Home | History | Annotate | only in /src/sys/arch/x68k/include
History log of /src/sys/arch/x68k/include
RevisionDateAuthorComments
 1.39 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.38 12-Jul-2018  maxv branches: 1.38.36;
Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.37 24-Dec-2015  christos branches: 1.37.16; 1.37.18;
fenv for m68k
 1.36 19-Nov-2011  isaki branches: 1.36.10; 1.36.28;
Obsolete pow(4) and rtcalarm(8). Discussed in port-x68k@.
Probably the combination of pow(4) ioctl and rtcalarm(8) does
not work for a long time, and nobody uses them.
I'll rewrite a part about power switch handler as a new device.
 1.35 21-Jul-2011  joerg branches: 1.35.2;
machine/stdarg.h and machine/varargs.h are gone
 1.34 11-Jul-2011  joerg Sort
 1.33 01-Jun-2008  isaki Remove x68k/include/pci_machdep.h.
x68k does not have PCI-bus, and no one refers to it.
 1.32 11-Mar-2007  isaki branches: 1.32.38; 1.32.40; 1.32.42; 1.32.44;
Stop installing <machine/intr.h> on x68k.
Suggested by simonb@ and tsutsui@.
 1.31 09-Feb-2007  ad branches: 1.31.2; 1.31.6;
Merge newlock2 to head.
 1.30 26-Jul-2006  drochner branches: 1.30.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.29 11-Dec-2005  christos branches: 1.29.4; 1.29.8;
merge ktrace-lwp.
 1.28 12-May-2004  minoura branches: 1.28.12;
Populate kbdmap-related definitions to the userland.
Also g/c unused ioctls.
Pointed out by he.
 1.27 08-May-2004  kleink Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.26 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.25 18-Jan-2003  thorpej branches: 1.25.2;
Merge the nathanw_sa branch.
 1.24 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.23 14-Oct-2002  isaki Sort.
 1.22 07-Aug-2002  briggs Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.21 24-Mar-2002  isaki branches: 1.21.2;
bsd_audioio.h was obsolated by vs0
 1.20 28-Nov-2001  kleink No point in installing svr4_machdep.h.
 1.19 12-Jun-2001  minoura branches: 1.19.2; 1.19.8;
Remove unneeded whitespace.
 1.18 15-Apr-2001  kleink Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.17 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.16 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.15 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.14 26-Jun-2000  kleink branches: 1.14.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.13 29-Apr-2000  thorpej Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.12 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.11 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.10 19-Apr-1999  kleink branches: 1.10.2;
Add COMPAT_SVR4 for m68k.
 1.9 16-Mar-1999  minoura branches: 1.9.4;
Merged minoura_x68k_bus_h branch.
 1.8 15-Mar-1999  minoura Pullin m68k/ieee.h.
 1.7 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.6 14-Dec-1998  itohy branches: 1.6.2;
Added intr.h
 1.5 01-Sep-1998  itohy Added an include file on port dependent boot information.
 1.4 07-Aug-1998  minoura Moved parioctl.h to the system header directory.
 1.3 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.2 12-Jul-1998  veego Add elf_machdep.h to the INCS list.
 1.1 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.6.2.2 14-Mar-1999  minoura Export bus.h.
 1.6.2.1 31-Jan-1999  minoura Sync.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.8.7 11-Dec-2002  thorpej Sync with HEAD.
 1.19.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.19.8.5 13-Aug-2002  nathanw Catch up to -current.
 1.19.8.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.19.8.3 08-Jan-2002  nathanw Catch up to -current.
 1.19.8.2 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.19.8.1 12-Jun-2001  scw file Makefile was added on branch nathanw_sa on 2001-11-10 21:22:53 +0000
 1.19.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.2.1 31-Aug-2002  gehenna catch up with -current.
 1.25.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.12.3 03-Sep-2007  yamt sync with head.
 1.28.12.2 26-Feb-2007  yamt sync with head.
 1.28.12.1 30-Dec-2006  yamt sync with head.
 1.29.8.1 11-Aug-2006  yamt sync with head
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.30.4.1 01-Feb-2007  ad Header file cleanup.
 1.31.6.1 13-Mar-2007  ad Sync with head.
 1.31.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.44.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.32.42.1 04-May-2009  yamt sync with head.
 1.32.40.1 04-Jun-2008  yamt sync with head
 1.32.38.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 17-Apr-2012  yamt sync with head
 1.36.28.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.36.10.1 03-Dec-2017  jdolecek update from HEAD
 1.37.18.1 10-Jun-2019  christos Sync with HEAD
 1.37.16.1 28-Jul-2018  pgoyette Sync with HEAD
 1.38.36.1 02-Aug-2025  perseant Sync with HEAD
 1.2 07-May-2019  kamil Switch all users (except ia64) of custom machine/ansi.h to common_ansi.h

Deduplicate the code among ports and poll definitions of types
directly from a compiler.

This fixes miscompilation of certain programs that instruct compilers
to generate code for different types. This bug has been detected with
-fshort-wchar in EFI firmware.

Proposed and discussed on a mailing list (twice).

Itanium uses custom !ELF fallback switch, temporarily leave it as it is.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.256;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.256.1 10-Jun-2019  christos Sync with HEAD
 1.3 08-Oct-1996  cgd repoint at shared aout_machdep.h, not exec.h
 1.2 08-Sep-1996  thorpej Use <m68k/exec.h>.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2 16-Oct-2011  isaki Switch to 2-clause license.
 1.1 17-Jan-2009  isaki branches: 1.1.2; 1.1.4; 1.1.8;
Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 17-Jan-2009  yamt file autoconf.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:06 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 17-Jan-2009  skrll file autoconf.h was added on branch nick-hppapmap on 2009-01-19 13:17:07 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 17-Jan-2009  mjf file autoconf.h was added on branch mjf-devfs2 on 2009-01-17 13:28:37 +0000
 1.4 27-Sep-2001  minoura branches: 1.4.4;
Embed the version number of the interface between the bootloader and
kernel. See amiga.
 1.3 23-Sep-1999  minoura branches: 1.3.14; 1.3.16;
First step toward network boot.
By Takeshi Nakayama <tn@catvmics.ne.jp>.
 1.2 14-Dec-1998  itohy Make egcs happy.
 1.1 01-Sep-1998  itohy Added an include file on port dependent boot information.
 1.3.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.14.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.4.2 27-Sep-2001  minoura Embed the version number of the interface between the bootloader and
kernel. See amiga.
 1.4.4.1 27-Sep-2001  minoura file bootinfo.h was added on branch nathanw_sa on 2001-09-27 09:55:11 +0000
 1.3 24-Mar-2002  isaki bsd_audioio.h was obsolated by vs0
 1.2 05-Jan-1998  perry branches: 1.2.30; 1.2.34;
RCSID Police.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.34.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.30.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3 21-Aug-1999  simonb Include <sys/bswap.h> for function prototypes. i386, pc532 and vax
still include <machine/byte_swap.h> and define macros for some of
the bswap*() functions.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 15-Jan-1999  bouyer branches: 1.1.2;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1.2.2 31-Jan-1999  minoura Sync.
 1.1.2.1 15-Jan-1999  minoura file bswap.h was added on branch minoura_x68k_bus_h on 1999-01-31 05:40:37 +0000
 1.26 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.25 13-Oct-2012  tsutsui branches: 1.25.38;
struct device * -> device_t (from chs@)
 1.24 24-Mar-2011  tsutsui branches: 1.24.4; 1.24.14;
Fix typo in comment.
 1.23 24-Mar-2011  tsutsui - make X68K_BUS_PERFORMANCE_HACK part default
- use volatile rather than dummy __asm() statements to avoid optimization

Tested on X68030.
 1.22 19-Mar-2010  tsutsui branches: 1.22.2;
ANSI'fy, misc KNF.
 1.21 19-Mar-2010  tsutsui u_intN_t -> uintN_t
 1.20 19-Mar-2010  tsutsui bus_space_write_region_N() should also take a const buffer.
 1.19 19-Mar-2010  he Constify the buffer pointer argument of the _bus_space_write_multi_<n>
inline functions, so that this builds again. (Otherwise, ne2000.c driver
would now fail to build.)
 1.18 28-Apr-2008  martin branches: 1.18.20; 1.18.22;
