Home | History | Annotate | only in /src/sys/arch/atari/include
History log of /src/sys/arch/atari/include
RevisionDateAuthorComments
 1.28 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.27 12-Jul-2018  maxv branches: 1.27.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.26 24-Dec-2015  christos branches: 1.26.16; 1.26.18;
fenv for m68k
 1.25 17-Jul-2011  joerg branches: 1.25.12; 1.25.30;
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.24 09-Feb-2007  ad Merge newlock2 to head.
 1.23 26-Jul-2006  drochner branches: 1.23.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.22 11-Dec-2005  christos branches: 1.22.4; 1.22.8;
merge ktrace-lwp.
 1.21 08-May-2004  kleink branches: 1.21.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.20 17-Jan-2003  thorpej branches: 1.20.2;
Merge the nathanw_sa branch.
 1.19 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.18 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.17 28-Nov-2001  kleink branches: 1.17.8;
No point in installing svr4_machdep.h.
 1.16 15-Apr-2001  kleink branches: 1.16.2; 1.16.8;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.15 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.14 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.13 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.12 26-Jun-2000  kleink branches: 1.12.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.11 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.10 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.9 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.8 19-Apr-1999  kleink branches: 1.8.2;
Add COMPAT_SVR4 for m68k.
 1.7 31-Mar-1999  leo branches: 1.7.4;