Remove clause 3 and 4 from TNF licenses
 1.17 04-Mar-2007  christos branches: 1.17.40; 1.17.42; 1.17.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 21-Feb-2007  mrg add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

that allow a (normally broken/limited) device to restrict the bus address
range it can talk to. this is used by bce(4) to limit DMA addresses to
1GB range, the maximum the chip can address.

all this is from Yorick Hardy <yhardy@uj.ac.za> with input from several
people on tech-kern.

XXX: bus_dma(9) needs an update still.
 1.15 16-Feb-2006  perry branches: 1.15.20;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.14 11-Dec-2005  christos branches: 1.14.2; 1.14.4; 1.14.6;
merge ktrace-lwp.
 1.13 09-Mar-2005  matt branches: 1.13.4;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.12 18-Jan-2005  chs branches: 1.12.2;
de-__P, remove register, ansify.
 1.11 15-Jun-2003  fvdl branches: 1.11.2; 1.11.10;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.10 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.9 11-Nov-2001  isaki Support BUS_SPACE_MAP_SHIFTED_EVEN for bus_space_map().
Now BUS_SPACE_MAP_SHIFTED means BUS_SPACE_MAP_SHIFTED_ODD.
It is needed for Nereid Ethernet.
 1.8 19-Jul-2001  thorpej branches: 1.8.4; 1.8.6;
Add BUS_DMA_READ and BUS_DMA_WRITE flags, that hint the back-end
at dmamap load time that the mapping will be used for a unidirectional
transfer of the specified direction.
 1.7 07-Mar-2001  thorpej branches: 1.7.2;
Add the BUS_DMA_STREAMING flag.
 1.6 29-Jan-2001  itohy branches: 1.6.2;
Performance hack.
Mainly for the Neptune-X Ethernet adaptor,
and improves ftp(1) speed by ~10%.

get: 219 KB/s -> 246 KB/s
put: 226 KB/s -> 247 KB/s
(X68030, MC68030 25MHz)
 1.5 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.4 25-Jan-2000  drochner branches: 1.4.4;
define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.3 23-Mar-1999  drochner branches: 1.3.8;
Add a macro to check for sufficient pointer alignment in bus.h context,
"BUS_SPACE_ALIGNED_POINTER()".
Equal to the param.h "ALIGNED_POINTER()" normally, but obeys additional
requirements of the bus_space_xxx_n() macros. (BUS_SPACE_DEBUG)
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file bus.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.4 14-Mar-1999  minoura Use a single (inline) function instead of refering the bus_space switch.
 1.1.2.3 13-Feb-1999  minoura Implemented BUS_SPACE_MAP_SHIFTED.
Some of the devices are mapped only on the odd addresses for hardware
simplicity. To share drivers with other platforms, this should be
made transparent through the bus_space layer.
 1.1.2.2 30-Jan-1999  minoura Added DMAC driver.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.3.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.3.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.2 06-Jan-2002  he Pull up revision 1.9 (requested by isaki):
Support mapping devices with BUS_SPACE_MAP_SHIFTED_EVEN.
 1.4.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.6.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1 03-Aug-2001  lukem update to -current
 1.8.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.6.1 19-Jul-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-01-08 00:28:43 +0000
 1.8.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.10.1 29-Apr-2005  kent sync with -current
 1.11.2.2 01-Apr-2005  skrll Sync with HEAD.
 1.11.2.1 24-Jan-2005  skrll Sync with HEAD.
 1.12.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.3 03-Sep-2007  yamt sync with head.
 1.13.4.2 26-Feb-2007  yamt sync with head.
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.14.2.1 18-Feb-2006  yamt sync with head.
 1.15.20.2 12-Mar-2007  rmind Sync with HEAD.
 1.15.20.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.17.44.2 11-Aug-2010  yamt sync with head.
 1.17.44.1 16-May-2008  yamt sync with head.
 1.17.42.1 18-May-2008  yamt sync with head.
 1.17.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.22.2 21-Apr-2011  rmind sync with head
 1.18.22.1 30-May-2010  rmind sync with head
 1.18.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.22.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.24.4.1 30-Oct-2012  yamt sync with head
 1.25.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.67 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.66 19-Jan-2024  thorpej Switch the x68k port to use the same clockframe layout as the other
m68k ports.
 1.65 18-Jan-2024  thorpej Make the M68K_MMU_* defines real kernel options, available in opt_m68k_arch.h.
For 68030, 68040, and 68060, infer M68K_MMU_MOTOROLA. For 68010 and 68020, it
must be an explicit option (set in std.${MACHINE} or, in the case of hp300,
inferred from the specific model option).
 1.64 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.63 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.62 23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.61 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.60 22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.59 17-Dec-2016  flxd branches: 1.59.14; 1.59.16;
Fix typo "one the" and architecture where appropriate.
 1.58 31-Jul-2014  isaki branches: 1.58.4; 1.58.8;
Remove the variable not used anymore.
sync with x68k/pmap_bootstrap.c,v 1.21 (in 2001).
 1.57 19-Oct-2013  christos branches: 1.57.2;
make cpu_need_resched() macros consistent; __USE flags
 1.56 02-Feb-2012  tsutsui branches: 1.56.6; 1.56.10;