Export mtpr.h :-( This is because cpu.h depends on it. Probably userland
should not need cpu.h...
 1.6 15-Mar-1999  minoura Pullin m68k/ieee.h.
 1.5 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.4 24-Nov-1998  leo You also need intr.h, psl.h, pte.h and vmparam.h to build the world...
 1.3 02-Sep-1998  leo Reorganize installation if include files. Nuke some from atari/include as
they make no sense out of the kernel add some from atari/dev (ioctl's).
 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.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.8.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.12.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.8.5 11-Dec-2002  thorpej Sync with HEAD.
 1.16.8.4 13-Aug-2002  nathanw Catch up to -current.
 1.16.8.3 08-Jan-2002  nathanw Catch up to -current.
 1.16.8.2 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.16.8.1 15-Apr-2001  scw file Makefile was added on branch nathanw_sa on 2001-11-10 21:22:48 +0000
 1.16.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.8.1 30-Aug-2002  gehenna catch up with -current.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.12.2 26-Feb-2007  yamt sync with head.
 1.21.12.1 30-Dec-2006  yamt sync with head.
 1.22.8.1 11-Aug-2006  yamt sync with head
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.4.1 01-Feb-2007  ad Header file cleanup.
 1.25.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.25.12.1 03-Dec-2017  jdolecek update from HEAD
 1.26.18.1 10-Jun-2019  christos Sync with HEAD
 1.26.16.1 28-Jul-2018  pgoyette Sync with HEAD
 1.27.36.1 02-Aug-2025  perseant Sync with HEAD
 1.4 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.3 09-Jun-1995  leo branches: 1.3.172;
Make hardware locations u_char instead of char
 1.2 26-Mar-1995  leo fix some formatting nits
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3.172.1 11-Mar-2010  yamt sync with head
 1.4 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.3 26-Jul-2001  wiz branches: 1.3.6; 1.3.128;
auxilary -> auxiliary
 1.2 07-Jan-2001  leo branches: 1.2.4;
Make ahdi_part and ahdi_root 'packed' so I can use this include file on
an x86 machine to analyze my atari disk.
 1.1 19-Feb-1996  leo branches: 1.1.30;
New disklabel handling code (Waldi Ravens).
These are the final (?) modifications to the layout of the NetBSD/Atari
bootblock. The bootblock handling can be made backwards compatible using
the right config options (COMPAT_11 + DISKLABEL_AHDI).
 1.1.30.1 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.4.1 03-Aug-2001  lukem update to -current
 1.3.128.1 11-Mar-2010  yamt sync with head
 1.3.6.2 26-Jul-2001  wiz auxilary -> auxiliary
 1.3.6.1 26-Jul-2001  wiz file ahdilabel.h was added on branch nathanw_sa on 2001-07-26 23:07:58 +0000
 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 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.256;
NetBSD/Atari, port by Leo Weppelman.
 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 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2 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.1 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.40 17-Jul-2011  dyoung Switch to new-style <sys/bus.h>.
 1.39 08-Mar-2009  tsutsui ANSIfy, some KNF, misc cosmetics.
 1.38 05-Mar-2009  tsutsui Remove __P().
 1.37 28-Apr-2008  martin branches: 1.37.8; 1.37.14;
Remove clause 3 and 4 from TNF licenses
 1.36 06-Mar-2007  tsutsui branches: 1.36.40; 1.36.42; 1.36.44;
Change bus_space_handle_t from void * (formerly caddr_t) to u_long
to make things easier.
 1.35 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 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.33 11-Dec-2005  christos branches: 1.33.26;
merge ktrace-lwp.
 1.32 09-Mar-2005  matt branches: 1.32.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.31 10-Nov-2003  wiz branches: 1.31.8; 1.31.10;
Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.
 1.30 15-Jun-2003  fvdl branches: 1.30.2;
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.29 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.28 07-Jan-2002  thorpej Implement bus_space_mmap().
 1.27 19-Jul-2001  thorpej branches: 1.27.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.26 28-May-2001  leo branches: 1.26.2;
Add bus_space_vaddr().
 1.25 09-Mar-2001  leo Expand bus_dma implementation. It will now handle the bounce buffer
extensions needed to make the isa floppy driver on the Milan work.
 1.24 07-Mar-2001  thorpej Add the BUS_DMA_STREAMING flag.
 1.23 26-Jun-2000  simonb branches: 1.23.2;
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.22 11-Apr-2000  leo branches: 1.22.4;
Add dummies for barrier methods (copied from i386).
 1.21 25-Jan-2000  drochner define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.20 19-Jan-2000  leo Allow storage-space to be passed to the alloc_bus_space_tag() functions. This
permits static tags to be used during early console init.
 1.19 13-Dec-1999  leo Change the copy_region function to shutup gcc's unused warnings in some
cases. Use the bus_space_tag without doing something useful... (idea from
Matthias Drochner).
 1.18 28-Oct-1999  leo Use extent maps.
 1.17 14-Aug-1999  leo branches: 1.17.2; 1.17.4; 1.17.6;
Correct the argument order for memcpy(). This tremendously improves the
behaviour of wscons.... (Why did history create both bcopy & memcpy?)
 1.16 23-Mar-1999  drochner 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.15 08-Jan-1999  leo Make the abs_copy functions usable. The previous implementation caused
kernel "jump to zero" panics....
 1.14 01-Dec-1998  leo Fix the __abs_copy() macro (wrong parameters to __abs_opname).
 1.13 25-May-1998  leo Add bus_space_{read,write}_region_stream_N functions.
 1.12 10-Apr-1998  leo Major overhaul of the atari bus_space implementation.
 1.11 10-Mar-1998  leo Bus-dma implementation for the atari. Heavily based on the i386
implementation.
 1.10 16-Jan-1998  leo Add: bus_space_{read,write}_region_N() and bus_space_set_{multi,region}_N()
functions.
 1.9 02-Sep-1997  leo Add BUS_SPACE_MAP_* macro's.
 1.8 15-Jul-1997  leo branches: 1.8.2;
Implement bus_space_subregion()
 1.7 25-Jun-1997  leo Add the types for 'bus_dma_tag_t' and 'bus_dmamap_t'. While here, be a bit
more precise in using types of the bus_space* address arguments.
 1.6 03-Mar-1997  leo Add bus_space_peek_[1248] functions. These can be used by match/probe
functions.
 1.5 27-Jan-1997  leo branches: 1.5.4;
Fix typo's in last commit.
 1.4 27-Jan-1997  leo Change the type of bus_space_tag_t.
Add the bus_space_(read|write)* functions.
 1.3 08-Nov-1996  leo branches: 1.3.2;
Adapt to changes in the bus-interface; bus_[mem|io] -> bus_space. Thanks Jason.
 1.2 06-Nov-1996  leo Prototytpe bus_mem_map/bus_mem_unmap functions.
 1.1 05-Oct-1996  leo Minimal bus.h. Together with the minimal pci implementation, we have just
enough functionality to find a VGA card....
Will be expanded when I buy more pci-cards ;-)
 1.3.2.1 30-Jan-1997  thorpej update from trunk
 1.5.4.1 12-Mar-1997  is Merge in Changes from The Trunk.
 1.8.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.4.1 15-Nov-1999  fvdl Sync with -current
 1.17.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.17.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.22.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.23.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.23.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.26.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.2.1 03-Aug-2001  lukem update to -current
 1.27.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.27.6.2 11-Jan-2002  nathanw More catchup.
 1.27.6.1 19-Jul-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-01-11 23:38:12 +0000
 1.30.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.30.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.2.1 03-Aug-2004  skrll Sync with HEAD
 1.31.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.31.8.1 29-Apr-2005  kent sync with -current
 1.32.4.2 03-Sep-2007  yamt sync with head.
 1.32.4.1 26-Feb-2007  yamt sync with head.
 1.33.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.33.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.36.44.2 04-May-2009  yamt sync with head.
 1.36.44.1 16-May-2008  yamt sync with head.
 1.36.42.1 18-May-2008  yamt sync with head.
 1.36.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.37.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.3 27-Jan-2023  tsutsui Remove extra tabs.
 1.2 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.1 01-Jul-2011  dyoung branches: 1.1.54;
Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.1.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 07-Dec-2023  thorpej extent(9) -> vmem(9)
 1.2 03-Jul-2022  tsutsui Move the iomem extent stuff managed by bus_space(9) and make them static.

Inspired by MD bus_space(9) implemantation of arc.
Briefly tested on TT030.
 1.1 01-Jul-2011  dyoung Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.77 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.76 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.75 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.74 06-Jan-2023  tsutsui TAB/spaces/indents cleanup.
 1.73 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.72 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.71 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.70 19-Oct-2013  christos branches: 1.70.28; 1.70.30;
make cpu_need_resched() macros consistent; __USE flags
 1.69 02-Feb-2012  tsutsui branches: 1.69.6; 1.69.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.68 15-Nov-2011  tsutsui branches: 1.68.4;
Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.67 16-May-2011  tsutsui branches: 1.67.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.66 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.65 22-Dec-2010  matt branches: 1.65.2; 1.65.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.64 23-Nov-2009  rmind branches: 1.64.4;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.63 21-Oct-2009  rmind 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.62 05-Mar-2009  tsutsui Remove __P().
 1.61 27-Feb-2008  xtraeme branches: 1.61.4; 1.61.12; 1.61.18;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.60 08-Jan-2008  joerg branches: 1.60.2; 1.60.6;
Convert Atari to generic TODR and timecounter.
 1.59 17-Oct-2007  garbled branches: 1.59.2; 1.59.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.58 04-Aug-2007  ad branches: 1.58.2;
Add ci_cpuid where it's missing.
 1.57 21-May-2007  tsutsui branches: 1.57.2; 1.57.4; 1.57.8;
Move declarations of m68k common functions
from <machine/cpu.h> to <m68k/m68k.h>.
While here, remove some obsolete function decls.
 1.56 21-May-2007  tsutsui Remove obsolete decralations of switch_exit() and switch_lwp_ext().
 1.55 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.54 20-May-2007  isaki indent fix.
 1.53 18-May-2007  he Adapt to the merge of the yamt-idlelwp branch.
curcpu()->ci_want_resched is now required, so get rid of the
want_resched global. Also, cpu_need_resched() now takes two arguments.
The l_next and l_back fields in struct lwp no longer exists, so delete
references to it from genassym.cf.
Also, m68k/m68k/proc_subr.s is no longer used, says mhitch, so remove its use.

This brings the atari BOOT kernel back to a buildable state.
 1.52 21-Mar-2007  tsutsui branches: 1.52.4;
Apply MI softintr(9) patch before it becomes rotten. Untested.
See also:
http://mail-index.netbsd.org/port-atari/2007/03/07/0000.html
 1.51 04-Mar-2007  christos branches: 1.51.2; 1.51.4; 1.51.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.50 16-Feb-2007  ad branches: 1.50.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.49 09-Feb-2007  ad Merge newlock2 to head.
 1.48 22-Dec-2006  jdc We don't need the cpu_startup() prototype here. It is already provided by
sys/systm.h. Pointed out by skrll@.
 1.47 11-Dec-2005  christos branches: 1.47.20;
merge ktrace-lwp.
 1.46 04-Jun-2005  he branches: 1.46.2;
Adapt to compiling with -Wshadow and -Wcast-qual, by adding const
qualification in places and renaming a few local variables.
Also adds a couple uses of __UNVOLATILE() to allow passing volatile
variables to functions wanting e.g. caddr_t.
 1.45 26-Sep-2004  yamt don't expose cpu_info to userland.
 1.44 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.43 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.42 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.41 10-May-2003  thorpej branches: 1.41.2;
Remove redundant bounds_check_with_label() prototype.
 1.40 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.39 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.38 08-Sep-2001  thomas branches: 1.38.4;
ELF adaption, clockframe must be packed.
 1.37 30-May-2001  mrg branches: 1.37.2; 1.37.4;
use _KERNEL_OPT
 1.36 07-Jan-2001  leo branches: 1.36.2;
Add the Milan as a possible machine type.
 1.35 19-Dec-2000  scw Unification of the m68k syscall() function.
 1.34 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.33 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.32 10-Aug-1999  thorpej branches: 1.32.2;
Define cpu_number() as discussed on tech-smp.
 1.31 26-Feb-1999  is synchronize types, and s/curproc/p/ in one forgotten place
 1.30 25-Feb-1999  is mac68k part of pr 6152 fix, and missing bits for the others
 1.29 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.28 07-Oct-1998  thorpej Oops, back out a buglet I didn't intend to commit in the last change.
 1.27 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.26 05-Oct-1998  thorpej cpu_set_kpc() prototype is already in <sys/systm.h>.
 1.25 02-Sep-1998  leo Get rid of vm_offset_t/vm_size_t
 1.24 19-Feb-1998  leo Update Hades PCI support:
- Initialize the PCI bus and hand-out mem and i/o addresses. (there is
still lots of room for improvements here...)
- Implement the interupt functions
 1.23 26-Oct-1997  is Make these compile after m68k/m68k.h 1.4->1.5.
 1.22 02-Jun-1997  leo More stuff for handling an 68060.
 1.21 09-Apr-1997  thorpej regdump() is prototyped in <m68k/cpu.h> now
 1.20 04-Feb-1997  perry Nuke some options GENERIC residue.
 1.19 21-Jan-1997  leo Add a 'size' argument to badbaddr(). This is very useful on busses that
only accept certain size accesses on a specific address range. Like the
VME bus.
 1.18 03-Jan-1997  leo branches: 1.18.2;
Get rid of 'cpu040' variable. Use 'mmutype' or 'cputype' for testing
instead.
 1.17 18-Dec-1996  leo Tweak the clockframe structure a bit so we are able to save a few cycles
at interrupt time. (From Gordon Ross).
 1.16 25-Oct-1996  leo Nuke declaration of susword(). It's declared in systm.h now.
 1.15 25-Sep-1996  leo Catchup with -current:
- Extra argument to boot()
- select -> poll
 1.14 11-Sep-1996  thorpej Use <m68k/cpu.h>.
 1.13 10-Sep-1996  leo Add suline/susword prototypes for new trap.c
 1.12 23-Aug-1996  leo - Make the Hades a valid machine type
- Add some 68040 specific prototypes.
 1.11 18-Apr-1996  leo Yet more prototyping and -Wall fixes.
 1.10 19-Jan-1996  leo - Remove FPU defines, the FPU-type is no longer determined by the loader.
- Add some forgotten CPU-types (Waldi Ravens).
 1.9 21-Dec-1995  mycroft Remove deprecated cpu_setstack().
 1.8 28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.7 28-May-1995  leo Add CLKBROKEN define, so GEM version that are 2 years off on the RTC can
be identified.
 1.6 14-May-1995  leo - Remove double mapping of stack
- Change to new coredump format
 1.5 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.4 30-Apr-1995  leo - Move softint definitions to mtpr.h
- Add flags for TT/Falcon model for machineid, we definitely need them
 1.3 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.2 30-Mar-1995  leo KERNEL -> _KERNEL
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.18.2.1 30-Jan-1997  thorpej update from trunk
 1.32.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.32.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.32.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.36.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.37.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.38.4.5 03-Dec-2002  gmcgarry Use cpu_proc_fork().
 1.38.4.4 11-Nov-2002  nathanw Catch up to -current
 1.38.4.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.38.4.2 17-Nov-2001  scw MD Scheduler Activation bits for Atari.
Compile-tested only.
 1.38.4.1 08-Sep-2001  scw file cpu.h was added on branch nathanw_sa on 2001-11-17 23:18:08 +0000
 1.41.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.41.2.5 19-Oct-2004  skrll Sync with HEAD
 1.41.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.41.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.41.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.41.2.1 03-Aug-2004  skrll Sync with HEAD
 1.46.2.5 17-Mar-2008  yamt sync with head.
 1.46.2.4 21-Jan-2008  yamt sync with head
 1.46.2.3 03-Sep-2007  yamt sync with head.
 1.46.2.2 26-Feb-2007  yamt sync with head.
 1.46.2.1 30-Dec-2006  yamt sync with head.
 1.47.20.2 06-Feb-2007  ad Update m68k pasteware.
 1.47.20.1 12-Jan-2007  ad Sync with head.
 1.50.2.2 24-Mar-2007  yamt sync with head.
 1.50.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.51.6.1 29-Mar-2007  reinoud Pullup to -current
 1.51.4.1 11-Jul-2007  mjf Sync with head.
 1.51.2.3 20-Aug-2007  ad Sync with HEAD.
 1.51.2.2 27-May-2007  ad Sync with head.
 1.51.2.1 10-Apr-2007  ad Sync with head.
 1.52.4.2 03-Oct-2007  garbled Sync with HEAD
 1.52.4.1 22-May-2007  matt Update to HEAD.
 1.57.8.1 04-Aug-2007  jmcneill Sync with HEAD.
 1.57.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.57.2.1 07-Aug-2007  matt Sync with HEAD.
 1.58.2.2 23-Mar-2008  matt sync with HEAD
 1.58.2.1 06-Nov-2007  matt sync with HEAD
 1.59.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.59.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.60.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.60.2.1 24-Mar-2008  keiichi sync with head.
 1.61.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.61.4.2 11-Mar-2010  yamt sync with head
 1.61.4.1 04-May-2009  yamt sync with head.
 1.64.4.2 31-May-2011  rmind sync with head
 1.64.4.1 05-Mar-2011  rmind sync with head
 1.65.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.65.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.67.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.67.4.1 17-Apr-2012  yamt sync with head
 1.68.4.1 18-Feb-2012  mrg merge to -current.
 1.69.10.1 18-May-2014  rmind sync with head
 1.69.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.70.30.1 10-Jun-2019  christos Sync with HEAD
 1.70.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 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 24-Sep-2001  leo branches: 1.2.4; 1.2.170;
Enable ELF symbols in ddb.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.44; 1.1.1.1.46;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.46.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.1.1.44.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.170.1 03-Dec-2017  jdolecek update from HEAD
 1.2.4.2 24-Sep-2001  leo Enable ELF symbols in ddb.
 1.2.4.1 24-Sep-2001  leo file db_machdep.h was added on branch nathanw_sa on 2001-09-24 09:21:25 +0000
 1.10 01-Oct-2011  chs fix build errors with gcc 4.5.
 1.9 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.8 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.7 26-Jul-2001  wiz branches: 1.7.6; 1.7.128;
auxilary -> auxiliary
 1.6 05-Feb-2000  jdc branches: 1.6.8;
Add definition for default swap partition (libahdi uses this).
 1.5 19-Feb-1996  leo branches: 1.5.30;
New disklabel handling code (Waldi Ravens).
These are the final (?) modifications to the layout of the NetBSD/Atari
bootblock. The bootblock handling can be made backwards compatible using
the right config options (COMPAT_11 + DISKLABEL_AHDI).
 1.4 30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.3 05-Aug-1995  leo branches: 1.3.2;
Add disklabel support. In addition to the 'faked' disklables NetBSD/Atari
now also supports native NetBSD labels. When a NetBSD label is found it
overrules the Atari AHDI-partitioning.
 1.2 26-Mar-1995  leo fix some formatting nits
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3.2.1 27-Oct-1995  leo Fix memory leak in disklabel code when used on removables.
 1.5.30.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.8.1 03-Aug-2001  lukem update to -current
 1.7.128.1 11-Mar-2010  yamt sync with head
 1.7.6.2 26-Jul-2001  wiz auxilary -> auxiliary
 1.7.6.1 26-Jul-2001  wiz file disklabel.h was added on branch nathanw_sa on 2001-07-26 23:07:58 +0000
 1.12 07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.11 20-Oct-2009  snj branches: 1.11.22; 1.11.52;
Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.10 05-Mar-2009  tsutsui Remove __P().
 1.9 04-Mar-2007  christos branches: 1.9.44; 1.9.52; 1.9.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 22-Feb-1996  leo branches: 1.8.80; 1.8.118;
First bunch of changes due to stricter prototype checking.
 1.7 11-Jul-1995  leo Make DD/HD selection do anything sensible.
 1.6 14-May-1995  leo Function proto added.
 1.5 05-May-1995  leo Define dma_drvmode correctly
 1.4 30-Apr-1995  leo Added lock status bits, update function prototypes.
 1.3 22-Apr-1995  leo - Prefix 'dma-defines' with DMA_
- Add function prototypes
 1.2 26-Mar-1995  leo fix some formatting nits
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.8.118.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.80.1 03-Sep-2007  yamt sync with head.
 1.9.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.44.2 11-Mar-2010  yamt sync with head
 1.9.44.1 04-May-2009  yamt sync with head.
 1.11.52.1 27-Sep-2017  jdolecek pass ata channel interlock to st_dmagrab() so that it can release
and reacquire it if it sleeps
 1.11.22.1 03-Dec-2017  jdolecek update from HEAD
 1.1 12-Jul-1998  thorpej Basic elf_machdep.h for m68k; doesn't include relocations, yet.
 1.3 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.2 24-Jan-1999  mycroft branches: 1.2.8;
Format consistency.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2.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:05:28 +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 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 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:35:57 +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:32 +0000
 1.2 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.18;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.18.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2 30-Aug-1999  mycroft A foolish consistency.
 1.1 15-Mar-1999  minoura Pullin m68k/ieee.h.
 1.2 16-Apr-1995  jtc Fix typo: ieefp.h -> ieeefp.h.
 1.1 09-Apr-1995  mycroft Move fp_except and fp_rnd definitions to machine/include.
 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:36 +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:53:24 +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:08 +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:53:25 +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:05 +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:53:25 +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:19:52 +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:53:25 +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:05:29 +0000
 1.25 19-Jan-2024  thorpej Now that we've agreed on the name "intr_depth", let's agree on the type, too.
 1.24 19-Jan-2024  thorpej Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.
 1.23 11-Jul-2023  riastradh atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).
 1.22 02-Apr-2021  rin branches: 1.22.16;
For ports with __HAVE_LEGACY_INTRCNT, turn intrcnt[] and derived
variables into u_int, to match with kern/subr_evcnt.c.
 1.21 08-Jul-2009  tsutsui branches: 1.21.76; 1.21.78;
Merge local <atari/atari/intr.h> into common <machine/intr.h>.
 1.20 05-Mar-2009  tsutsui Remove __P().
 1.19 27-Dec-2008  tsutsui branches: 1.19.2;
Account idepth in all interrupt handlers in locore.s.
 1.18 28-Jun-2008  isaki branches: 1.18.4; 1.18.6;
Unify splraiseipl(9) implementation among m68k ports,
discussed with tsutsui@ on port-m68k. OK'ed by jdc@.

For atari:
- 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)
- vme/if_le_vme.c: fix a wrong usage of IPL_NET
 1.17 28-Apr-2008  martin branches: 1.17.2; 1.17.4;
Remove clause 3 and 4 from TNF licenses
 1.16 03-Dec-2007  ad branches: 1.16.14; 1.16.16; 1.16.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.15 21-Mar-2007  tsutsui branches: 1.15.12; 1.15.14; 1.15.20;
Apply MI softintr(9) patch before it becomes rotten. Untested.
See also:
http://mail-index.netbsd.org/port-atari/2007/03/07/0000.html
 1.14 11-Mar-2007  thorpej branches: 1.14.2; 1.14.4;
- 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.13 16-Feb-2007  ad branches: 1.13.2; 1.13.6;
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.12 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.11 13-Apr-2001  thorpej branches: 1.11.8; 1.11.40; 1.11.70; 1.11.72;
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.10 14-Jan-2001  thorpej branches: 1.10.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.9 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.8 05-Aug-1999  thorpej branches: 1.8.2;
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.7 18-Jul-1998  is Switching dev/ic/lpt.c to use spllpt() instead of spltty(). It doesn't use
tty structures, and on some machines (namely the DraCo internal lpt, and some
multi-i/o boards for Amigas and DraCos), tying spltty to the pretty high printer
interupt level would hurt serial performance.

On all affected ports but Amiga, spllpt() has been defined in machine/intr.h
to be spltty(), thus preserving old behaviour. Portmasters are encouraged to
change is, if they feel something else is better (e.g., one of its own were
possible).
 1.6 25-May-1998  leo Fix some severe bogons in the pci and isa interrupt system.
 1.5 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.4 29-Aug-1997  leo Pull in Scott Reynolds' version of _splraise(). Also do a bit of typographic
cleanup while visting this file.
 1.3 05-Jun-1997  leo branches: 1.3.4;
Implement and use splraise().
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 26-Feb-1997  leo branches: 1.1.2;
Move all spl-related stuff to the new file intr.h. The latter file also
contains some generic defines used by the drivers in dev/[pci|isa].
 1.1.2.2 12-Mar-1997  is Merge in Changes from The Trunk.
 1.1.2.1 26-Feb-1997  is file intr.h was added on branch is-newarp on 1997-03-12 14:46:52 +0000
 1.3.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.8.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.8.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.10.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.72.2 05-Nov-2006  yamt add IPL_VM.
 1.11.72.1 05-Nov-2006  yamt splraiseipl/makeiplcookie for atari.
 1.11.70.1 12-Jan-2007  ad Sync with head.
 1.11.40.4 07-Dec-2007  yamt sync with head
 1.11.40.3 03-Sep-2007  yamt sync with head.
 1.11.40.2 26-Feb-2007  yamt sync with head.
 1.11.40.1 30-Dec-2006  yamt sync with head.
 1.11.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.11.8.1 13-Apr-2001  thorpej file intr.h was added on branch nathanw_sa on 2001-04-13 23:30:00 +0000
 1.13.6.3 03-Dec-2007  ad Sync with HEAD.
 1.13.6.2 10-Apr-2007  ad Sync with head.
 1.13.6.1 13-Mar-2007  ad Sync with head.
 1.13.2.2 24-Mar-2007  yamt sync with head.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.4.1 29-Mar-2007  reinoud Pullup to -current
 1.14.2.1 11-Jul-2007  mjf Sync with head.
 1.15.20.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.14.1 09-Jan-2008  matt sync with HEAD
 1.15.12.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.18.3 18-Jul-2009  yamt sync with head.
 1.16.18.2 04-May-2009  yamt sync with head.
 1.16.18.1 16-May-2008  yamt sync with head.
 1.16.16.1 18-May-2008  yamt sync with head.
 1.16.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.1 03-Jul-2008  simonb Sync with head.
 1.17.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.6.1 06-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #219):