Always include <m68k/cpu.h> (i.e. outside #if defined(_KERNEL))
for crash(8) as amiga and sun3. There are _KERNEL protections in it.

Briefly tested by "build.sh -m news68k -U build".
Further possible botch will be fixed later.
 1.55 15-Nov-2011  tsutsui branches: 1.55.4;
Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.54 16-May-2011  tsutsui branches: 1.54.4;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.53 12-May-2011  tsutsui Make intiobase and intiolimit unsigned for consistency.
 1.52 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.51 22-Dec-2010  matt branches: 1.51.2; 1.51.4;
Collect cpu_info and friends and move to m68k/include/cpu.h
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.50 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.49 21-Oct-2009  rmind branches: 1.49.2; 1.49.4;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.48 17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.47 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.46 18-Dec-2008  isaki Move external decl. of intiobase: dev/intiovar.h -> include/cpu.h
Move definition of intiobase: x68k/pmap_bootstrap.c -> x68k/locore.s
These synchronize code with other m68k ports.
 1.45 27-Feb-2008  xtraeme branches: 1.45.4; 1.45.12;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.44 17-Oct-2007  garbled branches: 1.44.12; 1.44.16;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.43 04-Aug-2007  ad branches: 1.43.2;
Add ci_cpuid where it's missing.
 1.42 21-May-2007  tsutsui branches: 1.42.2; 1.42.4; 1.42.8;
Move declarations of m68k common functions
from <machine/cpu.h> to <m68k/m68k.h>.
While here, remove some obsolete function decls.
 1.41 20-May-2007  mhitch Add missing call to lwp_startup() in lwp_trampoline() (which was renamed
from proc_trampoline to match the other ports).

A DIAGNOSTIC kernel will now boot and run. LOCKDEBUG still doesn't work yet.
Also, my amiga no longer loses time.
 1.40 19-May-2007  isaki Use do { } while (0) to macro.
 1.39 19-May-2007  isaki Adapt to the merge of yamt-idlelwp branch.
tested on my X68030.
 1.38 04-Mar-2007  christos branches: 1.38.2; 1.38.4; 1.38.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37 16-Feb-2007  ad branches: 1.37.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.36 09-Feb-2007  ad Merge newlock2 to head.
 1.35 11-Dec-2005  christos branches: 1.35.20;
merge ktrace-lwp.
 1.34 13-Jun-2005  he branches: 1.34.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.33 18-Jan-2005  chs de-__P, remove register, ansify.
 1.32 26-Sep-2004  yamt branches: 1.32.4;
don't expose cpu_info to userland.
 1.31 22-Sep-2004  yamt move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.30 04-Jan-2004  jdolecek Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
 1.29 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.28 18-Jan-2003  thorpej branches: 1.28.2;
Merge the nathanw_sa branch.
 1.27 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.26 30-May-2001  mrg branches: 1.26.8;
use _KERNEL_OPT
 1.25 19-Dec-2000  scw branches: 1.25.2;
Unification of the m68k syscall() function.
 1.24 25-Aug-2000  thorpej Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.23 26-May-2000  thorpej First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.22 23-Apr-2000  minoura Do not include opt_m680x0 in LKM.
 1.21 18-Apr-2000  minoura defopt M680[2346]0.
 1.20 23-Sep-1999  minoura branches: 1.20.2;
Use m68k common cacheops.c.
 1.19 10-Aug-1999  thorpej Define cpu_number() as discussed on tech-smp.
 1.18 05-May-1999  minoura Use mvme68k-derived delay routine.
Now that we support various models, the old constant-loop delay routine
may cause problems.
 1.17 24-Mar-1999  minoura branches: 1.17.2; 1.17.4; 1.17.6;
Shut up gcc -Wall.
 1.16 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.15 26-Feb-1999  is synchronize types, and s/curproc/p/ in one forgotten place
 1.14 26-Feb-1999  is x68k specific part of fix for PR 6152
 1.13 13-Dec-1998  minoura branches: 1.13.2;
Splitted out the interrupt handling code to a separate file.
Disallow getting down the interrupt level by splXX.
 1.12 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.11 07-Oct-1998  thorpej Oops, back out a buglet I didn't intend to commit in the last change.
 1.10 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.9 22-Aug-1998  minoura Eliminated vm_offset_t and vm_size_t.
 1.8 13-Feb-1998  scottr Avoid declaring the "astpending" and "want_resched" globals in cpu.h,
as this breaks C++ code that happens to indirectly include this header.
Both Matthias Scheler and I noticed this, independently.

This problem notably does not affect the atari and sun3/sun3x ports,
which have already implemented a similar solution.
 1.7 26-Oct-1997  is Make these compile after m68k/m68k.h 1.4->1.5.
 1.6 10-Oct-1997  oki Add prototypes.
 1.5 03-Feb-1997  oki branches: 1.5.8;
Remove #ifdef GENERIC ... #endif
 1.4 08-Jan-1997  oki Add fpu_probe prototype.
 1.3 11-Sep-1996  thorpej Use <m68k/cpu.h>.
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.1 14-Mar-1999  minoura Sync.
 1.17.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.17.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.2.1 24-Jun-1999  perry pullup 1.17->1.18 (minoura): Use mvme68k-derived delay() routine
 1.20.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.26.8.4 11-Nov-2002  nathanw Catch up to -current
 1.26.8.3 08-Dec-2001  thorpej Add a cpu_proc_fork(), called from uvm_proc_fork(), which takes care
of machine-dependent handling a fork() time (this is different from
forking the actual context in an LWP world). #define it away on
platforms which do not need it.

Problem noted by Gregory McGarry.
 1.26.8.2 18-Nov-2001  scw MD Scheduler Activation bits for X68k.
Compile-tested only.
 1.26.8.1 30-May-2001  scw file cpu.h was added on branch nathanw_sa on 2001-11-18 18:44:17 +0000
 1.28.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.6 24-Jan-2005  skrll Sync with HEAD.
 1.28.2.5 19-Oct-2004  skrll Sync with HEAD
 1.28.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.34.2.3 17-Mar-2008  yamt sync with head.
 1.34.2.2 03-Sep-2007  yamt sync with head.
 1.34.2.1 26-Feb-2007  yamt sync with head.
 1.35.20.1 06-Feb-2007  ad Update m68k pasteware.
 1.37.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.38.10.2 03-Oct-2007  garbled Sync with HEAD
 1.38.10.1 22-May-2007  matt Update to HEAD.
 1.38.4.1 11-Jul-2007  mjf Sync with head.
 1.38.2.2 20-Aug-2007  ad Sync with HEAD.
 1.38.2.1 27-May-2007  ad Sync with head.
 1.42.8.1 04-Aug-2007  jmcneill Sync with HEAD.
 1.42.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.42.2.1 07-Aug-2007  matt Sync with HEAD.
 1.43.2.2 23-Mar-2008  matt sync with HEAD
 1.43.2.1 06-Nov-2007  matt sync with HEAD
 1.44.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.44.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.44.12.1 24-Mar-2008  keiichi sync with head.
 1.45.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.45.4.3 11-Aug-2010  yamt sync with head.
 1.45.4.2 11-Mar-2010  yamt sync with head
 1.45.4.1 04-May-2009  yamt sync with head.
 1.49.4.3 31-May-2011  rmind sync with head
 1.49.4.2 05-Mar-2011  rmind sync with head
 1.49.4.1 03-Jul-2010  rmind sync with head
 1.49.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.51.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.4.1 17-Apr-2012  yamt sync with head
 1.55.4.1 18-Feb-2012  mrg merge to -current.
 1.56.10.1 18-May-2014  rmind sync with head
 1.56.6.2 03-Dec-2017  jdolecek update from HEAD
 1.56.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.58.8.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.58.4.1 05-Feb-2017  skrll Sync with HEAD
 1.59.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.59.16.1 10-Jun-2019  christos Sync with HEAD
 1.59.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3 06-Nov-2017  christos Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.
 1.2 06-Dec-2001  minoura branches: 1.2.166;
Add ELF support.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.46; 1.1.1.1.50;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.50.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.1.1.46.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.166.1 03-Dec-2017  jdolecek update from HEAD
 1.7 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.6 30-Aug-2011  bouyer Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.5 23-Nov-2009  pooka If cpu_disklabel includes struct dkbad, define __HAVE_DISKLABEL_DKBAD.
This allows use of subr_disk_mbr on all archs. Default to it for
the rump disk component. No functional change for regular kernels.
(The other option would've been to include dkbad in disklabels
everywhere, but arguably this approach has less possible side-effects,
especially given that wedges and related magic will take over the
world any second now).
 1.4 11-Dec-2005  christos branches: 1.4.78;
merge ktrace-lwp.
 1.3 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.2 30-Jun-1998  msaitoh branches: 1.2.50;
sync with -current after a long silence
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.50.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.78.1 11-Mar-2010  yamt sync with head
 1.1 12-Jul-1998  thorpej Basic elf_machdep.h for m68k; doesn't include relocations, yet.
 1.4 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.3 16-Mar-1999  minoura branches: 1.3.8;
Merged minoura_x68k_bus_h branch.
 1.2 24-Jan-1999  mycroft Format consistency.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.1 31-Jan-1999  minoura Sync.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 17-Mar-2000  mycroft branches: 1.1.6;
In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 17-Mar-2000  bouyer file endian_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:30:05 +0000
 1.3 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.2 08-Sep-1996  thorpej Use <m68k/exec.h>.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.1 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.1 24-Dec-2015  christos branches: 1.1.2; 1.1.18;
fenv for m68k
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 24-Dec-2015  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:36:49 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 24-Dec-2015  skrll file fenv.h was added on branch nick-nhusb on 2015-12-27 12:09:44 +0000
 1.2 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.16;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.16.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.7 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.6 08-Feb-2011  rmind branches: 1.6.14; 1.6.32;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.5 04-Mar-2007  christos branches: 1.5.66; 1.5.72; 1.5.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 25-Jan-2004  minoura branches: 1.3.16;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 06-Aug-1998  minoura branches: 1.1.48;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.5.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.66.1 05-Mar-2011  rmind sync with head
 1.6.32.1 22-Sep-2015  skrll Sync with HEAD
 1.6.14.1 03-Dec-2017  jdolecek update from HEAD
 1.2 30-Aug-1999  mycroft A foolish consistency.
 1.1 15-Mar-1999  minoura Pullin m68k/ieee.h.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer constant macros.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.12.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:45 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:55:02 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-04-15 17:13:19 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_fmtio.h was added on branch thorpej_scsipi on 2001-04-21 17:55:02 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-15 15:29:14 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:55:02 +0000
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 14-Apr-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-04-14 12:20:03 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_mwgwtypes.h was added on branch thorpej_scsipi on 2001-04-21 17:55:02 +0000
 1.1 26-Jun-2000  kleink branches: 1.1.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 26-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:30:05 +0000
 1.23 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.22 11-Jul-2023  riastradh x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.
 1.21 22-Mar-2014  tsutsui branches: 1.21.60;
Remove obsolete ssir stuff which was used for pre-5.0 softintr(9).

No visible problem on X68030.
 1.20 23-Jun-2008  isaki branches: 1.20.30; 1.20.40; 1.20.46;
Unify splraiseipl(9) implementation among m68k ports,
discussed with tsutsui@ on port-m68k.

For x68k:
- export ipl2psl_table[] and make it uint16_t
- make makeiplcookie(9) inline
- put PSL_S bit into ipl2psl_table[] rather than adding it in makeiplcookie(9)
- define both IPL_SCHED and IPL_HIGH independently to avoid confusion
 1.19 23-May-2008  isaki branches: 1.19.2;
Initialize IPL_SERIAL. Analysed by tsutsui@.
Fixed kern/38684 (and other many panics).
 1.18 28-Apr-2008  martin branches: 1.18.2;
Remove clause 3 and 4 from TNF licenses
 1.17 03-Dec-2007  ad branches: 1.17.14; 1.17.16; 1.17.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.16 11-Mar-2007  isaki branches: 1.16.16; 1.16.18; 1.16.24;
Remove #ifdef _KERNEL since this file is no longer exported.
Suggested by tsutsui@.
 1.15 11-Mar-2007  thorpej - Shrink ipl_cookie_t from 32-bits to 16-bits (large enough to hold
an SR value or an IPL_* constant).
- Take advange of the smaller ipl_cookie_t to shrink kmutex_t from
16 bytes to 8 bytes by overlapping storage where possible.
- Implement a RAS-based _lock_cas() for mc68010 systems (Sun2). See
sun68k/sun68k/isr.c.

Tested on various m68k platforms, but NOT Sun2. In any case, at least
Sun2 compiles now.
 1.14 04-Mar-2007  tsutsui branches: 1.14.2;
Hide #include <m68k/softintr.h> inside #ifdef _KERNEL in <machine/intr.h>
to avoid exporting unnecessary files to userland.
Should fix build.sh failure, which was pointed out by isaki@.

XXX: which userland program would require contents of <machine/intr.h>?
 1.13 04-Mar-2007  tsutsui Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima.

XXX: x68k/dev/com.c should be rewritten to use MI com(4).
 1.12 16-Feb-2007  ad branches: 1.12.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.11 21-Dec-2006  yamt merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.
 1.10 27-Nov-2005  yamt branches: 1.10.20; 1.10.22;
implement splraiseipl() for the following ports.
evbppc, evbmips, evbsh3, hp700, mac68k, vax, x68k.
 1.9 18-Jan-2005  chs branches: 1.9.8; 1.9.14;
de-__P, remove register, ansify.
 1.8 13-Apr-2001  thorpej branches: 1.8.8; 1.8.24; 1.8.32;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.7 14-Jan-2001  thorpej branches: 1.7.2;
Make sure everybody has an splvm() and equate it with splimp() (splimp()
is the historical name for this interrupt level, and the historical name
is going to go away in the near future).
 1.6 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.5 16-Jan-2000  minoura Minor cleanups & corrections.
 1.4 23-Sep-1999  minoura branches: 1.4.2;
Protect some declarations by #ifdef _KERNEL.
 1.3 05-Aug-1999  thorpej Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 13-Dec-1998  minoura branches: 1.1.2;
Splitted out the interrupt handling code to a separate file.
Disallow getting down the interrupt level by splXX.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.32.1 29-Apr-2005  kent sync with -current
 1.8.24.2 11-Dec-2005  christos Sync with head.
 1.8.24.1 24-Jan-2005  skrll Sync with HEAD.
 1.8.8.2 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.8.8.1 13-Apr-2001  thorpej file intr.h was added on branch nathanw_sa on 2001-04-13 23:30:08 +0000
 1.9.14.1 29-Nov-2005  yamt sync with head.
 1.9.8.5 07-Dec-2007  yamt sync with head
 1.9.8.4 03-Sep-2007  yamt sync with head.
 1.9.8.3 26-Feb-2007  yamt sync with head.
 1.9.8.2 30-Dec-2006  yamt sync with head.
 1.9.8.1 21-Jun-2006  yamt sync with head.
 1.10.22.1 21-Sep-2006  yamt implement new api for x68k.
 1.10.20.1 12-Jan-2007  ad Sync with head.
 1.12.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.2.2 03-Dec-2007  ad Sync with HEAD.
 1.14.2.1 13-Mar-2007  ad Sync with head.
 1.16.24.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.18.1 09-Jan-2008  matt sync with HEAD
 1.16.16.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.17.18.2 04-May-2009  yamt sync with head.
 1.17.18.1 16-May-2008  yamt sync with head.
 1.17.16.2 04-Jun-2008  yamt sync with head
 1.17.16.1 18-May-2008  yamt sync with head.
 1.17.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.17.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.2.1 27-Jun-2008  simonb Sync with head.
 1.20.46.1 18-May-2014  rmind sync with head
 1.20.40.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.30.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.21.60.1 09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.10 01-Nov-2021  andvar fix typos, mainly in words minimum and maximum, but also few others.
 1.9 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.8 08-Feb-2011  rmind branches: 1.8.14; 1.8.32;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.7 11-Dec-2005  christos branches: 1.7.100; 1.7.106; 1.7.108;
merge ktrace-lwp.
 1.6 12-May-2004  minoura Populate kbdmap-related definitions to the userland.
Also g/c unused ioctls.
Pointed out by he.
 1.5 08-May-2004  minoura #ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 24-Mar-1999  minoura branches: 1.3.42;
Shut up gcc -Wall.
 1.2 03-Sep-1998  minoura Eliminated meaningless ITEKANJI.
 1.1 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.3.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.42.1 03-Aug-2004  skrll Sync with HEAD
 1.7.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.7.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.100.1 05-Mar-2011  rmind sync with head
 1.8.32.1 22-Sep-2015  skrll Sync with HEAD
 1.8.14.1 03-Dec-2017  jdolecek update from HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 13-Oct-1997  lukem branches: 1.2.52;
rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.52.1 03-Aug-2004  skrll Sync with HEAD
 1.3 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 12-May-2004  minoura branches: 1.1.2;
Populate kbdmap-related definitions to the userland.
Also g/c unused ioctls.
Pointed out by he.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 12-May-2004  skrll file kbdmap.h was added on branch ktrace-lwp on 2004-08-03 10:42:56 +0000
 1.6 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.5 28-Aug-2006  he branches: 1.5.104; 1.5.124;
Add duplicate include protection to <dev/sun/kbio.h>.
Make the x68k port use this include file, so that what remains
is only the port-specific additions.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8;
merge ktrace-lwp.
 1.3 08-May-2004  minoura branches: 1.3.12;
#ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.3.12.1 30-Dec-2006  yamt sync with head.
 1.4.8.1 03-Sep-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.124.1 22-Sep-2015  skrll Sync with HEAD
 1.5.104.1 03-Dec-2017  jdolecek update from HEAD
 1.1 13-Jan-1997  oki first commit of M68060 and FPU_EMULATE support.
M68060 support by YAMASAKI Yasushi, few arranged by me.
 1.4 28-Mar-2012  christos - Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.3 23-Jun-2002  perry branches: 1.3.146; 1.3.150;
remove definition of CLOCKS_PER_SEC protected by #ifdef KERNEL. It is
used nowhere, and KERNEL is defined nowhere (vs. _KERNEL).
 1.2 09-Jan-1998  perry branches: 1.2.30; 1.2.34; 1.2.42;
multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.42.1 17-Jul-2002  gehenna catch up with -current.
 1.2.34.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.30.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.150.1 05-Apr-2012  mrg sync to latest -current.
 1.3.146.1 17-Apr-2012  yamt sync with head
 1.8 06-Aug-2014  joerg Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
 1.7 20-Mar-2012  minoura branches: 1.7.2; 1.7.12;
Add xxboot (stage1) support.
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.38; 1.6.40;
Remove clause 3 and 4 from TNF licenses
 1.5 25-Jan-2006  christos branches: 1.5.72; 1.5.74; 1.5.76;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.4 11-Dec-2005  christos branches: 1.4.2;
merge ktrace-lwp.
 1.3 18-Jan-2005  chs branches: 1.3.8;
de-__P, remove register, ansify.
 1.2 31-Oct-2001  thorpej branches: 1.2.2; 1.2.4; 1.2.20; 1.2.28;
Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.1 27-Sep-2001  minoura branches: 1.1.2; 1.1.4;
libsa for the new bootloader of x68k port.
 1.1.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.1.2.1 27-Sep-2001  fvdl file loadfile_machdep.h was added on branch thorpej-devvp on 2001-10-01 12:43:06 +0000
 1.2.28.1 29-Apr-2005  kent sync with -current
 1.2.20.1 24-Jan-2005  skrll Sync with HEAD.
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 31-Oct-2001  thorpej file loadfile_machdep.h was added on branch kqueue on 2002-01-10 19:50:24 +0000
 1.2.2.2 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.2.2.1 31-Oct-2001  thorpej file loadfile_machdep.h was added on branch nathanw_sa on 2001-10-31 17:20:51 +0000
 1.3.8.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 01-Feb-2006  yamt sync with head.
 1.5.76.1 16-May-2008  yamt sync with head.
 1.5.74.1 18-May-2008  yamt sync with head.
 1.5.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.40.1 18-Nov-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #645):
sys/arch/x68k/stand/newdisk/newdisk.c: revision 1.10
sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile: revision 1.1
sys/arch/x68k/stand/xxboot/xx.c: revision 1.1
sys/arch/x68k/stand/Makefile: revision 1.10
sys/arch/x68k/stand/Makefile: revision 1.11
sys/arch/x68k/stand/boot/conf.c: revision 1.9
sys/arch/x68k/stand/Makefile: revision 1.12
sys/arch/x68k/stand/Makefile: revision 1.13
sys/arch/x68k/include/loadfile_machdep.h: revision 1.7
sys/arch/x68k/stand/xxboot/consio1.c: revision 1.1
sys/arch/x68k/stand/libsa/sdcd.c: revision 1.12
sys/arch/x68k/stand/libsa/libx68k.h: revision 1.6
sys/arch/x68k/stand/boot/ne.c: revision 1.1
sys/arch/x68k/stand/xxboot/boot.S: revision 1.1
sys/arch/x68k/stand/libsa/sdcd.c: revision 1.13
sys/arch/x68k/stand/netboot/boot.c: revision 1.1
sys/arch/x68k/stand/libsa/devopen.c: revision 1.6
sys/arch/x68k/stand/libsa/clock.c: revision 1.1
sys/arch/x68k/stand/boot/ne.h: revision 1.1
sys/arch/x68k/stand/netboot/conf.c: revision 1.1
sys/arch/x68k/stand/boot/version: revision 1.5
sys/arch/x68k/stand/boot/version: revision 1.6
sys/arch/x68k/stand/netboot/version: revision 1.1
sys/arch/x68k/stand/xxboot/Makefile.xxboot: revision 1.1
sys/arch/x68k/stand/boot/if_ne.c: revision 1.1
sys/arch/x68k/stand/boot/dp8390.h: revision 1.1
sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile: revision 1.1
sys/arch/x68k/stand/boot/dp8390.c: revision 1.1
sys/arch/x68k/stand/xxboot/bootmain.c: revision 1.1
sys/arch/x68k/stand/installboot/installboot.c: revision 1.6
sys/arch/x68k/stand/xxboot/conf.c: revision 1.1
sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile: revision 1.1
sys/arch/x68k/stand/libsa/Makefile.inc: revision 1.2
distrib/sets/lists/base/md.x68k: revision 1.44
sys/arch/x68k/stand/boot/conf.c: revision 1.10
sys/arch/x68k/stand/boot/boot.ldscript: revision 1.3
distrib/sets/lists/base/md.x68k: revision 1.45
sys/arch/x68k/stand/xxboot/xxboot.ldscript: revision 1.1
sys/arch/x68k/stand/xxboot/Makefile: revision 1.15
sys/arch/x68k/stand/libsa/Makefile: revision 1.29
sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile: revision 1.1
sys/arch/x68k/stand/netboot/Makefile: revision 1.1
sys/arch/x68k/stand/libsa/consio.c: revision 1.10
sys/arch/x68k/stand/xxboot/version: revision 1.1
sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile: revision 1.1
Comment fix.
Add FFSv2 support.
Fix CD support.
Initial support for xxboot (cdboot_cd9660, specifically).
Add xxboot (stage1) support.
put library first.
Fix CD support (again!).
Descend to xxboot.
Add xxboot_?fsv?.
Change to the 2-clauses license.
Tweak SUBDIR build order and add comments about each dir.
Fix a bug in check_getchar() (called from awaitkey_1sec()).
It didn't clear input key data when non ASCII keys (CTRL, OPT.1 etc)
were pressed so it couldn't detect further key inputs and
"any other key for boot menu" interrupt during boot didn't work
in that case.
The problem was tracked by Y.Sugahara,
and tested on X68030 and XM6i by me.
Bump version to denote check_getchar() bug fix.
First cut at x68k network bootloader via NE2000 on Neptune-X and Nereid.
Written by isaki@ back in 2003 based on x86's NE2000 netboot, and
misc debug and improvements by tsutsui@ and Y.Sugahara.
Tested on XM6i (emulating Nereid Ethernet) and X68030 + Neptune-X by me,
also on X68030 + Nereid and X68000 PRO-II + Xellent30 + Nereid by isaki@.
Note:
- X680x0 IPLROM doesn't support bootstrap from Neptune-X or Nereid,
so this network bootloader needs to be loaded from floppy or harddisk.
- Currently netboot support is not merged into the secondary Multi-boot
(/usr/mdec/boot) due to size restriction.
- Primary loaders assumes that the secondary bootloader name is /boot,
so /usr/mdec/netboot needs to be installed as /boot into the target
bootstrap device.
Add new /usr/mdec/netboot.
Check lp->d_npartitions before calling dkcksum()
(which is in src/sbin/disklabel/dkcksum.c) because
it doesn't check range and could cause coredump during
installboot against floppy that includes garbage in LABELSECTOR.
 1.6.38.1 05-Apr-2012  mrg sync to latest -current.
 1.6.34.1 17-Apr-2012  yamt sync with head
 1.7.12.1 10-Aug-2014  tls Rebase.
 1.7.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1 29-Apr-2000  thorpej branches: 1.1.6;
Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 29-Apr-2000  bouyer file lock.h was added on branch thorpej_scsipi on 2000-11-20 20:30:06 +0000
 1.1 30-Nov-2024  christos branches: 1.1.4;
Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:56:15 +0000
 1.1 23-Dec-1999  kleink branches: 1.1.6;
C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 23-Dec-1999  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:30:07 +0000
 1.2 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 10-Nov-2001  scw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.1 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.2 11-Jun-1997  kleink GC this file. It has been unused for quite a while.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:45 +0000
 1.6 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 13-Oct-1997  lukem branches: 1.2.52;
rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.52.1 03-Aug-2004  skrll Sync with HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-May-2004  minoura branches: 1.1.2;
An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file opmreg.h was added on branch ktrace-lwp on 2004-08-03 10:42:56 +0000
 1.31 06-Jan-2024  isaki x68k: Make _delay() argument to microseconds.
'<< 8' is just a magnification factor and should not be visible
from the outside.
 1.30 31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.29 28-Dec-2019  isaki branches: 1.29.12;
Bump MSGBUFSIZE (2 * NBPG).
Since timestamp was introduced, it was too small to store full dmesg
of one boot.
And putting this behind of #include <m68k/param.h> had no effect.
This was fixed on many arch in 1997 but x68k was not...
http://mail-index.netbsd.org/source-changes/1997/09/20/0021.html
 1.28 10-Feb-2012  para branches: 1.28.48; 1.28.52;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.27 08-Feb-2011  rmind branches: 1.27.4; 1.27.8;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.26 11-Dec-2009  tsutsui branches: 1.26.4; 1.26.6; 1.26.8;
Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSEG, and SEGOFSET from <machine/param.h>
to <m68k/pmap_motorola.h> where they should belong
- also simplify NBSEG macro for both 020/030 and 040/060 cases
- also move m68k_trunc_seg(), m68k_round_seg(), and m68k_seg_offset()
(that use SEGOFSET) from <m68k/param.h> to <m68k/pmap_motorola.h>
- add comments about each segment size value used on pmap_motorola
implementation
- add TIA_SIZE, TIA_SHIFT, TIB_SIZE, and TIB_SHIFT macro which can be
used for ste/pte index sizes
- use proper vaddr_t cast instead of unsigned for SEGOFSET/PGOFSET macro

Tested on atari, hp300, and news68k.
 1.25 09-Dec-2009  tsutsui Fix wrong NBSEG values for all hp300 pmap derived m68k ports.
They were incorrect since 1997 on amiga and atari, and since 2002
on other ports, but fortunately they don't look so fatal.

Anyway, these values will be moved into <m68k/pmap_motorola.h> soon
since they are quite pmap implementation dependent.
 1.24 31-Dec-2007  ad branches: 1.24.10;
Remove COMPAT_HPUX.
 1.23 11-Mar-2007  isaki branches: 1.23.18; 1.23.24; 1.23.30;
Merge #ifdef _KERNEL stuff into one place.
Suggested by tsutsui@.
 1.22 11-Mar-2007  isaki Include <machine/intr.h> only in _KERNEL.
Suggested by tsutsui@.
 1.21 11-Dec-2005  christos branches: 1.21.26; 1.21.30;
merge ktrace-lwp.
 1.20 18-Jan-2005  chs branches: 1.20.8;
de-__P, remove register, ansify.
 1.19 07-Aug-2003  agc branches: 1.19.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.18 18-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.16 30-May-2001  mrg branches: 1.16.8;
use _KERNEL_OPT
 1.15 11-Jan-2001  minoura branches: 1.15.2;
Sync. w/ luna68k; eliminate irrelavant code imposed by
the restriction of hp300 hardware and HP-UX compatibility.
 1.14 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.13 04-Dec-1999  ragge CL* discarding.
 1.12 05-May-1999  minoura branches: 1.12.2; 1.12.8;
Use mvme68k-derived delay routine.
Now that we support various models, the old constant-loop delay routine
may cause problems.
 1.11 13-Dec-1998  minoura branches: 1.11.4; 1.11.6; 1.11.8;
Splitted out the interrupt handling code to a separate file.
Disallow getting down the interrupt level by splXX.
 1.10 30-Jun-1998  msaitoh sync with -current after a long silence
 1.9 25-Jun-1998  thorpej defopt COMPAT_HPUX
 1.8 09-Oct-1997  oki Prototype spl0().
 1.7 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.6 10-Jul-1997  veego branches: 1.6.2;
Restore the define of NPTEPG.
 1.5 10-Jun-1997  veego The 'Mach derived conversion macros' are now in <m68k/param.h>
 1.4 10-Jun-1997  veego Use the MI <m68k/param.h> include.
 1.3 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.2 16-May-1996  oki branches: 1.2.8;
spl0 prototype.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.8.1 12-Mar-1997  is Merge in changes from Trunk
 1.6.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.8.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.11.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.4.1 24-Jun-1999  perry pullup 1.11->1.12 (minoura): Use mvme68k-derived delay() routine
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.8.4 11-Nov-2002  nathanw Catch up to -current
 1.16.8.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.16.8.2 18-Nov-2001  scw MD Scheduler Activation bits for X68k.
Compile-tested only.
 1.16.8.1 30-May-2001  scw file param.h was added on branch nathanw_sa on 2001-11-18 18:44:18 +0000
 1.18.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.8.2 21-Jan-2008  yamt sync with head
 1.20.8.1 03-Sep-2007  yamt sync with head.
 1.21.30.1 13-Mar-2007  ad Sync with head.
 1.21.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.30.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.24.1 18-Feb-2008  mjf Sync with HEAD.
 1.23.18.1 09-Jan-2008  matt sync with HEAD
 1.24.10.1 11-Mar-2010  yamt sync with head
 1.26.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.26.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.4.1 05-Mar-2011  rmind sync with head
 1.27.8.1 18-Feb-2012  mrg merge to -current.
 1.27.4.1 17-Apr-2012  yamt sync with head
 1.28.52.1 02-Jan-2020  martin Pull up following revision(s) (requested by isaki in ticket #594):

sys/arch/x68k/include/param.h: revision 1.29

Bump MSGBUFSIZE (2 * NBPG).

Since timestamp was introduced, it was too small to store full dmesg
of one boot.

And putting this behind of #include <m68k/param.h> had no effect.

This was fixed on many arch in 1997 but x68k was not...
http://mail-index.netbsd.org/source-changes/1997/09/20/0021.html
 1.28.48.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.12.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 08-May-2004  minoura #ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 07-Aug-1998  minoura branches: 1.1.48;
Moved parioctl.h to the system header directory.
 1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2 31-Mar-1997  gwr Need a common <m68k/pcb.h> for gdb.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2 01-Jun-2008  isaki Remove x68k/include/pci_machdep.h.
x68k does not have PCI-bus, and no one refers to it.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.168; 1.1.1.1.170; 1.1.1.1.172; 1.1.1.1.174;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.174.2 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.1.1.1.174.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.1.1.1.172.1 04-May-2009  yamt sync with head.
 1.1.1.1.170.1 04-Jun-2008  yamt sync with head
 1.1.1.1.168.1 02-Jun-2008  mjf Sync with HEAD.
 1.27 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.26 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.25 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.24 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.23 10-Sep-2001  chris branches: 1.23.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.22 26-May-2001  chs branches: 1.22.2; 1.22.4;
replace vm_page_t with struct vm_page *.
 1.21 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.20 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.19 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.18 21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.17 21-Sep-2000  thorpej branches: 1.17.2;
Make PMAP_PAGEIDLEZERO() return a boolean value. FALSE indidcates
that the page being zero'd was not completed and that page zeroing
should be aborted. This may be used by machine-dependent code doing
slow page access to reduce the latency of running a process that has
become runnable while in the middle of doing a slow page zero.
 1.16 26-Aug-2000  minoura Add #ifdef _KERNEL ~ #endif to protect kernel variables from userland.
 1.15 14-May-2000  minoura branches: 1.15.4;
MD parts of uvm_pageidlezero.
 1.14 13-May-1999  minoura branches: 1.14.2;
Missing #if for 060.
 1.13 16-Mar-1999  minoura branches: 1.13.2; 1.13.4; 1.13.6;
Merged minoura_x68k_bus_h branch.
 1.12 26-Feb-1999  is x68k specific part of fix for PR 6152
 1.11 18-Jan-1999  itohy MACHINE_NEW_NONCONTIG is no longer optional
remove non-MNN code
 1.10 22-Aug-1998  minoura branches: 1.10.6;
Eliminated vm_offset_t and vm_size_t.
 1.9 30-Jun-1998  msaitoh sync with -current after a long silence
 1.8 18-Feb-1998  cgd Move pmap_map() function definition to MD headers, as appropriate. It's
an internal function, and the VM system shouldn't try to prototype it.
(Note that some ports _don't_ prototype it.)
 1.7 06-Jan-1998  thorpej Garbage-collect pm_stchanged; it's not used by anything.
 1.6 06-Jan-1998  thorpej Garbage-collect use of the PCB's copy of the user segment table pointer.
 1.5 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.4 01-Jan-1998  thorpej Change an argument name to PMAP_ACTIVATE() to more accurately describe the
semantics of the argument.
 1.3 01-Jan-1998  thorpej - Make pmap_activate() and pmap_deactivate() take a struct proc *.
- Define active_user_pmap() and use it in the appropriate places (from hp300
port).
 1.2 10-Jun-1997  veego s/x68k_btop/m68k_btop/
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.10.6.2 14-Mar-1999  minoura Sync.
 1.10.6.1 31-Jan-1999  minoura Sync.
 1.13.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 21-Jun-1999  perry pullup 1.13->1.14 (minoura): Missing #if for 060 & minor cosmetics
 1.14.2.2 23-Apr-2001  bouyer Sync with HEAD.
 1.14.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.4.1 31-Aug-2000  minoura Pullup rev.1.16. Approved by thorpej.
Add #ifdef _KERNEL ~ #endif to protect kernel variables from userland.
 1.17.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.22.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.4.6 11-Nov-2002  nathanw Catch up to -current
 1.23.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.23.4.4 02-Jul-2002  nathanw Adjust whitespace so that this matches the trunk.
 1.23.4.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.23.4.2 18-Nov-2001  scw MD Scheduler Activation bits for X68k.
Compile-tested only.
 1.23.4.1 10-Sep-2001  scw file pmap.h was added on branch nathanw_sa on 2001-11-18 18:44:18 +0000
 1.2 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.1 07-Aug-2002  briggs branches: 1.1.2; 1.1.4; 1.1.6; 1.1.202; 1.1.204;
Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.1.204.1 10-Jun-2019  christos Sync with HEAD
 1.1.202.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 07-Aug-2002  jdolecek file pmc.h was added on branch kqueue on 2002-09-06 08:42:43 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 07-Aug-2002  gehenna file pmc.h was added on branch gehenna-devsw on 2002-08-31 14:52:55 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 07-Aug-2002  nathanw file pmc.h was added on branch nathanw_sa on 2002-08-13 02:19:10 +0000
 1.5 19-Nov-2011  isaki Obsolete pow(4) and rtcalarm(8). Discussed in port-x68k@.
Probably the combination of pow(4) ioctl and rtcalarm(8) does
not work for a long time, and nobody uses them.
I'll rewrite a part about power switch handler as a new device.
 1.4 20-Dec-2008  isaki branches: 1.4.14;
x68k pow(4) now uses MI sysmon_pswitch framework. suggested by tsutsui@.
- Make MD poffd(8) retire, and use MI powerd(8) instead of it.
- Make /dev/pow1 retire, because nobody holds /dev/pow0 any longer.
Use /dev/pow0 for pow(4) ioctl.
- POWIOCSSIGNAL ioctl which is for poffd(8) is also obsoleted.
 1.3 11-Dec-2005  christos branches: 1.3.74; 1.3.78; 1.3.86;
merge ktrace-lwp.
 1.2 08-May-2004  minoura #ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.3.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.78.1 04-May-2009  yamt sync with head.
 1.3.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.14.1 17-Apr-2012  yamt sync with head
 1.4 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.3 30-Jun-1998  msaitoh branches: 1.3.30; 1.3.34; 1.3.42;
sync with -current after a long silence
 1.2 24-Dec-1997  oki Add MDP_STACKADJ.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.16;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.16.1 25-Dec-1997  perry pull up from trunk (oki)
 1.3.42.1 17-Jul-2002  gehenna catch up with -current.
 1.3.34.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.34.1 18-Nov-2001  scw MD Scheduler Activation bits for X68k.
Compile-tested only.
 1.3.30.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3 14-Oct-2002  chs merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.2 21-Feb-2001  minoura branches: 1.2.8;
Use m68k_page_offset and m68k_trunc_page macros,
instead of using PGOFSET directly.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.32;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.32.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file rwlock.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:45 +0000
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2 13-Sep-1998  mycroft Minor change.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.3 11-Dec-2005  christos branches: 1.3.122; 1.3.142;
merge ktrace-lwp.
 1.2 08-May-2004  minoura #ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.3.142.1 22-Sep-2015  skrll Sync with HEAD
 1.3.122.1 03-Dec-2017  jdolecek update from HEAD
 1.4 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.3 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.2 22-Jan-1999  mycroft Standardize format.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.1 31-Jan-1999  minoura Sync.
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
Add m68k sunos_machdep.h
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 14:00:15 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:57:48 +0000
 1.4 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.3 09-Nov-1999  kleink branches: 1.3.40; 1.3.218;
Rip protection against multiple inclusion from wrapper headers.
 1.2 29-Apr-1999  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10;
Pull in the right generic m68k header. (Where was my mind?)
 1.1 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.2.10.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.6.1 15-Nov-1999  fvdl Sync with -current
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.218.1 10-Jun-2019  christos Sync with HEAD
 1.3.40.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.16 01-Apr-2021  simonb Define __HAVE_LEGACY_INTRCNT to indicate this port uses legacy intrcnt
interrupt accounting.
 1.15 20-Jan-2008  joerg branches: 1.15.110; 1.15.112;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.14 17-Oct-2007  garbled branches: 1.14.2; 1.14.8;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.13 14-Jul-2007  ad branches: 1.13.10;
Generic soft interrupts are mandatory.
 1.12 04-Mar-2007  tsutsui branches: 1.12.2; 1.12.10;
Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima.

XXX: x68k/dev/com.c should be rewritten to use MI com(4).
 1.11 19-Sep-2006  gdamore branches: 1.11.4;
Convert x68k to timecounters. This conversion is not tested, due to lack
of available test candidates. It uses the previously unused (as far as I
can tell) Timer D, in freerunning mode. It only uses a 1/200 prescaler
(20KHz), as anything faster would roll over too fast for the system timer.
(Gotta love 8-bit resolution timers!) Approved for untested commit by core@.
 1.10 14-Sep-2006  gdamore branches: 1.10.2;
Converted x68k to todr. Compile tested only, but it has a low probably
of breaking anything.
 1.9 11-Dec-2005  christos branches: 1.9.8; 1.9.20;
merge ktrace-lwp.
 1.8 18-Jan-2005  chs branches: 1.8.8;
x68k no longer abuses cf_unit.
 1.7 28-Feb-2002  simonb branches: 1.7.16; 1.7.24;
Use "#define<tab>".
 1.6 05-Feb-2000  cgd branches: 1.6.8; 1.6.12;
add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.5 01-Feb-2000  danw #define __HAVE_DEVICE_REGISTER on ports that have it, and check for
that, rather than a list of architecture defines, in config_attach
 1.4 04-Aug-1998  minoura branches: 1.4.14;
__BROKEN_INDIRECT_CONFIG fixes.
 1.3 09-Oct-1997  oki Remove __BDEVSW_DUMP_OLD_TYPE.
 1.2 05-Dec-1996  cgd branches: 1.2.10;
First step inn removing config_scan() and the hacks that gave devices
on indirect-config busses a (permanent) softc that they could share
between 'match' and 'attach' routines:

Define __BROKEN_INDIRECT_CONFIG so that old autoconfiguration
interfaces are used, until drivers are converted to use the new
interfaces (actually, converted back to use the _older_ interfaces)
which prohibit indirect configuration devices from receiving a softc
in their match routine that they can share with their attach routine.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.24.1 29-Apr-2005  kent sync with -current
 1.7.16.1 24-Jan-2005  skrll Sync with HEAD.
 1.8.8.2 21-Jan-2008  yamt sync with head
 1.8.8.1 30-Dec-2006  yamt sync with head.
 1.9.20.1 18-Nov-2006  ad Sync with head.
 1.9.8.1 14-Sep-2006  yamt sync with head.
 1.10.2.1 22-Oct-2006  yamt sync with head
 1.11.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.10.1 03-Oct-2007  garbled Sync with HEAD
 1.12.2.1 15-Jul-2007  ad Sync with head.
 1.13.10.2 23-Mar-2008  matt sync with HEAD
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.14.8.1 23-Jan-2008  bouyer Sync with HEAD.
 1.14.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.15.112.1 03-Apr-2021  thorpej Sync with HEAD.
 1.15.110.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.41 08-Feb-2025  tsutsui Bump DFLSSIZ from 512KB to 2MB on all hp300 pmap m68k ports.

Some modern applications could require 512KB buffer on stack and
no particular comment on port-m68k@:
https://mail-index.netbsd.org/port-m68k/2025/02/02/msg000893.html
 1.40 01-Feb-2020  tsutsui branches: 1.40.30;
Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.39 28-Jun-2019  tsutsui branches: 1.39.2; 1.39.4;
Fix lingering page size comments.

Pointed out by christos@ on port-m68k@:
http://mail-index.netbsd.org/port-m68k/2019/06/06/msg000726.html

XXX: we also need MAX_PAGE_SIZE in somewhere for newer jemalloc?
 1.38 02-Feb-2017  rin branches: 1.38.14;
PR port-mac68k/51923
Bump default MAXTSIZ to 32MB for m68k ports, which allos us to use GCC 5.4 on
GENERIC kernels.
Ok jklos
 1.37 02-Feb-2017  rin PR port-mac68k/51923
Remove unused SYSPTSIZE and USRPTSIZE from m68k ports.
Ok jklos
 1.36 25-Jan-2014  tsutsui branches: 1.36.6; 1.36.10; 1.36.14;
Increase VM_KERNEL_PT_PAGES from 2 to 4 for x68k.

X68030 with 8MB or 12MB RAM (which is default for most X68030s)
now gets "pmap_enter_ptpage: can't get KPT page" panic again
with VM_KERNEL_PT_PAGES=2 while it works with >=14MB.
3 is enough to boot for now, but I also add a spare.

I guess this is because the post netbsd-6 vmem(9) bootstrap
changes require more kernel memory before MD pmap_init().

Note1: netbsd-6 (which also pulls physmem detection changes
that affect nptpages) doesn't have this problem.
Note2: other hp300 pmap based m68k ports might have the same issue,
but at least 12MB luna68k works with VM_KERNEL_PT_PAGES=2
so I think it depends on kernel size and/or iomapsize.
 1.35 21-Jan-2012  tsutsui branches: 1.35.6; 1.35.10;
Give higher priority to faster local memory on uvm_page_physload().
Tested by Y.Sugahara on his 060turbo with 128MB local memory and
this improved even simple benchmark. Ok'ed by isaki@.
 1.34 09-Oct-2011  tsutsui branches: 1.34.2; 1.34.6;
Move VM_MAXUSER_ADDRESS and VM_MAX_ADDRESS from 0xFFFFD000 to 0xFFF00000
which is used by other hp300 derived ports.
The previous values might be derived from (0 - UPAGES * PAGE_SIZE), but
there is no particular reason to have different values among m68k ports.
 1.33 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.32 06-Nov-2010  uebayasi branches: 1.32.2; 1.32.4;
Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.31 08-Dec-2009  tsutsui branches: 1.31.2; 1.31.4;
Use PGSHIFT from <machine/param.h> for PAGE_SHIFT.
We can assume PGSHIFT is always constant on current
m68k pmap_motorola implementation.
Also fix some leftover HP300 comments on some ports.
 1.30 26-Aug-2009  thorpej Minor tweak to the pv_table management in the Hibler-derived m68k pmaps:
The head of the list is now a pv_header, which contains the first pv_entry
as well as a 16-bit attributes field (replaces the pmap_attributes array
plus the pv_entry::pv_flags field) as a 16-bit count of caller-specified
cache-inhibited mappings.

Tested on hp300 (shared pmap_motorola.c), changes to atari and amiga copies
are purely mechanical.
 1.29 06-Mar-2009  joerg Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
 1.28 11-Dec-2005  christos branches: 1.28.78; 1.28.86; 1.28.92;
merge ktrace-lwp.
 1.27 01-Apr-2005  yamt merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.26 07-Aug-2003  agc branches: 1.26.8; 1.26.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.25 02-Apr-2003  thorpej branches: 1.25.2;
Use PAGE_SIZE rather than NBPG.
 1.24 10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.23 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.22 28-Oct-2001  isaki branches: 1.22.2;
fix typo s/X86K/X68K/ in comment.
 1.21 01-May-2001  thorpej branches: 1.21.2; 1.21.6;
Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.20 29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

This deprecates struct pmap_physseg. As a transitional measure,
allow a port to #define PMAP_PHYSSEG so that it can continue to
use it until its pmap is converted to use VM_MDPAGE_MEMBERS.

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.19 11-Jan-2001  minoura branches: 1.19.2;
Sync. w/ luna68k; eliminate irrelavant code imposed by
the restriction of hp300 hardware and HP-UX compatibility.
 1.18 11-Jan-2001  minoura Eliminate EIOMAPSIZE.
 1.17 11-Jan-2001  minoura G/C.
 1.16 01-Dec-2000  tsutsui Remove unused pcbb() macro.
 1.15 14-Nov-2000  thorpej We use 4K pages on the x86k. Make PAGE_SIZE and friends into
compile-time constants.
 1.14 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.13 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.12 15-Jan-2000  minoura Change physseg allocation strategy to VM_PSTRAT_BIGFIRST.
Required when big (>64MB) high memory is installed.
 1.11 04-Dec-1999  ragge CL* discarding.
 1.10 26-Apr-1999  thorpej branches: 1.10.2; 1.10.8;
Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.9 16-Mar-1999  minoura branches: 1.9.2; 1.9.4;
Merged minoura_x68k_bus_h branch.
 1.8 18-Jan-1999  itohy MACHINE_NEW_NONCONTIG is no longer optional
remove non-MNN code
 1.7 03-Sep-1998  minoura branches: 1.7.6;
Unimplemented EIOMAPSIZE defaults to 0.
 1.6 22-Aug-1998  minoura Eliminated vm_offset_t and vm_size_t.
 1.5 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.4 30-Jun-1998  msaitoh sync with -current after a long silence
 1.3 12-Jul-1997  perry branches: 1.3.6;
update comment from 1981 on memory and disk prices -- pr-2754 from Curt Sampson
 1.2 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.6; 1.1.1.1.10;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.10.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.1.1.1.6.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.3.6.1 13-Oct-1998  cgd work around broken extended memory detection, via patch. (minoura)
 1.7.6.1 31-Jan-1999  minoura Sync.
 1.9.4.2 06-Aug-1999  chs take an initial guess at UBC parameters.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.1 15-Jan-2000  he Pull up revision 1.12 (requested by minoura):
Change physseg allocation strategy to VM_PSTRAT_BIGFIRST. Required
when big (>64MB) high memory is installed, i.e. in a situation
where DMA reachable memory runs out because of the large buffer
cache.
 1.10.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.10.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.10.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.21.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.22.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.22.2.1 28-Oct-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:28:43 +0000
 1.25.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.25.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.10.1 23-Feb-2005  yamt change kernel va layout, following mac68k.
XXX why maps p0upa cache invalidated?
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.28.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.28.78.3 11-Mar-2010  yamt sync with head
 1.28.78.2 16-Sep-2009  yamt sync with head
 1.28.78.1 04-May-2009  yamt sync with head.
 1.31.4.1 05-Mar-2011  rmind sync with head
 1.31.2.1 26-Apr-2010  uebayasi Remove the unfinished code to add a memory segment after uvm_page_init().
It doesn't even compile.

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.32.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.32.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.6.1 18-Feb-2012  mrg merge to -current.
 1.34.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1 17-Apr-2012  yamt sync with head
 1.35.10.1 18-May-2014  rmind sync with head
 1.35.6.2 03-Dec-2017  jdolecek update from HEAD
 1.35.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.36.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.36.6.1 05-Feb-2017  skrll Sync with HEAD
 1.38.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.39.4.1 29-Feb-2020  ad Sync with head.
 1.39.2.1 10-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
sys/arch/mac68k/include/vmparam.h: revision 1.46
sys/arch/sun3/include/vmparam.h: revision 1.38
sys/arch/m68k/include/vmparam.h: revision 1.1
sys/arch/hp300/include/vmparam.h: revision 1.41
sys/arch/m68k/include/Makefile: revision 1.32
sys/arch/amiga/include/vmparam.h: revision 1.48
distrib/sets/lists/comp/ad.m68k: revision 1.63
sys/arch/x68k/include/vmparam.h: revision 1.40
sys/arch/mvme68k/include/vmparam.h: revision 1.38
sys/arch/luna68k/include/vmparam.h: revision 1.23
sys/arch/news68k/include/vmparam.h: revision 1.23
sys/arch/atari/include/vmparam.h: revision 1.34
sys/arch/cesfic/include/vmparam.h: revision 1.19

Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.

For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.40.30.1 02-Aug-2025  perseant Sync with HEAD
 1.5 28-Aug-2006  he Collapse two more separate instances of MD vuid_event.h header
files to instead use the common <dev/sun/vuid_event.h> header.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8;
merge ktrace-lwp.
 1.3 08-May-2004  minoura branches: 1.3.12;
#ifndef _XXX_H_ #define _XXX_H_ .... #endif
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.3.12.1 30-Dec-2006  yamt sync with head.
 1.4.8.1 03-Sep-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-May-2004  kleink branches: 1.1.2;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file wchar_limits.h was added on branch ktrace-lwp on 2004-08-03 10:42:56 +0000
 1.9 29-Mar-2008  tsutsui Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.8 07-Nov-2007  ad branches: 1.8.14;
Merge tty changes from the vmlocking branch.
 1.7 04-Mar-2007  tsutsui branches: 1.7.2; 1.7.18; 1.7.20; 1.7.24; 1.7.26;
Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima.

XXX: x68k/dev/com.c should be rewritten to use MI com(4).
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 18-Jan-2005  chs branches: 1.5.8;
de-__P, remove register, ansify.
 1.4 23-Mar-2004  minoura branches: 1.4.8;
Fix my bogus copyright notice. Pointed out by wiz.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 16-Mar-1999  minoura branches: 1.2.42;
Merged minoura_x68k_bus_h branch.
 1.1 07-Aug-1998  minoura branches: 1.1.6;
Switched to MI zs driver.
 1.1.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.2.42.4 24-Jan-2005  skrll Sync with HEAD.
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.8.2 15-Nov-2007  yamt sync with head.
 1.5.8.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.7.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.7.20.1 08-Nov-2007  matt sync with -HEAD
 1.7.18.1 11-Nov-2007  joerg Sync with HEAD.
 1.7.2.1 03-Dec-2007  ad Sync with HEAD.
 1.8.14.1 03-Apr-2008  mjf Sync with HEAD.

RSS XML Feed