sys/arch/atari/include/intr.h: revision 1.19
sys/arch/atari/atari/locore.s: revision 1.102
sys/arch/atari/atari/intr.c: revision 1.16
Account idepth in all interrupt handlers in locore.s.
 1.18.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.18.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.78.1 03-Apr-2021  thorpej Sync with HEAD.
 1.21.76.1 03-Apr-2021  thorpej Sync with HEAD.
 1.22.16.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.17 08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.16 18-Oct-2014  snj branches: 1.16.56;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.15 10-Aug-2012  tsutsui branches: 1.15.2;
Appease gcc -fno-common:
- remove physmem from machdep.c since it's initialized in atari_init.c
- declare I/O address space variables properly
Compile test only. (currenty my TT030 is busy on pkgsrc builds)
 1.14 20-Oct-2009  snj branches: 1.14.12;
Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.13 23-Aug-2009  mrg fix atari builds in two ways:
- isa_detach_hook() was missing a parameter name (hi dyoung!)
- PCI_CONF_SIZE -> PCI_CONFIG_SIZE; pcivar.h has a PCI_CONF_SIZE now (hi jak!)
 1.12 02-Apr-2003  thorpej branches: 1.12.108;
Use PAGE_SIZE rather than NBPG.
 1.11 15-Apr-2002  bjh21 Only include opt_*.h #ifdef _KERNEL_OPT.
 1.10 28-May-2001  leo branches: 1.10.2; 1.10.8;
PCI_VGA_SIZE -> PCI_MEM_SIZE. (Plus some comments on those constants).
 1.9 12-Apr-2001  leo Update these for Milan addresses.
 1.8 06-Jan-2000  leo branches: 1.8.6;
Determine the default floppy type on the TT/Falcon by reading the config
switches. (Thanks to Michael Schwingen for the missing bits of information!).
 1.7 06-Dec-1999  leo Implement an allocator for VA-space using fixed extent maps. It is now
possible to allocate VA-space before uvm is initialized.
 1.6 22-Sep-1999  leo branches: 1.6.2; 1.6.8;
Reverse the order in which PCI cards are scanned. Now the order matches the
TOS-scan order. This causes TOS & NetBSD to use the same video card on
a system with multiple VGA cards.
 1.5 20-Dec-1998  thomas Changed grf mmap that it is closer to XFree. VGA memory on et4000/et6000
is now at offset 0xa0000.
 1.4 02-Sep-1998  leo Get rid of vm_offset_t/vm_size_t
 1.3 23-Aug-1996  leo - Make all definitions relative to 'stio_addr'
- Add the PCI areas.
 1.2 26-Mar-1995  leo fix some formatting nits
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.6.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.8.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.2 17-Apr-2002  nathanw Catch up to -current.
 1.10.8.1 28-May-2001  nathanw file iomap.h was added on branch nathanw_sa on 2002-04-17 00:02:41 +0000
 1.10.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.108.2 11-Mar-2010  yamt sync with head
 1.12.108.1 16-Sep-2009  yamt sync with head
 1.14.12.1 30-Oct-2012  yamt sync with head
 1.15.2.1 03-Dec-2017  jdolecek update from HEAD
 1.16.56.1 02-Aug-2025  perseant Sync with HEAD
 1.18 18-Oct-2016  jdolecek add isa_intr_establish_xname() to MD isa headers so that it can be used
by MI drivers
 1.17 27-Oct-2012  chs branches: 1.17.14; 1.17.18;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 01-Jul-2011  dyoung branches: 1.16.2; 1.16.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.15 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.14 19-Aug-2009  dyoung (Re-)define isa_detach_hook(), and define isa_dmadestroy(). Update
some isa_chipset_tag_t->ic_detach_hook() definitions.
 1.13 08-Jul-2009  tsutsui Merge local <atari/atari/intr.h> into common <machine/intr.h>.
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 09-May-2003  fvdl branches: 1.11.104; 1.11.106; 1.11.108;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.10 12-Apr-2001  leo branches: 1.10.8;
Update these for Milan addresses.
 1.9 04-Jun-2000  cgd branches: 1.9.4;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.8 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.7 07-Feb-2000  thorpej branches: 1.7.2;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.6 21-Oct-1999  leo Add prototype of isa_intr_alloc().
 1.5 19-Mar-1999  cgd branches: 1.5.8; 1.5.10; 1.5.12;
Moved from arch/atari/isa/isa_machdep.h,v
 1.4 09-Jun-1998  thorpej Add isa_dma{freeze,thaw}(), used to temporarily stop and then restart
all ISA DMA. Needed by e.g. the SmartCard reader for Sharks.
 1.3 09-Jun-1998  thorpej Change the ISA DMA API to take an isa_chipset_tag_t rather than
a struct device * corresponding to the ISA bus device. The ISA DMA
controller driver functions have been renamed and now take a struct
isa_dma_state *, and are called indirectly by machine-dependent code
which provides the DMA state.

These changes allow e.g. `ofisa' (the OpenFirmware configuration
mechanism for the ISA bus, used by e.g. Sharks) to use the MI ISA
DMA controller code.
 1.2 22-Apr-1998  leo Fix prototype of interrupt function.
 1.1 15-Jul-1997  leo branches: 1.1.1;
Initial revision
 1.1.1.1 15-Jul-1997  leo isabus support
 1.5.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.10.1 15-Nov-1999  fvdl Sync with -current
 1.5.8.2 21-Apr-2001  bouyer Sync with HEAD
 1.5.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.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.2 12-Apr-2001  leo Update these for Milan addresses.
 1.10.8.1 12-Apr-2001  leo file isa_machdep.h was added on branch nathanw_sa on 2001-04-12 07:17:31 +0000
 1.11.108.4 11-Mar-2010  yamt sync with head
 1.11.108.3 19-Aug-2009  yamt sync with head.
 1.11.108.2 18-Jul-2009  yamt sync with head.
 1.11.108.1 16-May-2008  yamt sync with head.
 1.11.106.1 18-May-2008  yamt sync with head.
 1.11.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.12.2 03-Dec-2017  jdolecek update from HEAD
 1.16.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.2.1 30-Oct-2012  yamt sync with head
 1.17.18.1 04-Nov-2016  pgoyette Sync with HEAD
 1.17.14.1 05-Dec-2016  skrll Sync with HEAD
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 01-Jun-2000  cgd branches: 1.4.128; 1.4.130; 1.4.132;
kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
Moved from arch/atari/isa/isapnp_machdep.h,v
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 22-Apr-1998  leo Add isapnp stuff (Thomas Gerner)
 1.3.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 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.132.1 16-May-2008  yamt sync with head.
 1.4.130.1 18-May-2008  yamt sync with head.
 1.4.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1 10-Mar-1996  leo Add the include files and the atari kernel support for new format panic
dumps.
 1.2 28-Mar-2012  christos - Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.206; 1.1.1.1.210;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.210.1 05-Apr-2012  mrg sync to latest -current.
 1.1.1.1.206.1 17-Apr-2012  yamt sync with head
 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:05:29 +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:55:31 +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:05:29 +0000
 1.2 17-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.6 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.5 03-May-2003  wiz branches: 1.5.108;
DMA, not dma nor Dma.
 1.4 11-Apr-2001  leo branches: 1.4.8;
Adapt these for use on the Milan.
 1.3 15-Jul-1997  leo branches: 1.3.20; 1.3.32;
Isabus support.
 1.2 26-Mar-1995  leo fix some formatting nits
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3.32.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.20.1 21-Apr-2001  bouyer Sync with HEAD
 1.4.8.2 11-Apr-2001  leo Adapt these for use on the Milan.
 1.4.8.1 11-Apr-2001  leo file mfp.h was added on branch nathanw_sa on 2001-04-11 14:45:08 +0000
 1.5.108.1 11-Mar-2010  yamt sync with head
 1.5 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.4 20-Oct-2009  snj branches: 1.4.22; 1.4.40;
Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.3 11-Dec-2005  christos branches: 1.3.78;
merge ktrace-lwp.
 1.2 03-Sep-2004  leo Correct typo in copyright notice. (noticed by Hubert Feyrer).
 1.1 12-Apr-1996  leo branches: 1.1.64;
Add 3-button mouse support.
 1.1.64.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.64.1 18-Sep-2004  skrll Sync with HEAD.
 1.3.78.1 11-Mar-2010  yamt sync with head
 1.4.40.1 22-Sep-2015  skrll Sync with HEAD
 1.4.22.1 03-Dec-2017  jdolecek update from HEAD
 1.8 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.7 11-Dec-2005  christos branches: 1.7.100; 1.7.106; 1.7.108;
merge ktrace-lwp.
 1.6 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.5 23-May-2002  leo branches: 1.5.6;
Fix the siron()/siroff() macro's. They were using a too loose contraint
that made the wd-driver fall over on kernels compiled with the latest
assembler. The macro;s now use the single_inst_*() functions so there
are less places to go wrong here next time...
 1.4 15-Sep-1997  leo branches: 1.4.30; 1.4.34; 1.4.42; 1.4.44;
Small readability update.
 1.3 04-Jul-1996  leo branches: 1.3.10;
Change accesses to 'ssir' to inline asm macro's.
 1.2 30-Apr-1995  leo branches: 1.2.6;
Moved softint definitions still in cpu.h into mtpr.h and did some minor
cleanups.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2.6.1 19-Jul-1996  jtc Pulled up from rev 1.3 by request from Leo Weppelman
 1.3.10.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.44.1 28-May-2002  lukem Pull up revision 1.5 (requested by leo):
Fix the siron()/siroff() macro's. They were using a too loose contraint
that made the wd-driver fall over on kernels compiled with the latest
assembler. The macro;s now use the single_inst_*() functions so there
are less places to go wrong here next time...
 1.4.42.1 30-May-2002  gehenna Catch up with -current.
 1.4.34.1 20-Jun-2002  nathanw Catch up to -current.
 1.4.30.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.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.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:06:09 +0000
 1.35 10-Feb-2012  para proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.34 08-Feb-2011  rmind branches: 1.34.4; 1.34.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.33 11-Dec-2009  tsutsui branches: 1.33.4; 1.33.6; 1.33.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.32 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.31 03-Jan-2008  joerg branches: 1.31.10;
Simplify delay based on x86 version.
 1.30 11-Dec-2005  christos branches: 1.30.24; 1.30.50; 1.30.56; 1.30.64; 1.30.68;
merge ktrace-lwp.
 1.29 07-Aug-2003  agc branches: 1.29.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.28 01-Nov-2000  leo branches: 1.28.24;
Do not pull-in machine/intr.h when _KERNEL is not defined. This fixes
compilation problems in the regression tests.
 1.27 11-Feb-2000  thorpej branches: 1.27.4;
Update for the NKMEMPAGES changes.
 1.26 04-Dec-1999  ragge CL* discarding.
 1.25 20-Sep-1997  leo branches: 1.25.16; 1.25.22;
Move the definition of MSGBUFSIZE up to the machine-arch level if
possible. Pointed out by Bernd Ernesti.
 1.24 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.23 10-Jul-1997  veego branches: 1.23.2;
Restore the defines of UPAGES and NPTEPG.
 1.22 10-Jun-1997  veego The 'Mach derived conversion macros' are now in <m68k/param.h>
 1.21 10-Jun-1997  veego Use the MI <m68k/param.h> include.
 1.20 26-Feb-1997  leo Allow MCLSHIFT to be overridden by a config option.
 1.19 26-Feb-1997  leo Move all spl-related stuff to the new file intr.h. The latter file also
contains some generic defines used by the drivers in dev/[pci|isa].
 1.18 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.17 27-Jan-1997  leo branches: 1.17.4;
Make MCLBYTES 2K.
 1.16 03-Jan-1997  leo branches: 1.16.2;
Get rid of 'cpu040' variable. Use 'mmutype' or 'cputype' for testing
instead.
 1.15 13-Oct-1996  christos backout previous kprintf changes
 1.14 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 04-Mar-1996  cgd add _MACHINE and _MACHINE_ARCH, which are like MACHINE and MACHINE_ARCH,
execpt without quotes. meant to be __CONCAT()ted for easy #includes
of machine-dependent headers for MI code (e.g. for the MI ISA/EISA/PCI/TC
bus code).
 1.12 01-Mar-1996  cgd Clean up tabbing/spacing in defns of MACHINE, MACHINE_ARCH, and MID_MACHINE.
 1.11 22-Feb-1996  leo First bunch of changes due to stricter prototype checking.
 1.10 07-Jan-1996  leo Remove a stray MAXPARTITIONS definition.
 1.9 13-Aug-1995  mycroft Replace splnet() with splsoftnet(). Add splnet(). Make splimp() > spltty().
 1.8 28-Jun-1995  cgd kill user-land DELAY macro, as suggested by gwr.
 1.7 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.6 30-Apr-1995  leo Get 68040 defines in line with other 68k ports so libkvm/kvm_m68k.c compiles
cleanly.
 1.5 22-Apr-1995  leo Define DELAY to call delay()
 1.4 30-Mar-1995  leo KERNEL -> _KERNEL
 1.3 26-Mar-1995  leo fix some formatting nits
 1.2 26-Mar-1995  leo cgd for leo: kill some casts; catch up with the state of the rest of the world
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.16.2.1 30-Jan-1997  thorpej update from trunk
 1.17.4.1 12-Mar-1997  is Merge in Changes from The Trunk.
 1.23.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.22.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.16.2 22-Nov-2000  bouyer Sync with HEAD.
 1.25.16.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.27.4.1 01-Nov-2000  tv Pullup 1.28 [leo]:
Do not pull-in machine/intr.h when _KERNEL is not defined. This fixes
compilation problems in the regression tests.
 1.28.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.24.1 03-Aug-2004  skrll Sync with HEAD
 1.29.16.1 21-Jan-2008  yamt sync with head
 1.30.68.1 03-Jan-2009  jdc Pull up revisions:
1.39 sys/arch/atari/dev/clock.c
1.31 sys/arch/atari/include/param.h
(requested by tsutsui in ticket #1253).

Simplify delay based on x86 version.
 1.30.64.1 08-Jan-2008  bouyer Sync with HEAD
 1.30.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.30.50.1 09-Jan-2008  matt sync with HEAD
 1.30.24.1 02-Jan-2009  jdc Pull up revisions:
1.39 sys/arch/atari/dev/clock.c
1.31 sys/arch/atari/include/param.h
(requested by tsutsui in ticket #1253).

Simplify delay based on x86 version.
 1.31.10.1 11-Mar-2010  yamt sync with head
 1.33.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.33.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.4.1 05-Mar-2011  rmind sync with head
 1.34.8.1 18-Feb-2012  mrg merge to -current.
 1.34.4.1 17-Apr-2012  yamt sync with head
 1.9 01-Jan-2009  tsutsui Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35

- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes

Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.

Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.

Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.8 31-Dec-2008  tsutsui Remove quite obsolete pcb_cmap2.
 1.7 04-Mar-2007  christos branches: 1.7.40; 1.7.44; 1.7.52; 1.7.54;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.24; 1.6.26;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 30-Sep-2000  leo branches: 1.4.24;
Add PCB_REGS_* defines. This makes ddb compile again.
 1.3 06-Jan-1998  thorpej branches: 1.3.14;
The user segment table pointer is no longer kept here. Change it to
a spare field.

XXX Should be changed to use generic m68k PCB!
 1.2 14-May-1995  leo Fixup comment.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3.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.4.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.24.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1258):
sys/arch/atari/atari/atari_init.c: revision 1.68, 1.69, 1.70
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
sys/arch/atari/include/pmap.h: revision 1.35, 1.37, 1.39 (via patch)
sys/arch/atari/atari/pmap.c: revision 1.106, 1.111 (via patch)
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.7, 1.8, 1.9
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
Remove quite obsolete pcb_cmap2.
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
Update one more comment which was missed in previous.
 1.7.54.2 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/atari_init.c: revision 1.69
sys/arch/atari/atari/pmap.c: revision 1.111 via patch
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.9
sys/arch/atari/include/pmap.h: revision 1.39 via patch
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and
pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.7.54.1 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/include/pcb.h: revision 1.8
Remove quite obsolete pcb_cmap2.
 1.7.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.44.1 04-May-2009  yamt sync with head.
 1.7.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.16 29-Mar-2014  christos make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.15 27-Oct-2012  chs branches: 1.15.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.14 04-Apr-2011  dyoung branches: 1.14.4; 1.14.14;
Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args. Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
pci_intr_map() was a leftover from Xen 2. Probably a bug. I
stopped writing it. I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
Probably a bug. I use a temporary variable. I have not tested this
change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
Probably a bug. Use a local pci_attach_args. I have not tested
this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
caller's pci_attach_args. Probably a bug. Make a local copy of the
caller's pci_attach_args and modify the copy. I have not tested
this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.13 08-Jul-2009  tsutsui branches: 1.13.4; 1.13.6;
Merge local <atari/atari/intr.h> into common <machine/intr.h>.
 1.12 11-Dec-2005  christos branches: 1.12.78;
merge ktrace-lwp.
 1.11 29-Jul-2004  drochner remove now unnecessary "pci_enumerate_bus" definitions
 1.10 15-May-2002  thorpej branches: 1.10.10;
Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.9 15-May-2002  thorpej Implement pci_decompose_tag().
 1.8 08-Jun-2001  simonb branches: 1.8.2; 1.8.8;
For ports that wire up pciide in compatibility mode, have
them define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
in pci_machdep.h and pciide_map_compat_intr() only calls
pciide_machdep_compat_intr_establish() if that preprocessor
define exists.

Ports that don't need to do this no longer need to supply a
dummy function.
 1.7 28-Dec-2000  sommerfeld branches: 1.7.2;
Change pci_intr_map to get interrupt source information from a "struct
pci_attach_args *" instead of from four separate parameters which in
all cases were extracted from the same "struct pci_attach_args".

This both simplifies the driver api, and allows for alternate PCI
interrupt mapping schemes, such as one using the tables described in
the Intel Multiprocessor Spec which describe interrupt wirings for
devices behind pci-pci bridges based on the device's location rather
the bridge's location.

Tested on alpha and i386; welcome to 1.5Q
 1.6 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.5 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.4 19-Mar-1999  cgd branches: 1.4.8; 1.4.16;
Moved from arch/atari/pci/pci_machdep.h,v
 1.3 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.2 19-Feb-1998  leo Update Hades PCI support:
- Initialize the PCI bus and hand-out mem and i/o addresses. (there is
still lots of room for improvements here...)
- Implement the interupt functions
 1.1 05-Oct-1996  leo branches: 1.1.1;
Initial revision
 1.1.1.1 05-Oct-1996  leo minimal pci support
 1.4.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.4.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.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.8.1 08-Jun-2001  nathanw file pci_machdep.h was added on branch nathanw_sa on 2002-06-20 03:38:19 +0000
 1.8.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.10.1 03-Aug-2004  skrll Sync with HEAD
 1.12.78.1 18-Jul-2009  yamt sync with head.
 1.13.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.4.1 21-Apr-2011  rmind sync with head
 1.14.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.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.14.4.1 30-Oct-2012  yamt sync with head
 1.15.2.1 18-May-2014  rmind sync with head
 1.43 06-Jan-2023  tsutsui TAB/spaces/indents cleanup.
 1.42 21-Apr-2022  andvar s/substract/subtract/ in comments and error message.
s/obtainted/obtained/ in one comment.
 1.41 06-Dec-2009  tsutsui Move initialization of protection_codes[] and kernel_pmap()
from MD pmap bootstrap sources to common pmap_bootstrap_finalize().

Tested on atari, hp300, mac68k, and news68k.

XXX: Why is protection_codes[] array initialized at run time?
 1.40 13-Mar-2009  abs Use separate free lists for TT and ST ram, and give TT a lower id
so all TT ram will be used before any ST ram. (free_list param to
uvm_page_physload())
Tested on a TT with and without TT ram.
 1.39 01-Jan-2009  tsutsui branches: 1.39.2;
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35

- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes

Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.

Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.

Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.38 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.37 15-Nov-2008  abs Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
 1.36 11-Jan-2008  he branches: 1.36.6; 1.36.10; 1.36.16; 1.36.18; 1.36.20;
Include <sys/simplelock.h> to pull in appropriate definitions.
 1.35 21-Feb-2007  thorpej branches: 1.35.22; 1.35.28; 1.35.34;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.34 16-Feb-2006  perry branches: 1.34.18; 1.34.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.33 24-Dec-2005  perry branches: 1.33.2; 1.33.4; 1.33.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.32 11-Dec-2005  christos merge ktrace-lwp.
 1.31 07-Aug-2003  agc branches: 1.31.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.30 02-Apr-2003  thorpej branches: 1.30.2;
Use PAGE_SIZE rather than NBPG.
 1.29 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.28 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.27 10-Sep-2001  chris branches: 1.27.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.26 26-May-2001  chs branches: 1.26.2; 1.26.4;
replace vm_page_t with struct vm_page *.
 1.25 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.24 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.23 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.22 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.21 28-Sep-2000  is branches: 1.21.2;
The Atari pmap does wired page accounting; advertize it to UVM.
 1.20 25-Feb-1999  is branches: 1.20.8; 1.20.18;
Atari part of fix for pr 6152
 1.19 02-Sep-1998  leo Get rid of vm_offset_t/vm_size_t
 1.18 07-May-1998  leo Implement MACHINE_NEW_NONCONTIG. Implementation is based on Ignatios' amiga
implementation and Chuck's conversion description.
 1.17 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.16 06-Jan-1998  thorpej Garbage-collect pm_stchanged; it's not used by anything.
 1.15 06-Jan-1998  thorpej Garbage-collect use of the PCB's copy of the user segment table pointer.
 1.14 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.13 01-Jan-1998  thorpej Change an argument name to PMAP_ACTIVATE() to more accurately describe the
semantics of the argument.
 1.12 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.11 10-Jun-1997  veego s/atari_btop/m68k_btop/
 1.10 06-Nov-1996  leo pmap_changebit() no longer static.
 1.9 20-Jul-1996  leo Checkpoint integration of 68040 MMU support. Also fix oversight in allocation
of (virtual) I/O area address range.
 1.8 12-Jul-1996  leo Sync with atari_init cleanup
 1.7 18-Apr-1996  leo Yet more prototyping and -Wall fixes.
 1.6 09-Jun-1995  leo Support & require MACHINE_NONCONTIG
 1.5 16-Apr-1995  leo Changed '#endif KERNEL' -> '#endif /* _KERNEL */'.
 1.4 10-Apr-1995  mycroft Oops; finish that last change.
 1.3 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.2 30-Mar-1995  leo KERNEL -> _KERNEL
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.20.18.1 28-Sep-2000  is Pullup from -current, requested by is, approved by thorpej:

sys/arch/arm32/include/pmap.h 1.18
sys/arch/atari/include/pmap.h 1.21
sys/arch/i386/include/pmap.h 1.50
sys/arch/pc532/include/pmap.h 1.29
sys/arch/sh3/include/pmap.h 1.6

These are architectures that do implemented wired page accounting;
advertize it to UVM, so that mlock() from non-root processes works.
 1.20.8.2 23-Apr-2001  bouyer Sync with HEAD.
 1.20.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.21.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.26.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.26.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.26.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.27.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.27.4.4 02-Jul-2002  nathanw Adjuct whitespace so that this matches the trunk.
 1.27.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.27.4.2 17-Nov-2001  scw MD Scheduler Activation bits for Atari.
Compile-tested only.
 1.27.4.1 10-Sep-2001  scw file pmap.h was added on branch nathanw_sa on 2001-11-17 23:18:09 +0000
 1.30.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.2.1 03-Aug-2004  skrll Sync with HEAD
 1.31.16.2 21-Jan-2008  yamt sync with head
 1.31.16.1 26-Feb-2007  yamt sync with head.
 1.33.6.1 22-Apr-2006  simonb Sync with head.
 1.33.4.1 09-Sep-2006  rpaulo sync with head
 1.33.2.1 18-Feb-2006  yamt sync with head.
 1.34.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.34.18.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1258):
sys/arch/atari/atari/atari_init.c: revision 1.68, 1.69, 1.70
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
sys/arch/atari/include/pmap.h: revision 1.35, 1.37, 1.39 (via patch)
sys/arch/atari/atari/pmap.c: revision 1.106, 1.111 (via patch)
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.7, 1.8, 1.9
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
Remove quite obsolete pcb_cmap2.
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
Update one more comment which was missed in previous.
 1.35.34.1 11-Jan-2008  bouyer Sync with HEAD
 1.35.28.1 18-Feb-2008  mjf Sync with HEAD.
 1.35.22.1 23-Mar-2008  matt sync with HEAD
 1.36.20.3 26-Mar-2009  snj Pull up following revision(s) (requested by abs in ticket #612):
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.3
sys/arch/atari/atari/atari_init.c: revision 1.76
sys/arch/atari/include/pmap.h: revision 1.40
sys/arch/atari/include/vmparam.h: revision 1.24
Use separate free lists for TT and ST ram, and give TT a lower id
so all TT ram will be used before any ST ram. (free_list param to
uvm_page_physload())
Tested on a TT with and without TT ram.
 1.36.20.2 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/atari_init.c: revision 1.69
sys/arch/atari/atari/pmap.c: revision 1.111 via patch
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.9
sys/arch/atari/include/pmap.h: revision 1.39 via patch
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and
pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.36.20.1 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/atari_init.c: revision 1.68
sys/arch/atari/atari/pmap.c: revision 1.106
sys/arch/atari/include/pmap.h: revision 1.37
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
 1.36.18.2 28-Apr-2009  skrll Sync with HEAD.
 1.36.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.10.2 11-Mar-2010  yamt sync with head
 1.36.10.1 04-May-2009  yamt sync with head.
 1.36.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.39.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 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:33:27 +0000
 1.1.4.2 30-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-30 00:19:24 +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:18:02 +0000
 1.3 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.2 11-Jun-1997  kleink branches: 1.2.36; 1.2.40; 1.2.48;
GC obsolete MDP_AST flag.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2.48.1 16-Jul-2002  gehenna catch up with -current.
 1.2.40.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.40.1 17-Nov-2001  scw MD Scheduler Activation bits for Atari.
Compile-tested only.
 1.2.36.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 23-Jan-2005  chs make this the same as the other m68k platforms.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.66; 1.1.1.1.74;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.74.1 29-Apr-2005  kent sync with -current
 1.1.1.1.66.1 24-Jan-2005  skrll Sync with HEAD.
 1.8 01-Jan-2009  tsutsui Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35

- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes

Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.

Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.

Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.7 11-Dec-2005  christos branches: 1.7.24; 1.7.74; 1.7.78; 1.7.86; 1.7.88;
merge ktrace-lwp.
 1.6 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.5 02-Apr-2003  thorpej branches: 1.5.2;
Use PAGE_SIZE rather than NBPG.
 1.4 10-Apr-2001  leo branches: 1.4.8;
The Milan uses the U0 pin to switch the pci-bridge between little & big
endian mode. That's why I moved the 'wired' flag to U1.
 1.3 20-Jul-1996  leo branches: 1.3.28; 1.3.40;
Checkpoint integration of 68040 MMU support. Also fix oversight in allocation
of (virtual) I/O area address range.
 1.2 30-Apr-1995  leo Get 68040 defines in line with other 68k ports so libkvm/kvm_m68k.c compiles
cleanly.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3.40.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.28.1 21-Apr-2001  bouyer Sync with HEAD
 1.4.8.2 10-Apr-2001  leo The Milan uses the U0 pin to switch the pci-bridge between little & big
endian mode. That's why I moved the 'wired' flag to U1.
 1.4.8.1 10-Apr-2001  leo file pte.h was added on branch nathanw_sa on 2001-04-10 19:51:01 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.88.1 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/atari_init.c: revision 1.69
sys/arch/atari/atari/pmap.c: revision 1.111 via patch
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.9
sys/arch/atari/include/pmap.h: revision 1.39 via patch
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and
pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.7.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.78.1 04-May-2009  yamt sync with head.
 1.7.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.24.2 15-Jan-2009  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1258):
sys/arch/atari/atari/atari_init.c: revision 1.68, 1.69, 1.70
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
sys/arch/atari/include/pmap.h: revision 1.35, 1.37, 1.39 (via patch)
sys/arch/atari/atari/pmap.c: revision 1.106, 1.111 (via patch)
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.7, 1.8, 1.9
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
Remove quite obsolete pcb_cmap2.
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
Update one more comment which was missed in previous.
 1.7.24.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1258):
sys/arch/atari/atari/atari_init.c: revision 1.68, 1.69, 1.70
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
sys/arch/atari/include/pmap.h: revision 1.35, 1.37, 1.39 (via patch)
sys/arch/atari/atari/pmap.c: revision 1.106, 1.111 (via patch)
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.7, 1.8, 1.9
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
Remove quite obsolete pcb_cmap2.
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
Update one more comment which was missed in previous.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 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:06:10 +0000
 1.2 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.172;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.172.1 11-Mar-2010  yamt sync with head
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2 13-Sep-1998  mycroft Minor change.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.3 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.2 22-Jan-1999  mycroft Standardize format.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 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 13:55:32 +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:50:05 +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.4 19-Feb-1996  leo New disklabel handling code (Waldi Ravens).
These are the final (?) modifications to the layout of the NetBSD/Atari
bootblock. The bootblock handling can be made backwards compatible using
the right config options (COMPAT_11 + DISKLABEL_AHDI).
 1.3 30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.2 05-Aug-1995  leo branches: 1.2.2;
Add disklabel support. In addition to the 'faked' disklables NetBSD/Atari
now also supports native NetBSD labels. When a NetBSD label is found it
overrules the Atari AHDI-partitioning.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2.2.1 27-Oct-1995  leo Fix memory leak in disklabel code when used on removables.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.19 01-Apr-2021  simonb Define __HAVE_LEGACY_INTRCNT to indicate this port uses legacy intrcnt
interrupt accounting.
 1.18 01-Apr-2021  simonb Whitespace: #define<tab>
 1.17 23-Jan-2021  christos branches: 1.17.2;
Document via __HAVE_BUS_SPACE_8 platforms that implement bus_space_*_8
 1.16 18-Dec-2011  tsutsui branches: 1.16.60;
Restore __HAVE_MM_MD_READWRITE which was added for 5.99.53 in rev 1.14
but removed by merge botch on __HAVE_NEW_STYLE_BUS_H changes in rev 1.15.

Fixes "/dev/nvram: Device not configured" problem on installboot(8)
reported by David Ross.
 1.15 17-Jul-2011  dyoung branches: 1.15.2; 1.15.6;
Switch to new-style <sys/bus.h>.
 1.14 12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.13 20-Jan-2008  joerg branches: 1.13.32; 1.13.42;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.12 08-Jan-2008  joerg Convert Atari to generic TODR and timecounter.
 1.11 17-Oct-2007  garbled branches: 1.11.2; 1.11.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.10 14-Jul-2007  ad branches: 1.10.10;
Generic soft interrupts are mandatory.
 1.9 21-Mar-2007  tsutsui branches: 1.9.4;
Apply MI softintr(9) patch before it becomes rotten. Untested.
See also:
http://mail-index.netbsd.org/port-atari/2007/03/07/0000.html
 1.8 28-Feb-2002  simonb branches: 1.8.70; 1.8.74; 1.8.76; 1.8.78;
Use "#define<tab>".
 1.7 10-Jul-2001  leo branches: 1.7.6;
Remove __BROKEN_CONFIG_UNIT_USAGE.
 1.6 05-Feb-2000  cgd branches: 1.6.8;
add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.5 20-Dec-1996  leo branches: 1.5.28;
Get rid of BROKEN_INDIRECT_CONFIG
 1.4 05-Dec-1996  cgd 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.3 11-Jul-1995  leo Dumping works, now if there were tools to handle it...
 1.2 26-Jun-1995  cgd define __BDEVSW_DUMP_OLD_TYPE for ports where it's true. clean up
some m68k ports inclusion of common header.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.5.28.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.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.8.1 03-Aug-2001  lukem update to -current
 1.7.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.6.1 10-Jul-2001  nathanw file types.h was added on branch nathanw_sa on 2002-04-01 07:39:33 +0000
 1.8.78.1 29-Mar-2007  reinoud Pullup to -current
 1.8.76.1 11-Jul-2007  mjf Sync with head.
 1.8.74.2 15-Jul-2007  ad Sync with head.
 1.8.74.1 10-Apr-2007  ad Sync with head.
 1.8.70.1 24-Mar-2007  yamt sync with head.
 1.9.4.1 03-Oct-2007  garbled Sync with HEAD
 1.10.10.1 06-Nov-2007  matt sync with HEAD
 1.11.8.2 23-Jan-2008  bouyer Sync with HEAD.
 1.11.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.11.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.13.42.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.32.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.15.6.1 18-Feb-2012  mrg merge to -current.
 1.15.2.1 17-Apr-2012  yamt sync with head
 1.16.60.1 03-Apr-2021  thorpej Sync with HEAD.
 1.17.2.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 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.10 25-Mar-2023  andvar s/resultion/resolution/ in comment.
 1.9 25-Mar-2023  andvar s/Predective/Predictive/ and s/dedected/detected/ in comments.
 1.8 03-Jul-2022  andvar fix various typos in comments, mainly s/pallete/palette/.
 1.7 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.6 27-Mar-1996  leo branches: 1.6.170;
Take out direct access to the YM2149. The chip definitions are moved
from video.h to ym2149reg.h.
 1.5 10-Mar-1996  leo Take the type of the attached monitor into account when selecting a
display-mode. Includes hack to make things work on non-VGA monitors.
 1.4 02-Jan-1996  leo Allow selection of Falcon (videl) video modes other than the mode selected
on startup (Thomas Gerner).
 1.3 30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.2 17-Aug-1995  leo branches: 1.2.2;
Add video registers and other defines for Falcon video.
 1.1 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo NetBSD/Atari, port by Leo Weppelman.
 1.2.2.1 16-Nov-1995  leo Oops, this also belongs to the ser02 selection.
 1.6.170.1 11-Mar-2010  yamt sync with head
 1.35 06-Jan-2023  tsutsui TAB/spaces/indents cleanup.
 1.34 01-Feb-2020  tsutsui 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.33 27-Mar-2019  christos branches: 1.33.4; 1.33.6;
- expose vmparams to userland on arm, like other archs do.
- remove unneeded includes
 1.32 26-Feb-2018  tsutsui branches: 1.32.4;
Add dumb memory probe routines for Milan to use all available memory.

Tested on Milan with 32Mx1, 32Mx4, 128MBx1, and 128MBx3.
(bootloader ROM fails to load TOS with 128MBx4)

No particular comment on port-atari@:
http://mail-index.netbsd.org/port-atari/2018/02/09/msg000580.html
 1.31 02-Feb-2017  rin branches: 1.31.6;
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.30 02-Feb-2017  rin PR port-mac68k/51923
Remove unused SYSPTSIZE and USRPTSIZE from m68k ports.
Ok jklos
 1.29 26-Jul-2014  tsutsui branches: 1.29.4; 1.29.8; 1.29.12;
Reorganize and bump VM related constants.

- sync VM_MAXUSER_ADDRESS and VM_MAX_ADDRESS with other hp300 derived ports
and use same definitions for USRSTACK as other m68k ports
(no worth to have sun3/sunos compat in these days)
- remove unused KUSER_AREA
- bump MAXTSIZ, MAXDSIZ, and MAXSSIZ

These changes allow my 64MB TT030 build pkgsrc/textproc/icu
which seems to require >200MB VA space.
(note our current 040/060 pmap implementation can't handle >224MB VA size)
 1.28 08-Feb-2011  rmind branches: 1.28.14; 1.28.28;
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.27 06-Nov-2010  uebayasi branches: 1.27.2; 1.27.4;
Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.26 08-Dec-2009  tsutsui branches: 1.26.2; 1.26.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.25 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.24 13-Mar-2009  abs Use separate free lists for TT and ST ram, and give TT a lower id
so all TT ram will be used before any ST ram. (free_list param to
uvm_page_physload())
Tested on a TT with and without TT ram.
 1.23 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.22 01-Jan-2009  tsutsui branches: 1.22.2;
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35

- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes

Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.

Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.

Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.21 11-Dec-2005  christos branches: 1.21.24; 1.21.74; 1.21.78; 1.21.86; 1.21.88;
merge ktrace-lwp.
 1.20 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.19 02-Apr-2003  thorpej branches: 1.19.2;
Use PAGE_SIZE rather than NBPG.
 1.18 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.17 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.16 01-May-2001  thorpej branches: 1.16.2; 1.16.8;
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.15 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.14 14-Nov-2000  thorpej branches: 1.14.2;
We use 8K pages on the Atari. Make PAGE_SIZE and friends into
compile-time constants.
 1.13 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.12 26-Jan-2000  tsutsui Remove obsoleted macros.
 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 03-Mar-1999  leo branches: 1.9.4;
Dump max. datasize (MAXDSIZ) to 64MB and decouple the maximum stack size
(MAXSSIZ) from the MAXDSIZ.
 1.8 20-Nov-1998  leo Follow the amiga vmparam.h, from Ignatios:
Yet another workaround for pmap bugs. Several reports on the port-amiga
list claim this helps with some big-machine situations.
 1.7 02-Sep-1998  leo Get rid of vm_offset_t/vm_size_t
 1.6 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.5 07-May-1998  leo Implement MACHINE_NEW_NONCONTIG. Implementation is based on Ignatios' amiga
implementation and Chuck's conversion description.
 1.4 10-Oct-1997  leo VM_MAX_ADDRESS is the user max address -- adjust (From Chris Hopps).
 1.3 12-Jul-1997  perry branches: 1.3.2;
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 26-Mar-1995  leo branches: 1.1.1;
Initial revision
 1.1.1.1 26-Mar-1995  leo branches: 1.1.1.1.8; 1.1.1.1.12;
NetBSD/Atari, port by Leo Weppelman.
 1.1.1.1.12.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.1.1.1.8.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.3.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 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.10.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 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.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.8.3 11-Dec-2002  thorpej Sync with HEAD.
 1.16.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.16.8.1 01-May-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:23:37 +0000
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.88.2 26-Mar-2009  snj Pull up following revision(s) (requested by abs in ticket #612):
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.3
sys/arch/atari/atari/atari_init.c: revision 1.76
sys/arch/atari/include/pmap.h: revision 1.40
sys/arch/atari/include/vmparam.h: revision 1.24
Use separate free lists for TT and ST ram, and give TT a lower id
so all TT ram will be used before any ST ram. (free_list param to
uvm_page_physload())
Tested on a TT with and without TT ram.
 1.21.88.1 08-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #230):
sys/arch/atari/atari/atari_init.c: revision 1.69
sys/arch/atari/atari/pmap.c: revision 1.111 via patch
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.9
sys/arch/atari/include/pmap.h: revision 1.39 via patch
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and
pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
 1.21.86.2 28-Apr-2009  skrll Sync with HEAD.
 1.21.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.78.3 11-Mar-2010  yamt sync with head
 1.21.78.2 16-Sep-2009  yamt sync with head
 1.21.78.1 04-May-2009  yamt sync with head.
 1.21.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.21.24.1 15-Jan-2009  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1258):
sys/arch/atari/atari/atari_init.c: revision 1.68, 1.69, 1.70
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.1
sys/arch/atari/include/pte.h: revision 1.8
sys/arch/atari/include/vmparam.h: revision 1.22
sys/arch/atari/include/pmap.h: revision 1.35, 1.37, 1.39 (via patch)
sys/arch/atari/atari/pmap.c: revision 1.106, 1.111 (via patch)
sys/arch/atari/atari/genassym.cf: revision 1.28
sys/arch/atari/conf/files.atari: revision 1.113
sys/arch/atari/include/pcb.h: revision 1.7, 1.8, 1.9
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
Remove bogus DEBUG uvm_map() calls - (sync with amiga pmap). From Tuomo
Remove quite obsolete pcb_cmap2.
Pull the following amiga's pmap changes to atari:
arch/amiga/amiga/amiga_init.c 1.95-1.97, 1.100-1.102
arch/amiga/amiga/pmap.c 1.123, 1.126-1.131, 1.142, 1.145
arch/amiga/amiga/pmap_bootstrap.c 1.1, 1.2, 1.3, 1.4
arch/amiga/conf/files.amiga 1.137
arch/amiga/include/pcb.h 1.16
arch/amiga/include/pmap.h 1.44
arch/amiga/include/pte.h 1.19
arch/amiga/include/vmparam.h 1.35
- change kernel address space layout (i.e. move Sysmap to the end of KVA)
to match other m68k ports, which should be done on yamt-km merge
- rework pmap_zero_page(), pmap_copy_page() and some more other functions
to make them compatible with m68k/pmap_motorola.c
- move pmap_bootstrap() into a separate file to allow using either
the atari pmap.c or the m68k common pmap_motorola.c
- use common m68k include files, pcb.h, pmap_motorola.h, and pte_motorola.h
- misc style and cosmetic changes
Most merge work is done by Tuomo Makinen, and
miscellaneous fixes and cleanups are done by me.
Tested on Falcon with both 68030 and 68060 by Tuomo, and
also tested on TT030 by David Ross on port-atari.
Should be pulled up to netbsd-4 (it requires at least Sysmap changes)
and netbsd-5.
Update one more comment which was missed in previous.
 1.22.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.4.1 05-Mar-2011  rmind sync with head
 1.26.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.27.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.28.1 10-Aug-2014  tls Rebase.
 1.28.14.2 03-Dec-2017  jdolecek update from HEAD
 1.28.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.29.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.29.4.1 05-Feb-2017  skrll Sync with HEAD
 1.31.6.1 13-Mar-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #624):
sys/arch/atari/stand/xxboot/sdboot/milan/Makefile: revision 1.4
sys/arch/atari/dev/nvram.c: revision 1.21
sys/arch/atari/conf/MILAN.in: revision 1.28
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.9
sys/dev/isa/fd.c: revision 1.111
sys/arch/atari/atari/bus.c: revision 1.60
sys/arch/atari/stand/xxboot/ahdi-xxboot/milan/Makefile: revision 1.4
sys/arch/atari/atari/locore.s: revision 1.111
sys/arch/atari/isa/isa_machdep.c: revision 1.41
distrib/sets/lists/base/md.atari: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.56
sys/arch/atari/include/vmparam.h: revision 1.32
sys/arch/atari/isa/isa_milan.c: revision 1.15
sys/arch/atari/isa/isa_milan.c: revision 1.16
sys/arch/atari/atari/bus.c: revision 1.59
sys/arch/atari/atari/atari_init.c: revision 1.101
sys/arch/atari/pci/pci_milan.c: revision 1.15
Fix I/O access failures for regions allocated by bus_space_map(9) on Milan.

Passing to PMAP_WIRED against I/O spaces seems problematic,
probably after yamt-km branch merge, which was committed
between NetBSD 3.0 and NetBSD 4.0.
(i.e. ISA and PCI devices on Milan didn't work after 4.0 release)

XXX:
According to pmap(9) man page, the "flags" arg for pmap_enter(9)
doesn't take VM_PROT_READ and VM_PROT_WRITE, but pmap_enter()
implementation in sys/arch/m68k/m68k/pmap_motolora.c historically
checks them.

Fix silent hang during config_console() (before consinit()) on Milan.
config_console() was a dirty hack used by ancient m68k ports
to probe and initialize console devices before "real" configure(9),
using subset of configure(9) functions.

In that case, most device specific data (except I/O access method)
are not initialized so we must not access device specific device_t and
softc structures in config_console() cases.

Fix silent hang after isa_intr_establish() on Milan.
The problems (wrong macro replacements) were slipped in rev 1.107:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/atari/atari/locore.s#rev1.107
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.
This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.
atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.

Use a proper PSL value to be passed to splx(9) functions.
This should have been changed on yamt-splraiseipl branch merge
back in 2006, which made MI IPL_xxx values independent from
m68k MD PSL values for the %sr register.

Restore piixide(4) for Milan and disable other pciide devices.
piixide was removed in rev 1.18 and the log message said
"because Intel IDE disk controllers only exist as part of
Intel chipsets for x86 systems" but the Milan actually has
the Intel 82371FB southbridge on its board.
Other pciide devices are unlikely necessary for the default
kernel for such a rare machine.
Also fix pasto in comment.

Skip NVRAM checksum check and re-initialization on Milan.
Milan's firmware seems to use different check method.

Ack EOI for IRQ_SLAVE of the master PIC after ack for IRQ of the slave PIC.
I'm not sure if there are possible races in the original code, but
this is what i8259_asm_ack2() in sys/arch/x86/include/i8259.h does
and it looks this change makes a Milan kernel a bit stable.
Replace CRTC register values with ones taken from sys/dev/ic/vga_subr.c.
This fixes noise around column 3 and 4 and makes screen output clearer
on Milan with S3 Trio64V.

Explicitly setup the secondary IDE interrupt of PIIX on Milan.
The secondary IDE interrupt is connected to MBIRQ0 on PIIX, but
the Milan's ROM bootloader (at least version 0.99.7) doesn't seem
to setup the MBIRQ0 register to route it to IRQ15.

On Milan, also explicitly disable MBIRQ1 on PIIX.
Milan's ROM bootloader v1.2 and v1.4 incorrectly set MBIRQ0 connected
to the secondary IDE to IRQ14 (not 15) and unused MBIRQ1 to IRQ15,
so both IDE channels don't work properly.

Add dumb memory probe routines for Milan to use all available memory.
Tested on Milan with 32Mx1, 32Mx4, 128MBx1, and 128MBx3.
(bootloader ROM fails to load TOS with 128MBx4)
No particular comment on port-atari@:
http://mail-index.netbsd.org/port-atari/2018/02/09/msg000580.html

Provide wdboot as a copy of sdboot for Milan.
It looks Milan's bootloader ROM emulates IDE disks as SCSI disks
so sdboot works for them, but atari's installboot checks a specified
device name and requires wdboot for wd(4) devices.

Fix another possible out of bounds.

Replace bus_dmamap_sync(9) op with a newer one taken from m68k/bus_dma.c.
This could fix memory corruption issue caused by PREREAD ops with regions
whose boundaries are not aligned at cacheline size.
 1.32.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.32.4.1 10-Jun-2019  christos Sync with HEAD
 1.33.6.1 29-Feb-2020  ad Sync with head.
 1.33.4.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.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:33:26 +0000

RSS XML Feed