Home | History | Annotate | only in /src/sys/arch/alpha
History log of /src/sys/arch/alpha
RevisionDateAuthorComments
 1.15 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.14 03-Apr-2011  dyoung branches: 1.14.2;
Fix 'tags' target.
 1.13 25-Oct-2008  apb branches: 1.13.16; 1.13.22;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.12 06-Jan-2003  lukem branches: 1.12.104; 1.12.108; 1.12.114;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.11 12-Jun-1998  cgd branches: 1.11.26;
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.10 11-Oct-1997  mycroft Minor rearrangement to match other files.
 1.9 11-Oct-1997  mycroft Nuke NOOBJ.
 1.8 11-Oct-1997  mycroft Update all the tags goo, and use bsd.subdir.mk.
 1.7 07-May-1997  mycroft branches: 1.7.4; 1.7.6;
Don't use _SUBDIRUSE outside of bsd.subdir.mk.
 1.6 04-May-1997  mjacob Oops- Really should do local files before common.
 1.5 04-May-1997  mjacob Fix tags target.
 1.4 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 27-Feb-1995  cgd branches: 1.3.4;
fill up device switches, clean up a couple of mistakes.
 1.2 16-Feb-1995  cgd Id -> NetBSD
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.6.2 07-May-1997  mycroft Don't use _SUBDIRUSE outside of bsd.subdir.mk.
 1.7.6.1 07-May-1997  mycroft file Makefile was added on branch alpha-nwscons on 1997-05-07 17:28:48 +0000
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.26.1 07-Jan-2003  thorpej Sync with HEAD.
 1.12.114.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.12.108.1 04-May-2009  yamt sync with head.
 1.12.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.13.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.16.1 21-Apr-2011  rmind sync with head
 1.14.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.12 12-Mar-1998  thorpej Nuke these; they are long-since obsolete.
 1.11 25-Feb-1997  cgd branches: 1.11.6;
update for current reality. Needs a lot of work.
 1.10 09-Jul-1996  cgd branches: 1.10.2; 1.10.8;
kill a typo
 1.9 13-Jun-1996  cgd update readme files for present reality.
 1.8 25-Apr-1996  cgd branches: 1.8.4;
clean up and improve instructions, update to reflect current reality.
 1.7 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.6 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.5 23-Feb-1995  cgd add an entry to the 'thanks' section.
 1.4 21-Feb-1995  cgd clean up a bit...
 1.3 21-Feb-1995  cgd hyphenation foo.
 1.2 21-Feb-1995  cgd updated version of the readme
 1.1 14-Feb-1995  cgd just a quick blurb
 1.8.4.1 13-Jun-1996  cgd pull up from trunk:
>update readme files for present reality.
 1.10.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.6.2 25-Feb-1997  cgd update for current reality. Needs a lot of work.
 1.11.6.1 25-Feb-1997  cgd file README was added on branch alpha-nwscons on 1997-02-25 03:17:21 +0000
 1.8 12-Mar-1998  thorpej Nuke these; they are long-since obsolete.
 1.7 23-Apr-1997  cgd branches: 1.7.6;
note eb64+/AlphaPC 64 support
 1.6 26-Nov-1996  cgd branches: 1.6.2;
note eb164 support
 1.5 06-Sep-1996  cgd note that the AlphaStation 500 works (with the same caveats as the
AlphaStation 600).
 1.4 13-Jun-1996  cgd update readme files for present reality.
 1.3 25-Apr-1996  cgd branches: 1.3.4;
update for present reality
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 25-Apr-1995  cgd status report
 1.3.4.2 06-Sep-1996  cgd pull up from trunk:
>revision 1.5
>date: 1996/09/06 04:01:37; author: cgd; state: Exp; lines: +5 -6
>note that the AlphaStation 500 works (with the same caveats as the
>AlphaStation 600).
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>update readme files for present reality.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.6.2 23-Apr-1997  cgd note eb64+/AlphaPC 64 support
 1.7.6.1 23-Apr-1997  cgd file STATUS was added on branch alpha-nwscons on 1997-04-23 20:52:46 +0000
 1.7 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 22-Jan-2002  wiz Fix typo.
 1.5 22-Jul-2001  wiz branches: 1.5.2;
seperate -> separate
 1.4 02-Sep-1997  thorpej branches: 1.4.32;
Make a note about option headers.
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 08-Apr-1997  cgd branches: 1.2.2; 1.2.6; 1.2.8;
clean up some wording
 1.1 07-Apr-1997  cgd note NetBSD/alpha's (intentional) deviations from KNF
 1.2.8.2 08-Apr-1997  cgd clean up some wording
 1.2.8.1 08-Apr-1997  cgd file STYLE was added on branch alpha-nwscons on 1997-04-08 00:18:26 +0000
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.32.3 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.4.32.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.32.1 03-Aug-2001  lukem update to -current
 1.5.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.5.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.1 22-Jul-2001  nathanw file STYLE was added on branch nathanw_sa on 2002-02-28 04:06:08 +0000
 1.6 25-Feb-1997  cgd kill this
 1.5 01-Oct-1996  cgd branches: 1.5.2; 1.5.8;
clean up a bit
 1.4 13-Jun-1996  cgd update readme files for present reality.
 1.3 25-Apr-1996  cgd branches: 1.3.4;
update for present reality
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 25-Apr-1995  cgd Add 'users to-do list'
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>update readme files for present reality.
 1.5.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.34 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.33 31-Mar-2024  thorpej branches: 1.33.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.32 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.31 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.30 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.29 06-Feb-2012  matt branches: 1.29.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.28 01-Jul-2011  dyoung branches: 1.28.2; 1.28.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.27 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.26 18-Mar-2009  cegger branches: 1.26.10;
ansify function definitions
 1.25 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.24 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.23 04-Mar-2007  yamt branches: 1.23.44; 1.23.52; 1.23.58;
fix fallout from caddr_t changes.
 1.22 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 26-Feb-2006  he branches: 1.21.20;
Fix one more missing double quote.
 1.20 25-Feb-2006  thorpej Use device_is_a().
 1.19 23-Feb-2006  thorpej Use device_parent().
 1.18 11-Dec-2005  christos branches: 1.18.2; 1.18.4; 1.18.6;
merge ktrace-lwp.
 1.17 28-Jun-2004  mycroft branches: 1.17.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.16 14-Dec-2003  thorpej No need to include wdvar.h anymore.
 1.15 14-Oct-2003  nathanw Catch up to ata/ide changes; look for a parent device of wd named "atabus"
instead of "pciide", and check one layer farther up in the device hierarchy
for the scsipidev device.

From Manuel Bouyer, tested by me on a up1500 (identical changes to other
ide-booting code).
 1.14 14-Jun-2003  thorpej branches: 1.14.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.13 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.12 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.11 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.10 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.9 02-Dec-2001  bouyer branches: 1.9.8;
Convert to new ata/atapi attach structs.
 1.8 05-Jun-2001  thorpej branches: 1.8.2; 1.8.4;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.7 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.6 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.5 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.4 20-Jun-2000  matt branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8;
CDROMs can exist on ide buses
 1.3 11-Jun-2000  sommerfeld Let this build again after the pckbc_cnattach change
 1.2 06-Jun-2000  matt Needs to look at different stuff depending if the scsipi bus is SCSI or ATAPI
 1.1 01-Jun-2000  thorpej Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.4.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.6.3 23-Apr-2001  bouyer Sync with HEAD.
 1.4.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.4.6.1 20-Jun-2000  bouyer file api_up1000.c was added on branch thorpej_scsipi on 2000-11-20 19:56:19 +0000
 1.4.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.4.1 20-Jun-2000  minoura file api_up1000.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:08 +0000
 1.4.2.2 20-Jun-2000  matt CDROMs can exist on ide buses
 1.4.2.1 20-Jun-2000  matt file api_up1000.c was added on branch netbsd-1-5 on 2000-06-20 03:48:54 +0000
 1.8.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.8.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.4.1 05-Jun-2001  nathanw file api_up1000.c was added on branch nathanw_sa on 2002-01-08 00:22:50 +0000
 1.8.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.8.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.12.2 03-Sep-2007  yamt sync with head.
 1.17.12.1 21-Jun-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 01-Mar-2006  yamt sync with head.
 1.21.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.44.1 04-May-2009  yamt sync with head.
 1.26.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.28.6.1 18-Feb-2012  mrg merge to -current.
 1.28.2.2 30-Oct-2012  yamt sync with head
 1.28.2.1 17-Apr-2012  yamt sync with head
 1.29.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 03-Dec-1999  thorpej Remove now-obsolete atomic operations.
 1.8 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.7 28-Nov-1999  thorpej Implement atomic addition and subtraction on quadwords.
 1.6 31-May-1999  ross branches: 1.6.2; 1.6.8;
Convert to traceback-friendly temporary labels.
 1.5 25-Sep-1998  thorpej branches: 1.5.8;
Implement atomic quadword load-and-latch.
 1.4 24-Sep-1998  thorpej Implement atomic test-and-set for longwords (32-bit).
 1.3 22-Sep-1998  thorpej Add missing mb ops.
 1.2 22-Sep-1998  thorpej Implement quadword atomic test-and-set.
 1.1 22-Mar-1998  thorpej Implement a set of `atomic' (using load-locked and store-conditional)
operations. Initial set includes:

alpha_atomic_setbits_q() set bits in a quad
alpha_atomic_clearbits_q() clear bits in a quad
 1.5.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.60 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.59 31-Mar-2024  thorpej branches: 1.59.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.58 09-Jul-2021  thorpej If we're netbooting on a system with, for example, an ISA DE204 Ethernet
interface, we don't have sufficient information to find the device using
the bus/slot scheme that we do with a PCI network interface. However, in
these cases, some versions of the SRM console supply the MAC address of
the interface in the booted_dev environment variable, like so:

BOOTP 1 1 0 0 0 5 0 08-00-2B-xx-xx-xx 1

So, if we weren't able to find the booted device by the usual means,
check for this and, if we find a MAC address, try to find the network
interface by the MAC address.
 1.57 22-May-2021  thorpej Gah, fix cut-and-paste-o.
 1.56 22-May-2021  thorpej qemu_find_rootdev(): Zero the buffer that we use to fetch the Qemu
"prom" root device variable; junk past the trailing NUL would cause
the way we parse the string to fail. Also parse rootdev= and root=
the same way ("be liberal in what you accept" approach).
 1.55 03-Oct-2020  thorpej branches: 1.55.6; 1.55.8;
Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.54 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.53 20-Jan-2014  tsutsui branches: 1.53.28; 1.53.30;
Check and set "is_console" property to PCI displays for framebuffer drivers.

Tested on DS15 with radeonfb(4) and XP1000 with vga(4)
by Naruaki Etomi in PR/48431.
 1.52 29-Jul-2012  mlelstv branches: 1.52.2; 1.52.4;
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().

Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().

Make cpu_rootconf(9) describe the calling order.
 1.51 06-Feb-2012  matt branches: 1.51.2;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.50 27-Jul-2011  njoly branches: 1.50.2; 1.50.6;
Make atoi() use strtoll from libkern.
 1.49 26-Jul-2011  njoly Make atoi func static, and constify
 1.48 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.47 18-Mar-2009  cegger branches: 1.47.10;
ansify function definitions
 1.46 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.45 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.44 03-Dec-2007  ad branches: 1.44.18; 1.44.26; 1.44.32;
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.43 11-Dec-2005  christos branches: 1.43.30; 1.43.48; 1.43.50; 1.43.56;
merge ktrace-lwp.
 1.42 01-Jun-2005  drochner branches: 1.42.2;
fix constification fallout
 1.41 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.40 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.39 06-Sep-2002  gehenna branches: 1.39.6;
Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.38 12-Jul-2001  thorpej branches: 1.38.2; 1.38.14;
bcopy -> memcpy
 1.37 03-Jun-2000  thorpej branches: 1.37.6;
- Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.36 17-Sep-1999  thorpej branches: 1.36.2; 1.36.10;
Centralize the declaration and clearing of `cold'.
 1.35 15-Sep-1999  thorpej Rename the machine-dependent autoconfiguration entry point `cpu_configure()',
and rename config_init() to configure() and call cpu_configure() from there.
 1.34 07-Jun-1999  thorpej Don't pass a nam2blk around at all; just have setroot() and friends reference
dev_name2blk[] directly. Addresses PR #7622 (ITOH Yasufumi), although
in a different way.
 1.33 23-Feb-1999  thorpej branches: 1.33.4;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.32 25-Nov-1998  mjacob add missing include file
 1.31 06-Oct-1998  thorpej Move the calls to hwrpb_restart_setup() and cpu_run_spinup_queue() to the
end of configure().
 1.30 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.29 09-Jan-1998  drochner Selection of network configuration method for diskless boot can be
controlled by config options now. Remove setting of nfs_boot_rfc951,
it is set by default if "option NFS_BOOT_BOOTP" is defined.
 1.28 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.27 13-Sep-1997  thorpej The Alpha console uses BOOTP for network booting, so the NetBSD kernel
should, too. Enable the BOOTP support in nfs_boot().
 1.26 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.25 06-Jun-1997  cgd branches: 1.25.4;
fix slight bogons in splhigh() usage, that were introduced when the
behaviour of splhigh() was changed. The new behaviour raised the level to
IPL_HIGH if it was lower, but left it alone if the same or higher. Apparently
the firmware transfers to NetBSD with all interrupts blocked, or something
else blocks all interrupts (including machine checks) before the code
is really started. This meant that machine checks were blocked during
device probes, leading to false device probes _and_ an unexpected (and
therefore fatal) machine check at the spl0() after autoconfiguration.
 1.24 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.23 07-Apr-1997  cgd include machine/options.h
 1.22 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.21 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.20 26-Mar-1997  gwr Move findroot/setroot stuff from configure() to cpu_rootconf().
 1.19 03-Feb-1997  cgd branches: 1.19.2;
add fd and wd to alpha_nam2blk
 1.18 31-Jan-1997  thorpej Use the new machine-independent setroot()
 1.17 01-Jan-1997  pk branches: 1.17.2;
RAMDISK_HOOKS => MEMORY_DISK_HOOKS
 1.16 13-Nov-1996  cgd branches: 1.16.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.15 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.14 13-Oct-1996  christos backout previous kprintf changes
 1.13 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 03-Oct-1996  cgd frob things so that RAMDISK_HOOKS in the 'right' way with 'swap generic'
and/or RB_ASKNAME. (Basically, assume that if RAMDISK_HOOKS are included,
the default root device should be rd0a, etc.)
 1.11 03-Oct-1996  cgd add major info for 'rd' ramdisk devices. make parsedisk() static.
tolerate 'halt' at any of the boot-time prompts.
fix (fatal) bug in the 'swap device' prompt reprinting code.
 1.10 17-Sep-1996  cgd hmm, fix an apparent typo (two letters got deleted!)
 1.9 17-Sep-1996  cgd print default device names slightly more nicely. (if not disk device,
don't print a blank before the close paren.)
 1.8 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.7 14-Jun-1996  cgd add a new machine-dependent sysctl, machdep.root_device, which is the
(string) name of the root device. It's a string so that it can
be used before dev_mkdb has been run.
 1.6 13-Jun-1996  cgd fix error in 'swap generic' nfs root picking code (a case that can never
currently happen) which forgot to set rood device correctly.
 1.5 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.4 12-Jun-1996  cgd rework setroot() and friends, largely by cloning from the sparc code
and whacking a bit here and there where appropriate. Does not yet do
automatic root device detection, but that's much easier to add now.
RB_ASKNAME now supports specification of network devices, for diskless
booting. Also, RB_ASKNAME is now supported on _all_ kernels.
 1.3 12-Apr-1996  cgd branches: 1.3.4;
clean up copyrights and RCS IDs
 1.2 04-Apr-1996  cgd update for the fact that config_found() and config_rootfound() now
return pointers. (Check vs. NULL, rather than just boolean tests.)
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.4.3 14-Jun-1996  cgd pull up from trunk:
>add a new machine-dependent sysctl, machdep.root_device, which is the
>(string) name of the root device. It's a string so that it can
>be used before dev_mkdb has been run.
 1.3.4.2 13-Jun-1996  cgd pull up from trunk:
>fix error in 'swap generic' nfs root picking code (a case that can never
>currently happen) which forgot to set rood device correctly.
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>rework setroot() and friends, largely by cloning from the sparc code
>and whacking a bit here and there where appropriate. Does not yet do
>automatic root device detection, but that's much easier to add now.
>RB_ASKNAME now supports specification of network devices, for diskless
>booting. Also, RB_ASKNAME is now supported on _all_ kernels.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.16.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.16.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.2 31-Jan-1997  cgd sync with trunk
 1.16.2.1 24-Jan-1997  cgd sync with trunk
 1.17.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.19.2.1 02-Mar-1997  mrg swapconf() is no more.
 1.25.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.4.2 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.36.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.36.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.37.6.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.37.6.1 03-Aug-2001  lukem update to -current
 1.38.14.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.38.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.38.2.1 12-Jul-2001  nathanw file autoconf.c was added on branch nathanw_sa on 2002-09-17 21:12:34 +0000
 1.39.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.39.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.39.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.39.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.39.6.1 03-Aug-2004  skrll Sync with HEAD
 1.42.2.1 07-Dec-2007  yamt sync with head
 1.43.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.43.50.1 09-Jan-2008  matt sync with HEAD
 1.43.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.43.30.1 18-Oct-2007  ad More interrupt changes; collapse the symbolic levels down to the ones
that we actually need (none, soft, vm, sched, high) but retain aliases
like IPL_BIO for now.
 1.44.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.44.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.44.18.1 04-May-2009  yamt sync with head.
 1.47.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.50.6.1 18-Feb-2012  mrg merge to -current.
 1.50.2.3 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.50.2.2 30-Oct-2012  yamt sync with head
 1.50.2.1 17-Apr-2012  yamt sync with head
 1.51.2.1 08-Aug-2012  martin Pull up following revision(s) (requested by mlelstv in ticket #466):
sys/arch/amiga/amiga/autoconf.c: revision 1.113
sys/arch/rs6000/rs6000/autoconf.c: revision 1.4
sys/arch/emips/emips/autoconf.c: revision 1.6
sys/arch/sandpoint/sandpoint/autoconf.c: revision 1.27
sys/arch/evbmips/alchemy/autoconf.c: revision 1.18
sys/arch/sgimips/sgimips/autoconf.c: revision 1.43
sys/arch/atari/atari/autoconf.c: revision 1.63
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.17
sys/arch/mmeye/mmeye/autoconf.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1771
sys/arch/mipsco/mipsco/autoconf.c: revision 1.25
sys/arch/iyonix/iyonix/autoconf.c: revision 1.14
sys/arch/hp300/hp300/autoconf.c: revision 1.100
sys/kern/init_main.c: revision 1.445
sys/arch/pmax/pmax/autoconf.c: revision 1.79
sys/arch/netwinder/netwinder/autoconf.c: revision 1.11
sys/arch/dreamcast/dreamcast/autoconf.c: revision 1.10
sys/arch/ibmnws/ibmnws/autoconf.c: revision 1.12
sys/arch/evbppc/ev64260/autoconf.c: revision 1.17
sys/arch/evbmips/gdium/autoconf.c: revision 1.5
sys/arch/algor/algor/autoconf.c: revision 1.21
share/man/man9/Makefile: revision 1.367
sys/arch/ews4800mips/ews4800mips/autoconf.c: revision 1.9
sys/arch/amigappc/amigappc/autoconf.c: revision 1.5
sys/arch/x86/x86/x86_autoconf.c: revision 1.65
sys/arch/acorn26/acorn26/autoconf.c: revision 1.9
sys/arch/mvmeppc/mvmeppc/autoconf.c: revision 1.13
sys/arch/vax/vax/autoconf.c: revision 1.94
sys/arch/usermode/dev/cpu.c: revision 1.72
sys/arch/evbppc/virtex/autoconf.c: revision 1.5
sys/arch/next68k/next68k/autoconf.c: revision 1.26
sys/arch/mac68k/mac68k/autoconf.c: revision 1.73
sys/arch/ia64/ia64/autoconf.c: revision 1.6
sys/arch/evbppc/obs405/obs405_autoconf.c: revision 1.6
share/man/man9/cpu_rootconf.9: revision 1.7
sys/arch/landisk/landisk/autoconf.c: revision 1.6
sys/arch/evbmips/malta/autoconf.c: revision 1.16
sys/arch/sun3/sun3/autoconf.c: revision 1.76
sys/arch/evbppc/explora/autoconf.c: revision 1.13
sys/arch/sun3/sun3/autoconf.c: revision 1.77
sys/arch/evbmips/loongson/autoconf.c: revision 1.3
sys/arch/evbmips/atheros/autoconf.c: revision 1.11
sys/arch/sparc64/sparc64/autoconf.c: revision 1.188
sys/arch/acorn32/acorn32/autoconf.c: revision 1.18
sys/arch/evbarm/evbarm/autoconf.c: revision 1.13
sys/arch/cobalt/cobalt/autoconf.c: revision 1.30
sys/arch/mvme68k/mvme68k/autoconf.c: revision 1.46
sys/arch/hp700/hp700/autoconf.c: revision 1.48
sys/arch/evbmips/adm5120/autoconf.c: revision 1.5
sys/arch/hpcmips/hpcmips/autoconf.c: revision 1.25
sys/arch/alpha/alpha/autoconf.c: revision 1.52
sys/arch/sparc/sparc/autoconf.c: revision 1.244
sys/arch/evbppc/pmppc/autoconf.c: revision 1.7
sys/arch/bebox/bebox/autoconf.c: revision 1.25
sys/arch/luna68k/luna68k/autoconf.c: revision 1.13
sys/arch/hpcarm/hpcarm/autoconf.c: revision 1.20
sys/arch/evbppc/walnut/autoconf.c: revision 1.21
sys/arch/cesfic/cesfic/autoconf.c: revision 1.26
sys/arch/cats/cats/autoconf.c: revision 1.17
sys/arch/x68k/x68k/autoconf.c: revision 1.67
sys/arch/news68k/news68k/autoconf.c: revision 1.21
sys/arch/arc/arc/autoconf.c: revision 1.34
sys/arch/evbsh3/evbsh3/autoconf.c: revision 1.11
sys/sys/conf.h: revision 1.143
sys/arch/evbmips/rasoc/autoconf.c: revision 1.3
sys/arch/hpcsh/hpcsh/autoconf.c: revision 1.26
sys/arch/sun68k/sun68k/autoconf.c: revision 1.29
sys/arch/evbmips/rmixl/autoconf.c: revision 1.6
sys/arch/zaurus/zaurus/autoconf.c: revision 1.12
sys/arch/xen/x86/autoconf.c: revision 1.15
sys/arch/evbppc/mpc85xx/autoconf.c: revision 1.6
sys/arch/shark/shark/autoconf.c: revision 1.18
sys/arch/prep/prep/autoconf.c: revision 1.25
sys/arch/newsmips/newsmips/autoconf.c: revision 1.36
sys/arch/sbmips/sbmips/autoconf.c: revision 1.8
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.
No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().
Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().
Make cpu_rootconf(9) describe the calling order.
add rootconf(9) as a link to cpu_rootconf(9)
make this compile again
 1.52.4.1 18-May-2014  rmind sync with head
 1.52.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.53.30.1 10-Jun-2019  christos Sync with HEAD
 1.53.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.55.8.1 31-May-2021  cjep sync with head
 1.55.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.55.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.59.2.1 02-Aug-2025  perseant Sync with HEAD
 1.17 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.16 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.15 14-Mar-2009  dsl branches: 1.15.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.14 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.13 25-Feb-2006  thorpej branches: 1.13.72; 1.13.80; 1.13.86;
Use device_is_a().
 1.12 23-Feb-2006  thorpej Use device_parent().
 1.11 11-Dec-2005  christos branches: 1.11.2; 1.11.4; 1.11.6;
merge ktrace-lwp.
 1.10 28-Jun-2004  mycroft branches: 1.10.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.9 27-Sep-2002  thorpej branches: 1.9.6;
Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.8 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.7 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 25-Apr-2001  bouyer branches: 1.6.2; 1.6.4; 1.6.16;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.5 22-May-2000  thorpej branches: 1.5.6;
When checking for netboot, also check for MOP protocol.
 1.4 24-Sep-1998  ross branches: 1.4.12;
Fix include path, these days a12 header files are in alpha/a12.
 1.3 02-Mar-1998  ross Second part of cdev_decl() migration. Declare cputype variable.
Add config info for a12 switch driver and console driver.
 1.2 31-Jan-1998  ross Take Jason's most excellent advice on platform.model.
 1.1 29-Jan-1998  ross Add a12 platform support. The A12 is a scalable, distributed memory parallel
processor.
 1.4.12.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.4.12.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.6.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.6.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.6.4.1 25-Apr-2001  nathanw file avalon_a12.c was added on branch nathanw_sa on 2002-09-17 21:12:34 +0000
 1.6.2.1 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.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.12.1 21-Jun-2006  yamt sync with head.
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 01-Mar-2006  yamt sync with head.
 1.13.86.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.80.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.72.1 04-May-2009  yamt sync with head.
 1.15.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file avalon_a12.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.4 02-Dec-1999  thorpej Inline the BWX instructions.
 1.3 03-Nov-1997  ross branches: 1.3.14; 1.3.20;
--Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.2 16-Sep-1997  thorpej branches: 1.2.2; 1.2.4;
Fix a typo in a comment.
 1.1 16-Sep-1997  thorpej Add stubs for the Alpha Byte/Word Extension (BWX) instructions, present
on EV56 and later processors that have the "amask BWX" bit clear. These
instructions will be used to implement non-swizzle bus access functions
on newer systems, such as the new AlphaStation 500s with EV56 and 21172
PCI chipsets.

See "Alpha Architecture Handbook, Version 3", DEC order number EC-QD2KB-TE.
 1.2.4.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.2.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 16-Sep-1997  thorpej file bwx.s was added on branch marc-pcmcia on 1997-09-22 06:29:53 +0000
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.47 05-Apr-2022  skrll KNF
 1.46 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.45 29-Sep-2020  thorpej Improve time keeping and host CPU usage when running in Qemu:
- clockattach(): Allow multiple calls when running in Qemu. Anything
after this first one is ignored, but this gives us a change to use
a clock source provided by the VM directly, rather than relying on
a more expensive hardware emulation.
- Add cpu_initclocks_secondary(), to handle clock setup on secondary
CPUs, if needed.
- Allow us to use the WTINT PALcode call in cpu_idle() to idle in a lower
power state (Qemu's PALcode supports this).
- Use the Qemu per-cpu set-alarm-rel call as the hardclock interrupt
source. In Qemu environments, reduce hz to 50 (rather than the
default 1024) to give the clock a snowball's chance when running on
a host system with hz=100. XXX We have to manually re-calculate
tick and tickadj. There should be MI code to do this for us. Also
in Qemu environments, let hardclock() drive the sched clock by setting
schedhz=0.
 1.44 27-Sep-2020  thorpej Don't use the PCC timecunter on emulated Qemu systems.
 1.43 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.42 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.41 08-Feb-2011  rmind branches: 1.41.4; 1.41.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.40 14-Mar-2009  dsl branches: 1.40.4; 1.40.6; 1.40.8;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.39 05-Apr-2008  tsutsui branches: 1.39.4; 1.39.12; 1.39.18;
Allow MD cycle counter routines to pass their own optimized
tc_get_timecount function to MI cc_init().
 1.38 17-Oct-2007  garbled branches: 1.38.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.37 21-Jul-2007  tsutsui branches: 1.37.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.36 11-Dec-2005  christos branches: 1.36.30; 1.36.38; 1.36.42; 1.36.44;
merge ktrace-lwp.
 1.35 01-Jun-2005  drochner branches: 1.35.2;
typo in comment
 1.34 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.33 23-Jun-2003  martin branches: 1.33.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.32 05-Feb-2003  nakayama Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.31 27-May-2001  sommerfeld branches: 1.31.4;
Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.30 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.29 05-Jun-2000  thorpej branches: 1.29.4;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.28 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.27 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.26 06-Sep-1999  sommerfeld branches: 1.26.2; 1.26.10;
Patch time_precision so we report a realistic NTP "precision" value to userland.
 1.25 04-Mar-1999  chs branches: 1.25.2;
fix printf format types.
 1.24 23-Feb-1999  ross Generate the new schedclk() call into the MI kernel. Set schedhz
here to indicate that.
 1.23 12-Feb-1999  thorpej Fix printf format problems on Alpha.
 1.22 29-Sep-1998  drochner Allow to use the RTC chip in a way compatible to OSF/1: use an offset
of 52 years between RTC and UNIX time.
This is controlled by "option CLOCK_COMPAT_OSF1".
 1.21 24-Aug-1998  tv egcs warning fixes, clean up `register'
 1.20 31-Jan-1998  ross Remove the #include of rpb.h from clock.c and set hz from the hwrpb
in alpha_init() instead of from a hardwired 1024 in cpu_initclocks().
 1.19 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.18 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.17 22-Jul-1997  jonathan branches: 1.17.2;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.16 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.15 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.14 23-Nov-1996  cgd branches: 1.14.2;
move interrupt establishment to just before clock interrupts are
enabled (from the attach routine), and add comments as to why.
Some PALcode apparently 'saves' a clock interrupt for the kernel,
and if the clock interrupt handler is enabled at attach time, it
will be run when that interrupt hits, i.e. right after the spl0()
at the end of autoconfiguration. That would cause hardclock to be
run, but proc0's p_stats isn't set up by then, which would cause
hardclock to crash.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 11-Jul-1996  cgd clean up for -Wall
 1.10 23-Apr-1996  cgd prototyping cleanups
 1.9 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.8 12-Apr-1996  cgd update for new ISA & bus code, and clean a bit
 1.7 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.6 20-Dec-1995  cgd deal with renaming of asic to ioasic, and other new-tc-config changes
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 03-Aug-1995  cgd resettodr returns void
 1.3 28-Jun-1995  cgd sync with my current Alpha sources
 1.2 03-Mar-1995  cgd add support for more clock frequencies; use 1024 Hz.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.14.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.14.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.17.2.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.1 10-Oct-1999  cgd pull up rev 1.26 from trunk (requested by sommerfeld):
Patch time_precision so we report a realistic NTP "precision"
value to userland.
 1.26.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.26.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.29.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.31.4.2 27-May-2001  sommerfeld Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.31.4.1 27-May-2001  sommerfeld file clock.c was added on branch nathanw_sa on 2001-05-27 13:53:25 +0000
 1.33.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.33.2.1 03-Aug-2004  skrll Sync with HEAD
 1.35.2.1 03-Sep-2007  yamt sync with head.
 1.36.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.36.42.1 07-Aug-2007  matt Sync with HEAD.
 1.36.38.1 03-Oct-2007  garbled Sync with HEAD
 1.36.30.1 20-Aug-2007  ad Sync with HEAD.
 1.37.6.1 06-Nov-2007  matt sync with HEAD
 1.38.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.39.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.39.4.1 04-May-2009  yamt sync with head.
 1.40.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.40.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.41.8.1 18-Feb-2012  mrg merge to -current.
 1.41.4.1 17-Apr-2012  yamt sync with head
 1.6 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.5 12-Apr-1996  cgd update for new ISA & bus code, and clean a bit
 1.4 20-Dec-1995  cgd deal with renaming of asic to ioasic, and other new-tc-config changes
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.1 28-Jun-1995  cgd sync with my current Alpha sources
 1.3 28-Jun-1995  cgd sync with my current Alpha sources
 1.2 03-Mar-1995  cgd add support for more clock frequencies; use 1024 Hz.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 21-Jul-2007  tsutsui branches: 1.5.6; 1.5.8; 1.5.68; 1.5.72;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.4 22-Jul-1997  jonathan branches: 1.4.30; 1.4.56;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 17-Apr-1996  cgd branches: 1.2.2;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.1 28-Jun-1995  cgd sync with my current Alpha sources
 1.2.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.56.1 20-Aug-2007  ad Sync with HEAD.
 1.4.30.1 03-Sep-2007  yamt sync with head.
 1.5.72.1 18-Feb-2012  mrg merge to -current.
 1.5.68.1 17-Apr-2012  yamt sync with head
 1.5.8.2 15-Aug-2007  skrll Sync with HEAD.
 1.5.8.1 21-Jul-2007  skrll file clockvar.h was added on branch nick-csl-alignment on 2007-08-15 13:46:56 +0000
 1.5.6.2 07-Aug-2007  matt Sync with HEAD.
 1.5.6.1 21-Jul-2007  matt file clockvar.h was added on branch matt-mips64 on 2007-08-07 18:04:50 +0000
 1.22 16-Mar-2017  chs allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.21 16-May-2014  matt branches: 1.21.4; 1.21.8; 1.21.12;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.20 06-Feb-2012  matt branches: 1.20.6; 1.20.10; 1.20.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.19 07-Jun-2011  matt branches: 1.19.2; 1.19.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.18 21-Nov-2009  rmind branches: 1.18.4; 1.18.10;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.17 24-Apr-2008  ad branches: 1.17.2; 1.17.4;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.16 20-Dec-2007  dsl branches: 1.16.6; 1.16.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 04-Mar-2007  christos branches: 1.15.20; 1.15.28; 1.15.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 09-Feb-2007  ad branches: 1.14.2;
Merge newlock2 to head.
 1.13 11-Dec-2005  christos branches: 1.13.20;
merge ktrace-lwp.
 1.12 14-Sep-2005  martin Add missing <compat/...> includes
 1.11 17-Jan-2003  thorpej branches: 1.11.2; 1.11.18;
Merge the nathanw_sa branch.
 1.10 12-Jul-2001  thorpej branches: 1.10.2;
bcopy -> memcpy
 1.9 22-Dec-2000  jdolecek branches: 1.9.4;
split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.8 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.7 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.6 16-Aug-1999  simonb branches: 1.6.2;
Spell "privilege" correctly (correct spelling from Jonathan Stone).
 1.5 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.4 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.3 19-Nov-1998  ross #include <machine/alpha.h>
 1.2 20-Sep-1998  thorpej Nuke some unneeded debugging code.
 1.1 13-Sep-1998  thorpej Make signal delivery work again.
 1.6.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.6.2.2 08-Dec-2000  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.9.4.1 03-Aug-2001  lukem update to -current
 1.10.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.10.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.10.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.10.2.1 12-Jul-2001  nathanw file compat_13_machdep.c was added on branch nathanw_sa on 2001-08-30 23:43:39 +0000
 1.11.18.4 21-Jan-2008  yamt sync with head
 1.11.18.3 03-Sep-2007  yamt sync with head.
 1.11.18.2 26-Feb-2007  yamt sync with head.
 1.11.18.1 21-Jun-2006  yamt sync with head.
 1.11.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.28.1 26-Dec-2007  ad Sync with head.
 1.15.20.1 09-Jan-2008  matt sync with HEAD
 1.16.8.1 18-May-2008  yamt sync with head.
 1.16.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.17.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.2.1 11-Mar-2010  yamt sync with head
 1.18.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.18.4.1 12-Jun-2011  rmind sync with head
 1.19.6.1 18-Feb-2012  mrg merge to -current.
 1.19.2.1 17-Apr-2012  yamt sync with head
 1.20.20.1 10-Aug-2014  tls Rebase.
 1.20.10.1 18-May-2014  rmind sync with head
 1.20.6.2 03-Dec-2017  jdolecek update from HEAD
 1.20.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.21.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.21.4.1 28-Aug-2017  skrll Sync with HEAD
 1.24 25-Apr-2025  riastradh alpha: Align signal pointer on entry to signal handler.

PR kern/59327: user stack pointer is not aligned properly
 1.23 27-Oct-2021  thorpej branches: 1.23.10;
Use the signal trampoline version constants from <sys/signal.h>.
 1.22 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.21 16-Mar-2017  chs branches: 1.21.14;
allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.20 19-Mar-2016  mrg branches: 1.20.2; 1.20.4;
remove some dead code.
 1.19 16-May-2014  matt branches: 1.19.4;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.18 06-Feb-2012  matt branches: 1.18.6; 1.18.10; 1.18.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.17 07-Jun-2011  matt branches: 1.17.2; 1.17.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.16 21-Nov-2009  rmind branches: 1.16.4; 1.16.10;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.15 21-Nov-2008  he Wrap includes of opt* header files with _KERNEL_OPT. It is not entirely
clear to me that this will end up doing the right thing, because there
surely is a reason for the opt* headers.
Also, replace one "ksyms.h" with <sys/ksyms.h>.

Fixes build problems when this is built as part of a module.
 1.14 28-Apr-2008  martin branches: 1.14.2; 1.14.6; 1.14.8;
Remove clause 3 and 4 from TNF licenses
 1.13 24-Apr-2008  ad branches: 1.13.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.12 20-Dec-2007  dsl branches: 1.12.6; 1.12.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.11 04-Mar-2007  christos branches: 1.11.20; 1.11.28; 1.11.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.10 09-Feb-2007  ad branches: 1.10.2;
Merge newlock2 to head.
 1.9 11-Dec-2005  christos branches: 1.9.20;
merge ktrace-lwp.
 1.8 14-Sep-2005  he The compat signal / signalvar headers are only needed under COMPAT_13
and COMPAT_OSF1, so make the header inclusion conditional as well.
 1.7 14-Sep-2005  martin Add missing <compat/...> includes
 1.6 02-Jun-2005  drochner branches: 1.6.2;
add more "const"
 1.5 21-Jan-2005  drochner don't need signal trampolin version 1 if we just do COMPAT_OSF1
 1.4 17-Jan-2005  drochner separate the requirements for OSF1 compat from NetBSD's
 1.3 13-Oct-2003  nathanw branches: 1.3.4; 1.3.10;
Catch up DEBUG printfs to siginfo changes.
 1.2 08-Oct-2003  thorpej * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.
 1.1 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.5 24-Jan-2005  skrll Sync with HEAD.
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 13-Oct-2003  skrll file compat_16_machdep.c was added on branch ktrace-lwp on 2004-08-03 10:31:03 +0000
 1.6.2.4 21-Jan-2008  yamt sync with head
 1.6.2.3 03-Sep-2007  yamt sync with head.
 1.6.2.2 26-Feb-2007  yamt sync with head.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.9.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.9.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.10.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.28.1 26-Dec-2007  ad Sync with head.
 1.11.20.1 09-Jan-2008  matt sync with HEAD
 1.12.8.1 18-May-2008  yamt sync with head.
 1.12.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.2.3 11-Mar-2010  yamt sync with head
 1.13.2.2 04-May-2009  yamt sync with head.
 1.13.2.1 16-May-2008  yamt sync with head.
 1.14.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.14.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.16.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.16.4.1 12-Jun-2011  rmind sync with head
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.20.1 10-Aug-2014  tls Rebase.
 1.18.10.1 18-May-2014  rmind sync with head
 1.18.6.2 03-Dec-2017  jdolecek update from HEAD
 1.18.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.4.2 28-Aug-2017  skrll Sync with HEAD
 1.19.4.1 22-Apr-2016  skrll Sync with HEAD
 1.20.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.20.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.21.14.1 10-Jun-2019  christos Sync with HEAD
 1.23.10.1 02-Aug-2025  perseant Sync with HEAD
 1.68 26-Oct-2002  jdolecek now that mem_no is emitted by config(8), there is no reason to keep
copy of more or less identical iskmemdev() for every arch; move the function
to spec_vnop.c, and g/c machine-dependant copies
 1.67 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.66 19-Jul-2002  thorpej Rename cdev_systrace_init() to cdev_clonemisc_init(), so it can
be properly used by any misc. cloning device. While here, correct
a comment to indicate that "open" is the only entry point and that
everything else is handled with fileops.
 1.65 28-Jun-2002  thorpej Add the kttcp device.
 1.64 27-Jun-2002  ross add bktr
 1.63 17-Jun-2002  christos MD systrace gluons.
 1.62 16-Mar-2002  martin branches: 1.62.4;
Rename ISDN devices, per discussion on tech-kern. The network devices
become ippp (ISDN ppp) and irip (ISDN raw IP). The character device now
are called: /dev/isdn (isdnd <-> kernel communication), /dev/isdnctl (dialing
and other control), /dev/isdntrc* (tracing), /dev/isdnbchan* (raw B channel
access, i.e. for user land PPP) and /dev/isdntel* (telephone devices, i.e.
for answering machines).
 1.61 12-Jan-2002  manu Oops, wrong number (84 -> 69)
 1.60 12-Jan-2002  manu Added clockctl
 1.59 18-Sep-2001  ad Hook in the `stic' device. With any luck this should be temporary.
 1.58 15-Sep-2001  thorpej Add PCI and AGP devices.
 1.57 21-Mar-2001  lukem branches: 1.57.2; 1.57.4; 1.57.6;
move duplicate definitions for:
pc, lpt, joy, ocis, apm, satlink, i4bctl, i4brbch, i4btel, i4btrc, i4b
from the port-specific arch/*/*/conf.c files into sys/conf.h
 1.56 04-Feb-2001  ad branches: 1.56.2;
Add a driver for the Mylex DAC960 family (including DEC SWXCR).
 1.55 14-Jan-2001  martin The i4b raw b-channel devices actually do have an ioctl routine,
so better add this to the cdevsw entry.
Noted by Bruno Achauer.
 1.54 08-Jan-2001  martin Add isdn devices to all archs that seem to support at least one of the
necessary busses. Sync comments with reality for archs that already had
the devices.
 1.53 05-Jan-2001  martin Enable the imported ISDN4BSD based ISDN subsystem.

This is the kernel part (userland to follow soon) of the latest (and
very probably last) release (version 0.96) of ISDN4BSD. ISDN4BSD has a
homepage at http://www.freebsd-support.de/i4b/.

It gives the user various ways to use the isdn connection: raw data (via
the i4brbch "raw b-channel" device), ppp (via the isp "isdn PPP" device),
voice/answering machine (the i4btel "telephone" device) and ip over isdn
(the ipr device, "IP over raw ISDN").

Supported are a bunch of common and older cards, more to be added soon
after some cleanup. Currently only the european E-DSS1 variant of the
ISDN D channel protocol is supported.
 1.52 14-Dec-2000  thorpej Glue in ALTQ.
 1.51 26-Nov-2000  ad lsu -> ld, by popular request.
 1.50 19-Oct-2000  ad ca -> lsu
 1.49 23-Sep-2000  augustss Grab a major # for USB scanners.
 1.48 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.47 28-May-2000  thorpej branches: 1.47.2;
Add Cyclades Y and Z multiport serial adapters.
 1.46 28-Apr-2000  ad branches: 1.46.2;
- Enable ca(4) device.
- Fix a couple of nits.
 1.45 22-Feb-2000  tls revert previous change
 1.44 22-Feb-2000  mjacob remove SES driver
 1.43 25-Jan-2000  augustss Update for the ucom(4) addition.
 1.42 20-Jan-2000  mjacob add SES device
 1.41 16-Aug-1999  augustss branches: 1.41.2;
Add umodem device.
 1.40 29-Jul-1999  augustss Add wsmux device.
(Also add lots of missing chrtoblktbl[] entries.)
 1.39 24-Apr-1999  ross Copy isdn4bsd cdevsw hooks from i386 conf.c.
 1.38 22-Mar-1999  mycroft branches: 1.38.2;
Add MIDI and sequencer devices. They seem to work, even.
 1.37 08-Dec-1998  augustss Add ugen, a generic USB driver.
 1.36 29-Nov-1998  thorpej Add USB devices.
 1.35 20-Nov-1998  kml Changes to support a HIPPI Framing Protocol device, which allows raw
HIPPI packets to be written without having to go through the network
stack.
 1.34 13-Nov-1998  oster Updating of bdev's and cdev's to support RAIDframe.
 1.33 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.32 15-Apr-1998  drochner update for new mi wscons, add ISA speaker
 1.31 24-Mar-1998  thorpej Slight hack to allow the MI SCC driver to be used at cdev major 15
for testing purposes. Normal kernels still get the Alpha-specific
SCC driver.
 1.30 02-Mar-1998  ross Second part of cdev_decl() migration. Declare cputype variable.
Add config info for a12 switch driver and console driver.
 1.29 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.28 15-Jan-1998  thorpej Undo the wdc -> awdc mapping kludge.
 1.27 13-Oct-1997  explorer o Make usage of /dev/random dependant on
pseudo-device rnd # /dev/random and in-kernel generator
in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
that this code is derived in part from Ted Tyso's linux code.
 1.26 19-Sep-1997  thorpej Make IDE work again, from Ross Harvey <ross@teraflop.com>.
 1.25 03-Sep-1997  thorpej branches: 1.25.2;
Define a cdev_satlink_init(). XXX This should be done in an MI header file.
 1.24 02-Sep-1997  thorpej Add __KERNEL_RCSID() and definitions for ISA satlink driver.
 1.23 07-Apr-1997  cgd branches: 1.23.2;
clean up NetBSD RCS ID strings
 1.22 18-Mar-1997  cgd pull in se.h
 1.21 18-Mar-1997  cgd add cdevsw entry for 'se'
 1.20 31-Jan-1997  cgd add major and minor numbers for 'wd', slight clean
 1.19 07-Jan-1997  mrg use pseudo-device ipfilter, not ipl.
 1.18 06-Jan-1997  cgd dd bdevsw and cdevsw entries for floppy disk driver (not currently usable),
and cdevsw for ipl (IP filter).
 1.17 28-Dec-1996  pk rename: ramdisk => md
 1.16 18-Oct-1996  cgd branches: 1.16.2;
clean up chrtoblktbl, adding comments naming the devices which actually do
have entries in both device switch tables. Add 'st' entry to chrtoblktbl.
 1.15 09-Sep-1996  cgd add entries for rd (cdev + bdev), ss (cdev), and uk (cdev).
 1.14 07-Sep-1996  mycroft Implement poll(2).
 1.13 05-Sep-1996  mycroft Remove duplicate declarations of LKM functions and macros.
 1.12 11-Jul-1996  cgd clean up for -Wall
 1.11 12-Apr-1996  cgd new entries for keyboard, mouse, and parallel printer
 1.10 14-Mar-1996  christos fdopen -> filedescopen
 1.9 17-Aug-1995  thorpej Add entries for the ccd.
 1.8 03-Aug-1995  cgd entries for wsc, com
 1.7 04-Jul-1995  mycroft Make each disk and tape driver define its own read and write functions.
Deprecate rawread() and rawwrite() completely. Remove d_strategy from cdevsw to
force the abstraction barrier.
 1.6 28-Jun-1995  cgd sync with my current Alpha sources
 1.5 10-Apr-1995  mycroft Minor consistency nits.
 1.4 10-Apr-1995  mycroft Update to match conf.h.
 1.3 08-Mar-1995  cgd fix major number for swap device
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.16.2.7 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.16.2.6 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.16.2.5 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.4 31-Jan-1997  cgd sync with trunk
 1.16.2.3 31-Jan-1997  cgd wsdisplay now has its own poll function
 1.16.2.2 24-Jan-1997  cgd sync with trunk
 1.16.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.23.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.25.2.2 03-Sep-1997  thorpej Define a cdev_satlink_init(). XXX This should be done in an MI header file.
 1.25.2.1 03-Sep-1997  thorpej file conf.c was added on branch bouyer-scsipi on 1997-09-03 00:25:02 +0000
 1.38.2.1 26-Apr-1999  perry branches: 1.38.2.1.2;
pullup 1.38->1.39 (ross)
 1.38.2.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.38.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.41.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.41.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.41.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.41.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.41.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.41.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.46.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.47.2.2 25-Oct-2001  he Apply patch (requested by ad):
Add Mylex DACC960, CAC-EISA, and I2O block/SCSI drivers.
 1.47.2.1 01-May-2001  he Pull up revision 1.55 (requested by martin):
Add ioctl entry to cdevsw for i4b raw B-channel devices.
 1.56.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.57.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.57.4.8 11-Nov-2002  nathanw Catch up to -current
 1.57.4.7 17-Sep-2002  nathanw Catch up to -current.
 1.57.4.6 01-Aug-2002  nathanw Catch up to -current.
 1.57.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.57.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.57.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.57.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.57.4.1 21-Mar-2001  nathanw file conf.c was added on branch nathanw_sa on 2001-09-21 22:34:53 +0000
 1.57.2.5 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.57.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.57.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.57.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.57.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.62.4.4 21-Jul-2002  gehenna catch up with -current.
 1.62.4.3 16-Jul-2002  gehenna catch up with -current.
 1.62.4.2 09-Jul-2002  gehenna catch up with -current.
 1.62.4.1 16-May-2002  gehenna Bye block/character device swicth tables.
 1.11 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.10 20-Nov-2019  pgoyette branches: 1.10.12;
Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.9 16-May-2014  matt branches: 1.9.28;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.8 01-Jan-2014  dsl branches: 1.8.2;
Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.
 1.7 06-Feb-2012  matt branches: 1.7.6; 1.7.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 13-Jun-2011  matt branches: 1.6.2; 1.6.6;
Deal with PCU state when performing coredumps. As the kernel moves each LWP
into LSSUSPENDED state, have that LWP save its PCU state for the coredump and
release its PCU status since its probably going to be exiting very soon.
Make pcu_save_all tolerate for being called for non-curlwp if that lwp belongs
to the same process, has a state of LSSUSPENDED, and no PCUs are in use.

Make the MD coredump code use pcu_save_all(l) since it'll need to save all
the PCU state anyways and can take advantage of the above tests.
 1.5 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.4 15-Dec-2010  matt branches: 1.4.6;
remove unneeded <uvm/uvm_extern.h> includes
 1.3 21-Nov-2009  rmind branches: 1.3.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.2 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.12.4 11-Mar-2010  yamt sync with head
 1.1.12.3 19-Aug-2009  yamt sync with head.
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file core_machdep.c was added on branch yamt-nfs-mp on 2009-05-04 08:10:27 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file core_machdep.c was added on branch nick-hppapmap on 2009-01-19 13:15:53 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file core_machdep.c was added on branch mjf-devfs2 on 2009-01-17 13:27:47 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file core_machdep.c was added on branch haad-dm on 2008-12-13 01:12:57 +0000
 1.3.4.2 12-Jun-2011  rmind sync with head
 1.3.4.1 05-Mar-2011  rmind sync with head
 1.4.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.6.6.1 18-Feb-2012  mrg merge to -current.
 1.6.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.2.1 17-Apr-2012  yamt sync with head
 1.7.10.1 18-May-2014  rmind sync with head
 1.7.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.2.1 10-Aug-2014  tls Rebase.
 1.9.28.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.108 06-Mar-2024  thorpej Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary.
 1.107 22-May-2022  andvar fix various small typos, mainly in comments.
 1.106 09-Apr-2022  riastradh alpha: Convert cpu_iccb_send from membar_exit to membar_release.

XXX Maybe this should really use alpha_mb, since it's not writing to
normal MI-type memory so technically the membr_* semantics doesn't
apply?
 1.105 27-Feb-2022  riastradh alpha: Fix placement of membar for sending ICCB message.

While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway. So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.
 1.104 05-May-2021  thorpej Decorate cpu_info_list with __read_mostly; it's never modified once
all the CPUs are attached.
 1.103 15-Oct-2020  thorpej branches: 1.103.6;
Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.102 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.101 29-Sep-2020  thorpej Improve time keeping and host CPU usage when running in Qemu:
- clockattach(): Allow multiple calls when running in Qemu. Anything
after this first one is ignored, but this gives us a change to use
a clock source provided by the VM directly, rather than relying on
a more expensive hardware emulation.
- Add cpu_initclocks_secondary(), to handle clock setup on secondary
CPUs, if needed.
- Allow us to use the WTINT PALcode call in cpu_idle() to idle in a lower
power state (Qemu's PALcode supports this).
- Use the Qemu per-cpu set-alarm-rel call as the hardclock interrupt
source. In Qemu environments, reduce hz to 50 (rather than the
default 1024) to give the clock a snowball's chance when running on
a host system with hz=100. XXX We have to manually re-calculate
tick and tickadj. There should be MI code to do this for us. Also
in Qemu environments, let hardclock() drive the sched clock by setting
schedhz=0.
 1.100 04-Sep-2020  thorpej Decorate some symbols with the appropriate things for better cache
behavior. Assert that cpu_infos are cache line aligned.
 1.99 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.98 07-Aug-2020  fcambus Use CPU_IS_PRIMARY macro on alpha and sparc64.
 1.97 08-Apr-2019  thorpej Add some additional CPU and system types.
 1.96 10-Oct-2015  martin branches: 1.96.18;
PR port-alpha/50325: cosmetic fix for cpu attach message
from Felix Deichmann.
 1.95 06-Feb-2012  matt branches: 1.95.6; 1.95.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.94 28-Jul-2011  uebayasi branches: 1.94.2; 1.94.6;
One more typo in #ifdef DEBUG.
 1.93 28-Jul-2011  uebayasi Fix DEBUG build.
 1.92 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.91 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.90 17-Dec-2010  joerg branches: 1.90.6;
Fix build by pulling in uvm/uvm_extern.h.
 1.89 15-Dec-2010  matt remove unneeded <uvm/uvm_extern.h> includes
 1.88 26-Nov-2009  matt branches: 1.88.4;
Kill proc0paddr. Use lwp0.l_addr instead.
 1.87 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.86 06-Sep-2009  mhitch There's now some per-cpu initialization that occurs before the secondary
cpus are told to begin running. Since the seconedary cpus weren't being
added to the cpu_info list until then, that initialization wasn't being
done and resulted in crashes on the secondary cpus. Add the secondary
cpus to the cpu_info_list after they've been started (but waiting to be
told to start running). This fixes the problem specifically stated in
PR port-alpha/41106. MP alphas will now at least boot and begin running,
but will eventually crash in various ways later.
 1.85 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.84 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.83 16-Dec-2008  christos branches: 1.83.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.82 28-Apr-2008  martin branches: 1.82.8; 1.82.10; 1.82.14; 1.82.16;
Remove clause 3 and 4 from TNF licenses
 1.81 10-Mar-2008  ad branches: 1.81.2; 1.81.4;
Use MI atomic operations.
 1.80 28-Nov-2007  ad branches: 1.80.10; 1.80.14;
Hook in the atomic ops on alpha.
 1.79 19-Nov-2007  ad Set curlwp for the boot CPU before entering main().
 1.78 17-Oct-2007  garbled branches: 1.78.2;
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.77 08-Oct-2007  ad branches: 1.77.2;
Merge run time accounting changes from the vmlocking branch. These make
the LWP "start time" per-thread instead of per-CPU.
 1.76 21-Jul-2007  tsutsui branches: 1.76.4; 1.76.6; 1.76.8;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.75 18-May-2007  mhitch branches: 1.75.2; 1.75.4;
Fix alpha MP for idlelwp: ci_idle_lwp was added to cpu_info
structure, but never initialized. There's already a cpu_idlelwp
in ci_data, which appears to be the same thing, so use that instead.
 1.74 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.73 24-Dec-2005  perry branches: 1.73.26; 1.73.30; 1.73.32; 1.73.36; 1.73.38;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.72 11-Dec-2005  christos merge ktrace-lwp.
 1.71 27-Oct-2003  chs branches: 1.71.16;
uninitialized variables
 1.70 05-Feb-2003  nakayama branches: 1.70.2;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.69 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.68 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.67 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.66 25-Jul-2002  he Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.65 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.64 13-Jul-2001  thorpej branches: 1.64.2; 1.64.14; 1.64.16;
Change the way we spin up CPUs. Now boot the CPU as soon as we
discover it, but make it block on a semaphore until the MI kernel
says that we can let the secondary processors loose. This allows
us to announce the extensions on the secondary CPUs, and to compute
the intersection of all the extensions across all CPUs, like so:

cpu0 at mainbus0: ID 0 (primary), 21164A-2
cpu0: Architecture extensions: 1<BWX>
cpu1 at mainbus0: ID 1, 21164A-2
cpu1: Architecture extensions: 1<BWX>
 1.63 27-May-2001  sommerfeld branches: 1.63.2;
Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.62 24-Apr-2001  thorpej Fix an uninitialized variable problem in the non-MULTIPROCESSOR case.
 1.61 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.60 22-Nov-2000  thorpej branches: 1.60.2;
Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.59 19-Nov-2000  thorpej Synch cpu_hatch() with the i386:
- print the same style message when the CPU is running.
- Initialize ci->ci_schedstate.spc_runtime on the CPU.
 1.58 18-Nov-2000  thorpej Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.57 18-Nov-2000  thorpej Make sure that the cpu_info points at the correct softc on
single-processor kernels running on multi-processor systems.
 1.56 17-Nov-2000  thorpej I have long since upgraded the boot block on my test system. (Actually,
I have an entirely different test system now.)
 1.55 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.54 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.53 03-Jul-2000  thorpej Don't bother with minor printing, except on the LCA CPUs (because
that tells us if we have a 21066 or 21068).
 1.52 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.51 12-Jun-2000  sommerfeld Fix this so it compiles again with DEBUG
 1.50 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.49 03-Jun-2000  thorpej Err, actually, print "21264A", not "EV67".
 1.48 03-Jun-2000  thorpej Recognize PCA57 and EV67.
 1.47 01-Jun-2000  sommerfeld Add missing newline
 1.46 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.45 26-May-2000  thorpej branches: 1.45.2;
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.44 23-May-2000  thorpej Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.43 03-Apr-2000  thorpej Print any architecture extensions present on the primary CPU.
 1.42 09-Feb-2000  sommerfeld Fix typo in error message
 1.41 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.40 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.39 23-Aug-1999  ross branches: 1.39.2; 1.39.8;
Fix minor type () bug. Fall thru correctly when the minor type is not known.
 1.38 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.37 06-Jul-1999  thorpej Make the kthread API a bit more friendly to loadable kernel modules.
 1.36 29-Jun-1999  ross Identify the various ev6 pass numbers.
Also print the raw pass number rpb value as, say, `21264-4', like SRM does.
 1.35 04-Mar-1999  chs branches: 1.35.2; 1.35.4; 1.35.6;
fix printf format types.
 1.34 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.33 19-Nov-1998  ross #include <machine/alpha.h>
 1.32 29-Sep-1998  thorpej - Use a bitmask for "running CPUs", rather than a flag in the softc.
- Add a function to halt a secondary CPU.
- Enable interrupts on secondary CPUs once they've hatched.
 1.31 28-Sep-1998  thorpej PROM doens't need to be mapped to start up the secondaries, so remove some
dead code.
 1.30 28-Sep-1998  thorpej Turn off some debugging printfs, and kludge around a boot block bug until
I can install fixed boot blocks on my MP test systems.
 1.29 26-Sep-1998  thorpej - Oops, forgot to initalize the cpu_softc simplelock.
- Add yet another debugging printf.
 1.28 25-Sep-1998  thorpej Don't bother printing the message from the secondary console. All it is
is basically the acknowledgement of the START command. Print the idle
USPACE address for now. Use the alias "apcb_backup_ksp" when setting the
backup kernel stack pointer in the secondary's boot HWPCB.
 1.27 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.26 22-Sep-1998  ross Change 41 separate printf()'s into a table and 2 printf()'s.
 1.25 24-Jun-1998  ross Replace expressions with the new macros: LOCATE_PCS(), PCS_CPU_MAJORTYPE(),
and PCS_CPU_MINORTYPE().
 1.24 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.23 12-Jan-1998  thorpej Adjust for config changes.
 1.22 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.21 07-Apr-1997  cgd branches: 1.21.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.20 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.19 01-Apr-1997  mycroft #ifdef DEBUG a variable to prevent compiler warning.
 1.18 12-Mar-1997  cgd don't assume that CPU ID is same as device unit number (DUH!), add some
comments about future work to be done. make a mostly-extraneous set of
printfs (cpu capabilities) become #ifdef DEBUG.
 1.17 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.16 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.15 13-Nov-1996  cgd branches: 1.15.2;
print out unrecognized processor minor types as 0x%x, rather than %d,
also print out minor types in a few cases where they previously wouldn't
be printed (but that aren't likely to be run into, anyway).
 1.14 13-Nov-1996  cgd update for all known processor major and minor type numbers.
 1.13 13-Nov-1996  cgd recognize 21164A (ev56)
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.9 29-Apr-1996  cgd fix botched printf spacing in last change.
 1.8 29-Apr-1996  cgd fix definition of the "Primary Eligible" RPB PCS processor variation field.
 1.7 17-Apr-1996  cgd print cpu names slightly differently (number first)
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 28-Jun-1995  cgd sync with my current Alpha sources
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.15.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.15.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.21.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.35.4.2 02-Aug-1999  thorpej Update from trunk.
 1.35.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.35.2.1 02-Jul-1999  perry pullup 1.35->1.36 (ross)
 1.39.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.39.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.39.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.39.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.39.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.45.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.60.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.63.2.4 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.63.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.63.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.63.2.1 03-Aug-2001  lukem update to -current
 1.64.16.1 29-Jul-2002  lukem Pull up revision 1.66 (requested by he in ticket #552):
Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.64.14.2 30-Aug-2002  gehenna catch up with -current.
 1.64.14.1 09-Jul-2002  gehenna catch up with -current.
 1.64.2.6 16-Dec-2002  nathanw LWPify some MULTIPROCESSOR code.
 1.64.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.64.2.4 01-Aug-2002  nathanw Catch up to -current.
 1.64.2.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.64.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.64.2.1 13-Jul-2001  nathanw file cpu.c was added on branch nathanw_sa on 2002-06-20 03:37:29 +0000
 1.70.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.70.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.70.2.1 03-Aug-2004  skrll Sync with HEAD
 1.71.16.5 17-Mar-2008  yamt sync with head.
 1.71.16.4 07-Dec-2007  yamt sync with head
 1.71.16.3 27-Oct-2007  yamt sync with head.
 1.71.16.2 03-Sep-2007  yamt sync with head.
 1.71.16.1 21-Jun-2006  yamt sync with head.
 1.73.38.3 16-Oct-2007  garbled Sync with HEAD
 1.73.38.2 03-Oct-2007  garbled Sync with HEAD
 1.73.38.1 22-May-2007  matt Update to HEAD.
 1.73.36.2 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.73.36.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.73.32.1 11-Jul-2007  mjf Sync with head.
 1.73.30.5 03-Dec-2007  ad Sync with HEAD.
 1.73.30.4 03-Dec-2007  ad Sync with HEAD.
 1.73.30.3 09-Oct-2007  ad Sync with head.
 1.73.30.2 20-Aug-2007  ad Sync with HEAD.
 1.73.30.1 27-May-2007  ad Sync with head.
 1.73.26.2 24-Mar-2007  yamt initialize ci->ci_schedstate.spc_mutex of APs.
(sched_rqinit is called before APs are attached.)
 1.73.26.1 20-Mar-2007  yamt adapt alpha.
 1.75.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.75.2.1 07-Aug-2007  matt Sync with HEAD.
 1.76.8.1 14-Oct-2007  yamt sync with head.
 1.76.6.3 23-Mar-2008  matt sync with HEAD
 1.76.6.2 09-Jan-2008  matt sync with HEAD
 1.76.6.1 06-Nov-2007  matt sync with HEAD
 1.76.4.3 03-Dec-2007  joerg Sync with HEAD.
 1.76.4.2 21-Nov-2007  joerg Sync with HEAD.
 1.76.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.77.2.1 21-Nov-2007  bouyer Sync with HEAD
 1.78.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.80.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.80.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.80.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.80.10.1 24-Mar-2008  keiichi sync with head.
 1.81.4.4 11-Mar-2010  yamt sync with head
 1.81.4.3 16-Sep-2009  yamt sync with head
 1.81.4.2 04-May-2009  yamt sync with head.
 1.81.4.1 16-May-2008  yamt sync with head.
 1.81.2.1 18-May-2008  yamt sync with head.
 1.82.16.1 21-Apr-2010  matt sync to netbsd-5
 1.82.14.1 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #949):
sys/arch/alpha/alpha/cpu.c: revision 1.86
There's now some per-cpu initialization that occurs before the secondary
cpus are told to begin running. Since the seconedary cpus weren't being
added to the cpu_info list until then, that initialization wasn't being
done and resulted in crashes on the secondary cpus. Add the secondary
cpus to the cpu_info_list after they've been started (but waiting to be
told to start running). This fixes the problem specifically stated in
PR port-alpha/41106. MP alphas will now at least boot and begin running,
but will eventually crash in various ways later.
 1.82.10.1 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #949):
sys/arch/alpha/alpha/cpu.c: revision 1.86
There's now some per-cpu initialization that occurs before the secondary
cpus are told to begin running. Since the seconedary cpus weren't being
added to the cpu_info list until then, that initialization wasn't being
done and resulted in crashes on the secondary cpus. Add the secondary
cpus to the cpu_info_list after they've been started (but waiting to be
told to start running). This fixes the problem specifically stated in
PR port-alpha/41106. MP alphas will now at least boot and begin running,
but will eventually crash in various ways later.
 1.82.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.82.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.83.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.88.4.1 12-Jun-2011  rmind sync with head
 1.90.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.94.6.1 18-Feb-2012  mrg merge to -current.
 1.94.2.1 17-Apr-2012  yamt sync with head
 1.95.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.95.6.1 03-Dec-2017  jdolecek update from HEAD
 1.96.18.1 10-Jun-2019  christos Sync with HEAD
 1.103.6.1 13-May-2021  thorpej Sync with HEAD.
 1.38 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.37 08-Apr-2019  thorpej Add some additional CPU and system types.
 1.36 23-Sep-2013  tsutsui branches: 1.36.30;
Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.
 1.35 06-Feb-2012  matt branches: 1.35.6; 1.35.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.34 17-Jun-2011  matt branches: 1.34.2; 1.34.6;
Remove Avalon A12 support.
ok ross@
 1.33 18-Mar-2009  cegger branches: 1.33.10;
Ansify function definitions w/o arguments. Generated with sed.
 1.32 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.31 28-Apr-2008  martin branches: 1.31.8; 1.31.14;
Remove clause 3 and 4 from TNF licenses
 1.30 11-Dec-2005  christos branches: 1.30.74; 1.30.76; 1.30.78;
merge ktrace-lwp.
 1.29 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.28 27-Sep-2002  provos branches: 1.28.6;
remove trailing \n in panic(). approved perry.
 1.27 26-Jun-2000  enami branches: 1.27.2; 1.27.4;
Fix typo in previous to prevent compilation error when DEC_1000 isn't
configured.
 1.26 25-Jun-2000  thorpej For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.25 11-Jun-2000  thorpej branches: 1.25.2;
Add init glue for the DEC 2000/300 (Jensen).
 1.24 01-Jun-2000  thorpej Rearrange things a little so we can deal with systypes that aren't
densely packed.
 1.23 07-Dec-1999  thorpej branches: 1.23.2;
Add entry for AlphaServer 2100 (Sable, Sable-Gamma).
 1.22 29-Jun-1999  ross branches: 1.22.2; 1.22.8;
Turn on dec_6600_init, "DEC_6600".
 1.21 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.20 17-Mar-1999  drochner branches: 1.20.2; 1.20.4; 1.20.6;
identify ST_DEC_6600 (EV6) - as unsupported :-(
 1.19 13-Mar-1999  drochner make complaints about missing platform support match reality
 1.18 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.17 26-Jun-1998  ross Turn on ST_DEC_1000, but reuse the 1000a init and console routines.
 1.16 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.15 24-Jun-1998  ross New systype for DEC_1000A: Noritake, Pintake, and Corelle.
 1.14 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.13 29-Apr-1998  thorpej Add the DEC 550 Personal Workstation slot.
 1.12 16-Apr-1998  thorpej Make this compile if a Rawhide isn't configured.
 1.11 15-Apr-1998  mjacob add Alpha 4100 support
 1.10 20-Mar-1998  thorpej sync systypes w/ <machine/rpb.h>
 1.9 29-Jan-1998  ross Recognize Avalon A12 cputype code.
 1.8 06-Nov-1997  thorpej Clean up the messages displayed when either platform support is not
configured into the kernel, or when the platform is not supported.
Use the defopt'ed options, rather than NDEC_... and remove the needs-flag
hack that's existed for a while.
 1.7 23-Sep-1997  mjacob branches: 1.7.2;
Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.6 02-Sep-1997  thorpej branches: 1.6.2;
Clean this up a bit; defopt has rendered the #undef hacks unnecessary.
Also, put the cpu_decl()s in cpuconf.h, so that platform support files
can pull in the prototypes from there, and pull in options for those
systems for which there is code in the source tree.
 1.5 02-Sep-1997  thorpej Ressurect from the Attic.
 1.4 10-Apr-1997  cgd reorganize cpu configuration and device configuration tables. Now all macro
definitions and prototypes are in machine/conf.h, and all tables are in
alpha/conf.c.
 1.3 12-Mar-1997  cgd fix up kn8ae/DEC_21000 entry
 1.2 13-Nov-1996  cgd branches: 1.2.2;
fix slight mis-ordering
 1.1 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 02-Sep-1997  thorpej file cpuconf.c was added on branch marc-pcmcia on 1997-09-04 00:52:22 +0000
 1.7.2.1 06-Nov-1997  thorpej Pull up from trunk: clean up "not configured"/"not supported" messages.
 1.20.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.20.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.20.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.2.1 02-Jul-1999  perry pullup 1.21->1.22 (ross)
 1.22.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.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.23.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.1 27-Jun-2000  thorpej Update from trunk:
For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.27.4.1 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.27.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.28.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.6.1 03-Aug-2004  skrll Sync with HEAD
 1.30.78.2 04-May-2009  yamt sync with head.
 1.30.78.1 16-May-2008  yamt sync with head.
 1.30.76.1 18-May-2008  yamt sync with head.
 1.30.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.31.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.33.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.34.6.1 18-Feb-2012  mrg merge to -current.
 1.34.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1 17-Apr-2012  yamt sync with head
 1.35.10.1 18-May-2014  rmind sync with head
 1.35.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.30.1 10-Jun-2019  christos Sync with HEAD
 1.5 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.4 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.3 29-Sep-1998  thorpej CPUF_HATCHED is dead, replaced by cpus_running bitmask.
 1.2 26-Sep-1998  thorpej Add an interprocessor interrupt bitmask to the cpu_softc, and publicize
the cpus[] array.
 1.1 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.20 21-Nov-2023  thorpej pal_opname(): Make the static buffer for unknown PALcode ops large enough
to hold all possible values.
alpha_print_instruction(): Make this private if not-_KERNEL.
 1.19 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.18 21-Jun-2021  thorpej Remove the /I "alternate format" from db_disasm(), which was internally
interpreted as "showregs", whcih would print the values of the registers
at each instruction. Unfortunately, this was fundamentally broken because
the saved registers accessible to DDB are only valid for the faulting
insn that got us into DDB, and not arbitrary isns that can be examined
from within DDB.
 1.17 21-Jun-2021  thorpej Allow alpha_print_instruction() to be called from outside DDB, and
allow the caller to supply a buffer to contain the pretty-printed
insn string, rather than db_printf() (which is used if there is no
supplied buffer).
 1.16 20-Mar-2014  christos branches: 1.16.46;
kill sprintf
 1.15 06-Feb-2012  matt branches: 1.15.6; 1.15.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 22-Feb-2007  thorpej branches: 1.14.80; 1.14.84;
TRUE -> true, FALSE -> false
 1.13 21-Feb-2007  thorpej 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.12 11-Dec-2005  christos branches: 1.12.26;
merge ktrace-lwp.
 1.11 01-Jun-2005  drochner branches: 1.11.2;
fix constification fallout
 1.10 09-Aug-2000  tv branches: 1.10.24;
%lz -> db_format_hex()
 1.9 04-Jun-2000  thorpej ANSI'ify.
 1.8 25-May-2000  jhawk branches: 1.8.2;
Interface change: db_printsym() takes a third argument, pr, a function
pointer indicating how to print the symbol. This allows db_printsym()
to called in places where db_printf() is not an appropriate output
function.

While straightforward, apologies in advance if I've introduced any minor
syntax errors; I was unable to test compilation this on all the affected
platforms.
 1.7 20-Mar-2000  thorpej Handle a few more SPECIAL intructions.
 1.6 09-May-1999  cgd branches: 1.6.2;
convert to DEC-style register names (but not yet done for
the internal PALcode instruction format structure).
 1.5 13-Feb-1999  thorpej branches: 1.5.2; 1.5.4; 1.5.6;
Fix printf format warnings on Alpha.
 1.4 16-Sep-1997  thorpej Add support for disassembling the "integer miscellaneous" opcode subgroup.
 1.3 16-Sep-1997  thorpej Fix an oversight in the last commit.
 1.2 16-Sep-1997  thorpej - Rewrite the functions that provide opcode subfunction names to make it
easier to add instructions that the disassembler doesn't know about
(the opcode subfunction number is now printed).
- Add the "amask" and "implver" operate subfunctions.
- Add the "ldbu", "ldwu", "stb", and "stw" major opcodes (BWX instructions).
 1.1 06-Sep-1997  thorpej branches: 1.1.2;
Add support for DDB (in-kernel debugger) to NetBSD/alpha, based on
such code for Mach 3's Alpha port. Initially reworked for NetBSD/alpha
by Chris Demetriou, and then heavily hacked on by me. Works, but is still
a little rough around the edges. Known problems:

- Error recovery could be improved a bit.
- Back traces don't work.
- Single-stepping can be flaky, at times. (Alpha doesn't have hardware
support for single-stepping, and I'm not entirely convinced the
MI DDB software-emulated single-stepping logic is 100% correct.)
- Logic for when to drop into DDB needs some improvement.
 1.1.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file db_disasm.c was added on branch marc-pcmcia on 1997-09-06 17:59:38 +0000
 1.5.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 18-Jun-1999  perry pullup 1.5->1.6 (cgd): BWX instruction emulation and unaligned access
 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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.24.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.1 26-Feb-2007  yamt sync with head.
 1.12.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.14.84.1 18-Feb-2012  mrg merge to -current.
 1.14.80.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.80.1 17-Apr-2012  yamt sync with head
 1.15.10.1 18-May-2014  rmind sync with head
 1.15.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.46.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.13 20-Jul-2021  thorpej Define the FIX float function codes (ITOFF, ITOFS, ITOFT).
 1.12 21-Jun-2021  thorpej Remove the /I "alternate format" from db_disasm(), which was internally
interpreted as "showregs", whcih would print the values of the registers
at each instruction. Unfortunately, this was fundamentally broken because
the saved registers accessible to DDB are only valid for the faulting
insn that got us into DDB, and not arbitrary isns that can be examined
from within DDB.
 1.11 21-Jun-2021  thorpej Allow alpha_print_instruction() to be called from outside DDB, and
allow the caller to supply a buffer to contain the pretty-printed
insn string, rather than db_printf() (which is used if there is no
supplied buffer).
 1.10 21-Jul-2020  thorpej branches: 1.10.6;
Sort op_mskqh, op_insqh, and op_extqh.
 1.9 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 31-Aug-2001  simonb branches: 1.8.160; 1.8.164;
Use comments around the token after a #endif.
 1.7 26-Apr-2001  ross branches: 1.7.2; 1.7.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.6 20-Mar-2000  thorpej branches: 1.6.6;
Handle a few more SPECIAL intructions.
 1.5 09-May-1999  cgd branches: 1.5.2;
convert to DEC-style register names. the attempt to use function-based
register names was confusing, and could not _be_ correct in some cases.
Also, add a couple of 'generic' instruction formats which should be used
when decoding instructions before the specific format is known.
 1.4 16-Sep-1997  thorpej branches: 1.4.10; 1.4.12; 1.4.14;
Define the "integer miscellaneous" opcode and subfunctions.
 1.3 16-Sep-1997  thorpej Don't define another copy of the PALcode ops here; direct readers to
<machine/pal.h>.
 1.2 16-Sep-1997  thorpej - Add the "amask" and "implver" operate subfunctions.
- Add the "ldbu", "ldwu", "stb", and "stw" major opcodes (BWX instructions).
 1.1 06-Sep-1997  thorpej branches: 1.1.2;
Add support for DDB (in-kernel debugger) to NetBSD/alpha, based on
such code for Mach 3's Alpha port. Initially reworked for NetBSD/alpha
by Chris Demetriou, and then heavily hacked on by me. Works, but is still
a little rough around the edges. Known problems:

- Error recovery could be improved a bit.
- Back traces don't work.
- Single-stepping can be flaky, at times. (Alpha doesn't have hardware
support for single-stepping, and I'm not entirely convinced the
MI DDB software-emulated single-stepping logic is 100% correct.)
- Logic for when to drop into DDB needs some improvement.
 1.1.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file db_instruction.h was added on branch marc-pcmcia on 1997-09-06 17:59:39 +0000
 1.4.14.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.4.12.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.10.1 18-Jun-1999  perry pullup 1.4->1.5 (cgd): BWX instruction emulation and unaligned access
 1.5.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.6.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.7.4.1 26-Apr-2001  nathanw file db_instruction.h was added on branch nathanw_sa on 2001-09-21 22:34:53 +0000
 1.7.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.164.1 18-Feb-2012  mrg merge to -current.
 1.8.160.1 17-Apr-2012  yamt sync with head
 1.10.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.43 05-Feb-2024  andvar triple "r" typos, mainly s/interrrupt/interrupt/ in comments and one definition.
 1.42 22-Nov-2023  thorpej Changes to let the Alpha DDB code build in user-space for crash(8).
 1.41 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.40 21-Nov-2023  thorpej Ensure that all fields of db_regs[] are initialized.
 1.39 21-Nov-2023  thorpej Adjust proc/lwp access for user-space (crash(8)).
 1.38 21-Nov-2023  thorpej Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.
 1.37 26-Oct-2022  riastradh ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.
 1.36 23-Feb-2021  mrg introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0. idea from rillig@.

all touched ports built, several booted.
 1.35 18-Sep-2020  thorpej branches: 1.35.2;
Use alpha_pal_swpipl() directly instead of splhigh()/splx(), do avoid
soft int processing while dealing with entering / leaving the debugger.
Soft ints will be correctly handled during exception_return().
 1.34 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.33 15-Dec-2010  matt branches: 1.33.8; 1.33.12;
remove unneeded <uvm/uvm_extern.h> includes
 1.32 08-Jun-2010  mrg properly document alpha ddb "mach" commands. PR#38303.
 1.31 18-Mar-2009  cegger branches: 1.31.2; 1.31.4;
Ansify function definitions w/o arguments. Generated with sed.
 1.30 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.29 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.27 17-Oct-2007  garbled branches: 1.27.20; 1.27.28; 1.27.34;
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.26 22-Sep-2007  martin Add a new option DDB_VERBOSE_HELP that adds online help to ddb.
From Adam Hamsik.
Minor modifications by me, all bugs are probably mine.
 1.25 22-Feb-2007  dogcow branches: 1.25.4; 1.25.12; 1.25.20; 1.25.22;
miscellaneous fallout from the great boolean rototill.
 1.24 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.23 21-Feb-2007  thorpej 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.22 24-Dec-2005  perry branches: 1.22.26;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.21 11-Dec-2005  christos merge ktrace-lwp.
 1.20 09-Jun-2005  he branches: 1.20.2;
Adapt to compiling with -Wcast-qual by adding const to a function
parameter of db_mach_cpu().
 1.19 01-Jun-2005  drochner fix constification fallout
 1.18 17-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 13-May-2002  matt Nuke local extern label_t *db_recover; it's now in <ddb/db_extern.h>
 1.16 13-May-2001  ross branches: 1.16.2; 1.16.4;
Make the /u part of show reg/u work.
 1.15 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.14 22-Jan-2001  jdolecek branches: 1.14.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.
 1.13 18-Jan-2001  jdolecek adjust ddb variable access functions to have first arch 'const', make db_[e]regs[] const
 1.12 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.11 22-Nov-2000  thorpej Just access the trapframe directly for DDB registers.
 1.10 22-Nov-2000  thorpej Restructure the way registers are presented to DDB, to make it
easier to support reading registers from other CPUs.
 1.9 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 12-Oct-1999  jdolecek branches: 1.8.2;
rename the MD Debugger() to cpu_Debugger()
add MI Debugger() which switches to console if wscons is used prior
to calling cpu_Debugger()
 1.7 09-May-1999  cgd branches: 1.7.2;
convert to DEC-style register names.
 1.6 20-Apr-1999  thorpej - Clean up ddb_trap() somewhat, and handle exceptions that happen while we're
in DDB (e.g. if a bad pointer was dereferenced; the debugger will recover).
- Change a comment to indicate that we are on the debugger stack when we get
to ddb_trap().
- Fix possible buglet in computation of the branch target in db_branch_taken().
 1.5 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.4 14-Aug-1998  thorpej branches: 1.4.6;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.3 04-Jul-1998  jonathan defopt DDB.
 1.2 16-Sep-1997  thorpej - Use PALcode ops names defined in <machine/pal.h>.
- Fix a few bugs in the software single-stepping support code, where
VMS PALcode ops were being checked, rather than OSF/1 PALcode ops,
causing erroneous results in the "exception return" and "unconditional
branch" predicates.
- Add the BWX instructions ("ldbu", "ldwu", "stb", "stw") to the
"load" and "store" predicates.
 1.1 06-Sep-1997  thorpej branches: 1.1.2;
Add support for DDB (in-kernel debugger) to NetBSD/alpha, based on
such code for Mach 3's Alpha port. Initially reworked for NetBSD/alpha
by Chris Demetriou, and then heavily hacked on by me. Works, but is still
a little rough around the edges. Known problems:

- Error recovery could be improved a bit.
- Back traces don't work.
- Single-stepping can be flaky, at times. (Alpha doesn't have hardware
support for single-stepping, and I'm not entirely convinced the
MI DDB software-emulated single-stepping logic is 100% correct.)
- Logic for when to drop into DDB needs some improvement.
 1.1.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file db_interface.c was added on branch marc-pcmcia on 1997-09-06 17:59:40 +0000
 1.4.6.2 18-Jun-1999  perry pullup 1.6->1.7 (cgd): BWX instruction emulation and unaligned access
 1.4.6.1 07-Apr-1999  pk branches: 1.4.6.1.2; 1.4.6.1.4;
Pull up from trunk: copyright text warts.
 1.4.6.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.4.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.8.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.8.2.2 08-Dec-2000  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.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.4.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.16.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.16.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.16.4.1 13-May-2001  nathanw file db_interface.c was added on branch nathanw_sa on 2001-08-30 23:43:39 +0000
 1.16.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.3 27-Oct-2007  yamt sync with head.
 1.20.2.2 26-Feb-2007  yamt sync with head.
 1.20.2.1 21-Jun-2006  yamt sync with head.
 1.22.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.25.22.1 06-Nov-2007  matt sync with HEAD
 1.25.20.1 02-Oct-2007  joerg Sync with HEAD.
 1.25.12.1 03-Oct-2007  garbled Sync with HEAD
 1.25.4.1 09-Oct-2007  ad Sync with head.
 1.27.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.27.20.2 11-Aug-2010  yamt sync with head.
 1.27.20.1 04-May-2009  yamt sync with head.
 1.31.4.2 05-Mar-2011  rmind sync with head
 1.31.4.1 03-Jul-2010  rmind sync with head
 1.31.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.33.12.1 18-Feb-2012  mrg merge to -current.
 1.33.8.1 17-Apr-2012  yamt sync with head
 1.35.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.39 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.38 21-Nov-2023  thorpej Adjust proc/lwp access for user-space (crash(8)).
 1.37 21-Nov-2023  thorpej Reduce db_trace.c's exposure to proc/lwp.
 1.36 21-Nov-2023  thorpej decode_prologue(): Make pc a db_addr_t, not a db_expr_t.
db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix.
 1.35 21-Nov-2023  thorpej Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.
 1.34 21-Nov-2023  thorpej Don't access insns or frame values directly; use db_read_bytes().
 1.33 21-Nov-2023  riastradh ddb: New db_stack_trace_print_ra.

Takes an optional extra argument for the return address so that the
stack parser has a chance to use instruction-dependent interpretation
of the frame to find parent frames.

Implemented only on Alpha for now, which needs it. Other
architectures just ignore the extra argument.

PR port-alpha/57716

XXX pullup-10
XXX pullup-9
XXX pullup-8
 1.32 21-Jul-2022  thorpej Rename functions in previous in preparation for future changes.
 1.31 20-Jul-2022  thorpej Localize direct refernces to kernel symbols into functions. NFC.
 1.30 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.29 18-Sep-2020  thorpej branches: 1.29.6;
- Add exception_return() to the list of trap vector symbols, which will
enable us to trace back through an exception if the fault happens
during the exception return.
- Identify and report the kernel thread backstop when back tracing
kernel threads.
 1.28 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.27 01-Jul-2010  rmind branches: 1.27.8; 1.27.12;
Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.26 21-Nov-2009  rmind branches: 1.26.2; 1.26.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.25 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.24 02-Jul-2008  rmind Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
 1.23 28-Apr-2008  martin branches: 1.23.2; 1.23.4;
Remove clause 3 and 4 from TNF licenses
 1.22 22-Feb-2007  thorpej branches: 1.22.42; 1.22.44; 1.22.46;
TRUE -> true, FALSE -> false
 1.21 21-Feb-2007  thorpej Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

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.20 20-Feb-2007  ad - Add /a modifier to trace that allows a specific LWP to be selected.
- When doing trace/t, always note which pid/lid combination is being traced.
 1.19 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
 1.18 09-Feb-2007  ad branches: 1.18.2;
Merge newlock2 to head.
 1.17 06-Sep-2006  ad branches: 1.17.2;
Use p_find(addr, PFIND_LOCKED) in case the proclist_lock is held.
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.8;
merge ktrace-lwp.
 1.15 31-May-2005  chs branches: 1.15.2;
adapt to const changes.
 1.14 22-Jan-2004  nathanw In decode_prologue(), ignore positive-offset frame adjustments ("lda
sp, 64(sp)") on the theory that they're from the function epilogue,
which aggressive code motion has placed before the end of the
function's code.

Addresses my PR port-alpha/23996.
 1.13 29-Oct-2003  mycroft Simplify a little.
 1.12 27-Oct-2003  chs uninitialized variables
 1.11 23-Oct-2003  ragge Fix NULL change lossage.
 1.10 17-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 13-Dec-2000  mycroft branches: 1.9.2;
Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.8 22-Nov-2000  enami s/char \*/const &/ so that this file compiles again.
 1.7 04-Jun-2000  thorpej ANSI'ify.
 1.6 26-May-2000  jhawk branches: 1.6.2;
Rename the machine-specific stack trace printing functions
from db_stack_trace_cmd() to db_stack_trace_print(),
and add an additional argument, a function pointer for an
output routine (i.e. printf() or db_printf()).

Add db_stack_trace_cmd() in db_command.[ch], calling
db_stack_trace_print() with db_printf() as the printer.

Move count==-1 special handling from db_stack_trace_print() [nee
db_stack_trace_cmd()] to db_stack_trace_cmd() [nascent here].

Again, I'm unable to test compilation on all affected platforms,
so advance apologies for potential brokenness.
 1.5 25-May-2000  jhawk Interface change: db_printsym() takes a third argument, pr, a function
pointer indicating how to print the symbol. This allows db_printsym()
to called in places where db_printf() is not an appropriate output
function.

While straightforward, apologies in advance if I've introduced any minor
syntax errors; I was unable to test compilation this on all the affected
platforms.
 1.4 12-Jul-1999  ross branches: 1.4.2;
Fix off-by-one comparison.
 1.3 11-Jul-1999  ross * Big rototill: cleanup, reorganize, redo some things...
* New features:
+ traceback for threads (i.e., pids): db>trace/t 0t<pid>
+ traceback over console restart (halt and SRM continue)
+ print ipl in trapframes when it's known and it changed
+ print emulation and system call entry name (!) if proc is known
--- syscall (240, netbsd.sys_nanosleep) ---
 1.2 31-May-1999  ross After some banging and bashing, commit Jason's new ddb traceback code.
 1.1 06-Sep-1997  thorpej branches: 1.1.2; 1.1.16;
Add support for DDB (in-kernel debugger) to NetBSD/alpha, based on
such code for Mach 3's Alpha port. Initially reworked for NetBSD/alpha
by Chris Demetriou, and then heavily hacked on by me. Works, but is still
a little rough around the edges. Known problems:

- Error recovery could be improved a bit.
- Back traces don't work.
- Single-stepping can be flaky, at times. (Alpha doesn't have hardware
support for single-stepping, and I'm not entirely convinced the
MI DDB software-emulated single-stepping logic is 100% correct.)
- Logic for when to drop into DDB needs some improvement.
 1.1.16.2 02-Aug-1999  thorpej Update from trunk.
 1.1.16.1 21-Jun-1999  thorpej Sync w/ -current.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file db_trace.c was added on branch marc-pcmcia on 1997-09-06 17:59:41 +0000
 1.4.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.4.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.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.9.2.2 28-Feb-2002  nathanw Use proc_representative_lwp() instead of LIST_FIRST(&p->p_lwps) when
selecting a LWP for thread tracing.
XXX This doesn't affect t/t of single-LWP processes, but a better interface
XXX is needed to select a specific LWP of a multi-LWP process.
 1.9.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.2 26-Feb-2007  yamt sync with head.
 1.15.2.1 30-Dec-2006  yamt sync with head.
 1.16.8.1 14-Sep-2006  yamt sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 21-Oct-2006  ad Update for proc_representative_lwp() / calcru() signature change.
 1.18.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.22.46.4 11-Aug-2010  yamt sync with head.
 1.22.46.3 11-Mar-2010  yamt sync with head
 1.22.46.2 04-May-2009  yamt sync with head.
 1.22.46.1 16-May-2008  yamt sync with head.
 1.22.44.1 18-May-2008  yamt sync with head.
 1.22.42.2 28-Sep-2008  mjf Sync with HEAD.
 1.22.42.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.1 03-Jul-2008  simonb Sync with head.
 1.23.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.26.4.1 03-Jul-2010  rmind sync with head
 1.26.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.12.1 18-Feb-2012  mrg merge to -current.
 1.27.8.1 17-Apr-2012  yamt sync with head
 1.29.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 18-Sep-2020  thorpej Fix entering the kernel debugger when MULTIPROCESSOR is enabled; the
arguments to alpha_debug() were getting clobbered by the call to
cpu_pause_resume_all(), but they need to be passed along to ddb_trap().
 1.12 20-Aug-2009  skrll Don't try and symbol set debug_stack_top from the common symbol
debug_stack_bottom. It's bogus and disallowed in new binutils.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 23-Jun-2003  martin branches: 1.10.104; 1.10.106; 1.10.108;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.9 08-Apr-2003  thorpej Don't use NBPG.
 1.8 30-May-2001  lukem branches: 1.8.4;
add missing #include "opt_kgdb.h"
 1.7 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.6 21-Aug-2000  thorpej branches: 1.6.2;
Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.5 18-Jun-1999  thorpej branches: 1.5.2; 1.5.4;
Whitespace police.
 1.4 18-Jun-1999  thorpej Fix a harmless typo.
 1.3 31-May-1999  ross Convert to traceback-friendly temporary labels.
 1.2 31-May-1999  ross Calculate what sp would have been and save it in otherwise-unused
FRAME_SP slot if entering ddb.
 1.1 20-Apr-1999  thorpej Add a common debugger entry point, alpha_debug(), which performs various
tasks (i.e. switches to the debug stack) and then invokes the appropriate
debugger (DDB or eventually KGDB).
 1.5.4.2 23-Apr-2001  bouyer Sync with HEAD.
 1.5.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.5.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 18-Jun-1999  thorpej file debug.s was added on branch chs-ubc2 on 1999-06-21 00:46:03 +0000
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.2 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.8.4.1 30-May-2001  lukem file debug.s was added on branch nathanw_sa on 2001-05-30 15:24:28 +0000
 1.10.108.2 16-Sep-2009  yamt sync with head
 1.10.108.1 16-May-2008  yamt sync with head.
 1.10.106.1 18-May-2008  yamt sync with head.
 1.10.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.36 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.35 31-Mar-2024  thorpej branches: 1.35.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.34 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.33 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.32 06-Feb-2012  matt branches: 1.32.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.31 01-Jul-2011  dyoung branches: 1.31.2; 1.31.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.30 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.29 14-Sep-2009  mhitch branches: 1.29.10;
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.28 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.27 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.26 28-Apr-2008  martin branches: 1.26.8; 1.26.10; 1.26.14; 1.26.18;
Remove clause 3 and 4 from TNF licenses
 1.25 04-Mar-2007  yamt branches: 1.25.40; 1.25.42; 1.25.44;
fix fallout from caddr_t changes.
 1.24 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 25-Feb-2006  thorpej branches: 1.23.20;
Use device_is_a().
 1.22 23-Feb-2006  thorpej Use device_parent().
 1.21 11-Dec-2005  christos branches: 1.21.2; 1.21.4; 1.21.6;
merge ktrace-lwp.
 1.20 28-Jun-2004  mycroft branches: 1.20.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.19 14-Jun-2003  thorpej branches: 1.19.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.18 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.17 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.16 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.15 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.14 05-Jun-2001  thorpej branches: 1.14.2; 1.14.4; 1.14.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.13 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.12 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.11 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.10 19-Apr-2001  thorpej Work around a firmware bug on the AlphaServer 1000A whereby the
built-in ISA display is reported incorrectly.
 1.9 25-Jun-2000  thorpej branches: 1.9.2;
For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.8 09-Jun-2000  soda branches: 1.8.2;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.7 22-May-2000  thorpej branches: 1.7.2;
When checking for netboot, also check for MOP protocol.
 1.6 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.5 15-Apr-1999  thorpej branches: 1.5.2; 1.5.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.4 13-Feb-1999  thorpej branches: 1.4.2;
Fix printf format warnings on Alpha.
 1.3 19-Nov-1998  ross Clarify the 1000/1000A situation: two variation tables and an all-purpose
backup platform.family string.
 1.2 22-Sep-1998  thorpej Fix a typo in RCS keyword.
 1.1 24-Jun-1998  ross New platforms: Noritake, Pintake, and Corelle. Sometimes these are ev4/apecs,
sometimes they are ev5/cia.
 1.4.2.1 16-Apr-1999  thorpej branches: 1.4.2.1.2;
Pull up 1.4 -> 1.5.
 1.4.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.5.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.5.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.1 27-Jun-2000  thorpej Update from trunk:
For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.14.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.14.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.14.4.1 05-Jun-2001  nathanw file dec_1000a.c was added on branch nathanw_sa on 2002-09-17 21:12:35 +0000
 1.14.2.1 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.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.20.12.2 03-Sep-2007  yamt sync with head.
 1.20.12.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 01-Mar-2006  yamt sync with head.
 1.23.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.25.44.3 16-Sep-2009  yamt sync with head
 1.25.44.2 04-May-2009  yamt sync with head.
 1.25.44.1 16-May-2008  yamt sync with head.
 1.25.42.1 18-May-2008  yamt sync with head.
 1.25.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.18.1 21-Apr-2010  matt sync to netbsd-5
 1.26.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.10.1 26-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1010):
sys/arch/alpha/alpha/dec_1000a.c: revision 1.29
sys/arch/alpha/alpha/dec_2100_a500.c: revision 1.19
sys/arch/alpha/alpha/dec_6600.c: revision 1.29
sys/arch/alpha/alpha/dec_kn300.c: revision 1.37
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.26.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.31.6.1 18-Feb-2012  mrg merge to -current.
 1.31.2.2 30-Oct-2012  yamt sync with head
 1.31.2.1 17-Apr-2012  yamt sync with head
 1.32.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.35.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_1000a.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.23 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.22 31-Mar-2024  thorpej branches: 1.22.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.21 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.20 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.19 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.18 06-Feb-2012  matt branches: 1.18.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.17 14-Jun-2011  matt branches: 1.17.2; 1.17.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.16 28-Apr-2008  martin branches: 1.16.32;
Remove clause 3 and 4 from TNF licenses
 1.15 17-Oct-2007  garbled branches: 1.15.16; 1.15.18; 1.15.20;
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.14 19-Jul-2007  tsutsui branches: 1.14.6;
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
 1.13 04-Mar-2007  yamt branches: 1.13.2; 1.13.10; 1.13.12; 1.13.14;
fix fallout from caddr_t changes.
 1.12 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 25-Feb-2006  thorpej branches: 1.11.18; 1.11.20; 1.11.24;
Use device_is_a().
 1.10 23-Feb-2006  thorpej Use device_parent().
 1.9 14-Jun-2003  thorpej branches: 1.9.18; 1.9.30; 1.9.32; 1.9.34;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.8 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.7 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.6 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.5 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.4 30-May-2001  lukem branches: 1.4.2; 1.4.4; 1.4.16;
add missing #include "opt_kgdb.h"
 1.3 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.2 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.4.3 23-Apr-2001  bouyer Sync with HEAD.
 1.1.4.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.4.1 12-Jul-2000  bouyer file dec_2000_300.c was added on branch thorpej_scsipi on 2000-11-20 19:56:23 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file dec_2000_300.c was added on branch netbsd-1-5 on 2000-07-12 20:59:09 +0000
 1.4.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.4.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.4.4.1 30-May-2001  nathanw file dec_2000_300.c was added on branch nathanw_sa on 2002-09-17 21:12:35 +0000
 1.4.2.1 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.9.34.1 22-Apr-2006  simonb Sync with head.
 1.9.32.1 09-Sep-2006  rpaulo sync with head
 1.9.30.1 01-Mar-2006  yamt sync with head.
 1.9.18.2 03-Sep-2007  yamt sync with head.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.11.24.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.11.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.18.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.13.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.13.12.1 07-Aug-2007  matt Sync with HEAD.
 1.13.10.1 03-Oct-2007  garbled Sync with HEAD
 1.13.2.1 20-Aug-2007  ad Sync with HEAD.
 1.14.6.1 06-Nov-2007  matt sync with HEAD
 1.15.20.1 16-May-2008  yamt sync with head.
 1.15.18.1 18-May-2008  yamt sync with head.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.2 30-Oct-2012  yamt sync with head
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.2.1 02-Aug-2025  perseant Sync with HEAD
 1.71 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.70 31-Mar-2024  thorpej branches: 1.70.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.69 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.68 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.67 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.66 06-Feb-2012  matt branches: 1.66.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.65 01-Jul-2011  dyoung branches: 1.65.2; 1.65.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.64 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.63 14-Mar-2009  dsl branches: 1.63.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.62 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.61 04-Mar-2007  yamt branches: 1.61.44; 1.61.52; 1.61.58;
fix fallout from caddr_t changes.
 1.60 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.59 25-Feb-2006  thorpej branches: 1.59.20;
Use device_is_a().
 1.58 23-Feb-2006  thorpej Use device_parent().
 1.57 11-Dec-2005  christos branches: 1.57.2; 1.57.4; 1.57.6;
merge ktrace-lwp.
 1.56 28-Jun-2004  mycroft branches: 1.56.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.55 14-Jun-2003  thorpej branches: 1.55.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.54 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.53 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.52 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.51 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.50 19-Jun-2001  wiz branches: 1.50.2; 1.50.4; 1.50.16;
`existent', not `existant'
 1.49 05-Jun-2001  thorpej Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.48 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.47 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.46 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.45 25-Mar-2001  nathanw Verbose display of machine check errors on AS200/400 boxes.
 1.44 09-Jun-2000  soda branches: 1.44.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.43 22-May-2000  thorpej branches: 1.43.2;
When checking for netboot, also check for MOP protocol.
 1.42 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.41 15-Apr-1999  thorpej branches: 1.41.2; 1.41.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.40 13-Feb-1999  thorpej branches: 1.40.2;
Fix printf format warnings on Alpha.
 1.39 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.38 15-Apr-1998  drochner explicitely initialize console keyboard
 1.37 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.36 17-Oct-1997  mjacob more compile foo
 1.35 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.34 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.33 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.32 02-Sep-1997  thorpej Update for changes to how bus space tags are initialized.
 1.31 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.30 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.29 23-Aug-1997  drochner Adapt to serial console attachment changes.
 1.28 07-Jun-1997  cgd branches: 1.28.2; 1.28.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.27 18-Apr-1997  cgd try a slightly different heuristic to differentiate between ISA and PCI
(VGA) consoles.
 1.26 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.25 07-Apr-1997  cgd include machine/options.h
 1.24 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.23 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.22 04-Apr-1997  mycroft comdefaultrate -> comconsrate
comconsbah -> comconsioh
 1.21 21-Mar-1997  cgd fix check for bus number when root dev is behind PPB
 1.20 15-Jan-1997  cgd change the fixed delay to allow serial console output to settle
to something smarter, suggested by Charles Hannum.
 1.19 17-Dec-1996  cgd branches: 1.19.2;
update for recent com.c changes: delete references to now-nonexistant
comconsinit variable.
 1.18 25-Nov-1996  cgd branches: 1.18.2;
update for chipsets' init functions' new prototypes
 1.17 19-Nov-1996  cgd update for ISA VGA frame buffer possibily
 1.16 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.15 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.14 13-Oct-1996  christos backout previous kprintf change
 1.13 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 17-Sep-1996  cgd Differentiate between disked ("SCSI") and network ("BOOTP", but not yet MOP)
booted_dev specs. Add code to find the device, if booted from the network.
 1.11 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.10 14-Jun-1996  cgd add a delay before serial console is initialized, to allow any
outstanding PROM output to drain. Move the console-type printfs
so that they're only printed if console selection fails.
 1.9 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.8 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.7 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.6 15-Apr-1996  cgd branches: 1.6.4;
include <sys/termios.h> to make <dev/isa/comvar.h> happy, and set the
serial ('com') console bit size and parity to be "cs8 -parenb".
 1.5 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.4 12-Apr-1996  cgd update for new ISA & PCI code, etc.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.6.4.2 14-Jun-1996  cgd pull up from trunk:
>add a delay before serial console is initialized, to allow any
>outstanding PROM output to drain. Move the console-type printfs
>so that they're only printed if console selection fails.
 1.6.4.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.18.2.5 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.18.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.18.2.3 01-Feb-1997  cgd do the right thing to attach keyboard at console init time
 1.18.2.2 24-Jan-1997  cgd sync with trunk
 1.18.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.19.2.2 30-Jan-1997  thorpej update from trunk
 1.19.2.1 18-Jan-1997  thorpej Update from trunk.
 1.28.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.28.4.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.2 26-Aug-1997  bouyer Update from trunk.
 1.28.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.40.2.1 16-Apr-1999  thorpej branches: 1.40.2.1.2;
Pull up 1.40 -> 1.41.
 1.40.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.41.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.41.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.41.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.41.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.41.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.43.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.44.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.44.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.50.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.50.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.50.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.50.4.1 19-Jun-2001  nathanw file dec_2100_a50.c was added on branch nathanw_sa on 2002-09-17 21:12:36 +0000
 1.50.2.1 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.55.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.55.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.55.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.12.2 03-Sep-2007  yamt sync with head.
 1.56.12.1 21-Jun-2006  yamt sync with head.
 1.57.6.1 22-Apr-2006  simonb Sync with head.
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.57.2.1 01-Mar-2006  yamt sync with head.
 1.59.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.61.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.61.44.1 04-May-2009  yamt sync with head.
 1.63.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.65.6.1 18-Feb-2012  mrg merge to -current.
 1.65.2.2 30-Oct-2012  yamt sync with head
 1.65.2.1 17-Apr-2012  yamt sync with head
 1.66.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.70.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_2100_a50.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.6 13-Jun-1996  cgd clean up copyright notices
 1.5 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.4 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.3 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.2 03-Aug-1995  cgd branches: 1.2.6;
oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.2.6.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.6.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.27 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.26 31-Mar-2024  thorpej branches: 1.26.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.25 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.24 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.23 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.22 06-Feb-2012  matt branches: 1.22.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.21 01-Jul-2011  dyoung branches: 1.21.2; 1.21.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.20 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.19 14-Sep-2009  mhitch branches: 1.19.10;
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.18 28-Apr-2008  martin branches: 1.18.10; 1.18.18;
Remove clause 3 and 4 from TNF licenses
 1.17 04-Mar-2007  yamt branches: 1.17.40; 1.17.42; 1.17.44;
fix fallout from caddr_t changes.
 1.16 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 07-Oct-2006  elad branches: 1.15.4;
PR/29274: Anders Hjalmarsson: MOP booting Alphaserver 2000 does not find
root device

Patch applied, thanks!
 1.14 25-Feb-2006  thorpej branches: 1.14.14; 1.14.16;
Use device_is_a().
 1.13 23-Feb-2006  thorpej Use device_parent().
 1.12 11-Dec-2005  christos branches: 1.12.2; 1.12.4; 1.12.6;
merge ktrace-lwp.
 1.11 28-Jun-2004  mycroft branches: 1.11.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.10 14-Jun-2003  thorpej branches: 1.10.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.9 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.8 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.7 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.6 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.5 05-Jun-2001  thorpej branches: 1.5.2; 1.5.4; 1.5.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.4 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.3 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.2 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.1.2.3 27-Mar-2001  bouyer Finish merge.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file dec_2100_a500.c was added on branch thorpej_scsipi on 2001-01-05 17:33:39 +0000
 1.5.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.5.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.5.4.1 05-Jun-2001  nathanw file dec_2100_a500.c was added on branch nathanw_sa on 2002-09-17 21:12:36 +0000
 1.5.2.1 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.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.12.3 03-Sep-2007  yamt sync with head.
 1.11.12.2 30-Dec-2006  yamt sync with head.
 1.11.12.1 21-Jun-2006  yamt sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.1 01-Mar-2006  yamt sync with head.
 1.14.16.1 22-Oct-2006  yamt sync with head
 1.14.14.1 18-Nov-2006  ad Sync with head.
 1.15.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.44.2 16-Sep-2009  yamt sync with head
 1.17.44.1 16-May-2008  yamt sync with head.
 1.17.42.1 18-May-2008  yamt sync with head.
 1.17.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.18.1 21-Apr-2010  matt sync to netbsd-5
 1.18.10.1 26-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1010):
sys/arch/alpha/alpha/dec_1000a.c: revision 1.29
sys/arch/alpha/alpha/dec_2100_a500.c: revision 1.19
sys/arch/alpha/alpha/dec_6600.c: revision 1.29
sys/arch/alpha/alpha/dec_kn300.c: revision 1.37
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.19.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.21.6.1 18-Feb-2012  mrg merge to -current.
 1.21.2.2 30-Oct-2012  yamt sync with head
 1.21.2.1 17-Apr-2012  yamt sync with head
 1.22.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.26.2.1 02-Aug-2025  perseant Sync with HEAD
 1.50 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.49 31-Mar-2024  thorpej branches: 1.49.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.48 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.47 06-Feb-2012  matt branches: 1.47.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.46 14-Jun-2011  matt branches: 1.46.2; 1.46.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.45 14-Mar-2009  dsl branches: 1.45.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.44 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.43 04-Mar-2007  yamt branches: 1.43.44; 1.43.52; 1.43.58;
fix fallout from caddr_t changes.
 1.42 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.41 25-Feb-2006  thorpej branches: 1.41.20;
Use device_is_a().
 1.40 23-Feb-2006  thorpej Use device_parent().
 1.39 27-Sep-2002  provos branches: 1.39.22; 1.39.34; 1.39.36; 1.39.38;
remove trailing \n in panic(). approved perry.
 1.38 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.37 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.36 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.35 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.34 25-Apr-2001  bouyer branches: 1.34.2; 1.34.4; 1.34.16;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.33 17-Oct-2000  nisimura branches: 1.33.2;
- efforts to merge TC Alpha and IOASIC DECstation, derived from Mattias
Drochner's work made in nisimura-pmax-wscons branch. Still a little
to do before useful for DECstation. MI softintr required.
- allow wildcard matchs to have zstty/zskbd/zsms in default hardware
configuration.
- abandon to check zs_ioasic_cnattach() return value; it doesn't fail.
- have zs_ioasic_cnattach() serial line parameters hardcoded inside, in
symmetry with zs_ioasic_lk201_cnattach().
 1.32 05-Jul-2000  nisimura zs_ioasic external declarations are stored in zs_ioasicvar.h.
 1.31 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.30 22-May-2000  thorpej When checking for netboot, also check for MOP protocol.
 1.29 20-Nov-1999  mrg pull across fix from dec_3000_500.c:

>split the "asc" and "tcds" searching into two separate sections and
>keep a "tcdsdev" of the booted tcds device. make sure that the "asc"
>is the child of the tcds. this fixes boot device detection on dec
>5000/400 (prolly 400-900) machines in the presense of a tcds option
>card, which would use the right tcds chip & disk scsiid of the last
>attached tcds -- which meant it would choose the wrong disk, or not
>find the boot device at all if the corresponding scsiid was unused in
>the last attached disk.
>
>XXX: this may need to be copied to dec_3000_300.c but i have no idea
>as i can not test this hardware at all...
>
>fixes PR#8771 by myself.
 1.28 08-Aug-1999  ross branches: 1.28.2; 1.28.8;
ifndef NEW_SCC_DRIVER, tell sccattach() if we are on a fb or serial cons
 1.27 07-Aug-1999  drochner clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.26 15-Apr-1999  thorpej - Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.25 28-Mar-1999  drochner branches: 1.25.2;
Leave out display console related bits if wscons is not compiled in.
Should fix link error reported by Kevin <kev@drule.org>.
 1.24 26-Feb-1999  thorpej Fix printf formats.
 1.23 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.22 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.21 26-Mar-1998  thorpej Add support for attaching a zstty as the console, conditional on
NEW_SCC_DRIVER.
 1.20 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.19 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.18 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.17 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.16 07-Jun-1997  cgd branches: 1.16.2; 1.16.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.15 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.14 07-Apr-1997  cgd include machine/options.h
 1.13 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.12 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.11 27-Feb-1997  thorpej s/esp/asc/g
 1.10 12-Nov-1996  cgd branches: 1.10.2; 1.10.8;
convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 17-Sep-1996  cgd Differentiate between disked ("SCSI") and network ("BOOTP", but not yet MOP)
booted_dev specs. Add code to find the device, if booted from the network.
 1.6 13-Jun-1996  cgd clean up copyright notices
 1.5 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.4 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.3 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.2 03-Aug-1995  cgd branches: 1.2.6;
oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.2.6.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.6.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.10.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.10.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.25.2.2 08-Aug-1999  cgd pull up rev 1.28 from trunk (ross)
 1.25.2.1 16-Apr-1999  thorpej branches: 1.25.2.1.2; 1.25.2.1.4;
Pull up 1.25 -> 1.26.
 1.25.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.25.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.28.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.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.28.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.33.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.34.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.34.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.34.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.34.4.1 25-Apr-2001  nathanw file dec_3000_300.c was added on branch nathanw_sa on 2002-09-17 21:12:36 +0000
 1.34.2.1 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.39.38.1 22-Apr-2006  simonb Sync with head.
 1.39.36.1 09-Sep-2006  rpaulo sync with head
 1.39.34.1 01-Mar-2006  yamt sync with head.
 1.39.22.2 03-Sep-2007  yamt sync with head.
 1.39.22.1 21-Jun-2006  yamt sync with head.
 1.41.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.43.44.1 04-May-2009  yamt sync with head.
 1.45.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.46.6.1 18-Feb-2012  mrg merge to -current.
 1.46.2.2 30-Oct-2012  yamt sync with head
 1.46.2.1 17-Apr-2012  yamt sync with head
 1.47.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_3000_300.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.6 13-Jun-1996  cgd clean up copyright notices
 1.5 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.4 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.3 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.2 03-Aug-1995  cgd branches: 1.2.6;
oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.2.6.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.6.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.49 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.48 31-Mar-2024  thorpej branches: 1.48.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.47 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.46 06-Feb-2012  matt branches: 1.46.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.45 14-Jun-2011  matt branches: 1.45.2; 1.45.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.44 14-Mar-2009  dsl branches: 1.44.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.43 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.42 04-Mar-2007  yamt branches: 1.42.44; 1.42.52; 1.42.58;
fix fallout from caddr_t changes.
 1.41 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.40 25-Feb-2006  thorpej branches: 1.40.20;
Use device_is_a().
 1.39 23-Feb-2006  thorpej Use device_parent().
 1.38 27-Sep-2002  provos branches: 1.38.22; 1.38.34; 1.38.36; 1.38.38;
remove trailing \n in panic(). approved perry.
 1.37 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.36 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.35 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.34 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.33 25-Apr-2001  bouyer branches: 1.33.2; 1.33.4; 1.33.16;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.32 17-Oct-2000  nisimura branches: 1.32.2;
- efforts to merge TC Alpha and IOASIC DECstation, derived from Mattias
Drochner's work made in nisimura-pmax-wscons branch. Still a little
to do before useful for DECstation. MI softintr required.
- allow wildcard matchs to have zstty/zskbd/zsms in default hardware
configuration.
- abandon to check zs_ioasic_cnattach() return value; it doesn't fail.
- have zs_ioasic_cnattach() serial line parameters hardcoded inside, in
symmetry with zs_ioasic_lk201_cnattach().
 1.31 05-Jul-2000  nisimura zs_ioasic external declarations are stored in zs_ioasicvar.h.
 1.30 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.29 22-May-2000  thorpej When checking for netboot, also check for MOP protocol.
 1.28 19-Nov-1999  mrg split the "asc" and "tcds" searching into two separate sections and
keep a "tcdsdev" of the booted tcds device. make sure that the "asc"
is the child of the tcds. this fixes boot device detection on dec
5000/400 (prolly 400-900) machines in the presense of a tcds option
card, which would use the right tcds chip & disk scsiid of the last
attached tcds -- which meant it would choose the wrong disk, or not
find the boot device at all if the corresponding scsiid was unused in
the last attached disk.

XXX: this may need to be copied to dec_3000_300.c but i have no idea
as i can not test this hardware at all...

fixes PR#8771 by myself.
 1.27 08-Aug-1999  ross branches: 1.27.2; 1.27.8;
ifndef NEW_SCC_DRIVER, tell sccattach() if we are on a fb or serial cons
 1.26 07-Aug-1999  drochner clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.25 15-Apr-1999  thorpej - Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.24 28-Mar-1999  drochner branches: 1.24.2;
Leave out display console related bits if wscons is not compiled in.
Should fix link error reported by Kevin <kev@drule.org>.
 1.23 26-Feb-1999  thorpej Fix printf formats.
 1.22 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.21 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.20 26-Mar-1998  thorpej Add support for attaching a zstty as the console, conditional on
NEW_SCC_DRIVER.
 1.19 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.18 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.17 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.16 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.15 07-Jun-1997  cgd branches: 1.15.2; 1.15.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.14 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.13 07-Apr-1997  cgd include machine/options.h
 1.12 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.11 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.10 27-Feb-1997  thorpej s/esp/asc/g
 1.9 12-Nov-1996  cgd branches: 1.9.2; 1.9.8;
convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 17-Sep-1996  cgd Differentiate between disked ("SCSI") and network ("BOOTP", but not yet MOP)
booted_dev specs. Add code to find the device, if booted from the network.
 1.5 13-Jun-1996  cgd clean up copyright notices
 1.4 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.3 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.2 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.1 03-Aug-1995  cgd branches: 1.1.6;
cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.1.6.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.1.6.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.9.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.9.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.24.2.2 08-Aug-1999  cgd pull up rev 1.27 from trunk (ross)
 1.24.2.1 16-Apr-1999  thorpej branches: 1.24.2.1.2; 1.24.2.1.4;
Pull up 1.24 -> 1.25.
 1.24.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.24.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.27.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.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.27.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.32.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.33.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.33.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.33.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.33.4.1 25-Apr-2001  nathanw file dec_3000_500.c was added on branch nathanw_sa on 2002-09-17 21:12:37 +0000
 1.33.2.1 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.38.38.1 22-Apr-2006  simonb Sync with head.
 1.38.36.1 09-Sep-2006  rpaulo sync with head
 1.38.34.1 01-Mar-2006  yamt sync with head.
 1.38.22.2 03-Sep-2007  yamt sync with head.
 1.38.22.1 21-Jun-2006  yamt sync with head.
 1.40.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.42.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.42.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.42.44.1 04-May-2009  yamt sync with head.
 1.44.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.45.6.1 18-Feb-2012  mrg merge to -current.
 1.45.2.2 30-Oct-2012  yamt sync with head
 1.45.2.1 17-Apr-2012  yamt sync with head
 1.46.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.48.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_3000_500.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.6 13-Jun-1996  cgd clean up copyright notices
 1.5 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.4 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.3 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.2 03-Aug-1995  cgd branches: 1.2.6;
oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd cpu-specific functions which could be split out of various parts of
machdep.c. There probably is a better way to this this code up, but
i picked this one for simplicity, for now...
 1.2.6.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.6.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.39 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.38 31-Mar-2024  thorpej branches: 1.38.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.37 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.36 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.35 06-Feb-2012  matt branches: 1.35.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.34 01-Jul-2011  dyoung branches: 1.34.2; 1.34.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.33 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.32 14-Mar-2009  dsl branches: 1.32.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.31 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.30 04-Mar-2007  yamt branches: 1.30.44; 1.30.52; 1.30.58;
fix fallout from caddr_t changes.
 1.29 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 25-Feb-2006  thorpej branches: 1.28.20;
Use device_is_a().
 1.27 23-Feb-2006  thorpej Use device_parent().
 1.26 11-Dec-2005  christos branches: 1.26.2; 1.26.4; 1.26.6;
merge ktrace-lwp.
 1.25 28-Jun-2004  mycroft branches: 1.25.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.24 14-Dec-2003  thorpej branches: 1.24.2;
No need to include wdvar.h anymore.
 1.23 24-Oct-2003  mycroft Check the PCI device and function numbers correctly. Fixes boot device
identification on reinoud's PWS 550, and works fine on my AS200.
 1.22 14-Oct-2003  nathanw Catch up to ata/ide changes; look for a parent device of wd named "atabus"
instead of "pciide", and check one layer farther up in the device hierarchy
for the scsipidev device.

From Manuel Bouyer, tested by me on a up1500 (identical changes to other
ide-booting code).
 1.21 14-Jun-2003  thorpej branches: 1.21.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.20 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.19 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.18 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.17 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.16 02-Dec-2001  bouyer branches: 1.16.8;
Convert to new ata/atapi attach structs.
 1.15 05-Jun-2001  thorpej branches: 1.15.2; 1.15.4;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.14 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.13 02-May-2001  thorpej Add some page coloring defaults.
 1.12 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.11 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.10 20-Jun-2000  matt branches: 1.10.2; 1.10.4;
CDROMs can exist on ide buses
 1.9 09-Jun-2000  soda increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.8 06-Jun-2000  matt Needs to look at different stuff depending if the scsipi bus is SCSI or ATAPI
 1.7 22-May-2000  thorpej branches: 1.7.2;
When checking for netboot, also check for MOP protocol.
 1.6 05-Feb-2000  veego Bring in the support to boot from ide drives. This is from dec_eb164.c.
This is needed for newer firmware and to boot from slave drives.
 1.5 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.4 15-Apr-1999  thorpej branches: 1.4.2; 1.4.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.3 13-Feb-1999  thorpej branches: 1.3.2;
Fix printf format warnings on Alpha.
 1.2 06-Jun-1998  thorpej Add support for software powerdown of the Digital Personal Workstation.
 1.1 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.3.2.4 13-Feb-2000  he Apply patch (requested by elric):
Make this compile when NPCKBD > 0.
 1.3.2.3 12-Feb-2000  he Apply patch (requested by he):
Part of last pull-up (include file shuffling) not applicable to
the netbsd-1-4 branch, so reverting that.
 1.3.2.2 06-Feb-2000  he Pull up revision 1.5 (requested by veego):
Fix detection of booted device for IDE drives, such that automatic
booting from a slave drive or a drive on the second channel works.
 1.3.2.1 16-Apr-1999  thorpej branches: 1.3.2.1.2;
Pull up 1.3 -> 1.4.
 1.3.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.4.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.4.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.2 20-Jun-2000  matt CDROMs can exist on ide buses
 1.10.2.1 20-Jun-2000  matt file dec_550.c was added on branch netbsd-1-5 on 2000-06-20 03:48:54 +0000
 1.15.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.15.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.15.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.15.4.1 05-Jun-2001  nathanw file dec_550.c was added on branch nathanw_sa on 2002-01-08 00:22:50 +0000
 1.15.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.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 05-Jul-2004  he Pull up revision 1.25 (requested by mycroft in ticket #607):
Significantly cleanup and bug fix root device detection:
o On systems where it is relevant (6600, kin300, kn8ae),
check which PCI bus hierarchy we are looking at.
o Consistently check PCI function numbers (important for
quad-channel ATA controllers).
o Check logical unit numbers.
o Use strcasecmp() to check b->protocol; the case is
different depending on firmware revision.
o Remove b->boot_dec_type check, it is unneeded.
o Remove extraneous unneeded variables.
Fixes PR#9432, PR#12225, PR#25830 and multiple long-standing
bugs, and the code is smaller too.
 1.25.12.2 03-Sep-2007  yamt sync with head.
 1.25.12.1 21-Jun-2006  yamt sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.26.2.1 01-Mar-2006  yamt sync with head.
 1.28.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.30.44.1 04-May-2009  yamt sync with head.
 1.32.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.34.6.1 18-Feb-2012  mrg merge to -current.
 1.34.2.2 30-Oct-2012  yamt sync with head
 1.34.2.1 17-Apr-2012  yamt sync with head
 1.35.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.38.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_550.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.40 03-Oct-2025  thorpej Use device_{get,set}prop_bool() for "pciide-disable-dma".
 1.39 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.38 31-Mar-2024  thorpej branches: 1.38.2;
In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true. This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.
 1.37 31-Mar-2024  thorpej Always call platform.device_register(), even if bootdev_data is NULL.
 1.36 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.35 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.34 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.33 06-Feb-2012  matt branches: 1.33.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.32 01-Jul-2011  dyoung branches: 1.32.2; 1.32.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.31 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.30 07-Oct-2010  hans branches: 1.30.6;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.29 14-Sep-2009  mhitch branches: 1.29.2; 1.29.4;
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.28 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.27 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.26 04-Mar-2007  yamt branches: 1.26.44; 1.26.52; 1.26.54; 1.26.58; 1.26.62;
fix fallout from caddr_t changes.
 1.25 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.24 25-Feb-2006  thorpej branches: 1.24.20;
Use device_is_a().
 1.23 23-Feb-2006  thorpej Use device_parent().
 1.22 11-Dec-2005  christos branches: 1.22.2; 1.22.4; 1.22.6;
merge ktrace-lwp.
 1.21 28-Jun-2004  mycroft branches: 1.21.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.20 14-Dec-2003  thorpej branches: 1.20.2;
No need to include wdvar.h anymore.
 1.19 14-Oct-2003  nathanw Catch up to ata/ide changes; look for a parent device of wd named "atabus"
instead of "pciide", and check one layer farther up in the device hierarchy
for the scsipidev device.

From Manuel Bouyer, tested by me on a up1500 (identical changes to other
ide-booting code).
 1.18 14-Jun-2003  thorpej branches: 1.18.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.17 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.16 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.15 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.14 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.13 02-Dec-2001  bouyer branches: 1.13.8;
Convert to new ata/atapi attach structs.
 1.12 05-Jun-2001  thorpej branches: 1.12.2; 1.12.4;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.11 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.10 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.9 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.8 25-Jun-2000  thorpej branches: 1.8.2;
Implement tsp_bus_get_window().
 1.7 20-Jun-2000  matt branches: 1.7.2;
CDROMs can exist on ide buses
 1.6 09-Jun-2000  soda increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.5 06-Jun-2000  matt Needs to look at different stuff depending if the scsipi bus is SCSI or ATAPI
 1.4 22-May-2000  thorpej branches: 1.4.2;
When checking for netboot, also check for MOP protocol.
 1.3 05-Feb-2000  veego Sync the ide support with dec_eb164.c rev 1.32:
Add the support to boot an ide slave drive and to boot from the secondary
ide channel.
Michael Hitch gave me the final hint how to do that and Havard Eidnes
tested it with his slave drive.
This should fix pr#8808 on the DS10.
Also remove one ideboot check which wasn't removed when I removed it from
dec_eb164.c.
 1.2 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14;
System support for ev6 (21264) systems.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.6.3 23-Apr-2001  bouyer Sync with HEAD.
 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 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.1.4.2 06-Feb-2000  he Pull up revision 1.3 (requested by veego):
Fix detection of booted device for IDE drives, such that automatic
booting from a slave drive or a drive on the second channel works.
 1.1.4.1 29-Jun-1999  he file dec_6600.c was added on branch netbsd-1-4 on 2000-02-06 17:23:12 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file dec_6600.c was added on branch chs-ubc2 on 1999-07-01 23:00:55 +0000
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.2 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.7.2.1 20-Jun-2000  thorpej file dec_6600.c was added on branch netbsd-1-5 on 2000-06-27 19:45:54 +0000
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.12.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.12.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.12.4.1 05-Jun-2001  nathanw file dec_6600.c was added on branch nathanw_sa on 2002-01-08 00:22:51 +0000
 1.12.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.12.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.2.1 05-Jul-2004  he Pull up revision 1.21 (requested by mycroft in ticket #607):
Significantly cleanup and bug fix root device detection:
o On systems where it is relevant (6600, kin300, kn8ae),
check which PCI bus hierarchy we are looking at.
o Consistently check PCI function numbers (important for
quad-channel ATA controllers).
o Check logical unit numbers.
o Use strcasecmp() to check b->protocol; the case is
different depending on firmware revision.
o Remove b->boot_dec_type check, it is unneeded.
o Remove extraneous unneeded variables.
Fixes PR#9432, PR#12225, PR#25830 and multiple long-standing
bugs, and the code is smaller too.
 1.21.12.2 03-Sep-2007  yamt sync with head.
 1.21.12.1 21-Jun-2006  yamt sync with head.
 1.22.6.1 22-Apr-2006  simonb Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.22.2.1 01-Mar-2006  yamt sync with head.
 1.24.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.62.1 21-Apr-2010  matt sync to netbsd-5
 1.26.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.54.1 26-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1010):
sys/arch/alpha/alpha/dec_1000a.c: revision 1.29
sys/arch/alpha/alpha/dec_2100_a500.c: revision 1.19
sys/arch/alpha/alpha/dec_6600.c: revision 1.29
sys/arch/alpha/alpha/dec_kn300.c: revision 1.37
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.26.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.26.44.3 09-Oct-2010  yamt sync with head
 1.26.44.2 16-Sep-2009  yamt sync with head
 1.26.44.1 04-May-2009  yamt sync with head.
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.29.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.30.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.32.6.1 18-Feb-2012  mrg merge to -current.
 1.32.2.2 30-Oct-2012  yamt sync with head
 1.32.2.1 17-Apr-2012  yamt sync with head
 1.33.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.38.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_6600.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.31 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.30 31-Mar-2024  thorpej branches: 1.30.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.29 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.28 16-Jul-2021  thorpej On LCA45 systems, look at the memory controller's Bcache configuration
to initialize uvmexp.ncolors rather than hard-coding a value per model
(some models can have more than one configuration).
 1.27 13-Oct-2012  jdc branches: 1.27.54;
Adapt to the changed signature of pckbc_cnattach().
 1.26 06-Feb-2012  matt branches: 1.26.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.25 01-Jul-2011  dyoung branches: 1.25.2; 1.25.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.24 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.23 14-Mar-2009  dsl branches: 1.23.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.22 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.21 04-Mar-2007  yamt branches: 1.21.44; 1.21.52; 1.21.58;
fix fallout from caddr_t changes.
 1.20 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 25-Feb-2006  thorpej branches: 1.19.20;
Use device_is_a().
 1.18 23-Feb-2006  thorpej Use device_parent().
 1.17 11-Dec-2005  christos branches: 1.17.2; 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 28-Jun-2004  mycroft branches: 1.16.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.15 14-Jun-2003  thorpej branches: 1.15.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.14 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.13 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.12 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.11 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.10 05-Jun-2001  thorpej branches: 1.10.2; 1.10.4; 1.10.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.9 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.8 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.7 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.6 09-Jun-2000  soda branches: 1.6.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.5 22-May-2000  thorpej branches: 1.5.2;
When checking for netboot, also check for MOP protocol.
 1.4 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.3 15-Apr-1999  thorpej branches: 1.3.2; 1.3.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.2 13-Feb-1999  thorpej branches: 1.2.2;
Fix printf format warnings on Alpha.
 1.1 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.2.2.1 16-Apr-1999  thorpej branches: 1.2.2.1.2;
Pull up 1.2 -> 1.3.
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.3.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.3.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.5.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.10.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.10.4.1 05-Jun-2001  nathanw file dec_alphabook1.c was added on branch nathanw_sa on 2002-09-17 21:12:38 +0000
 1.10.2.1 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.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.12.2 03-Sep-2007  yamt sync with head.
 1.16.12.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 01-Mar-2006  yamt sync with head.
 1.19.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.44.1 04-May-2009  yamt sync with head.
 1.23.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.25.6.1 18-Feb-2012  mrg merge to -current.
 1.25.2.2 30-Oct-2012  yamt sync with head
 1.25.2.1 17-Apr-2012  yamt sync with head
 1.26.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.27.54.1 01-Aug-2021  thorpej Sync with HEAD.
 1.30.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_alphabook1.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.71 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.70 31-Mar-2024  thorpej branches: 1.70.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.69 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.68 16-Jul-2021  thorpej On LCA45 systems, look at the memory controller's Bcache configuration
to initialize uvmexp.ncolors rather than hard-coding a value per model
(some models can have more than one configuration).
 1.67 13-Oct-2012  jdc branches: 1.67.54;
Adapt to the changed signature of pckbc_cnattach().
 1.66 06-Feb-2012  matt branches: 1.66.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.65 14-Jun-2011  matt branches: 1.65.2; 1.65.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.64 18-Mar-2009  cegger branches: 1.64.10;
Ansify function definitions w/o arguments. Generated with sed.
 1.63 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.62 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.61 04-Mar-2007  yamt branches: 1.61.44; 1.61.52; 1.61.58;
fix fallout from caddr_t changes.
 1.60 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.59 25-Feb-2006  thorpej branches: 1.59.20;
Use device_is_a().
 1.58 23-Feb-2006  thorpej Use device_parent().
 1.57 11-Dec-2005  christos branches: 1.57.2; 1.57.4; 1.57.6;
merge ktrace-lwp.
 1.56 28-Jun-2004  mycroft branches: 1.56.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.55 14-Jun-2003  thorpej branches: 1.55.2; 1.55.4;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.54 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.53 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.52 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.51 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.50 05-Jun-2001  thorpej branches: 1.50.2; 1.50.4; 1.50.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.49 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.48 02-May-2001  thorpej Add some page coloring defaults.
 1.47 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.46 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.45 09-Jun-2000  soda branches: 1.45.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.44 22-May-2000  thorpej branches: 1.44.2;
When checking for netboot, also check for MOP protocol.
 1.43 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.42 15-Apr-1999  thorpej branches: 1.42.2; 1.42.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.41 13-Feb-1999  thorpej branches: 1.41.2;
Fix printf format warnings on Alpha.
 1.40 20-Nov-1998  ross Sigh, shuffle the nsio ide frobber yet again.
 1.39 19-Nov-1998  ross +#include <machine/alpha.h>
-#include <machine/bus.h> (done for you by alpha.h)
Take the junk I/O chip IDE channel frobber and move it to machdep.c.
 1.38 07-Jul-1998  ross Teach dec_axppci_33_init() a little about the nsio config registers,
enable the nsio IDE, and leave the config register ISA ports mapped.
 1.37 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.36 15-Apr-1998  drochner explicitely initialize console keyboard
 1.35 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.34 17-Oct-1997  mjacob more compile foo
 1.33 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.32 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.31 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.30 02-Sep-1997  thorpej Update for changes to how bus space tags are initialized.
 1.29 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.28 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.27 23-Aug-1997  drochner Adapt to serial console attachment changes.
 1.26 07-Jun-1997  cgd branches: 1.26.2; 1.26.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.25 18-Apr-1997  cgd try a slightly different heuristic to differentiate between ISA and PCI
(VGA) consoles.
 1.24 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.23 07-Apr-1997  cgd include machine/options.h
 1.22 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.21 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.20 04-Apr-1997  mycroft comdefaultrate -> comconsrate
comconsbah -> comconsioh
 1.19 21-Mar-1997  cgd fix check for bus number when root dev is behind PPB
 1.18 15-Jan-1997  cgd change the fixed delay to allow serial console output to settle
to something smarter, suggested by Charles Hannum.
 1.17 17-Dec-1996  cgd branches: 1.17.2;
update for recent com.c changes: delete references to now-nonexistant
comconsinit variable.
 1.16 25-Nov-1996  cgd branches: 1.16.2;
update for chipsets' init functions' new prototypes
 1.15 19-Nov-1996  cgd update for ISA VGA frame buffer possibily
 1.14 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.13 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 17-Sep-1996  cgd Differentiate between disked ("SCSI") and network ("BOOTP", but not yet MOP)
booted_dev specs. Add code to find the device, if booted from the network.
 1.9 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.8 14-Jun-1996  cgd add a delay before serial console is initialized, to allow any
outstanding PROM output to drain. Move the console-type printfs
so that they're only printed if console selection fails.
 1.7 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.6 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.5 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.4 15-Apr-1996  cgd branches: 1.4.4;
include <sys/termios.h> to make <dev/isa/comvar.h> happy, and set the
serial ('com') console bit size and parity to be "cs8 -parenb".
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for new ISA & PCI code, etc.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.2 14-Jun-1996  cgd pull up from trunk:
>add a delay before serial console is initialized, to allow any
>outstanding PROM output to drain. Move the console-type printfs
>so that they're only printed if console selection fails.
 1.4.4.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.16.2.4 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.16.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.2 01-Feb-1997  cgd sync up with nwscons changes to dec_2100_a50.c
 1.16.2.1 24-Jan-1997  cgd sync with trunk
 1.17.2.2 30-Jan-1997  thorpej update from trunk
 1.17.2.1 18-Jan-1997  thorpej Update from trunk.
 1.26.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.26.4.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.2.2 26-Aug-1997  bouyer Update from trunk.
 1.26.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.41.2.1 16-Apr-1999  thorpej branches: 1.41.2.1.2;
Pull up 1.41 -> 1.42.
 1.41.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.42.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.42.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.42.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.44.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.45.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.50.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.50.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.50.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.50.4.1 05-Jun-2001  nathanw file dec_axppci_33.c was added on branch nathanw_sa on 2002-09-17 21:12:38 +0000
 1.50.2.1 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.55.4.1 05-Jul-2004  he Pull up revision 1.56 (requested by mycroft in ticket #607):
Significantly cleanup and bug fix root device detection:
o On systems where it is relevant (6600, kin300, kn8ae),
check which PCI bus hierarchy we are looking at.
o Consistently check PCI function numbers (important for
quad-channel ATA controllers).
o Check logical unit numbers.
o Use strcasecmp() to check b->protocol; the case is
different depending on firmware revision.
o Remove b->boot_dec_type check, it is unneeded.
o Remove extraneous unneeded variables.
Fixes PR#9432, PR#12225, PR#25830 and multiple long-standing
bugs, and the code is smaller too.
 1.55.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.55.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.55.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.12.2 03-Sep-2007  yamt sync with head.
 1.56.12.1 21-Jun-2006  yamt sync with head.
 1.57.6.1 22-Apr-2006  simonb Sync with head.
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.57.2.1 01-Mar-2006  yamt sync with head.
 1.59.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.61.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.61.44.1 04-May-2009  yamt sync with head.
 1.64.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.65.6.1 18-Feb-2012  mrg merge to -current.
 1.65.2.2 30-Oct-2012  yamt sync with head
 1.65.2.1 17-Apr-2012  yamt sync with head
 1.66.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.67.54.1 01-Aug-2021  thorpej Sync with HEAD.
 1.70.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_axppci_33.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.6 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.5 13-Jun-1996  cgd clean up copyright notices
 1.4 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.3 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.2 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.1 23-Nov-1995  cgd branches: 1.1.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.1.4.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.65 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.64 31-Mar-2024  thorpej branches: 1.64.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.63 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.62 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.61 06-Feb-2012  matt branches: 1.61.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.60 01-Jul-2011  dyoung branches: 1.60.2; 1.60.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.59 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.58 14-Mar-2009  dsl branches: 1.58.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.57 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.56 04-Mar-2007  yamt branches: 1.56.44; 1.56.52; 1.56.58;
fix fallout from caddr_t changes.
 1.55 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.54 26-Feb-2006  he branches: 1.54.20;
Insert an obviously missing double quote.
 1.53 25-Feb-2006  thorpej Use device_is_a().
 1.52 23-Feb-2006  thorpej Use device_parent().
 1.51 11-Dec-2005  christos branches: 1.51.2; 1.51.4; 1.51.6;
merge ktrace-lwp.
 1.50 28-Jun-2004  mycroft branches: 1.50.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.49 14-Dec-2003  thorpej No need to include wdvar.h anymore.
 1.48 14-Oct-2003  nathanw Catch up to ata/ide changes; look for a parent device of wd named "atabus"
instead of "pciide", and check one layer farther up in the device hierarchy
for the scsipidev device.

From Manuel Bouyer, tested by me on a up1500 (identical changes to other
ide-booting code).
 1.47 14-Jun-2003  thorpej branches: 1.47.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.46 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.45 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.44 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.43 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.42 02-Dec-2001  bouyer branches: 1.42.8;
Convert to new ata/atapi attach structs.
 1.41 05-Jun-2001  thorpej branches: 1.41.2; 1.41.4;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.40 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.39 02-May-2001  thorpej Add some page coloring defaults.
 1.38 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.37 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.36 20-Jun-2000  matt branches: 1.36.2; 1.36.4;
CDROMs can exist on ide buses
 1.35 09-Jun-2000  soda increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.34 06-Jun-2000  matt Needs to look at different stuff depending if the scsipi bus is SCSI or ATAPI
 1.33 22-May-2000  thorpej branches: 1.33.2;
When checking for netboot, also check for MOP protocol.
 1.32 05-Feb-2000  veego Add the support to boot an ide slave drive and to boot from the secondary
ide channel.
Michael Hitch gave me the final hint how to do that and Havard Eidnes
tested it with his slave drive.
This will also fix pr#8808 on the DS10 when I commit the changes to
dec_6600.c.
 1.31 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.30 02-Sep-1999  ross branches: 1.30.2; 1.30.8;
Don't get confused when pci function != 0.
 1.29 15-Apr-1999  thorpej - Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.28 16-Feb-1999  veego branches: 1.28.2;
Add support to boot from ide hard disks.
 1.27 13-Feb-1999  thorpej Fix printf format warnings on Alpha.
 1.26 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.25 15-Apr-1998  drochner explicitely initialize console keyboard
 1.24 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.23 12-Feb-1998  thorpej Make it a little more clear that the "eb164" systype doens't necessarily
mean that a machine is a DEC EB164 (it may be an AlphaPC 164, which is
different, from the firmware's perspective).
 1.22 17-Oct-1997  mjacob Recover from some include file foo.
 1.21 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.20 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.19 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.18 02-Sep-1997  thorpej Update for changes to how bus space tags are initialized.
 1.17 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.16 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.15 23-Aug-1997  drochner Adapt to serial console attachment changes.
 1.14 07-Jun-1997  cgd branches: 1.14.2; 1.14.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.13 18-Apr-1997  cgd try a slightly different heuristic to differentiate between ISA and PCI
(VGA) consoles.
 1.12 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.11 07-Apr-1997  cgd include machine/options.h
 1.10 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.9 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.8 04-Apr-1997  mycroft comdefaultrate -> comconsrate
comconsbah -> comconsioh
 1.7 21-Mar-1997  cgd fix check for bus number when root dev is behind PPB
 1.6 15-Jan-1997  cgd change the fixed delay to allow serial console output to settle
to something smarter, suggested by Charles Hannum.
 1.5 17-Dec-1996  cgd branches: 1.5.2;
update for recent com.c changes: delete references to now-nonexistant
comconsinit variable.
 1.4 25-Nov-1996  cgd branches: 1.4.2;
update for chipsets' init functions' new prototypes
 1.3 19-Nov-1996  cgd update for ISA VGA frame buffer possibily
 1.2 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.1 11-Nov-1996  cgd preliminary support for the EB164. The EB164 is more or less a 'normal'
21164 + 21172 box, with Yet Another Way of doing interrupts. The
interrupt mapping and handling code hasn't been written yet, and none
of this code has been tested. (Checkpoint of work in progress.)
 1.4.2.4 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.2 01-Feb-1997  cgd sync up with nwscons changes to dec_2100_a50.c
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.5.2.2 30-Jan-1997  thorpej update from trunk
 1.5.2.1 18-Jan-1997  thorpej Update from trunk.
 1.14.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.14.4.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.2.2 26-Aug-1997  bouyer Update from trunk.
 1.14.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.28.2.2 06-Feb-2000  he Pull up revision 1.32 (requested by veego):
Fix detection of booted device for IDE drives, such that automatic
booting from a slave drive or a drive on the second channel works.
 1.28.2.1 16-Apr-1999  thorpej branches: 1.28.2.1.2;
Pull up 1.28 -> 1.29.
 1.28.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.30.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.30.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.30.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.33.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.36.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.36.2.2 20-Jun-2000  matt CDROMs can exist on ide buses
 1.36.2.1 20-Jun-2000  matt file dec_eb164.c was added on branch netbsd-1-5 on 2000-06-20 03:48:55 +0000
 1.41.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.41.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.41.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.41.4.1 05-Jun-2001  nathanw file dec_eb164.c was added on branch nathanw_sa on 2002-01-08 00:22:51 +0000
 1.41.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.41.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.50.12.2 03-Sep-2007  yamt sync with head.
 1.50.12.1 21-Jun-2006  yamt sync with head.
 1.51.6.1 22-Apr-2006  simonb Sync with head.
 1.51.4.1 09-Sep-2006  rpaulo sync with head
 1.51.2.1 01-Mar-2006  yamt sync with head.
 1.54.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.56.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.56.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.56.44.1 04-May-2009  yamt sync with head.
 1.58.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.60.6.1 18-Feb-2012  mrg merge to -current.
 1.60.2.2 30-Oct-2012  yamt sync with head
 1.60.2.1 17-Apr-2012  yamt sync with head
 1.61.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.64.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_eb164.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.2 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.1 11-Nov-1996  cgd preliminary support for the EB164. The EB164 is more or less a 'normal'
21164 + 21172 box, with Yet Another Way of doing interrupts. The
interrupt mapping and handling code hasn't been written yet, and none
of this code has been tested. (Checkpoint of work in progress.)
 1.44 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.43 31-Mar-2024  thorpej branches: 1.43.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.42 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.41 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.40 06-Feb-2012  matt branches: 1.40.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.39 14-Jun-2011  matt branches: 1.39.2; 1.39.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.38 14-Mar-2009  dsl branches: 1.38.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 04-Mar-2007  yamt branches: 1.36.44; 1.36.52; 1.36.58;
fix fallout from caddr_t changes.
 1.35 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 25-Feb-2006  thorpej branches: 1.34.20;
Use device_is_a().
 1.33 23-Feb-2006  thorpej Use device_parent().
 1.32 11-Dec-2005  christos branches: 1.32.2; 1.32.4; 1.32.6;
merge ktrace-lwp.
 1.31 28-Jun-2004  mycroft branches: 1.31.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.30 14-Jun-2003  thorpej branches: 1.30.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.29 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.28 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.27 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.26 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.25 05-Jun-2001  thorpej branches: 1.25.2; 1.25.4; 1.25.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.24 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.23 02-May-2001  thorpej Add some page coloring defaults.
 1.22 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.21 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.20 09-Jun-2000  soda branches: 1.20.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.19 22-May-2000  thorpej branches: 1.19.2;
When checking for netboot, also check for MOP protocol.
 1.18 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.17 15-Apr-1999  thorpej branches: 1.17.2; 1.17.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.16 13-Feb-1999  thorpej branches: 1.16.2;
Fix printf format warnings on Alpha.
 1.15 19-Nov-1998  ross Include <machine/alpha.h> and do not directly include <bus.h>
 1.14 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.13 15-Apr-1998  drochner explicitely initialize console keyboard
 1.12 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.11 17-Oct-1997  mjacob more compile foo
 1.10 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.9 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.8 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.7 02-Sep-1997  thorpej Update for changes to how bus space tags are initialized.
 1.6 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.5 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.4 23-Aug-1997  drochner Adapt to serial console attachment changes.
 1.3 07-Jun-1997  cgd branches: 1.3.2; 1.3.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.2 18-Apr-1997  cgd branches: 1.2.2;
try a slightly different heuristic to differentiate between ISA and PCI
(VGA) consoles.
 1.1 10-Apr-1997  cgd add eb64+ support, enabled with options DEC_EB64PLUS
 1.2.2.4 22-Jul-1997  cgd update display console attachment code, cloned from eb164
 1.2.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.2.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.2.1 18-Apr-1997  cgd file dec_eb64plus.c was added on branch alpha-nwscons on 1997-06-01 04:11:17 +0000
 1.3.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.3.4.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.2 26-Aug-1997  bouyer Update from trunk.
 1.3.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.16.2.1 16-Apr-1999  thorpej branches: 1.16.2.1.2;
Pull up 1.16 -> 1.17.
 1.16.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.17.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.17.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.19.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.25.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.25.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.25.4.1 05-Jun-2001  nathanw file dec_eb64plus.c was added on branch nathanw_sa on 2002-09-17 21:12:38 +0000
 1.25.2.1 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.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.12.2 03-Sep-2007  yamt sync with head.
 1.31.12.1 21-Jun-2006  yamt sync with head.
 1.32.6.1 22-Apr-2006  simonb Sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.32.2.1 01-Mar-2006  yamt sync with head.
 1.34.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.36.44.1 04-May-2009  yamt sync with head.
 1.38.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.39.6.1 18-Feb-2012  mrg merge to -current.
 1.39.2.2 30-Oct-2012  yamt sync with head
 1.39.2.1 17-Apr-2012  yamt sync with head
 1.40.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.43.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_eb64plus.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.32 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.31 31-Mar-2024  thorpej branches: 1.31.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.30 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.29 16-Jul-2021  thorpej On LCA45 systems, look at the memory controller's Bcache configuration
to initialize uvmexp.ncolors rather than hard-coding a value per model
(some models can have more than one configuration).
 1.28 13-Oct-2012  jdc branches: 1.28.54;
Adapt to the changed signature of pckbc_cnattach().
 1.27 06-Feb-2012  matt branches: 1.27.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.26 01-Jul-2011  dyoung branches: 1.26.2; 1.26.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.25 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.24 14-Mar-2009  dsl branches: 1.24.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.23 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.22 04-Mar-2007  yamt branches: 1.22.44; 1.22.52; 1.22.58;
fix fallout from caddr_t changes.
 1.21 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 25-Feb-2006  thorpej branches: 1.20.20;
Use device_is_a().
 1.19 23-Feb-2006  thorpej Use device_parent().
 1.18 11-Dec-2005  christos branches: 1.18.2; 1.18.4; 1.18.6;
merge ktrace-lwp.
 1.17 28-Jun-2004  mycroft branches: 1.17.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.16 14-Jun-2003  thorpej branches: 1.16.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.15 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.14 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.13 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.12 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.11 05-Jun-2001  thorpej branches: 1.11.2; 1.11.4; 1.11.16;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.10 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.9 02-May-2001  thorpej Add some page coloring defaults.
 1.8 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.7 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.6 09-Jun-2000  soda branches: 1.6.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.5 22-May-2000  thorpej branches: 1.5.2;
When checking for netboot, also check for MOP protocol.
 1.4 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.3 15-Apr-1999  thorpej branches: 1.3.2; 1.3.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.2 13-Feb-1999  thorpej branches: 1.2.2;
Fix printf format warnings on Alpha.
 1.1 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.2.2.1 16-Apr-1999  thorpej branches: 1.2.2.1.2;
Pull up 1.2 -> 1.3.
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.3.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.3.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.5.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.16.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.11.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.4.2 17-Sep-2002  nathanw Catch up to -current.
 1.11.4.1 05-Jun-2001  nathanw file dec_eb66.c was added on branch nathanw_sa on 2002-09-17 21:12:39 +0000
 1.11.2.1 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.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.12.2 03-Sep-2007  yamt sync with head.
 1.17.12.1 21-Jun-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 01-Mar-2006  yamt sync with head.
 1.20.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.22.44.1 04-May-2009  yamt sync with head.
 1.24.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.26.6.1 18-Feb-2012  mrg merge to -current.
 1.26.2.2 30-Oct-2012  yamt sync with head
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.27.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.28.54.1 01-Aug-2021  thorpej Sync with HEAD.
 1.31.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_eb66.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.69 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.68 31-Mar-2024  thorpej branches: 1.68.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.67 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.66 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.65 13-Oct-2012  jdc Adapt to the changed signature of pckbc_cnattach().
 1.64 06-Feb-2012  matt branches: 1.64.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.63 01-Jul-2011  dyoung branches: 1.63.2; 1.63.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.62 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.61 14-Mar-2009  dsl branches: 1.61.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.60 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.59 04-Mar-2007  yamt branches: 1.59.44; 1.59.52; 1.59.58;
fix fallout from caddr_t changes.
 1.58 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.57 25-Feb-2006  thorpej branches: 1.57.20;
Use device_is_a().
 1.56 23-Feb-2006  thorpej Use device_parent().
 1.55 11-Dec-2005  christos branches: 1.55.2; 1.55.4; 1.55.6;
merge ktrace-lwp.
 1.54 28-Jun-2004  mycroft branches: 1.54.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.53 14-Jun-2003  thorpej branches: 1.53.2;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.52 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.51 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.50 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.49 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.48 29-Aug-2001  itohy branches: 1.48.12;
Print extra information on machine check (AS500, AS600).
 1.47 05-Jun-2001  thorpej branches: 1.47.2; 1.47.4;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.46 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.45 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.44 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.43 09-Jun-2000  soda branches: 1.43.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.42 22-May-2000  thorpej branches: 1.42.2;
When checking for netboot, also check for MOP protocol.
 1.41 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.40 15-Apr-1999  thorpej branches: 1.40.2; 1.40.8;
- Use the CTB_TURBOSLOT_* macros from rpb.h.
- Don't assume bus/slot == ISA display. Instead, test for TYPE_ISA.
- Some cosmetic (whitespace, mostly) cleanup.
 1.39 13-Feb-1999  thorpej branches: 1.39.2;
Fix printf format warnings on Alpha.
 1.38 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.37 15-Apr-1998  drochner explicitely initialize console keyboard
 1.36 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.35 17-Oct-1997  mjacob more compile foo
 1.34 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.33 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.32 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.31 13-Sep-1997  thorpej Update the model string for current reality.
 1.30 02-Sep-1997  thorpej Update for changes to how bus space tags are initialized.
 1.29 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.28 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.27 23-Aug-1997  drochner Adapt to serial console attachment changes.
 1.26 07-Jun-1997  cgd branches: 1.26.2; 1.26.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.25 18-Apr-1997  cgd try a slightly different heuristic to differentiate between ISA and PCI
(VGA) consoles.
 1.24 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.23 07-Apr-1997  cgd include machine/options.h
 1.22 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.21 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.20 04-Apr-1997  mycroft comdefaultrate -> comconsrate
comconsbah -> comconsioh
 1.19 21-Mar-1997  cgd fix check for bus number when root dev is behind PPB
 1.18 15-Jan-1997  cgd change the fixed delay to allow serial console output to settle
to something smarter, suggested by Charles Hannum.
 1.17 17-Dec-1996  cgd branches: 1.17.2;
update for recent com.c changes: delete references to now-nonexistant
comconsinit variable.
 1.16 25-Nov-1996  cgd branches: 1.16.2;
update for chipsets' init functions' new prototypes
 1.15 19-Nov-1996  cgd update for ISA VGA frame buffer possibily
 1.14 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.13 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 17-Sep-1996  cgd Differentiate between disked ("SCSI") and network ("BOOTP", but not yet MOP)
booted_dev specs. Add code to find the device, if booted from the network.
 1.9 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.8 14-Jun-1996  cgd add a delay before serial console is initialized, to allow any
outstanding PROM output to drain. Move the console-type printfs
so that they're only printed if console selection fails.
 1.7 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.6 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.5 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.4 15-Apr-1996  cgd branches: 1.4.4;
include <sys/termios.h> to make <dev/isa/comvar.h> happy, and set the
serial ('com') console bit size and parity to be "cs8 -parenb".
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for new ISA & PCI code, etc.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.2 14-Jun-1996  cgd pull up from trunk:
>add a delay before serial console is initialized, to allow any
>outstanding PROM output to drain. Move the console-type printfs
>so that they're only printed if console selection fails.
 1.4.4.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.16.2.4 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.16.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.2 01-Feb-1997  cgd sync up with nwscons changes to dec_2100_a50.c
 1.16.2.1 24-Jan-1997  cgd sync with trunk
 1.17.2.2 30-Jan-1997  thorpej update from trunk
 1.17.2.1 18-Jan-1997  thorpej Update from trunk.
 1.26.4.6 16-Oct-1997  thorpej Sync w/ trunk.
 1.26.4.5 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.2.2 26-Aug-1997  bouyer Update from trunk.
 1.26.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.39.2.1 16-Apr-1999  thorpej branches: 1.39.2.1.2;
Pull up 1.30 -> 1.40.
 1.39.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.40.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.40.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.40.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.40.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.42.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.43.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.47.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.47.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.47.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.47.4.1 05-Jun-2001  nathanw file dec_kn20aa.c was added on branch nathanw_sa on 2001-09-21 22:34:53 +0000
 1.47.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.47.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.48.12.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.53.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.53.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.53.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.12.2 03-Sep-2007  yamt sync with head.
 1.54.12.1 21-Jun-2006  yamt sync with head.
 1.55.6.1 22-Apr-2006  simonb Sync with head.
 1.55.4.1 09-Sep-2006  rpaulo sync with head
 1.55.2.1 01-Mar-2006  yamt sync with head.
 1.57.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.59.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.59.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.59.44.1 04-May-2009  yamt sync with head.
 1.61.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.63.6.1 18-Feb-2012  mrg merge to -current.
 1.63.2.2 30-Oct-2012  yamt sync with head
 1.63.2.1 17-Apr-2012  yamt sync with head
 1.64.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.68.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_kn20aa.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.6 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.5 13-Jun-1996  cgd clean up copyright notices
 1.4 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.3 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.2 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.1 23-Nov-1995  cgd branches: 1.1.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.1.4.1 13-Jun-1996  cgd pull up from trunk:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.45 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.44 31-Mar-2024  thorpej branches: 1.44.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.43 19-Jun-2021  thorpej No need to include pci_kn300.h here.
 1.42 14-Dec-2015  martin branches: 1.42.34;
Make it compile
 1.41 13-Dec-2015  christos PR/50523: David Binderman: Fix incorrect shifts.
 1.40 13-Oct-2012  jdc branches: 1.40.14;
Adapt to the changed signature of pckbc_cnattach().
 1.39 06-Feb-2012  matt branches: 1.39.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.38 14-Jun-2011  matt branches: 1.38.2; 1.38.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.37 14-Sep-2009  mhitch branches: 1.37.10;
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.36 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.35 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.34 04-Mar-2007  yamt branches: 1.34.44; 1.34.52; 1.34.54; 1.34.58; 1.34.62;
fix fallout from caddr_t changes.
 1.33 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 25-Feb-2006  thorpej branches: 1.32.20;
Use device_is_a().
 1.31 23-Feb-2006  thorpej Use device_parent().
 1.30 11-Dec-2005  christos branches: 1.30.2; 1.30.4; 1.30.6;
merge ktrace-lwp.
 1.29 28-Jun-2004  mycroft branches: 1.29.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.28 14-Jun-2003  thorpej branches: 1.28.2; 1.28.4;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.27 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.26 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.25 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.24 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.23 20-Aug-2001  wiz branches: 1.23.2; 1.23.14;
"wierd" is weird.
 1.22 05-Jun-2001  thorpej branches: 1.22.2;
Use symbolic names for the CTB terminal type field, rather than
hard-coded constants.
 1.21 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.20 02-May-2001  thorpej Determine the size of the B-Cache earier, and initialize the
number of page colors accordingly.
 1.19 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.18 19-Apr-2001  thorpej Add support for attaching "com" serial ports as KGDB devices.
 1.17 09-Jun-2000  soda branches: 1.17.4;
increase number of parameters of pckbc_cnattach(), since offset of command port
is not 4 (KBCMDP), but 1 on jazz based platforms of arc port.
 1.16 26-May-2000  thorpej branches: 1.16.2;
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.15 22-May-2000  thorpej Normalize determination of scsiboot and netboot.
 1.14 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.13 15-Apr-1999  thorpej branches: 1.13.2; 1.13.8;
Massive cleanup of the AlphaServer 4100 console initialization code.

Instead of using the PROM console until autoconfiguration is complete (at
which time we called dec_kn300_cons_init() directly!), make this work like
basically all of the other systems which have PCI attached consoles. That
is, initialize the PCI chipset which holds the console early, and perform
console initialization at the correct time.

This should make both PCI and ISA display consoles with PC keyboards work
(i.e. the deskside workstation version of the Rawhide).
 1.12 13-Feb-1999  thorpej branches: 1.12.2;
Fix printf format warnings on Alpha.
 1.11 19-Nov-1998  ross #include <machine/alpha.h>
 1.10 11-Nov-1998  mjacob more printf cleanups
 1.9 01-Nov-1998  mjacob fix botched printout format
 1.8 13-Jul-1998  ross Use the new cpu_mchkinfo().
 1.7 08-Jul-1998  mjacob tentative better fix for allocating the correct number of mchkinfo structs
 1.6 08-Jul-1998  mjacob Doh! Jason caught me being really stupid. There isn't necessarily
a linear 0..N mapping out of alpha_cpu_whami - which is what I was
using to index the new cpu machine check array. This is a quick hack
back to just using the first element while I think of a kinder function
that will do the function (per-platform) of whami->VIRTUAL CPU ID, which
if you think about it, is really necessary anyway.
 1.5 08-Jul-1998  mjacob Start of the platform specific (RAWHIDE) machine check handler. This
is not really needed for this platform, except that we might want to
handle PCI errors which get reported through here. In any case, this
prints out more info than is usual. Will probably need to detune
this to be based upon DIAGNOSTIC defines.
 1.4 05-May-1998  mjacob Move declaration within block where it will be used (in case
keyboard not defined).
 1.3 17-Apr-1998  mjacob Hmmm... handle the case where there is no keyboard configured (panic
if the console selection is asking for it). Also add the stuff that
was missing from dec_kn300.
 1.2 15-Apr-1998  mjacob add back in display console stuff
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.12.2.1 16-Apr-1999  thorpej branches: 1.12.2.1.2;
Pull up 1.12 -> 1.13.
 1.12.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.13.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.13.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.16.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.23.14.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.23.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.23.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.23.2.1 20-Aug-2001  nathanw file dec_kn300.c was added on branch nathanw_sa on 2002-09-17 21:12:39 +0000
 1.28.4.1 05-Jul-2004  he Pull up revision 1.29 (requested by mycroft in ticket #607):
Significantly cleanup and bug fix root device detection:
o On systems where it is relevant (6600, kin300, kn8ae),
check which PCI bus hierarchy we are looking at.
o Consistently check PCI function numbers (important for
quad-channel ATA controllers).
o Check logical unit numbers.
o Use strcasecmp() to check b->protocol; the case is
different depending on firmware revision.
o Remove b->boot_dec_type check, it is unneeded.
o Remove extraneous unneeded variables.
Fixes PR#9432, PR#12225, PR#25830 and multiple long-standing
bugs, and the code is smaller too.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.12.2 03-Sep-2007  yamt sync with head.
 1.29.12.1 21-Jun-2006  yamt sync with head.
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.1 01-Mar-2006  yamt sync with head.
 1.32.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.62.1 21-Apr-2010  matt sync to netbsd-5
 1.34.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.54.1 26-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1010):
sys/arch/alpha/alpha/dec_1000a.c: revision 1.29
sys/arch/alpha/alpha/dec_2100_a500.c: revision 1.19
sys/arch/alpha/alpha/dec_6600.c: revision 1.29
sys/arch/alpha/alpha/dec_kn300.c: revision 1.37
Add support for booting off a couple of common RAID adapters found on
several models of alpha systems: mlx [Mylex DAC060] and iop [I2O].
Addresses PR #25829.
 1.34.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.34.44.2 16-Sep-2009  yamt sync with head
 1.34.44.1 04-May-2009  yamt sync with head.
 1.37.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.38.6.1 18-Feb-2012  mrg merge to -current.
 1.38.2.2 30-Oct-2012  yamt sync with head
 1.38.2.1 17-Apr-2012  yamt sync with head
 1.39.6.2 03-Dec-2017  jdolecek update from HEAD
 1.39.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.40.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.42.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.44.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_kn300.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.1 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.45 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.44 31-Mar-2024  thorpej branches: 1.44.2;
Always call platform.device_register(), even if bootdev_data is NULL.
 1.43 04-Sep-2020  thorpej Include <sys/lwp.h>
 1.42 04-Nov-2013  christos remove unused variable
 1.41 06-Feb-2012  matt branches: 1.41.6; 1.41.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.40 14-Jun-2011  matt branches: 1.40.2; 1.40.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.39 14-Mar-2009  dsl branches: 1.39.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.38 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.37 04-Mar-2007  christos branches: 1.37.44; 1.37.52; 1.37.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.36 24-Jan-2007  hubertf branches: 1.36.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.35 25-Feb-2006  thorpej branches: 1.35.14;
Use device_is_a().
 1.34 23-Feb-2006  thorpej Use device_parent().
 1.33 11-Dec-2005  christos branches: 1.33.2; 1.33.4; 1.33.6;
merge ktrace-lwp.
 1.32 28-Jun-2004  mycroft branches: 1.32.12;
Significant cleanup and bug fix of root device detection:
* On systems where it's relevant (6600, kn300, kn8ae), check which PCI bus
hierarchy we're looking at.
* Consistently check PCI function numbers (important for quad-channel ATA
controllers).
* Check the channel number (important for ATA and multi-channel SCSI
controllers).
* Check logical unit numbers.
* Use strcasecmp() to check b->protocol; the case is different depending on
the firmware revision.
* Remove b->boot_dev_type check; it's unneeded.
* Remove extraneous unneeded variables.

Not only does this fix a few PRs and multiple long-standing bugs, but the
code is smaller too.

PR 9432
PR 12225
PR 25830
 1.31 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.30 27-Sep-2002  thorpej branches: 1.30.6;
Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.29 26-Sep-2002  thorpej Get the pointer to the driver name early, rather than always dereferencing
the cfdriver pointer.
 1.28 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.27 20-Aug-2001  wiz branches: 1.27.2; 1.27.14;
"wierd" is weird.
 1.26 12-Jul-2001  thorpej bzero -> memset
 1.25 25-Apr-2001  bouyer branches: 1.25.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.24 26-May-2000  thorpej branches: 1.24.6;
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.23 15-Apr-1999  thorpej branches: 1.23.2;
Add an empty dec_kn8ae_cons_init().
 1.22 13-Feb-1999  thorpej branches: 1.22.2;
Fix printf format warnings on Alpha.
 1.21 19-Nov-1998  ross #include <machine/alpha.h>
 1.20 13-Jul-1998  ross Use the new cpu_mchkinfo().
 1.19 08-Jul-1998  mjacob tentative better fix for allocating the correct number of mchkinfo structs
 1.18 08-Jul-1998  mjacob Doh! Jason caught me being really stupid. There isn't necessarily
a linear 0..N mapping out of alpha_cpu_whami - which is what I was
using to index the new cpu machine check array. This is a quick hack
back to just using the first element while I think of a kinder function
that will do the function (per-platform) of whami->VIRTUAL CPU ID, which
if you think about it, is really necessary anyway.
 1.17 08-Jul-1998  mjacob First (prelim placeholder) pass at machine check handler for tlsb
 1.16 15-Apr-1998  mjacob do not cia include files here
 1.15 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.14 17-Oct-1997  mjacob more compile foo
 1.13 16-Oct-1997  thorpej Adjust for new "com" driver home.
 1.12 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.11 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.10 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.9 23-Aug-1997  kleink bootp vs. mop: don't clobber `netboot' flag.
 1.8 07-Jun-1997  cgd branches: 1.8.2; 1.8.4;
remove extraneous, and now incorrect, cpu_decl()s.
 1.7 07-Apr-1997  cgd branches: 1.7.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.6 07-Apr-1997  cgd include machine/options.h
 1.5 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.4 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 21-Mar-1997  cgd fix check for bus number when root dev is behind PPB
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.7.2.4 22-Jul-1997  cgd remove XXX added in last sweep since this doesn't support display (yet)
 1.7.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 07-Apr-1997  cgd file dec_kn8ae.c was added on branch alpha-nwscons on 1997-06-01 04:11:19 +0000
 1.8.4.4 16-Oct-1997  thorpej Sync w/ trunk.
 1.8.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.2 26-Aug-1997  bouyer Update from trunk.
 1.8.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.22.2.1 16-Apr-1999  thorpej branches: 1.22.2.1.2;
Pull up 1.22 -> 1.23.
 1.22.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.23.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.23.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.24.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.25.2.3 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.25.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.25.2.1 03-Aug-2001  lukem update to -current
 1.27.14.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.27.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.27.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.27.2.1 20-Aug-2001  nathanw file dec_kn8ae.c was added on branch nathanw_sa on 2002-09-17 21:12:40 +0000
 1.30.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.6.1 03-Aug-2004  skrll Sync with HEAD
 1.32.12.3 03-Sep-2007  yamt sync with head.
 1.32.12.2 26-Feb-2007  yamt sync with head.
 1.32.12.1 21-Jun-2006  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 01-Mar-2006  yamt sync with head.
 1.35.14.1 01-Feb-2007  ad Sync with head.
 1.36.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.37.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.37.44.1 04-May-2009  yamt sync with head.
 1.39.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.40.6.1 18-Feb-2012  mrg merge to -current.
 1.40.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.40.2.1 17-Apr-2012  yamt sync with head
 1.41.10.1 18-May-2014  rmind sync with head
 1.41.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file dec_kn8ae.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 22-Nov-2000  bouyer Remove files that should not have been commited.
 1.1.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.42 03-Apr-2019  christos centralize setdisklabel(9)
 1.41 06-Feb-2012  matt branches: 1.41.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.40 14-Jun-2011  matt branches: 1.40.2; 1.40.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.39 16-Mar-2009  dsl branches: 1.39.10;
ANSIfy functions with function-pointer arguments
 1.38 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 02-Jan-2008  ad branches: 1.36.10; 1.36.18; 1.36.24;
Merge vmlocking2 to head.
 1.35 17-Oct-2007  garbled branches: 1.35.2; 1.35.4; 1.35.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.34 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.33 29-Jul-2007  ad branches: 1.33.4; 1.33.6; 1.33.8;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.32 04-Mar-2007  yamt branches: 1.32.2; 1.32.10; 1.32.12; 1.32.14;
fix fallout from caddr_t changes.
 1.31 25-Nov-2006  scw branches: 1.31.4;
Partition sizes are specified in terms of the physical sector size of the disk.
 1.30 25-Nov-2006  scw Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
 1.29 11-Dec-2005  christos branches: 1.29.20; 1.29.22;
merge ktrace-lwp.
 1.28 01-Jun-2005  drochner branches: 1.28.2;
add "const", and spellcheck a comment
 1.27 10-May-2003  thorpej branches: 1.27.2;
Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself. This paves the way for some future changes.
 1.26 02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.25 05-Mar-2002  simonb Don't cast argument to ffs() to long.
Per discussion on port-alpha, noticed by Robert Elz.
 1.24 19-Feb-2002  wiz strategy should have an 'r'. Inspired by similar change in OpenBSD.
 1.23 26-Dec-2001  ross include systm.h (for libkern.h (for ffs()))
 1.22 19-May-2001  tsutsui branches: 1.22.2; 1.22.4; 1.22.6;
Remove unneeded scsipi includes.
 1.21 20-Nov-2000  chs branches: 1.21.2;
rationalize the use of b_flags for geteblk() buffers.
rather than assigning to the whole field, set or clear individual flags,
which implies that the B_BUSY and B_INVAL flags will remain set.
this allows us to make the assertion in brelse() that B_BUSY is set,
which is the purpose of all this.
 1.20 19-May-2000  thorpej A foolish consistency; most parts of the kernel use bp->b_data, so
change these from bp->b_un.b_addr to bp->b_data, as well. This also
allows us more flexibility to experiment with other data buffer types
hung off of struct buf.
 1.19 16-May-2000  thorpej Nuke dk_establish() from orbit except from those ports which still use
it to determine the boot device: mvme68k, pc532, macppc, ofppc. Those
platforms should be changed to use device_register(). In the mean time,
those ports defined __BROKEN_DK_ESTABLISH.
 1.18 07-Mar-2000  tsutsui Use DISKPART/DISKMINOR/DISKUNIT instead of dkpart/dkminor/dkunit.
 1.17 18-Jan-2000  thorpej Use b_cylinder as defined in sys/buf.h
 1.16 15-Oct-1998  drochner branches: 1.16.12; 1.16.18;
Initialize default disklabel properly: Whole disk is RAW_PART, not 'a'.
 1.15 24-Aug-1998  tv egcs warning fixes, clean up `register'
 1.14 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.13 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.12 07-Apr-1997  cgd branches: 1.12.2; 1.12.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.11 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.10 03-Feb-1997  cgd clean up a bit, add bad144-handling code
 1.9 13-Nov-1996  cgd branches: 1.9.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 29-Apr-1996  cgd update for dk_establish() proto change
 1.5 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.4 07-Jan-1996  thorpej New generic disk framework. Highlights:

- New metrics handling. Metrics are now kept in the new
`struct disk'. Busy time is now stored as a timeval, and
transfer count in bytes.

- Storage for disklabels is now dynamically allocated, so that
the size of the disk structure is not machine-dependent.

- Several new functions for attaching and detaching disks, and
handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
 1.3 22-Apr-1995  cgd get rid of bogus header inclusions
 1.2 24-Mar-1995  cgd kill a couple of debugging printfs
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.16.18.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.16.12.2 22-Nov-2000  bouyer Sync with HEAD.
 1.16.12.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.22.6.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.22.6.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.22.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.22.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.22.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.22.4.1 19-May-2001  nathanw file disksubr.c was added on branch nathanw_sa on 2002-01-08 00:22:51 +0000
 1.22.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.22.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.4 21-Jan-2008  yamt sync with head
 1.28.2.3 27-Oct-2007  yamt sync with head.
 1.28.2.2 03-Sep-2007  yamt sync with head.
 1.28.2.1 30-Dec-2006  yamt sync with head.
 1.29.22.1 10-Dec-2006  yamt sync with head.
 1.29.20.1 12-Jan-2007  ad Sync with head.
 1.31.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.32.12.1 07-Aug-2007  matt Sync with HEAD.
 1.32.10.2 16-Oct-2007  garbled Sync with HEAD
 1.32.10.1 03-Oct-2007  garbled Sync with HEAD
 1.32.2.3 18-Oct-2007  ad Update for buffer cache changes.
 1.32.2.2 09-Oct-2007  ad Sync with head.
 1.32.2.1 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.33.8.1 14-Oct-2007  yamt sync with head.
 1.33.6.2 09-Jan-2008  matt sync with HEAD
 1.33.6.1 06-Nov-2007  matt sync with HEAD
 1.33.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.35.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.35.4.1 30-Dec-2007  ad Locking changes for alpha.
 1.35.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.36.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.18.1 28-Apr-2009  skrll Sync with HEAD.
 1.36.10.1 04-May-2009  yamt sync with head.
 1.39.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.40.6.1 18-Feb-2012  mrg merge to -current.
 1.40.2.1 17-Apr-2012  yamt sync with head
 1.41.48.1 10-Jun-2019  christos Sync with HEAD
 1.33 16-Mar-2025  thorpej Convert the 24 year-old "temporary trap shadow instrumentation" to use
event counters (so they're generally visible) and atomics to adjust them
(so they're not total jibberish on MP systems).
 1.32 16-Mar-2025  thorpej Add an alpha_fp_init() function, and move the initialization of
FP-related event counters there.

No functional change intended.
 1.31 21-Nov-2023  thorpej branches: 1.31.2;
Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.30 22-May-2022  andvar fix various small typos, mainly in comments.
 1.29 08-Dec-2021  andvar s/desireable/desirable/ in comments.
 1.28 04-Oct-2021  andvar remove duplicate the article in comments.
 1.27 23-Jul-2021  thorpej IEEE SQRTS / SQRTT is fix_float opclass 11, not fix_float opclass 10
(which is VAX SQRTF / SQRTG).
 1.26 23-Jul-2021  thorpej - Expose alpha_fp_complete_at() to callers outside fp_complete.c.
- Use ufetch_32() instead of copyin() to fetch the instruction.
 1.25 22-Jul-2021  thorpej Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.24 01-Sep-2020  thorpej branches: 1.24.6;
- compare_{le,lt)(): Use float64_{le,lt}_quiet() to avoid raising
exceptions on QNaNs.
- alpha_fp_interpret(): Instructions are 32-bits wide, so don't use a
uint64_t to contain them.
- alpha_fp_complete(): Operations on NaNs trap on Alpha, but the exception
summary reports INV (invalid operation) rather than SWC (software
completion) in this case. So also interpret the instruction if INV
is set in the exception summary. This will emulate operations on
NaN and correctly suppress FP traps for QNaNs.

This fixes bin/55633, which was caused by:

-> Input string "nanotime" is passed to awk's internal is_number().
-> strtod() interprets as "nan" and returns QNaN as the result.
-> Result compared against HUGE_VAL, blows up because cmptle is called
with a NaN operand, and the hardware doesn't care that it's quiet.
 1.23 25-Mar-2019  maxv branches: 1.23.4;
Remove compat_osf1, discussed on tech-kern@.
 1.22 31-Dec-2017  martin branches: 1.22.4;
PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.21 19-May-2014  matt branches: 1.21.20;
Update PCU_REENABLE for MP. For UP, add a KASSERT to make sure it's never
present.
 1.20 19-May-2014  matt When completing a FP trap, only load the FPU if we don't already own it.
While the FPU is on, disable kernel preemption.
 1.19 18-May-2014  martin No need to re-set MDLWP_FPACTIVE in the REENABLE case - it should be
set already.
 1.18 18-May-2014  martin Properly handle PCU_REENABLE in fpu_state_load. Hint from Nick Hudson.
This seems to help PR port-alpha/48782 a lot.
 1.17 16-May-2014  matt Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.16 16-May-2014  rmind pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.
 1.15 26-Dec-2012  matt branches: 1.15.2; 1.15.10;
Update to new pcu_state_{load,save,release} definitions
 1.14 06-Feb-2012  matt branches: 1.14.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.13 07-Jun-2011  matt branches: 1.13.2; 1.13.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.12 10-May-2008  martin branches: 1.12.20; 1.12.30;
Backout previous: the license sweep touched these files in error, so
restore the old license.
 1.11 28-Apr-2008  martin branches: 1.11.2;
Remove clause 3 and 4 from TNF licenses
 1.10 02-May-2006  drochner fix typo in comment
 1.9 24-Dec-2005  perry branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 04-Dec-2003  keihan branches: 1.7.16;
netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.6 17-Jan-2003  thorpej branches: 1.6.2;
Merge the nathanw_sa branch.
 1.5 18-Jan-2002  ross Fix bug which prevented SIGFPE delivery
 1.4 20-Aug-2001  wiz branches: 1.4.2;
"wierd" is weird.
 1.3 26-Apr-2001  ross branches: 1.3.2; 1.3.4;
Clean up 3 comments.
 1.2 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1 22-Apr-2001  ross branches: 1.1.2;
Add one-line placeholder for pending commit so diffs are complete.
 1.1.2.2 23-Apr-2001  bouyer Sync with HEAD.
 1.1.2.1 22-Apr-2001  bouyer file fp_complete.c was added on branch thorpej_scsipi on 2001-04-23 09:41:27 +0000
 1.3.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.4.2.1 20-Aug-2001  nathanw file fp_complete.c was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.9.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.10.1 11-May-2006  elad sync with head
 1.9.8.1 24-May-2006  yamt sync with head.
 1.9.6.1 01-Jun-2006  kardel Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.30.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.12.20.1 12-Jun-2011  rmind sync with head
 1.13.6.1 18-Feb-2012  mrg merge to -current.
 1.13.2.2 23-Jan-2013  yamt sync with head
 1.13.2.1 17-Apr-2012  yamt sync with head
 1.14.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.6.1 25-Feb-2013  tls resync with head
 1.15.10.1 10-Aug-2014  tls Rebase.
 1.15.2.1 18-May-2014  rmind sync with head
 1.21.20.1 26-Feb-2018  snj Pull up following revision(s) (requested by maya in ticket #584):
sys/arch/alpha/alpha/fp_complete.c: 1.22
sys/lib/libkern/softfloat.c: 1.6
sys/lib/libkern/softfloat.h: 1.5
PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.22.4.1 10-Jun-2019  christos Sync with HEAD
 1.23.4.1 02-Sep-2020  martin Pull up following revision(s) (requested by thorpej in ticket #1071):

sys/arch/alpha/alpha/fp_complete.c: revision 1.24

- compare_{le,lt)(): Use float64_{le,lt}_quiet() to avoid raising
exceptions on QNaNs.
- alpha_fp_interpret(): Instructions are 32-bits wide, so don't use a
uint64_t to contain them.
- alpha_fp_complete(): Operations on NaNs trap on Alpha, but the exception
summary reports INV (invalid operation) rather than SWC (software
completion) in this case. So also interpret the instruction if INV
is set in the exception summary. This will emulate operations on
NaN and correctly suppress FP traps for QNaNs.

This fixes bin/55633, which was caused by:
-> Input string "nanotime" is passed to awk's internal is_number().
-> strtod() interprets as "nan" and returns QNaN as the result.
-> Result compared against HUGE_VAL, blows up because cmptle is called
with a NaN operand, and the hardware doesn't care that it's quiet.
 1.24.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.31.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 04-Oct-1997  gwr use common genassym.awk
 1.3 23-Jul-1997  cgd branches: 1.3.2;
note differences in symbol names between ports (underscores). Also,
don't assume that the names/values to be put into defines in assym.h
start with the first .ascii in the assembler file; look for the array
start symbol, instead.
 1.2 23-Jul-1997  cgd clean up rcs id
 1.1 19-Jul-1997  cgd branches: 1.1.2;
convert to use a genassym.c that produces awk-able assembler output, a
la the sun3 port. This makes cross-compilation easier.
 1.1.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.1.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.1.2.1 19-Jul-1997  cgd file genassym.awk was added on branch alpha-nwscons on 1997-07-22 05:54:34 +0000
 1.3.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31 29-Nov-2000  jdolecek convert to use common genassym.cf
 1.30 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.29 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.28 26-May-2000  thorpej branches: 1.28.2;
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.27 26-May-2000  thorpej Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor. Test against SONPROC as appropriate rather than
combinations of SRUN and curproc. Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
 1.26 16-Dec-1999  thorpej Garbage-collect.
 1.25 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.24 10-Aug-1999  thorpej branches: 1.24.2; 1.24.8;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.23 01-Jul-1999  thorpej Const poison local printf() prototype.
 1.22 20-Apr-1999  thorpej Back out previous; we're going to dispatch to the debugger differently.
 1.21 19-Apr-1999  thorpej Define BPT and BUGCHK Intruction Fault codes.
 1.20 23-Feb-1999  thorpej branches: 1.20.4;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.19 29-Sep-1998  thorpej Define the offset of hwrpb->rpb_primary_cpu_id.
 1.18 13-Sep-1998  thorpej Make signal delivery work again.
 1.17 31-Dec-1997  thorpej Remove a couple of unneeded VM-related headers.
 1.16 17-Oct-1997  mjacob Add in missing includes.
 1.15 02-Sep-1997  thorpej Garbage-collect VM_PMAP_STPTE, USTP_OFFSET, VM_PMAP. Define VM_MAP_PMAP
instead.
 1.14 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.13 23-Jul-1997  cgd branches: 1.13.2;
clean up RCS id. also, use __RCSID rather than __KERNEL_RCSID, since
this file isn't actually compiled into the kernel.
 1.12 19-Jul-1997  cgd convert to use a genassym.c that produces awk-able assembler output, a
la the sun3 port. This makes cross-compilation easier.
 1.11 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.10 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.9 20-Aug-1996  cgd branches: 1.9.2;
OLD_PMAP -> NEW_PMAP
 1.8 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Add machinery to make [fs]uswintr be a bit more careful when
determining if a fault was actually their fault. (Unfortunately, they're
not actually implemented now, anyway.)
 1.7 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.6 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.5 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.4 17-May-1996  cgd fix declaration of main()
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.9.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.20.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.24.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.24.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.28.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31 05-Feb-2024  andvar triple "r" typos, mainly s/interrrupt/interrupt/ in comments and one definition.
 1.30 12-Jul-2021  thorpej Optimized fast-paths for mutex_spin_enter() and mutex_spin_exit().
 1.29 11-Jul-2021  thorpej Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().
 1.28 11-Jul-2021  thorpej Define ALPHA_PGBYTES (missed in prior commit).
 1.27 19-Sep-2020  thorpej branches: 1.27.6;
Move softintr bits into <machine/intr.h> and define ALPHA_ALL_SOFTINTS
for locore.s
 1.26 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.25 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.24 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.23 03-Sep-2020  thorpej The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE). We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.
 1.22 20-Feb-2020  skrll G/C
 1.21 06-Apr-2019  thorpej branches: 1.21.6;
Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.20 07-Jun-2011  matt branches: 1.20.54;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.19 15-Dec-2010  matt branches: 1.19.6;
Remove unneeded <uvm/uvm.h> include
 1.18 10-Dec-2009  rmind branches: 1.18.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.17 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.16 20-Sep-2008  tsutsui Remove advertising clause for UCB in various genassym.cf files,
which were derived from genassym.c in 4.4BSD-Lite2 (or 386BSD).
Closes PR misc/39573. Approved by martin@.
 1.15 17-Oct-2007  garbled branches: 1.15.16; 1.15.20; 1.15.22; 1.15.26;
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.14 17-May-2007  yamt branches: 1.14.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.13 09-Feb-2007  ad branches: 1.13.2; 1.13.6; 1.13.8; 1.13.14;
Merge newlock2 to head.
 1.12 11-Dec-2005  christos branches: 1.12.20;
merge ktrace-lwp.
 1.11 28-Mar-2004  he branches: 1.11.16;
Adapt to the removal of __HAVE_SIGINFO, assume that we always have it now.
 1.10 04-Nov-2003  dsl Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
 1.9 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.8 08-Apr-2003  thorpej branches: 1.8.2;
Don't use NBPG.
 1.7 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 26-Sep-2002  thorpej Remove <sys/map.h>
 1.5 18-Sep-2002  thorpej Add support for restartable atomic sequences. Rearragne the tail
of cpu_switch() slightly so we can reenable interrupts a little
earlier.
 1.4 29-Apr-2001  thorpej branches: 1.4.2; 1.4.4; 1.4.12;
Add glue for page zero'ing in the idle loop.
 1.3 19-Jan-2001  thorpej branches: 1.3.2;
Make ASTs per-process.
 1.2 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.1 29-Nov-2000  jdolecek branches: 1.1.2;
convert to use common genassym.cf
 1.1.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 29-Nov-2000  bouyer file genassym.cf was added on branch thorpej_scsipi on 2000-12-08 09:23:22 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.12.2 22-Mar-2002  thorpej * Fix the tail-calls to the slow-path.
* Handle MUTEX_DEBUG.
 1.4.12.1 17-Mar-2002  thorpej Allocate proc0 in machine-dependent code (can't specify align(16) in
C code on x86).
 1.4.4.5 11-Dec-2002  thorpej Add missing L_MD_TF define (oops, how did this linger for so long...)
 1.4.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.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.4.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.4.4.1 29-Apr-2001  nathanw file genassym.cf was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.4.2.1 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.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.16.2 03-Sep-2007  yamt sync with head.
 1.11.16.1 26-Feb-2007  yamt sync with head.
 1.12.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.13.14.1 22-May-2007  matt Update to HEAD.
 1.13.8.1 11-Jul-2007  mjf Sync with head.
 1.13.6.1 27-May-2007  ad Sync with head.
 1.13.2.3 20-Apr-2007  yamt cpu_switchto:
- update curlwp.
- don't bother to clear ci_want_resched.
 1.13.2.2 23-Mar-2007  yamt remove L_FORW and L_BACK.
 1.13.2.1 20-Mar-2007  yamt adapt alpha.
 1.14.10.1 06-Nov-2007  matt sync with HEAD
 1.15.26.1 19-Oct-2008  haad Sync with HEAD.
 1.15.22.1 10-Oct-2008  skrll Sync with HEAD.
 1.15.20.2 11-Mar-2010  yamt sync with head
 1.15.20.1 04-May-2009  yamt sync with head.
 1.15.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.18.4.2 12-Jun-2011  rmind sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.54.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.20.54.1 10-Jun-2019  christos Sync with HEAD
 1.21.6.1 29-Feb-2020  ad Sync with head.
 1.27.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.15 25-Jan-2008  joerg Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.14 04-Mar-2007  christos branches: 1.14.20; 1.14.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 11-Dec-2005  christos branches: 1.13.26;
merge ktrace-lwp.
 1.12 07-Aug-2003  agc branches: 1.12.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 19-May-2001  thorpej branches: 1.11.4; 1.11.24;
Brain'o in last. Pointed out by Steve Woodford <scw@netbsd.org>.
 1.10 19-May-2001  thorpej Don't compute psuedo header checksum if nxt == 0.
 1.9 29-Apr-2001  thorpej Disable the optimized in4_cksum() for now -- there seem to be problems.
 1.8 29-Apr-2001  thorpej Optimized in4_cksum().
 1.7 02-Sep-1997  thorpej branches: 1.7.30;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 07-Apr-1997  cgd branches: 1.6.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 13-Nov-1996  cgd branches: 1.4.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.3 30-May-1996  cgd Fix from Matt Thomas to fix problem where packets like
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01 would be checksummed
incorrectly: rather than adding two 32-bit quantities together to
sum a quadword (which was losing a carry bit), add as four 16-bit
quantities.
 1.2 19-May-1996  cgd branches: 1.2.4;
minor cleanups, mostly KNF.
 1.1 19-May-1996  cgd Tuned in_cksum() from Matt Thomas <matt@3am-software.com>. According
to him, this implementation is approximately 50% faster than the
machine-independent portable version.
 1.2.4.1 30-May-1996  cgd Pull up from trunk:
>Fix from Matt Thomas to fix problem where packets like
>0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01 would be checksummed
>incorrectly: rather than adding two 32-bit quantities together to
>sum a quadword (which was losing a carry bit), add as four 16-bit
>quantities.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.30.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.24.1 03-Aug-2004  skrll Sync with HEAD
 1.11.4.2 19-May-2001  thorpej Brain'o in last. Pointed out by Steve Woodford <scw@netbsd.org>.
 1.11.4.1 19-May-2001  thorpej file in_cksum.c was added on branch nathanw_sa on 2001-05-19 14:21:14 +0000
 1.12.16.2 04-Feb-2008  yamt sync with head.
 1.12.16.1 03-Sep-2007  yamt sync with head.
 1.13.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.20.1 23-Mar-2008  matt sync with HEAD
 1.100 10-Nov-2021  msaitoh s/suport/support/ in comment.
 1.99 16-Jul-2021  thorpej The Alpha AXP Architecture Reference Manual is explcit that the only
valid bits in the PSL are the IPL and USER bits, the latter of which
will always be clear when in the kernel, and that all other bits MBZ.
So, when reading the PSL to get the current IPL, don't bother masking
with ALPHA_PSL_IPL_MASK.
 1.98 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.97 05-May-2021  thorpej Disable preemption around the main work of badaddr_read() and delay();
they both use "current CPU" resources.
 1.96 05-May-2021  thorpej Make scb_strat() static.
 1.95 20-Apr-2021  thorpej branches: 1.95.2;
Don't use atomics to manipulate cpu_info::ci_intrdepth: it's modified
only in the interrupt service path by the owning CPU, at entry and exit.
Even if the r/m/w cycle of incrementing the value were interrupted, the
result would still be the same because the interrupting frame will have
completed its own symmetrical increment/decrement cycle upon return.
 1.94 20-Apr-2021  thorpej Slight tweak to previous changes:

Rather than simply increment the interrupt depth for the clock interrupt,
we add 0x10. Why? Because while we only use a single Alpha IPL (4) for
IPL_{BIO,NET,TTY,VM}, technically the architecture specification suports
two in the OSF/1 PALcode (3 [low-pri] and 4 [high-pri]), meaning we could
conceiveably have intrdepth > 1 just for device interrupts.

Adding 0x10 here means that cpu_intr_p() can check for "intrdepth != 0" for
"in interrupt context" and CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
"was processing interrupts when the clock interrupt happened".
 1.93 15-Apr-2021  rin Contrary to comment here, nowadays hardclock() and statclock() should be
called with cpu_intr_p() is turning on, if used from the interrupt context.

Otherwise, entropy_enter() is used instead of entropy_enter_intr(), which
results in KASSERT() failure.

Therefore, bump ci_intrdepth for clock interrupt. Remove stale comment also.
 1.92 10-Oct-2020  thorpej branches: 1.92.4;
Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.91 26-Sep-2020  thorpej Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.90 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.89 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.88 19-Sep-2020  thorpej Enable __HAVE_FAST_SOFTINTS and garbage-collect the #ifdefs.
 1.87 19-Sep-2020  thorpej Move softintr bits into <machine/intr.h> and define ALPHA_ALL_SOFTINTS
for locore.s
 1.86 17-Sep-2020  thorpej Reduce the __HAVE_FAST_SOFTINTS #ifdef perimeter.
 1.85 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.84 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.83 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.82 29-Aug-2020  thorpej In ipl2psl_table[], use IPL_SCHED instead of IPL_CLOCK (the legacy name),
and add a comment noting that this is the level IPIs come in with on
alpha.
 1.81 17-Jan-2016  martin PR port-alpha/50667: add missing va_start/va_end.
 1.80 06-Feb-2012  matt branches: 1.80.6; 1.80.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.79 20-Dec-2010  matt branches: 1.79.8; 1.79.12;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.78 28-Apr-2008  martin branches: 1.78.22;
Remove clause 3 and 4 from TNF licenses
 1.77 10-Mar-2008  ad branches: 1.77.2; 1.77.4;
Use MI atomic operations.
 1.76 03-Dec-2007  ad branches: 1.76.10; 1.76.14;
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.75 17-Oct-2007  garbled branches: 1.75.2;
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.74 21-Jul-2007  tsutsui branches: 1.74.4; 1.74.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.73 17-May-2007  yamt branches: 1.73.2; 1.73.4;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.72 09-Feb-2007  ad branches: 1.72.2; 1.72.6; 1.72.8; 1.72.12; 1.72.14;
Merge newlock2 to head.
 1.71 12-Jan-2007  ad Define ipl_cookie_t._psl as uint8_t so that it can be packed into a
word with other seldomly written fields.
 1.70 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.69 24-Dec-2005  perry branches: 1.69.20; 1.69.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.68 11-Dec-2005  christos merge ktrace-lwp.
 1.67 29-Oct-2005  yamt pull splraiseipl() from newlock branch.
 1.66 05-Feb-2003  nakayama branches: 1.66.2; 1.66.18; 1.66.20;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.65 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.64 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.63 27-Jul-2001  thorpej branches: 1.63.2; 1.63.10;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.62 03-Jul-2001  nathanw branches: 1.62.2;
The machine check error code is reliably located at an offset of 0x10
in the logout frame. Print it for all fatal machine checks on all
models.
 1.61 27-May-2001  sommerfeld Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.60 14-May-2001  ross o Deal with stray machine checks
o Add for alpha a security-sensitive rate-limiting printf(9) wrapper based
on ratecheck(9): void rlprintf(struct timeval *t, const char *fmt, ...);
 1.59 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.58 15-Apr-2001  thorpej In splx(), don't call spl0() unless the ssir != 0.
 1.57 15-Apr-2001  thorpej Clean up soft interrupt related stuff a bit.
 1.56 14-Apr-2001  thorpej Change the softintr implementation to be a bit more cache friendly
(though, sigh, slightly more expensive at softintr_schedule() time).
 1.55 15-Jan-2001  thorpej branches: 1.55.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.54 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.53 20-Nov-2000  thorpej Move IPI processing into a separate function.
 1.52 18-Nov-2000  thorpej Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.51 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.50 02-Jul-2000  cgd Kwality control:
* put #includes of opt headers and headers to get protos used by
net/netisr_dispatch.h in net/netisr.h (if !defined(_LOCORE)) (rather than
in netisr_dispatch.h itself, and potentially nowhere, respectively).
* require netisr.h to be included before netisr_dispatch.h.
* minor additional cleanup of both netisr.h and netisr_dispatch.h.
* clean up uses to remove now-unnecessary header file inclusions, and
local prototypes of the fns.
* convert netisr dispatch implementations which didn't use
netisr_dispatch.h (pc532) to use it.
 1.49 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.48 05-Jun-2000  thorpej branches: 1.48.2;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.47 04-Jun-2000  thorpej Increment an interrupt depth counter in non-clock interrupt cases
so that we can get time spent in interrupt statistics.
 1.46 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.45 26-May-2000  thorpej branches: 1.45.2;
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.44 23-May-2000  thorpej Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.43 29-Feb-2000  thorpej Reset mc_received after we've done a badaddr probe.
 1.42 07-Dec-1999  thorpej When doing a badaddr check, insert an extra `mb', which is highly magic
on some systems (due to quirky bus adapters).
 1.41 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.40 10-Aug-1999  thorpej branches: 1.40.2; 1.40.8;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.39 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.38 28-Feb-1999  ross schedclk() -> schedclock(), for consistency with hardclock(), statclock(), ...
update comments for recent scheduler mods
 1.37 24-Feb-1999  thorpej Fix an uninitialized variable.
 1.36 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.35 23-Feb-1999  ross Scheduler bug fixes and reorganization
* fix the ancient nice(1) bug, where nice +20 processes incorrectly
steal 10 - 20% of the CPU, (or even more depending on load average)
* provide a new schedclk() mechanism at a new clock at schedhz, so high
platform hz values don't cause nice +0 processes to look like they are
niced
* change the algorithm slightly, and reorganize the code a lot
* fix percent-CPU calculation bugs, and eliminate some no-op code

=== nice bug === Correctly divide the scheduler queues between niced and
compute-bound processes. The current nice weight of two (sort of, see
`algorithm change' below) neatly divides the USRPRI queues in half; this
should have been used to clip p_estcpu, instead of UCHAR_MAX. Besides
being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op,
and it was done after decay_cpu() which can only _reduce_ the value. It
has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can
scheduler-penalize themselves onto the same queue as nice +20 processes.
(Or even a higher one.)

=== New schedclk() mechansism === Some platforms should be cutting down
stathz before hitting the scheduler, since the scheduler algorithm only
works right in the vicinity of 64 Hz. Rather than prescale hz, then scale
back and forth by 4 every time p_estcpu is touched (each occurance an
abstraction violation), use p_estcpu without scaling and require schedhz
to be generated directly at the right frequency. Use a default stathz (well,
actually, profhz) / 4, so nothing changes unless a platform defines schedhz
and a new clock. Define these for alpha, where hz==1024, and nice was
totally broke.

=== Algorithm change === The nice value used to be added to the
exponentially-decayed scheduler history value p_estcpu, in _addition_ to
be incorporated directly (with greater wieght) into the priority calculation.
At first glance, it appears to be a pointless increase of 1/8 the nice
effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that
because it will ramp up linearly but be decayed only exponentially, thus
converging to an additional .75 nice for a loadaverage of one. I killed
this, it makes the behavior hard to control, almost impossible to analyze,
and the effect (~~nothing at for the first second, then somewhat increased
niceness after three seconds or more, depending on load average) pointless.

=== Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation.
Collect scheduler functionality. Try to put each abstraction in just one
place.
 1.34 19-Nov-1998  ross #include <machine/intrcnt.h>
#include <machine/alpha.h>
g/c some EVCNT_COUNTERS stuff.
 1.33 29-Sep-1998  thorpej some temporary debugging printfs in the IPI code.
 1.32 29-Sep-1998  drochner make compile w/o MULTIPROCESSOR
 1.31 29-Sep-1998  thorpej Don't process CLOCK or DEVICE interrupts if we're not the primary CPU.
 1.30 26-Sep-1998  thorpej Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP.

XXX HALT is not yet implemented, it's just a stub.
 1.29 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.28 13-Jul-1998  ross Use the new cpu_mchkinfo().
 1.27 13-Jul-1998  ross 1. Don't deref zero on early machine checks.
2. Revert last week's non-KNF {} editing.
 1.26 08-Jul-1998  mjacob tentative better fix for allocating the correct number of mchkinfo structs
 1.25 08-Jul-1998  mjacob Doh! Jason caught me being really stupid. There isn't necessarily
a linear 0..N mapping out of alpha_cpu_whami - which is what I was
using to index the new cpu machine check array. This is a quick hack
back to just using the first element while I think of a kinder function
that will do the function (per-platform) of whami->VIRTUAL CPU ID, which
if you think about it, is really necessary anyway.
 1.24 08-Jul-1998  mjacob use new mchkinfo structures for expect/recv storage
 1.23 24-Feb-1998  thorpej Add support for UVM.
 1.22 19-Nov-1997  mjacob copyright foo
 1.21 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.20 13-Sep-1997  thorpej Don't panic if we receive a Processor Correctable Error or a System
Correctable Error; report them, instead.

XXX Need a platform-specific machine check handler so we can decode the
logout area on such errors.
 1.19 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18 07-Apr-1997  cgd branches: 1.18.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 07-Apr-1997  cgd include machine/options.h
 1.16 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.15 12-Mar-1997  cgd from Matt Jacob: deal with type 5 (passive release?) interrupts. (ignore them
but print out their vector(?) to see if we can ever discern anything useful
from it.) Also, some slight general cleanup.
 1.14 13-Nov-1996  cgd branches: 1.14.2;
update copyright dates
 1.13 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.12 13-Oct-1996  cgd increment cnt.v_intr for I/O device and clock interrupts
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 14-Jul-1996  cgd (1) Restructure and improve machine check and correctable error
handling based on information in the 2nd Ed. of the Alpha Architecture
Reference Manual.
(2) Clean up interrupt handling slightly.
(3) Clean up badaddr().
 1.8 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.7 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 23-Apr-1996  cgd Changes from Trevor Mendez <tmendez@bbn.com> to print 0x's before hex
numbers when panic()ing because of a machine check, for sanity.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd MB -> wbflush
 1.2 28-Jun-1995  cgd sync with my current Alpha sources
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.14.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.14.2.2 07-Jun-1997  cgd sync alpha-nwscons branch with changes in -current
 1.14.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.18.2.4 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.2.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.40.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.40.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.40.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.40.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.40.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.40.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.45.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.48.2.1 15-May-2001  he Pull up revision 1.60 (via patch, requested by ross):
Deal with stray machine checks.
 1.55.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.62.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.62.2.1 03-Aug-2001  lukem update to -current
 1.63.10.1 10-Mar-2002  thorpej Adjustments for new mutex routines:
* Make all the IPL_* constants meaningful within a single number domain.
* Use new SI_* constants to number the soft interrupt queues, rather than
IPL_SOFT*.
* Add splraiseipl() for use by kern_mutex.c. Usage is e.g.
splraiseipl(IPL_BIO).
 1.63.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.63.2.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.63.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.63.2.1 27-Jul-2001  nathanw file interrupt.c was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.66.20.1 02-Nov-2005  yamt sync with head.
 1.66.18.6 17-Mar-2008  yamt sync with head.
 1.66.18.5 07-Dec-2007  yamt sync with head
 1.66.18.4 03-Sep-2007  yamt sync with head.
 1.66.18.3 26-Feb-2007  yamt sync with head.
 1.66.18.2 30-Dec-2006  yamt sync with head.
 1.66.18.1 21-Jun-2006  yamt sync with head.
 1.66.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.69.22.1 18-Sep-2006  yamt implement new api for alpha.
 1.69.20.2 12-Jan-2007  ad Sync with head.
 1.69.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.72.14.2 03-Oct-2007  garbled Sync with HEAD
 1.72.14.1 22-May-2007  matt Update to HEAD.
 1.72.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.72.8.1 11-Jul-2007  mjf Sync with head.
 1.72.6.6 03-Dec-2007  ad Sync with HEAD.
 1.72.6.5 03-Dec-2007  ad Sync with HEAD.
 1.72.6.4 18-Oct-2007  ad More interrupt changes; collapse the symbolic levels down to the ones
that we actually need (none, soft, vm, sched, high) but retain aliases
like IPL_BIO for now.
 1.72.6.3 18-Oct-2007  ad Interrupt stuff for alpha (but no fast softints yet).
 1.72.6.2 20-Aug-2007  ad Sync with HEAD.
 1.72.6.1 27-May-2007  ad Sync with head.
 1.72.2.1 20-Mar-2007  yamt adapt alpha.
 1.73.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.73.2.1 07-Aug-2007  matt Sync with HEAD.
 1.74.6.3 23-Mar-2008  matt sync with HEAD
 1.74.6.2 09-Jan-2008  matt sync with HEAD
 1.74.6.1 06-Nov-2007  matt sync with HEAD
 1.74.4.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.75.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.76.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.76.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.76.10.1 24-Mar-2008  keiichi sync with head.
 1.77.4.1 16-May-2008  yamt sync with head.
 1.77.2.1 18-May-2008  yamt sync with head.
 1.78.22.1 05-Mar-2011  rmind sync with head
 1.79.12.1 18-Feb-2012  mrg merge to -current.
 1.79.8.1 17-Apr-2012  yamt sync with head
 1.80.24.1 19-Mar-2016  skrll Sync with HEAD
 1.80.6.1 03-Dec-2017  jdolecek update from HEAD
 1.92.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.95.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.95.2.1 13-May-2021  thorpej Sync with HEAD.
 1.55 09-Apr-2022  riastradh alpha: Convert ipifuncs.c to membar_release/acquire.

No semantic change is possible because all of these membars are just
mb on alpha -- change just makes the intent clearer. (Only
membar_producer is weaker, wmb.)
 1.54 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.53 03-Sep-2020  thorpej - alpha_ipi_process(): Continue processing IPIs until the ipimask
reads 0. Issue a memory barrier between the atomic swap and performing
the work.
- alpha_send_ipi(): Issue a memory barrier before setting the ipimask
to ensure all memory accesses prior to signalling the IPI have
completed. Also issue a memory barrier getween setting the ipimask
and calling PALcode to write the IPIR.
 1.52 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.51 15-Aug-2020  thorpej Convert some #ifdef DIAGNOSTIC checks to KASSERTs. NFCI.
 1.50 01-Dec-2019  ad Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.
 1.49 21-Nov-2019  ad alpha_ipi_ast: use ci_data.cpu_onproc, not ci_curlwp.
 1.48 19-May-2014  rmind branches: 1.48.28;
Implement MI IPI interface with cross-call support.
 1.47 14-Jun-2011  matt branches: 1.47.12; 1.47.26;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.46 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.45 17-Dec-2010  joerg branches: 1.45.6;
Fix build by pulling in uvm/uvm_extern.h.
 1.44 15-Dec-2010  matt remove unneeded <uvm/uvm_extern.h> includes
 1.43 23-Jun-2010  rmind Fix build for Alpha.
 1.42 22-Jun-2010  rmind Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight. Will be used for passive serialization.

OK ad@.
 1.41 26-Oct-2009  thorpej branches: 1.41.2; 1.41.4;
Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.40 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.39 10-Mar-2008  ad branches: 1.39.2; 1.39.4;
Use MI atomic operations.
 1.38 04-Feb-2008  ad branches: 1.38.2; 1.38.6;
Don't call printf from an IPI handler.
 1.37 17-Oct-2007  garbled branches: 1.37.2;
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.36 21-Jul-2007  tsutsui branches: 1.36.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.35 17-May-2007  yamt branches: 1.35.2; 1.35.4;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.34 09-Feb-2007  ad branches: 1.34.2; 1.34.6; 1.34.8; 1.34.12; 1.34.14;
Merge newlock2 to head.
 1.33 05-Feb-2003  nakayama branches: 1.33.18; 1.33.48;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.32 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.31 28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.30 15-Jul-2001  thorpej branches: 1.30.2; 1.30.4;
- Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.29 01-May-2001  thorpej branches: 1.29.2;
Use CPU_INFO_FOREACH().
 1.28 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.27 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.26 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.25 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.24 19-Jan-2001  thorpej branches: 1.24.2;
Make ASTs per-process.
 1.23 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.22 20-Nov-2000  thorpej Move IPI processing into a separate function.
 1.21 19-Nov-2000  sommerfeld Fix obvious typo (don't mark current cpu as not running when doing a
broadcast IPI).
 1.20 18-Nov-2000  thorpej Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.19 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.18 26-Aug-2000  thorpej Thinko in previous.
 1.17 26-Aug-2000  thorpej Snapshot of TLB shootdown bugfixes.
 1.16 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.15 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.14 13-Aug-2000  thorpej Add alpha_multicast_ipi().
 1.13 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.11 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.10 23-May-2000  thorpej branches: 1.10.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.9 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.8 30-Nov-1999  thorpej Vector to a local function for the IMB IPI.
 1.7 29-Nov-1999  thorpej Add an IPI which causes the target CPU to perform AST processing when
it returns to userspace.
 1.6 10-Aug-1999  thorpej branches: 1.6.2; 1.6.8;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.5 24-Feb-1999  thorpej Restructure the IPI code a little, allowing multiple IPIs to be sent at
once. Add a way to broadcast an IPI to all processors (except the sender,
obviously). Add an IPI for TLB shootdown.
 1.4 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.3 29-Sep-1998  thorpej some temporary debugging printfs in the IPI code.
 1.2 29-Sep-1998  thorpej First try at a HALT interprocessor interrupt handler.
 1.1 26-Sep-1998  thorpej Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP.

XXX HALT is not yet implemented, it's just a stub.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.6.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.6.2.2 22-Nov-2000  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.10.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.24.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.1 03-Aug-2001  lukem update to -current
 1.30.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.30.2.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.30.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.30.2.1 15-Jul-2001  nathanw file ipifuncs.c was added on branch nathanw_sa on 2001-10-08 20:10:43 +0000
 1.33.48.1 11-Jan-2007  ad Checkpoint work in progress.
 1.33.18.4 17-Mar-2008  yamt sync with head.
 1.33.18.3 11-Feb-2008  yamt sync with head.
 1.33.18.2 03-Sep-2007  yamt sync with head.
 1.33.18.1 26-Feb-2007  yamt sync with head.
 1.34.14.2 03-Oct-2007  garbled Sync with HEAD
 1.34.14.1 22-May-2007  matt Update to HEAD.
 1.34.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.34.8.1 11-Jul-2007  mjf Sync with head.
 1.34.6.2 20-Aug-2007  ad Sync with HEAD.
 1.34.6.1 27-May-2007  ad Sync with head.
 1.34.2.1 20-Mar-2007  yamt adapt alpha.
 1.35.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.35.2.1 07-Aug-2007  matt Sync with HEAD.
 1.36.6.2 23-Mar-2008  matt sync with HEAD
 1.36.6.1 06-Nov-2007  matt sync with HEAD
 1.37.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.38.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.38.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.2.1 24-Mar-2008  keiichi sync with head.
 1.39.4.3 11-Aug-2010  yamt sync with head.
 1.39.4.2 11-Mar-2010  yamt sync with head
 1.39.4.1 16-May-2008  yamt sync with head.
 1.39.2.1 18-May-2008  yamt sync with head.
 1.41.4.2 12-Jun-2011  rmind sync with head
 1.41.4.1 03-Jul-2010  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.45.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.47.26.1 10-Aug-2014  tls Rebase.
 1.47.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.28.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 15-Dec-2010  matt remove unneeded <uvm/uvm_extern.h> includes
 1.6 11-Jan-2009  cegger branches: 1.6.6;
adaption for making kgdb_dev a dev_t
 1.5 28-Apr-2008  martin branches: 1.5.8;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.74; 1.4.76; 1.4.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 14-Jun-2003  thorpej branches: 1.3.18;
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
 1.2 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.1 19-Apr-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
KGDB glue for NetBSD/alpha.
 1.1.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.8.1 19-Apr-2001  nathanw file kgdb_machdep.c was added on branch nathanw_sa on 2002-01-08 00:22:51 +0000
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 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 19-Apr-2001  bouyer file kgdb_machdep.c was added on branch thorpej_scsipi on 2001-04-21 17:53:02 +0000
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.4.78.2 04-May-2009  yamt sync with head.
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.6.1 05-Mar-2011  rmind sync with head
 1.4 28-Apr-2023  skrll Pass local symbols relocations in both passes and provide the kobj_reloc
implementation visibility of these relocations.

Currently all implementations resolve local symbol relocations in the first
pass and simply skip them in the second. The RISC-V implementation will
make use of this visiblity.
 1.3 03-Nov-2017  maxv Handle absolute relocations coming from the kernel: preserve SHN_ABS in
the kernel and module symbols, and when relocating a symbol that has
SHN_ABS, take its value as-is and don't return an error if it equals zero.

Sent on tech-kern@.
 1.2 28-Apr-2008  martin branches: 1.2.44;
Remove clause 3 and 4 from TNF licenses
 1.1 04-Jan-2008  ad branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.16; 1.1.18;
Linker bits for alpha.
 1.1.18.1 16-May-2008  yamt sync with head.
 1.1.16.1 18-May-2008  yamt sync with head.
 1.1.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.8.1 04-Jan-2008  mjf file kobj_machdep.c was added on branch mjf-devfs on 2008-02-18 21:04:19 +0000
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 04-Jan-2008  yamt file kobj_machdep.c was added on branch yamt-lazymbuf on 2008-01-21 09:35:07 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 04-Jan-2008  matt file kobj_machdep.c was added on branch matt-armv6 on 2008-01-09 01:44:32 +0000
 1.1.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 04-Jan-2008  bouyer file kobj_machdep.c was added on branch bouyer-xeni386 on 2008-01-08 22:09:09 +0000
 1.2.44.1 03-Dec-2017  jdolecek update from HEAD
 1.4 12-Feb-2011  matt Use .pushsection/.popsection for __KERNEL_RCSID/__KERNEL_COPYRIGHT.
Add an explicit .text to linux_sigcode.s
 1.3 28-Apr-2008  martin branches: 1.3.22; 1.3.28; 1.3.30;
Remove clause 3 and 4 from TNF licenses
 1.2 13-May-2002  thorpej branches: 1.2.112; 1.2.114; 1.2.116;
Make the sigcode no-profile.
 1.1 27-Nov-2000  jdolecek branches: 1.1.2; 1.1.4; 1.1.6;
split linux signal code off locore.s
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 27-Nov-2000  bouyer file linux_sigcode.s was added on branch thorpej_scsipi on 2000-12-08 09:23:23 +0000
 1.2.116.1 16-May-2008  yamt sync with head.
 1.2.114.1 18-May-2008  yamt sync with head.
 1.2.112.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.30.1 17-Feb-2011  bouyer Sync with HEAD
 1.3.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.22.1 05-Mar-2011  rmind sync with head
 1.34 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.33 07-Mar-2015  christos Adjust to new trace_{enter,exit} signature.
 1.32 06-Feb-2012  matt branches: 1.32.6; 1.32.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.31 20-Dec-2010  matt branches: 1.31.8; 1.31.12;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.30 21-Nov-2009  rmind branches: 1.30.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.29 21-Oct-2008  ad Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.
 1.28 21-Oct-2008  ad Undo revivesa damage to userret().
 1.27 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.26 28-Apr-2008  martin branches: 1.26.2; 1.26.6;
Remove clause 3 and 4 from TNF licenses
 1.25 24-Apr-2008  ad branches: 1.25.2;
- Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
 1.24 06-Feb-2008  dsl branches: 1.24.6; 1.24.8;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53
 1.23 05-Jan-2008  dsl Don't pass 'curlwp' into trace_enter() and trace_exit().
 1.22 04-Mar-2007  christos branches: 1.22.20; 1.22.26; 1.22.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 09-Feb-2007  ad branches: 1.21.2;
Merge newlock2 to head.
 1.20 19-Jul-2006  ad branches: 1.20.4;
- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
 1.19 07-Mar-2006  thorpej branches: 1.19.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.18 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.17 05-Mar-2006  christos Add a proc_is_traced_p() macro and use it, instead of copying the same code
in many places. Idea from thorpej.
 1.16 05-Mar-2006  christos branches: 1.16.2;
implement PT_SYSCALL
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6;
merge ktrace-lwp.
 1.14 01-Jul-2005  christos branches: 1.14.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.
 1.13 31-Oct-2003  simonb Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
 1.12 29-Oct-2003  mycroft Make sure "args" is pointing somewhere sane before calling trace_exit().
 1.11 27-Oct-2003  chs uninitialized variables
 1.10 17-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 21-Dec-2002  manu Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
 1.8 15-Nov-2002  manu Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
 1.7 18-Jun-2002  thorpej Fix syscall_intern after systrace (HI CHRISTOS!)
 1.6 17-Jun-2002  christos MD systrace gluons.
 1.5 30-May-2001  mrg branches: 1.5.2; 1.5.4; 1.5.16;
use _KERNEL_OPT
 1.4 03-Jan-2001  thorpej branches: 1.4.2; 1.4.4;
ANSI'ify, and inline userret().
 1.3 14-Dec-2000  mycroft Some #ifdefs to make LKMs happy.
 1.2 14-Dec-2000  mycroft Clean up #includes.
 1.1 14-Dec-2000  mycroft osf1_locore.s -> osf1_sigcode.s, to match the global convention.
Add linux_syscall.c.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.4.2.1 03-Jan-2001  bouyer file linux_syscall.c was added on branch thorpej_scsipi on 2001-01-05 17:33:39 +0000
 1.5.16.2 16-Jul-2002  gehenna catch up with -current.
 1.5.16.1 09-Jul-2002  gehenna catch up with -current.
 1.5.4.7 29-Dec-2002  thorpej Sync with HEAD.
 1.5.4.6 16-Dec-2002  nathanw LWPify KERNEL_PROC_UNLOCK().
 1.5.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.5.4.4 09-Jul-2002  nathanw #include <sys/sa.h> for type definitions.
 1.5.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.5.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.5.4.1 30-May-2001  nathanw file linux_syscall.c was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.5.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.2.6 11-Feb-2008  yamt sync with head.
 1.14.2.5 21-Jan-2008  yamt sync with head
 1.14.2.4 03-Sep-2007  yamt sync with head.
 1.14.2.3 26-Feb-2007  yamt sync with head.
 1.14.2.2 30-Dec-2006  yamt sync with head.
 1.14.2.1 21-Jun-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.16.2.3 11-Aug-2006  yamt sync with head
 1.16.2.2 13-Mar-2006  yamt sync with head.
 1.16.2.1 05-Mar-2006  yamt file linux_syscall.c was added on branch yamt-pdpolicy on 2006-03-13 09:06:51 +0000
 1.19.2.2 07-Mar-2006  thorpej Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.19.2.1 07-Mar-2006  thorpej file linux_syscall.c was added on branch elad-kernelauth on 2006-03-07 07:21:51 +0000
 1.20.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.20.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.21.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.32.1 08-Jan-2008  bouyer Sync with HEAD
 1.22.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.22.20.2 23-Mar-2008  matt sync with HEAD
 1.22.20.1 09-Jan-2008  matt sync with HEAD
 1.24.8.1 18-May-2008  yamt sync with head.
 1.24.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.24.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.2.3 11-Mar-2010  yamt sync with head
 1.25.2.2 04-May-2009  yamt sync with head.
 1.25.2.1 16-May-2008  yamt sync with head.
 1.26.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.26.6.1 19-Oct-2008  haad Sync with HEAD.
 1.26.2.3 15-Oct-2008  wrstuden Remove some now-unneeded includes. Matches previous changes to i386 code.
 1.26.2.2 23-May-2008  wrstuden Re-add userret hook. Add a new define, SA_NO_USERRET, which
indicates that upcall support should NOT be included. Add this
for all non-netbsd emulations. They will never be SA apps, so
let's make the invarient pretty blatant.

NetBSD code should include both sys/sa.h and sys/savar.h.
 1.26.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.31.12.1 18-Feb-2012  mrg merge to -current.
 1.31.8.1 17-Apr-2012  yamt sync with head
 1.32.24.1 06-Apr-2015  skrll Sync with HEAD
 1.32.6.1 03-Dec-2017  jdolecek update from HEAD
 1.8 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 09-Feb-2007  ad branches: 1.6.44; 1.6.46; 1.6.48;
Merge newlock2 to head.
 1.5 11-Dec-2005  christos branches: 1.5.20;
merge ktrace-lwp.
 1.4 07-Oct-2003  skd branches: 1.4.16;
Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.3 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 18-Jun-2001  christos branches: 1.1.2; 1.1.6;
Add a linux specific trapsignal() function. This is just a passthrough
on all platforms but the i386. On the i386 we look at T_PROTFLT and send
a SIGSEGV instead of SIGBUS. This makes allegro lisp 5.0 and pvs (a proof
verification system) to work.

XXX[1]: We need to go through each architecture and verify that we send
the correct signal on each trap type.
XXX[2]: trap.c on all other architectures but i386 needs to be modified
to s/trapsignal/(*p->p_emul->e_trapsignal)/g
 1.1.6.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.1.6.1 18-Jun-2001  nathanw file linux_trap.c was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 26-Feb-2007  yamt sync with head.
 1.5.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.6.48.2 11-Mar-2010  yamt sync with head
 1.6.48.1 16-May-2008  yamt sync with head.
 1.6.46.1 18-May-2008  yamt sync with head.
 1.6.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.4 03-Dec-1999  thorpej This file is obsolete.
 1.3 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.2 27-Jul-1999  thorpej branches: 1.2.2; 1.2.8;
Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.1 24-Sep-1998  thorpej branches: 1.1.8;
Machine-dependent spin lock operations for Alpha, included if MULTIPROCESSOR
is specified.
 1.1.8.1 02-Aug-1999  thorpej Update from trunk.
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.10 25-Aug-2021  thorpej G/C _lock_cas(); it is no longer needed (kern_mutex.c uses atomic_cas_ulong()
with appropriate memory barriers).
 1.9 14-Jul-2021  thorpej Disable the mutex_spin_{enter,exit}() fast-path stubs while I investigate
some an odd IPL-related panic that seems to be related (that I can fairly
reliabily reproduce on an LCA45).
 1.8 13-Jul-2021  thorpej Fix non-MULTIPROCESSOR build (e.g. INSTALL kernel).
 1.7 13-Jul-2021  thorpej As with membar_producer() and membar_sync(), initialize the fast-path
lock stubs with "unop" isns where memory barriers need to be, and if
we detect a multiprocessor system, patch those locations with "mb" insns.
 1.6 12-Jul-2021  thorpej Optimized fast-paths for mutex_spin_enter() and mutex_spin_exit().
 1.5 11-Jul-2021  thorpej Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().
 1.4 04-Sep-2020  thorpej branches: 1.4.6;
- Make the GET_CURLWP actually return curlwp, not &curlwp.
- exception_return(): Use GET_CURLWP directly, rather than a dance
acount GET_CPUINFO.
- Introduce SET_CURLWP(), to set the curlwp value.
- Garbage-collect GET_FPCURLWP.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 09-Feb-2007  ad branches: 1.2.12; 1.2.44; 1.2.46; 1.2.48;
Merge newlock2 to head.
 1.1 10-Mar-2002  thorpej branches: 1.1.2; 1.1.18; 1.1.36;
file lock_stubs.s was initially added on branch newlock.
 1.1.36.5 05-Feb-2007  ad Load up gp on entry to the stubs. From mhitch.
 1.1.36.4 03-Feb-2007  ad More changes to get alpha working. Many thanks to mhitch@ and martin@
for testing and debugging.
 1.1.36.3 31-Jan-2007  ad _lock_cas(): return the correct value on success. Problem found by mhitch.
 1.1.36.2 30-Jan-2007  ad Fix bugs.. Still not sure why this doesn't work.
 1.1.36.1 11-Jan-2007  ad Checkpoint work in progress.
 1.1.18.1 26-Feb-2007  yamt sync with head.
 1.1.2.5 22-Mar-2002  thorpej * Fix the tail-calls to the slow-path.
* Handle MUTEX_DEBUG.
 1.1.2.4 12-Mar-2002  thorpej * Correct a comment; we actually CAN use load-locked/store-conditional,
but we don't yet.
* Disable tail-calls for now, until I figure out why I get occasional
unaligned access faults when they're enabled.
 1.1.2.3 11-Mar-2002  thorpej Document a critical section in mutex_exit(). From the comment:

THIS IS IMPORTANT WHEN WE ADD SUPPORT FOR KERNEL PREEMPTION.

There is a critical section within mutex_exit(); if we are
preempted, between checking for waiters and releasing the
lock, then we must check for waiters again.

On some architectures, we could simply disable interrupts
(and, thus, preemption) for the short duration of this
critical section.

On others, where disabling interrupts might be too expensive,
a restartable sequence could be used; in the interrupt handler,
if the PC is within the critical section, then then PC should
be reset to the beginning of the critical section so that the
sequence will be restarted when we are resumed. NOTE: In this
case, it is very important that the insn that actually clears
the lock must NEVER be executed twice.

On the Alpha, it'd be nice to be able to use load-locked/store-conditional,
but since we're storing zero, that breaks the store-conditional logic. On
the alpha, we'll use the restartable sequence method.
 1.1.2.2 11-Mar-2002  thorpej mutex_exit(): memory barrier *before* clearing the lock.
 1.1.2.1 10-Mar-2002  thorpej Alpha support routines for kernel mutexes.
 1.2.48.1 16-May-2008  yamt sync with head.
 1.2.46.1 18-May-2008  yamt sync with head.
 1.2.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.12.1 18-Apr-2007  thorpej G/C _lock_cas().
 1.4.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.145 06-Sep-2025  riastradh paravirt_membar_sync(9): New memory barrier.

For use in paravirtualized drivers which require store-before-load
ordering -- irrespective of whether the kernel is built for a single
processor, or whether the (virtual) machine is booted with a single
processor.

This is even required on architectures that don't even have a
store-before-load ordering barrier, like m68k; adding, e.g., a virtio
bus is _as if_ the architecture has been extended with relaxed memory
ordering when talking with that new bus. Such architectures need
some way to request the hypervisor enforce that ordering -- on m68k,
that's done by issuing a CASL instruction, which qemu maps to an
atomic r/m/w with sequential consistency ordering in the host.

PR kern/59618: occasional virtio block device lock ups/hangs
 1.144 24-Jun-2025  andvar branches: 1.144.2;
s/Aguments/Arguments/ in comment.
 1.143 07-Aug-2022  andvar branches: 1.143.4; 1.143.10;
fix some typos and grammar in comments.
 1.142 20-Jul-2022  thorpej Fix a couple of nits with savectx():
- Note that this function is only used by dumpsys().
- Don't safe the PS word; there isn't actually a spot for it in the PCB.
- Don't bother returning anything; savectx() is declared void.
 1.141 22-Jul-2021  thorpej It's unlikely that a process will be using restartable atomic sequences
on Alpha, and furthermore it's unlikely that any given context switch
will be returning to one even if the process has them. So, re-arrange
the RAS processing in cpu_switchto() so that the most likely code paths
are predicted by the branch predictor. On an EV4-class processor, this
will save ~4-6 cycles on just about every context switch.
 1.140 11-Jul-2021  thorpej Pull in pmap_subr.s (missed in prior commit).
 1.139 07-Jul-2021  thorpej Provide a BWX version of alpha_copystr() and patch it into place if
the system supports the BWX extension. The inner loop of the BWX
version is 42% shorter than the non-BWX version (7 vs 12 insns).
 1.138 07-Jul-2021  thorpej Re-arrange alpha_copystr() so that the the error/unlikely cases are forward
branches (which will be predicted as not-taken), and that the likely cases
are fall-through, with the exception of the loop branch (which is a backward
branch, and thus will be predicted as taken).
 1.137 23-May-2021  thorpej Fix an error introduced in rev 1.130 where the previous pcb_onfault
handler was not restored properly in the kcopyerr case. Also add a
comment explaining why it's save for these routines to be wrappers
around memcpy().

Fixes port-alpha/56197.
 1.136 19-Sep-2020  thorpej branches: 1.136.6; 1.136.8;
- The Alpha fast-soft-intrs implementation supports 2 soft interrupt levels,
so in exception_return() ensure we clear ineligible-at-new-IPL softint
bits from the SSIR, otherwise we could loop forever in the following
scenario:

processing softnet -> clock interrupt -> schedule softclock

- If the softint thread blocks, it's possible to bounce back through
the softint return trampoline at something other than IPL_HIGH. This
is not a problem other than it's contrary to what alpha_softint_dispatch()
expect, so make alpha_softint_return() go to IPL_HIGH before it does
anything else.

These two fixes make fast-soft-interrupts work on Alpha.
 1.135 18-Sep-2020  thorpej - Give lwp0 the same kernel thread backstop as all of the others get
in cpu_lwp_fork().
- Add a bunch of comments to lwp_trampoline() to explain what's going on.
- In alpha_softint_switchto() tweak how we save the RA in the stack frame.
 1.134 17-Sep-2020  thorpej Reduce the __HAVE_FAST_SOFTINTS #ifdef perimeter.
 1.133 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.132 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.131 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.130 04-Sep-2020  thorpej Save a few instructions every time we manipulate pcb::pcb_onfault.
 1.129 04-Sep-2020  thorpej - Make the GET_CURLWP actually return curlwp, not &curlwp.
- exception_return(): Use GET_CURLWP directly, rather than a dance
acount GET_CPUINFO.
- Introduce SET_CURLWP(), to set the curlwp value.
- Garbage-collect GET_FPCURLWP.
 1.128 03-Sep-2020  thorpej Garbage-collect the SWITCH_CONTEXT macro, since it now expands to
just "call_pal PAL_OSF1_swpctx".
 1.127 03-Sep-2020  thorpej The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE). We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.
 1.126 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.125 30-Jun-2020  maxv Make copystr() a MI C function, part of libkern and shared on all
architectures.

Notes:

- On alpha and ia64 the function is kept but gets renamed locally to avoid
symbol collision. This is because on these two arches, I am not sure
whether the ASM callers do not rely on fixed registers, so I prefer to
keep the ASM body for now.
- On Vax, only the symbol is removed, because the body is used from other
functions.
- On RISC-V, this change fixes a bug: copystr() was just a wrapper around
strlcpy(), but strlcpy() makes the operation less safe (strlen on the
source beyond its size).
- The kASan, kCSan and kMSan wrappers are removed, because now that
copystr() is in C, the compiler transformations are applied to it,
without the need for manual wrappers.

Could test on amd64 only, but should be fine.
 1.124 08-Jan-2020  skrll oldlwp is always non-NULL in cpu_switchto so remove the test for NULL.
 1.123 06-Apr-2019  thorpej branches: 1.123.4; 1.123.6;
Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.122 19-Feb-2012  rmind branches: 1.122.32; 1.122.40;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.121 07-Jun-2011  matt branches: 1.121.2; 1.121.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.120 07-Jul-2010  chs branches: 1.120.6;
implement ucas_* for alpha.
 1.119 25-Feb-2010  skrll branches: 1.119.2;
s/cpu_fork/cpu_lwp_fork/ in comment.
 1.118 10-Dec-2009  rmind branches: 1.118.2;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.117 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.116 05-Nov-2009  thorpej Fix error in previous that could cause us to refer to the wrong cpu_info
after handling an AST.
 1.115 03-Nov-2009  thorpej Restructure exception_return() a bit in preparation for some upcoming
changes.
 1.114 01-Jun-2009  martin Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.113 28-Apr-2008  martin branches: 1.113.10; 1.113.16;
Remove clause 3 and 4 from TNF licenses
 1.112 17-Oct-2007  garbled branches: 1.112.16; 1.112.18; 1.112.20;
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.111 17-May-2007  yamt branches: 1.111.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.110 03-Mar-2007  tsutsui branches: 1.110.2; 1.110.4; 1.110.10;
Apply fix for boolean_t -> bool changes on uvm.page_idle_zero access.

Thanks Tobias Nygren for help, ok'ed by thorpej, and tested on
1000A by Aaron J. Grier and on PC164 and 3000/300 by me.
 1.109 09-Feb-2007  ad branches: 1.109.2;
Merge newlock2 to head.
 1.108 11-Dec-2005  christos branches: 1.108.20;
merge ktrace-lwp.
 1.107 31-May-2005  chs branches: 1.107.2;
remove vestigal {,e}intr{names,cnt} symbols now that vmstat doesn't need them.
 1.106 17-Jul-2004  yamt as i386 does, propagete errors from uvm_fault() to users of pcb_onfault
via v0 so that eg. read(2) can return more appropriate errors
rather than always EFAULT.

ok'ed by Jason Thorpe.
 1.105 04-Nov-2003  dsl Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
 1.104 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.103 17-Jan-2003  thorpej branches: 1.103.2;
Merge the nathanw_sa branch.
 1.102 18-Sep-2002  thorpej Add support for restartable atomic sequences. Rearragne the tail
of cpu_switch() slightly so we can reenable interrupts a little
earlier.
 1.101 01-Jul-2002  thorpej When delivering a signal, arrange for the signal handler to be invoked
directly, using the trampoline only for the return path.
 1.100 13-May-2002  thorpej branches: 1.100.2;
Make sigcode and proc_trampoline no-profile.
 1.99 30-Apr-2002  thorpej Move call to sched_unlock_idle to later in the context switch to
eliminate a race where another processor could grab the outgoing
process before we were done saving our state into it, with predictable
results.

Bug spotted on i386 by Frank van der Linden <fvdl@wasabisystems.com>.
 1.98 29-Aug-2001  nathanw branches: 1.98.8;
Correct a comment: The address of the signal handler is passed to the
sigcode trampoline in pv (t12), not a3, and has been since the
beginning of time.
 1.97 13-Jul-2001  thorpej branches: 1.97.2;
Use memcpy() in kcopy(), copyin(), and copyout(). XXX This means we have
to burn 3 insns to swap the arguments. Need to change the interface to
these routines to match memcpy().

G/C bcopy() from here. We'll let it be provided by libkern (which is
what provides memcpy()) until bcopy() is exorcised completely.
 1.96 30-May-2001  lukem branches: 1.96.2;
add missing #include "opt_kgdb.h"
 1.95 29-Apr-2001  thorpej Add glue for page zero'ing in the idle loop.
 1.94 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.93 21-Apr-2001  ross Import and use cpu_info_primary for non-MULTIPROCESSOR.
Hey, it compiles, and it's only -current.
 1.92 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.91 18-Apr-2001  thorpej Fix a problem with kcopy()/copyin()/copyout() on MP systems
that became apparent when UBC was added: store a pointer to
the process itself, not a pointer to ci->ci_curproc.

This gets us back to where we were before UBC went in: MP
kernels get to single-user mode, and can run processes on
both CPUs, but things go south when we try to come into
multi-user mode.
 1.90 15-Apr-2001  thorpej Clean up soft interrupt related stuff a bit.
 1.89 10-Apr-2001  ross g/c transfer_check
 1.88 19-Jan-2001  thorpej branches: 1.88.2;
Make ASTs per-process.
 1.87 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.86 13-Dec-2000  mycroft Start cleanup of syscall(), similar to i386 and arm32. getpid() rate on my
AS200 goes from ~279000/s to ~446000/s.
 1.85 27-Nov-2000  jdolecek split linux signal code off locore.s
 1.84 20-Nov-2000  thorpej Delete a block of code that was intended to get the second
CPU to handle interrupts, but prevents a whole slew of things
from working properly on the second CPU. It is no longer
necessary now that several other bugs have been fixed.
 1.83 20-Nov-2000  thorpej In Idle(), only switch to the idle PCB if we're not already running
on it, and make sure to deactivate the old process's address space,
as this will not otherwise be done by cpu_switch() later once we're
on the idle PCB.

Also, update some comments related to when s0 (i.e. the old process)
is NULL in the context switching code.
 1.82 19-Nov-2000  sommerfeld Correct conditionalization of last change.
 1.81 19-Nov-2000  sommerfeld MULTIPROCESSOR: context switch to cpu's idle pcb before unlocking the
scheduler in idle so our stack doesn't get stolen out from underneath us.
 1.80 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.79 20-Aug-2000  thorpej Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it). Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
 1.78 19-Jul-2000  nathanw In cpu_switch(), load value *after* checking that the base register
is not NULL.
 1.77 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.76 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.75 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.74 26-May-2000  thorpej branches: 1.74.2;
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.73 26-May-2000  thorpej Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor. Test against SONPROC as appropriate rather than
combinations of SRUN and curproc. Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
 1.72 16-Dec-1999  thorpej Garbage-collect.
 1.71 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.70 03-Dec-1999  thorpej Remove now-obsolete atomic operations.
 1.69 02-Dec-1999  thorpej Inline the BWX instructions.
 1.68 07-Nov-1999  chs in copystr(), be sure to return an error if maxlen == 0.
 1.67 01-Nov-1999  thorpej From Ross Harvey:
- Fix a bug where IPL wasn't being lowered to process SIRs, which
effectively caused them to be processed at splserial(), and loop
over the ssir, like we do for astpending.
- Optimize the flow of exception_return().
 1.66 01-Nov-1999  thorpej Fix a race condition in AST processing described by Andrew Gallatin on
the freebsd-alpha mailing list which basically boiled down to increasing
stack depth due to lowering the IPL before checking for an AST.

This changes AST processing to do basically what the i386 port does (as
described by Charles Hannum):

check_ast:
if (astpending) {
lower IPL
process AST
raise IPL
goto check_ast
}
 1.65 17-Sep-1999  thorpej branches: 1.65.2; 1.65.4; 1.65.6;
Centralize the declaration and clearing of `cold'.
 1.64 11-Jul-1999  ross * Set up a trapframe before calling console_restart(), and just pass it the
frame instead of a selection from the saved state.
* new macros: bfalse reg, dst /* "beq" */
btrue reg, dst /* "bne" */
 1.63 31-May-1999  ross Convert to traceback-friendly temporary labels.
 1.62 20-Apr-1999  thorpej - Revert previous change to XentIF(), now that we're going to enter the
debugger differently.
- Pull in debugger glue if DDB is configured.

And one unrelated change, while I was here: Don't create a fake trapframe
for main(); it hasn't been used by main() for quite some time, and panic
if main() returns, because that's not supposed to happen now.
 1.61 19-Apr-1999  thorpej Dispatch to the debugger from the Intruction Fault trap vector directly,
rather than doing it from trap(). This so we can switch to a temporary
stack for the debugger (in a forthcoming commit).
 1.60 24-Mar-1999  mrg branches: 1.60.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.59 22-Mar-1999  ross Enable fuword(9), fuiword(9).
 1.58 12-Mar-1999  perry remove ovbcopy references
 1.57 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.56 26-Nov-1998  thorpej Oops, restore pcb_onfault if a fault occures in kcopy(). Pointed out by
Charles Hannum.
 1.55 19-Nov-1998  ross Nuke the final holdout of INTRNAMES_DEFINITION.
Do a nice gas.new .rept/.endr loop and also pad each string with spaces
in case a platform actually does want to rewrite the names.

G/C some EVCNT_COUNTERS stuff.
 1.54 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.53 01-Oct-1998  erh Add linux signal trampoline code.
 1.52 29-Sep-1998  thorpej In exception_return(), if MULTIPROCESSOR, skip software interrupts, ASTs,
and floating point handling if we're not the primary CPU.
 1.51 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.50 13-Sep-1998  thorpej Make signal delivery work again.
 1.49 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.48 19-May-1998  thorpej Argh, finish renaming Lev1map to kernel_lev1map.
 1.47 22-Mar-1998  thorpej Implement a set of `atomic' (using load-locked and store-conditional)
operations. Initial set includes:

alpha_atomic_setbits_q() set bits in a quad
alpha_atomic_clearbits_q() clear bits in a quad
 1.46 22-Mar-1998  thorpej - The pmap now includes support for ASNs. We no longer need to flush
the TLB and I-cache in the SWITCH_CONTEXT macro.
- Right after switching to proc0's newly-created context at startup time,
flush the TLB and I-cache; this is the only place where it's not done
automatically.
- Fix a nasty bug in a critical section of cpu_switch(); change the
pmap_activate -> SWITCH_CONTEXT -> pmap_deactivate sequence to
pmap_deactivate -> pmap_activate -> SWITCH_CONTEXT. This prevents
erroneously marking a pmap inactive if switching to a process that
shares it's address space (and thus its pmap) with the oldproc! Noticed
by Chris Demetriou.
 1.45 19-Mar-1998  thorpej Nuke swpctxt(); it's only used by the Mach pmap, which we will only ever
use for reference.
 1.44 18-Mar-1998  thorpej Don't call pmap_deactivate() if we jumped into the middle of cpu_switch()
from switch_exit(), since by this time, the vmspace will have already
been deactivated and freed.
 1.43 05-Mar-1998  thorpej Fix think'o in last kcopy() change.
 1.42 04-Mar-1998  thorpej In kcopy(), make sure we save and restore the old fault handler; kcopy()
is called from uiomove(), which may be in the code path of servicing
a non-fatal page fault caused by a copyin() or copyout().
 1.41 27-Feb-1998  thorpej Several changes related to all pmaps having their own level 1
page table:
- Update the current hwpcb pointer in the SWITCH_CONTEXT macro, so that
we know it's always correct.
- Optimize cpu_switch(): if we're switching to ourselves, skip the
actual context swap.
- Clean up some comments and remove some code rendered obsolete by
the fact that address spaces are now selected by switching to a
new level 1 page table.
 1.40 24-Feb-1998  thorpej Add support for UVM.
 1.39 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.38 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.37 16-Sep-1997  thorpej branches: 1.37.2;
Add stubs for the Alpha Byte/Word Extension (BWX) instructions, present
on EV56 and later processors that have the "amask BWX" bit clear. These
instructions will be used to implement non-swizzle bus access functions
on newer systems, such as the new AlphaStation 500s with EV56 and 21172
PCI chipsets.

See "Alpha Architecture Handbook, Version 3", DEC order number EC-QD2KB-TE.
 1.36 16-Sep-1997  thorpej From page 6-9 of "Alpha AXP Architecture Reference Manual, Second Edition":

An IMB intruction must be executed after software or I/O devices
write into the instruction stream or modify the instruction
stream virtual address mapping, and before the new value is
fetched as an instruction.

We were missing calls to IMB after mappings were changed, which caused
systems with large I-caches (e.g. my AlphaStation 500) to fail miserably
when mapping in new pages of program text, or when context switching
(I couldn't even get the shell from init!).
 1.35 02-Sep-1997  thorpej Clean up the context switching code a bit:
- Marco-ize the 3 instructions that actually switch to the new process
context.
- Unify (except for the pmap_deactivate() call) the NEW_PMAP and not-NEW_PMAP
versions of cpu_switch(), and clean up some comments.
- Tidy up the not-NEW_PMAP bits of switch_exit().
 1.34 02-Sep-1997  thorpej Note that a2 and a3 contain bootinfo information passed from the boot
program to alpha_init().
 1.33 02-Sep-1997  thorpej branches: 1.33.2;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.32 08-Apr-1997  cgd branches: 1.32.2;
include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.31 07-Apr-1997  cgd clean up options.h inclusion slightly
 1.30 07-Apr-1997  cgd include machine/options.h
 1.29 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.28 03-Feb-1997  cgd clean up a bit, add kernel setjmp and longjmp definitions.
 1.27 03-Dec-1996  cgd branches: 1.27.2;
do_sir lowers the IPL itself, now
 1.26 17-Oct-1996  cgd update for changes in asm.h
 1.25 15-Oct-1996  cgd add an XentRestart, pointed to by the retore_term HWRPB vector (and maybe,
eventually, the restart HWRPB vector), which calls console_restart. This
is invoked when the console halt switch is used and the user enters 'c'
at the console prompt, and eventually causes a system crash dump to be
generated.
 1.24 17-Sep-1996  cgd use assembler directives and labels that make both the ELF- and ECOFF-
targeted assemblers happy.
 1.23 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP
 1.22 16-Jul-1996  cgd do TBIA rather than TBIAP after initial context switch
 1.21 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Clean up interrupt handling slightly.
(3) Add machinery to make [fs]uswintr be a bit more careful when
determining if a fault was actually their fault. (Unfortunately, they're
not actually implemented now, anyway.)
(4) Minor cleanup.
 1.20 11-Jul-1996  cgd rename rei() to exception_return(). rename proc_trampoline() to
switch_trampoline(). clean up trap/exception/syscall entries and
eliminate common code where appropriate. clean up bootstrapping
code.
 1.19 11-Jul-1996  cgd don't save and set the USP at every trap entry and exit. It's
unnecessary, and given that there's no reason to waste time and
add complexity in trap handlers. This means that code which sets and
uses the USP has to be a bit more careful, but that doesn't happen much.
 1.18 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.17 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.16 09-Jul-1996  cgd fix a few botched names
 1.15 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.14 12-Jun-1996  cgd don't pass "argc," "argv," and "envp" from boot blocks to kernel;
they're unnecessary and there's no reason to use them. Have the
kernel get necessary values from the PROM directly.
 1.13 16-May-1996  cgd branches: 1.13.4;
add 'kernel_text' symbol, for use by kvm_mkdb
 1.12 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.11 12-Apr-1996  cgd add rpcc entry point
 1.10 02-Feb-1996  mycroft Don't define _LOCORE here.
 1.9 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.8 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.7 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.6 03-Aug-1995  cgd kill alpha_mb(); it's now inlined. make copy functions' frame sizes
more easily adjustable.
 1.5 28-Jun-1995  cgd oops; this got mangled.
 1.4 28-Jun-1995  cgd sync with my current Alpha sources
 1.3 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.2 09-Mar-1995  mycroft copy*str() should use size_t.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.13.4.1 13-Jun-1996  cgd pull up from trunk:
>don't pass "argc," "argv," and "envp" from boot blocks to kernel;
>they're unnecessary and there's no reason to use them. Have the
>kernel get necessary values from the PROM directly.
 1.27.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.27.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.32.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.33.2.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.33.2.1 02-Sep-1997  thorpej file locore.s was added on branch bouyer-scsipi on 1997-09-02 13:18:19 +0000
 1.37.2.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.60.4.2 02-Aug-1999  thorpej Update from trunk.
 1.60.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.65.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.65.4.1 14-Nov-1999  fvdl Sync with -current.
 1.65.2.8 23-Apr-2001  bouyer Sync with HEAD.
 1.65.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.65.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.65.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.65.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.65.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.65.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.65.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.74.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.88.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.96.2.5 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.96.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.96.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.96.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.96.2.1 03-Aug-2001  lukem update to -current
 1.97.2.13 03-Jan-2003  thorpej Merge switch_exit() and switch_lwp_exit().
 1.97.2.12 31-Dec-2002  thorpej Rename cpu_preempt() to cpu_switchto(), and make the caller remove the
new process from its run queue before calling cpu_switchto().

While here, make a few cpu_switch() and cpu_switchto() implementations
get the outgoing LWP from the args, rather than looking at the curlwp
variable.
 1.97.2.11 23-Oct-2002  thorpej * Fix a bug in the last branch sync: when loading the proc * to check
for RAS, use ldq, not ldl. While here, save an instruction by loading
directly into a0, rather than into s3 and moving to a0 later.
* Reuse the guts of cpu_switch() for cpu_preempt().
 1.97.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.97.2.9 01-Aug-2002  nathanw Catch up to -current.
 1.97.2.8 19-Jul-2002  nathanw Don't need upcall trampolines.
 1.97.2.7 09-Jul-2002  nathanw s/curproc/curlwp/g
 1.97.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.97.2.5 29-Nov-2001  thorpej l_stat is an int now instead of a u_char. Pointed out by pk in
a commit message.
 1.97.2.4 17-Nov-2001  nathanw Adapt to new upcall signature and possible argument copying.
 1.97.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.97.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.97.2.1 13-Jul-2001  nathanw file locore.s was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.98.8.2 17-Mar-2002  thorpej Allocate proc0 in machine-dependent code (can't specify align(16) in
C code on x86).
 1.98.8.1 10-Mar-2002  thorpej Alpha support routines for kernel mutexes.
 1.100.2.1 16-Jul-2002  gehenna catch up with -current.
 1.103.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.103.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.103.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.103.2.1 03-Aug-2004  skrll Sync with HEAD
 1.107.2.2 03-Sep-2007  yamt sync with head.
 1.107.2.1 26-Feb-2007  yamt sync with head.
 1.108.20.2 30-Jan-2007  ad For now always call sched_unlock_idle/sched_lock_idle. They will be
removed by yamt's cpu_switchto() changes.
 1.108.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.109.2.4 20-Apr-2007  yamt update some comments.
XXX now pmap_activate is never called with sched_mutex held.
XXX what to do for PMAP_NO_LAZY_LEV1MAP?
 1.109.2.3 20-Apr-2007  yamt cpu_switchto:
- update curlwp.
- don't bother to clear ci_want_resched.
 1.109.2.2 20-Mar-2007  yamt adapt alpha.
 1.109.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.110.10.1 22-May-2007  matt Update to HEAD.
 1.110.4.1 11-Jul-2007  mjf Sync with head.
 1.110.2.1 27-May-2007  ad Sync with head.
 1.111.10.1 06-Nov-2007  matt sync with HEAD
 1.112.20.4 11-Aug-2010  yamt sync with head.
 1.112.20.3 11-Mar-2010  yamt sync with head
 1.112.20.2 20-Jun-2009  yamt sync with head
 1.112.20.1 16-May-2008  yamt sync with head.
 1.112.18.1 18-May-2008  yamt sync with head.
 1.112.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.113.16.1 09-Jun-2009  snj branches: 1.113.16.1.2;
Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.113.16.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.113.10.1 09-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.118.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.118.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.119.2.2 12-Jun-2011  rmind sync with head
 1.119.2.1 05-Mar-2011  rmind sync with head
 1.120.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.121.6.1 24-Feb-2012  mrg sync to -current.
 1.121.2.1 17-Apr-2012  yamt sync with head
 1.122.40.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.122.40.1 10-Jun-2019  christos Sync with HEAD
 1.122.32.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1859):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
(applied also to sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/cortex_init.S)
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/alpha/include/asm.h: revision 1.45
(applied to sys/arch/alpha/alpha/multiproc.s)
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.123.6.1 17-Jan-2020  ad Sync with head.
 1.123.4.2 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
(all via patch)

paravirt_membar_sync(9): New memory barrier.

For use in paravirtualized drivers which require store-before-load
ordering -- irrespective of whether the kernel is built for a single
processor, or whether the (virtual) machine is booted with a single
processor.

This is even required on architectures that don't even have a
store-before-load ordering barrier, like m68k; adding, e.g., a virtio
bus is _as if_ the architecture has been extended with relaxed memory
ordering when talking with that new bus. Such architectures need
some way to request the hypervisor enforce that ordering -- on m68k,
that's done by issuing a CASL instruction, which qemu maps to an
atomic r/m/w with sequential consistency ordering in the host.

PR kern/59618: occasional virtio block device lock ups/hangs

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.123.4.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #264):

sys/arch/alpha/include/asm.h: revision 1.45 (patch)
(also applied to locore.s and multiproc.s)

alpha: Add missing barriers in cpu_switchto.
Details in comments.
(accidently missed in original commit for ticket #264)
 1.136.8.1 31-May-2021  cjep sync with head
 1.136.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.136.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.143.10.1 02-Aug-2025  perseant Sync with HEAD
 1.143.4.1 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
common/lib/libc/arch/i386/atomic/atomic.S: revision 1.38
common/lib/libc/arch/sparc/atomic/membar_ops.S: revision 1.9
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
common/lib/libc/arch/sparc64/atomic/membar_ops.S: revision 1.10
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
common/lib/libc/arch/x86_64/atomic/atomic.S: revision 1.32
(all via patch)

paravirt_membar_sync(9): New memory barrier.

For use in paravirtualized drivers which require store-before-load
ordering -- irrespective of whether the kernel is built for a single
processor, or whether the (virtual) machine is booted with a single
processor.

This is even required on architectures that don't even have a
store-before-load ordering barrier, like m68k; adding, e.g., a virtio
bus is _as if_ the architecture has been extended with relaxed memory
ordering when talking with that new bus. Such architectures need
some way to request the hypervisor enforce that ordering -- on m68k,
that's done by issuing a CASL instruction, which qemu maps to an
atomic r/m/w with sequential consistency ordering in the host.

PR kern/59618: occasional virtio block device lock ups/hangs

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.144.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by riastradh in ticket #60):

sys/arch/sparc/sparc/locore.s: revision 1.287
share/man/man9/Makefile: revision 1.475
sys/arch/mips/mips/cpu_subr.c: revision 1.65
sys/arch/riscv/riscv/cpu_subr.c: revision 1.6
sys/arch/mips/mips/cpu_subr.c: revision 1.66
sys/arch/amd64/amd64/cpufunc.S: revision 1.70
common/lib/libc/arch/i386/atomic/atomic.S: revision 1.38
common/lib/libc/arch/sparc/atomic/membar_ops.S: revision 1.9
sys/arch/hppa/hppa/support.S: revision 1.9
sys/arch/alpha/alpha/locore.s: revision 1.145
share/man/man9/paravirt_membar_sync.9: revision 1.1
sys/arch/sparc64/sparc64/locore.s: revision 1.436
distrib/sets/lists/comp/mi: revision 1.2499
sys/arch/i386/i386/cpufunc.S: revision 1.54
common/lib/libc/arch/sparc64/atomic/membar_ops.S: revision 1.10
sys/sys/paravirt_membar.h: revision 1.1
sys/arch/arm/arm/cpu_subr.c: revision 1.6
sys/arch/virt68k/virt68k/locore.s: revision 1.17
common/lib/libc/arch/x86_64/atomic/atomic.S: revision 1.32

paravirt_membar_sync(9): New memory barrier.

For use in paravirtualized drivers which require store-before-load
ordering -- irrespective of whether the kernel is built for a single
processor, or whether the (virtual) machine is booted with a single
processor.

This is even required on architectures that don't even have a
store-before-load ordering barrier, like m68k; adding, e.g., a virtio
bus is _as if_ the architecture has been extended with relaxed memory
ordering when talking with that new bus. Such architectures need
some way to request the hypervisor enforce that ordering -- on m68k,
that's done by issuing a CASL instruction, which qemu maps to an
atomic r/m/w with sequential consistency ordering in the host.

PR kern/59618: occasional virtio block device lock ups/hangs

mips: Fix asm arch options in new paravirt_membar_sync.
Need to explicitly enable mips2 (MIPS-II) instructions in order to
use sync. Fixes:
/tmp/ccxgOmXc.s: Assembler messages:
/tmp/ccxgOmXc.s:3576: Error: opcode not supported on this processor: mips1 (mips1) `sync'
--- cpu_subr.o ---
*** Failed target: cpu_subr.o

PR kern/59618: occasional virtio block device lock ups/hangs
 1.383 25-Apr-2025  riastradh alpha: Align signal pointer on entry to signal handler.

PR kern/59327: user stack pointer is not aligned properly
 1.382 16-Mar-2025  thorpej Add an alpha_fp_init() function, and move the initialization of
FP-related event counters there.

No functional change intended.
 1.381 16-Mar-2025  thorpej identifycpu(): don't print the system serial number from the RPB
if there isn't one there.
 1.380 16-Mar-2025  riastradh Clear trapframe on exec.

Do this for all architectures, even if the trapframe is fully
initialized -- makes it easier to audit and be confident it's
correct, and most likely (with the exception of sh3 which has an
intermediate call to ufetch_int in the middle) the compiler can
eliminate redundant stores in these routines.

PR kern/59084: exec/spawn leaks register content
 1.379 31-Mar-2024  thorpej branches: 1.379.2;
Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.
 1.378 05-Mar-2024  thorpej Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.
 1.377 20-Dec-2023  andvar fix tripple n typos in "running"/"domainname", also one missing n in comments.
 1.376 03-Aug-2023  rin alpha: Add support for bootflags [xX] to enable debug messages.
 1.375 22-Jul-2021  thorpej Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.374 11-Jul-2021  thorpej Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().
 1.373 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.372 24-May-2021  thorpej Add _UC_SETSTACK / _UC_CLRSTACK handling. Fixes the t_sigaltstack test
on alpha.
 1.371 05-May-2021  thorpej branches: 1.371.2;
Remove unused dot_conv() function.
 1.370 05-May-2021  thorpej Disable preemption around the main work of badaddr_read() and delay();
they both use "current CPU" resources.
 1.369 15-Oct-2020  thorpej branches: 1.369.6;
Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.368 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.367 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.366 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.365 27-Sep-2020  thorpej prom_is_qemu -> alpha_is_qemu, and export it outside of prom.c.
 1.364 04-Sep-2020  thorpej Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.363 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.362 02-Sep-2020  riastradh Nix trailing whitespace.
 1.361 29-Aug-2020  thorpej - cpu_need_resched(): Explicitly cover each RESCHED_* case, and add a
comment explaining why we don't need to act on IDLE+REMOTE.
- cpu_signotify(): Move to machdep.c, and if we're asked to notify
an LWP running on another CPU, send an AST IPI to that CPU. Add some
assertions.
- cpu_need_proftick(): Move to machdep.c, add some assertions.
 1.360 11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.359 22-Feb-2020  thorpej Fix a couple of printf formats in debug messages.
 1.358 22-Feb-2020  thorpej Make it clear that the pfn argument to alpha_init() is no longer used.
 1.357 31-Dec-2019  ad branches: 1.357.2;
Rename uvm_free() -> uvm_availmem().
 1.356 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.355 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.354 05-Apr-2019  thorpej Prrovide a basic (i.e. empty) module_init_md(). MODULAR doesn't quite
work yet (missing support for a couple of relocations), but at last the
kernel links.
 1.353 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.352 27-Nov-2018  maxv Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.351 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.350 16-Mar-2017  chs branches: 1.350.4; 1.350.6; 1.350.12; 1.350.14;
allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.349 23-Dec-2016  cherry branches: 1.349.2;
"Make NetBSD great again!"

Introduce uvm_hotplug(9) to the kernel.

Many thanks, in no particular order to:

TNF, for funding the project.

Chuck Silvers - for multiple API reviews and feedback.
Nick Hudson - for testing on multiple architectures and bugfix patches.
Everyone who helped with boot testing.

KeK (http://www.kek.org.in) for hosting the primary developers.
 1.348 22-Dec-2016  cherry switch all ports to use uvm_init.c:uvm_md_init()

uvm_setpagesize() is now subsumed within this funciton.
 1.347 13-Oct-2016  flxd Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000.
OK skrll@
 1.346 17-Oct-2014  uebayasi branches: 1.346.2; 1.346.4;
Fix build of RAWHIDE kernel.
 1.345 16-May-2014  matt branches: 1.345.2; 1.345.4; 1.345.6;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.344 24-Mar-2014  christos branches: 1.344.2;
use cpu_{g,s}etmodel
 1.343 20-Mar-2014  christos kill sprintf
 1.342 12-Sep-2012  manu branches: 1.342.2; 1.342.4;
setcontext() used to be incompatible with -lpthread since it affected
the TLS pointer, therefore wrecking the pthread environement.

Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
that controlled whether setcontext() would change the TLS pointer.
This change let libpthread override setcontext() with its own version
that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
-lpthread.

We also have the following required changes here:
- rename alpha's _UC_UNIQUE into _UC_TLSBASE
- add _UC_TLSBASE definition in header file for all ports
(powerpc, sh3, sparc and sparc64 lack the implementation for now)
- introduce a libc stub that can be overriden for setcontext()
- modify MD libcs swapcontext() implementations so that they use the
setcontext() libc stub instead of doing a plain system call.

While we are there:
- document various MD _UC_* flags in header file
- add libc and libpthread tests for swapcontext() behavior
(hopefully helpful to spot MD problems introduced with this change)

Future work:
- Deciding whether kernel support or _UC_TLSBASE should be added for
powerpc, sh3, sparc and sparc64 is left to portmasters
sparc64

Approved by core@
 1.341 28-Jul-2012  matt physmem is defined in uvm_page.c
 1.340 13-Jun-2012  njoly Add some descriptions to machdep.unaligned_* sysctls.
 1.339 21-May-2012  martin Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.
 1.338 21-Feb-2012  para follow the sa removal for alpha
 1.337 06-Feb-2012  matt branches: 1.337.2;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.336 12-Dec-2011  mrg implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.
 1.335 12-Jun-2011  rmind branches: 1.335.2; 1.335.6;
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.334 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.333 24-May-2011  rmind branches: 1.333.2;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.332 15-Apr-2011  martin Hint from Matt Thomas: use evcnt_attach_dynamic_nozero()
 1.331 15-Apr-2011  martin Delay initialization of FPU related event counters to cpu_startup() - we
do not expect any events of this type before spinup of all cpus.
 1.330 04-Mar-2011  joerg Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.329 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.328 10-Nov-2010  uebayasi branches: 1.328.2; 1.328.4;
Use more VM_PHYSMEM_*() accessors. No functional changes.
 1.327 06-Nov-2010  uebayasi Machine dependent code is considered as part of UVM. Include
internal API header.
 1.326 08-Feb-2010  joerg branches: 1.326.2;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.325 10-Dec-2009  matt branches: 1.325.2;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.324 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.323 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.322 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.321 25-Oct-2009  mhitch We might switch cpu in between the start of cpu_reboot() and where we
actually start shutting down cpus. This caused problems because the
wait_mask computed at the beginning of cpu_reboot() wouldn't be correct
when actually waiting for the other cpus to shutdown, and cpu_halt()
might be called instead of prom_halt() at the end, leading to a hung
machine.
 1.320 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.319 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.318 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.317 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.316 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.315 13-Feb-2009  apb Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
 1.314 21-Jan-2009  he branches: 1.314.2;
Re-adapt to the changed return types for major() and minor().
 1.313 13-Jan-2009  rtr use PRIu64 to print 64 bit dev_t
 1.312 30-Nov-2008  martin As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
 1.311 25-Nov-2008  ad dumpsys: don't spew numbers into the log.
 1.310 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.309 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.308 11-Nov-2008  dyoung It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.
 1.307 15-Oct-2008  wrstuden branches: 1.307.2; 1.307.4;
Merge wrstuden-revivesa into HEAD.
 1.306 02-Jul-2008  ad branches: 1.306.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.305 28-Apr-2008  martin branches: 1.305.2; 1.305.4;
Remove clause 3 and 4 from TNF licenses
 1.304 24-Apr-2008  ad branches: 1.304.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.303 10-Mar-2008  ad branches: 1.303.2;
Use MI atomic operations.
 1.302 28-Nov-2007  ad branches: 1.302.10; 1.302.14;
Hook in the atomic ops on alpha.
 1.301 19-Nov-2007  ad Fix cpu_need_resched.
 1.300 17-Oct-2007  garbled branches: 1.300.2;
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.299 08-Jul-2007  pooka branches: 1.299.8; 1.299.10; 1.299.14;
Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."
 1.298 07-Jul-2007  tsutsui Don't update hz by the hardware RPB field.
Leave it default HZ since we always use 1024Hz in alpha/mcclock.c.
 1.297 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.296 04-Mar-2007  yamt branches: 1.296.2; 1.296.4; 1.296.8; 1.296.10;
fix fallout from caddr_t changes.
 1.295 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.294 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.293 09-Feb-2007  ad branches: 1.293.2;
Merge newlock2 to head.
 1.292 24-Jan-2007  hubertf Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.291 26-Dec-2006  elad Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
 1.290 22-Nov-2006  elad branches: 1.290.2;
Introduce KAUTH_REQ_MACHDEP_{ALPHA,X86}_UNMANAGEDMEM to handle access
to unmanaged memory.

These are the last two securelevel references in the MD code.
 1.289 21-Oct-2006  mrg in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev. this occurs when we try to set the dumpdev to a device
with no driver loaded. this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf(). (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
 1.288 11-Dec-2005  christos branches: 1.288.20; 1.288.22;
merge ktrace-lwp.
 1.287 28-Jul-2005  thorpej - Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.286 03-Jun-2005  jdc branches: 1.286.2;
Add a const where we cast a const variable.
 1.285 17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.284 25-Apr-2005  lukem Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
 1.283 07-Jul-2004  mhitch branches: 1.283.4; 1.283.10;
After sending the IPI to halt other CPUs, clear cpus_paused to ensure that
the other CPUs resume execution. If the halt was initiated from DDB, the
CPUs will not have been resume execution and will never halt. If one of the
paused CPUs is the primary CPU, the system will hang. Fixes PR#26159.
 1.282 24-Mar-2004  atatat branches: 1.282.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.281 14-Feb-2004  bjh21 Add a new MI attribute, pckbc_machdep_cnattach, and change pckbc_cnattach()
to only call pckbc_machdep_cnattach() if this is present. This allows
pckbc_machdep_cnattach() to be omitted entirely on most ports, where it only
returns ENXIO anyway.

The devices with this attribute at the moment are pc(4) on i386 and bebox, and
pckbc on sparc, where pckbc_machdep_cnattach() mysteriously returns 0 rather
than ENXIO.
 1.280 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.279 30-Dec-2003  pk Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
 1.278 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.277 19-Oct-2003  cl don't uvm_swapout LWPs which are LSONPROC on another cpu.

uvm_swapout_threads will swapout LWPs which are running on another CPU:
- uvm_swapout_threads considers LWPs running on another CPU for swapout
if their l_swtime is high
- uvm_swapout_threads considers LWPs on the runqueue for swapout if their
l_swtime is high but these LWPs might be running by the time uvm_swapout
is called

symptoms of failure: panic in setrunqueue

fixes PR kern/23095
 1.276 13-Oct-2003  nathanw Catch up DEBUG printfs to siginfo changes.
 1.275 08-Oct-2003  enami Adapt to recent ksiginfo change.
 1.274 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.273 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.272 02-Aug-2003  matt Make this compile with gcc3. Change kernel_pmap_store to array of struct
pmap instead of array u_long. A bit of space is wasted but it supresses
the -Wcast-align warning.
 1.271 24-Jul-2003  nathanw In setmcontext(), set MDP_FPUSED in l->l_md.md_flags when the provided
context has FPU state.
 1.270 29-Jun-2003  fvdl branches: 1.270.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.269 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.268 10-May-2003  thorpej Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.267 09-May-2003  enami - Adjust arguments to pmap_steal_memory() for new interface.
- We no longer able to use uvm_pageboot_alloc() before pmap_bootstrap()
is called. Use pmap_steal_memory() directly instead.

Approved by Jason R. Thorpe.
 1.266 26-Apr-2003  ragge Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)
 1.265 17-Apr-2003  nathanw cpu_getmcontext: Test for the the presence of FP state in a LWP by
looking for MDP_FPUSED in l->l_md.md_flags, instead of
l->l_addr->u_pcb.pcb_fpcpu being non-NULL. The latter indicates that
FP state is live in the FPU *now*, but doesn't indicate whether there
is any state saved in the PCB.
 1.264 11-Apr-2003  nathanw Make cpu_getmcontext() run the PC through ras_lookup() so that kernel
getcontext() plus userlevel setcontext() (as used in libpthread) respects
the atomicity of RAS regions.
 1.263 08-Apr-2003  thorpej Make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK compile time constants; we only
support 8K page models at the moment anyway.
 1.262 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.261 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.260 08-Jan-2003  thorpej Use the MI setrunqueue()/remrunqueue().
 1.259 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.258 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.257 25-Aug-2002  thorpej Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
 1.256 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.255 01-Jul-2002  thorpej When delivering a signal, arrange for the signal handler to be invoked
directly, using the trampoline only for the return path.
 1.254 18-Mar-2002  thorpej branches: 1.254.4;
PS_STRINGS -> p->p_psstr
 1.253 06-Mar-2002  tsutsui Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.
 1.252 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.251 18-Sep-2001  wiz Give initiali[sz]e all the "i"s it deserves.
 1.250 17-Sep-2001  jdolecek g/c superfluous cpu_exec_ecoff_setregs() prototype
only define the cpu_exec_ecoff_*() stuff #ifdef EXEC_ECOFF
 1.249 10-Sep-2001  chris 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.248 27-Jul-2001  thorpej branches: 1.248.2; 1.248.4;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.247 12-Jul-2001  thorpej bcopy -> memcpy
 1.246 12-Jul-2001  thorpej bzero -> memset
 1.245 02-Jun-2001  chs branches: 1.245.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.244 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.243 02-May-2001  thorpej Initialize the VM page size before calling the platform init routine.
 1.242 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.241 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.240 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.239 23-Apr-2001  thorpej The Alpha pmap_virtual_space() can return compile-time constants,
so do so. This allows us to call uvm_pageboot_alloc() before
pmap_bootstrap().

Also, the virtual_start variable is unneeded in the Alpha pmap
module, and virtual_end (and the mostly-unused-except-by-bus_dma
variables avail_start and avail_end) can be `computed' at the
same time.
 1.238 22-Apr-2001  thorpej Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.
 1.237 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.236 20-Apr-2001  thorpej No longer need to play with the kernel_lock while waiting
for the other processor to sync FP state.
 1.235 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.234 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.233 19-Apr-2001  thorpej Need <sys/kgdb.h> for kgdb_connect() prototype.
 1.232 15-Apr-2001  thorpej Clean up soft interrupt related stuff a bit.
 1.231 15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.230 22-Jan-2001  jdolecek branches: 1.230.2;
Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.
 1.229 27-Dec-2000  sommerfeld Let COMPAT_LINUX build with DEBUG
 1.228 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.227 24-Nov-2000  chs adjust the spinlock macros in the non-MULTIPROCESSOR, non-LOCKDEBUG case
so that gcc will think that static spinlock are used.
this allows us to remove the ugly conditionalization of
static spinlock declarations.
 1.226 24-Nov-2000  simonb Make this compile again (unterminated `#if' conditional).
 1.225 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.224 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.223 20-Nov-2000  thorpej Protect microtime_slock appropriately.
 1.222 19-Nov-2000  thorpej As a temporary measure, protect microtime() with a simple lock.
XXX Needs to be rewritten from scratch.
 1.221 24-Sep-2000  jdolecek add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
 1.220 13-Sep-2000  thorpej Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
 1.219 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.218 03-Jul-2000  thorpej Print the system serial number.
 1.217 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.216 28-Jun-2000  thorpej New delay() function that uses the RPCC instruction. From
Matthew Jacob <mjacob@feral.com>.
 1.215 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.214 09-Jun-2000  cgd make spl0() and spllowersoftclock() return void. Also, move spl0()
prototype from param.h to intr.h. (there were some big XXXs in param.h
that said to do that, and intr.h is included by param.h, so...)
 1.213 05-Jun-2000  jhawk Do not clear msgbufenabled in dumpsys(). Dump messages will now go to
the message buffer. This can be invaluable in debugging if the dump
fails (assuming a persistant message buffer)
 1.212 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.211 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.210 01-Jun-2000  thorpej Add a global patchable variable to enable debugging printfs in the
code that finds the boot device.
 1.209 01-Jun-2000  thorpej Rearrange things a little so we can deal with systypes that aren't
densely packed.
 1.208 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.207 26-May-2000  thorpej branches: 1.207.2;
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.206 23-May-2000  thorpej Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.205 22-May-2000  thorpej Remove the adjustment of VM_PHYS_SIZE for `large memory machines'. The
only adjustment that was really necessary was for VM_KMEM_SIZE, and that
is no longer necessary because there is now generic auto-sizing for
kmem_map.
 1.204 29-Mar-2000  enami Remove unnecessary cast in previous. Pointed out by shin@netbsd.org.
 1.203 27-Mar-2000  enami Fix previous in a different way.
 1.202 27-Mar-2000  enami Fix compilation error (printf format mismatch) due to recent round_page()
change. While I'm here I fold the long line.
 1.201 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.200 23-Mar-2000  thorpej Use a software interrupt for tty input processing, not a callout.
 1.199 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.198 29-Feb-2000  thorpej Put machine check info in cpu_info in the multiprocessor case, and
just have one statically allocate machine check info structure in the
single processor config case.
 1.197 26-Feb-2000  thorpej alpha_pa_access(): if securelevel <= 0, grant read/write access to
non-memory address locations.
 1.196 22-Feb-2000  thorpej Make this compile after the netisr_dispatch change.
 1.195 21-Feb-2000  erh Define the DONETISR macro and use netisr_dispatch.h. This is to cut down on code duplication and to standardize the available NETISRs across all ports.
 1.194 12-Feb-2000  thorpej G/c references to VM_KMEM_SIZE.
 1.193 09-Feb-2000  shin fix include file.

<netinet6/ip6.h> -> <netinet/ip6.h>
 1.192 22-Jan-2000  thorpej Fix netisr processing for PPP when there is only one device configured.

port-alpha/9257, Kevin P. Neal.
 1.191 19-Jan-2000  thorpej Move callout initialization to a single location; no need to duplicate
that code all over the place.
 1.190 19-Jan-2000  msaitoh check whether tv_usec >= 1000000
 1.189 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.188 04-Dec-1999  ragge CL* discarding.
 1.187 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.186 03-Dec-1999  thorpej New delay(), more carefully coded:
- Use explicit assembly; don't want the compiler optimizing things too
much here.
- Subtract 2 for each iteration of the loop, rather than 3. The loop
consists of only 2 instructions (even the C version compiled to a
loop of 2 instructions).

The latter change has squashed a fairly annoying timing bug in the
mii_bitbang module as used by the `ex' driver on my AlphaStation 500.

XXX delay() should maybe be rewritten again, to use the rpcc instruction.
 1.185 30-Nov-1999  thorpej Use ptoa() consistently when printing out how much memory we have, etc.
 1.184 07-Oct-1999  sato branches: 1.184.2;
fix typo about checking RB_POWERDOWN.
 1.183 17-Sep-1999  thorpej branches: 1.183.2;
Centralize the declaration and clearing of `cold'.
 1.182 12-Sep-1999  chs eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.181 19-Aug-1999  mjacob remove LIMITMEM code because it does not work anyway anymore
 1.180 16-Aug-1999  simonb Spell "privilege" correctly (correct spelling from Jonathan Stone).
 1.179 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.178 10-Aug-1999  thorpej Use atomic operations to manipulate the SSIR, and fix a problem introduced
with the spllowersoftclock() changes where more interrupts than necessary
were blocked while software interrupts were being processed.
 1.177 29-Jun-1999  ross * If the cpu_model string contains some form of MHz , don't print
the rpb field also.
* Add dot_conv(), hex format conversion for long hex digit strings.
 1.176 28-Jun-1999  itojun - Call ip6intr if INET6 is defined.
- remove "need-flag" for mac68k esp driver, as it is not used in anywhere
and conflicts with IPsec ESP header.

This should be the only MD change in IPv6 support, except kernel config file.
Very sorry if you have any compilation problem with it (I believe it is okay).
If your favorite arch is not included in here, please add a
call to ip6intr() from softintr handle.
 1.175 26-May-1999  thorpej Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.
 1.174 21-May-1999  thorpej Update the calls to allocsys().
 1.173 20-May-1999  lukem * convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes
 1.172 29-Apr-1999  ross Use a different initial FPCR, mainly to suppress the ieee inexact trap.
 1.171 27-Apr-1999  cgd use osf1_exec_ecoff_hook()
 1.170 25-Apr-1999  simonb g/c REAL_CLISTS.
 1.169 15-Apr-1999  thorpej Always call the platform's cons_init routine (note, it may not do anything,
but it's a very handy place to put console-related debugging code in,
even if we're still using the PROM console).
 1.168 11-Apr-1999  chs add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.167 10-Apr-1999  cgd branches: 1.167.2;
be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.166 01-Apr-1999  thorpej Don't call configure() from cpu_startup().
 1.165 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.164 26-Mar-1999  thorpej Don't bother allocating mb_map on these systems. Mbuf clusters are
allocated from a pool, and the MIPS and Alpha use KSEG to map pool
pages. So, mb_map wasn't actually being used. Saves around 4MB of
kernel virtual address space in a typical configuration.

Garbage-collect the related VM_MBUF_SIZE constant.
 1.163 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.162 27-Feb-1999  scottr defopt BUFCACHE and BUFPAGES.
 1.161 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.160 12-Feb-1999  thorpej Fix printf format problems on Alpha.
 1.159 10-Jan-1999  mjacob For some reason (I don't know why nobody else has seen this)
egcs-2.91.57 didn't like the void * subtraction on line 904.
I'll risk everyone's wrath by casting around it.
 1.158 09-Jan-1999  thorpej Garbage-collect `mbutl'.
 1.157 04-Dec-1998  thorpej Pass the symbol table size, like a.out.
 1.156 20-Nov-1998  ross Sigh, shuffle the nsio ide frobber yet again.
 1.155 19-Nov-1998  ross +#include <machine/alpha.h>
+#include <machine/intrcnt.h>

Also, this module gets the junk I/O IDE channel frobber that used to
be in dec_axppci_33.c, so it can be called for the eb64plus also.
 1.154 02-Nov-1998  ross Implement the new BUFCACHE option.
 1.153 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.152 06-Oct-1998  thorpej Move the calls to hwrpb_restart_setup() and cpu_run_spinup_queue() to the
end of configure().
 1.151 06-Oct-1998  thorpej Split hwrpb_restart_setup(), putting the code that initializes the vtpb
and primary hwpcb into hwrpb_primary_init(). Call the latter before
performing autoconfiguration().
 1.150 29-Sep-1998  thorpej Oops, brain'o.
 1.149 29-Sep-1998  thorpej Disable the code that halts secondary processors in cpu_reboot(). Halting
the secondary works, but not when called from here?! XXX!
 1.148 29-Sep-1998  thorpej In cpu_reboot(), halt the secondary CPUs.
 1.147 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.146 23-Sep-1998  thorpej "Gee, there was already a function to do that."
 1.145 23-Sep-1998  thorpej Implement a function to recompute the HWRPB checksum.
 1.144 22-Sep-1998  thorpej Add some support for multiple processors to the pmap module. Still left
to do: TLB shootdown code, but that will be much easier to write once
the code to spin up the additional CPUs is working.
 1.143 21-Sep-1998  matt Add softserial to the alpha port. This significantly improved PPP
throughput on com ports.
 1.142 13-Sep-1998  mycroft Fix omission in previous; remember to record that we're on the signal stack.
 1.141 13-Sep-1998  thorpej Make signal delivery work again.
 1.140 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.139 04-Aug-1998  thorpej Simple instrumentation of pmap_steal_memory().
 1.138 13-Jul-1998  ross Define cpu_mchkinfo() to locate the mchkinfo struct. This is used to fix
the recent bug where Multias around the world have been aborting back to
SRM with no message at all as they tried to attach a TGA or VGA console,
because the old mchkinfo pointer wasn't allocated prior to use.

And contrary to widespread rumour, this bug has nothing to do with my
LCA IDE mod...that worked just fine. "Not guilty."
 1.137 09-Jul-1998  mjacob Fix printing of real mem. I'm going to, for right now, leave it to
someone else to figure out the best machine independent fashion of
fixing ptoa to handle > 32 bits.
 1.136 08-Jul-1998  mjacob tentative better fix for allocating the correct number of mchkinfo structs
 1.135 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.134 08-Jul-1998  mjacob Move the search for number of cpus up earlier because we need to know
how many cpus there are when we (now) valloc per-cpu machine check
structures.
 1.133 05-Jul-1998  jonathan defopt NATM.
 1.132 05-Jul-1998  jonathan defopt NS, NSIP.
 1.131 05-Jul-1998  jonathan defopt ISO TPIP.
 1.130 05-Jul-1998  jonathan defopt CCITT.
 1.129 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.128 04-Jul-1998  jonathan defopt DDB.
 1.127 26-Jun-1998  thorpej defopt COMPAT_OSF1
 1.126 24-Jun-1998  ross Replace expression with new LOCATE_PCS() macro.
 1.125 09-Jun-1998  ross Fix a UVM #if so {} balance is preserved and ctags(1) doesn't lose.
 1.124 06-Jun-1998  thorpej If the platform specified a powerdown hook, and howto has RB_POWERDOWN,
call the hook. If the hook fails, print a warning, and just halt (RB_HALT
is implied by RB_POWERDOWN).
 1.123 25-May-1998  thorpej On DEC 3000s, ask the prom for the SCSI ID and "fast mode enabled" of
the built-in TCDS, while we can still access the prom.
 1.122 19-May-1998  thorpej Argh, finish renaming Lev1map to kernel_lev1map.
 1.121 08-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.120 30-Apr-1998  ross Include net/route.h
 1.119 29-Apr-1998  thorpej Ignore any `-' characters that might have been passed in the boot flags.
 1.118 28-Apr-1998  thorpej Add a stub pckbc_machdep_cnattach() which simply returns an error. This
function is meant to glue the new pckbd driver to the old console code
on ports which use the old PC-style console code. This will eventually
be purged when all of the old legacy consoles have gone away.
 1.117 15-Apr-1998  drochner Switch the console to polling mode before accessing the keyboard with
interrupts disabled.
 1.116 15-Apr-1998  mjacob clarification of comment
 1.115 26-Mar-1998  thorpej Remove references to NEW_PMAP.
 1.114 18-Mar-1998  thorpej Pass the max ASN from the HWRPB to pmap_boostrap().
 1.113 17-Mar-1998  thorpej Properly depend on the PMAP_NEW option.
 1.112 24-Feb-1998  thorpej Add support for UVM.
 1.111 19-Feb-1998  thorpej Disable the message buffer during crash dumps by clearing msgbufenabled,
not msgbufmapped.
 1.110 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.109 14-Feb-1998  cgd fix pasto in last (sigh)
 1.108 14-Feb-1998  cgd fix for (harmless) bogon introduced in last commit
 1.107 14-Feb-1998  cgd adjust kernel core dump code for changes in kcore.h, also clean up
slightly.
 1.106 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.105 13-Feb-1998  thorpej Use the platform family name in alpha_unknown_sysname().
 1.104 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.103 12-Feb-1998  cgd set 'hwrpb' in a way that works exactly the same way as the previous
code, but looks significantly less gross.
 1.102 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.101 11-Feb-1998  cgd leave space for bootstrap stack when calculating kernstart
 1.100 10-Feb-1998  thorpej Make it easier to keep the scaled VM_*_SIZE values in sync w/ the
constants.
 1.99 31-Jan-1998  ross Remove the #include of rpb.h from clock.c and set hz from the hwrpb
in alpha_init() instead of from a hardwired 1024 in cpu_initclocks().
 1.98 31-Jan-1998  cgd valloclim() was unused; kill it. #undef valloc() at the end of
allocsys().
 1.97 24-Jan-1998  mycroft When dumping, print out the device number as major,minor.
 1.96 19-Jan-1998  thorpej G/c LANCE DMA allocation goop.
 1.95 09-Jan-1998  thorpej Rearrange alpha_init() somewhat, setting the page size much earlier, and
keeping track of where the kernel lives in K0SEG. Place early data
structure allocation into an allocsys() function, like other ports, so
that it can be used to first calculate the amount of memory needed
for those data structures.
 1.94 09-Jan-1998  thorpej Call vm_set_page_size() after initializing PAGE_SIZE.
 1.93 16-Dec-1997  mjacob do not incread vm_kmem_size that radically for 1GB or better machines
 1.92 06-Nov-1997  thorpej Clean up the messages displayed when either platform support is not
configured into the kernel, or when the platform is not supported.
Use the defopt'ed options, rather than NDEC_... and remove the needs-flag
hack that's existed for a while.
 1.91 17-Oct-1997  mjacob branches: 1.91.2;
Recover from some include file foo.
 1.90 23-Sep-1997  mjacob A minor barely acceptable hack to handle having a kernel boot on a system
with large amounts of memory and not spew. This doesn't really replace
fixing this problem better later, but it works for now. Basically, if memory
is greater than 128MB, start upping the sizes of some maps.
 1.89 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.88 19-Sep-1997  mjacob Add in a clause ifdef'd for LIMITMEM- limit usage of memory to a certain
amount. Temporary until more drivers use busdma stuff.

Also correct to unsigned the printing out of memory sizes.
 1.87 19-Sep-1997  mjacob missing cast.
 1.86 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.85 11-Sep-1997  mycroft Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)
 1.84 02-Sep-1997  thorpej branches: 1.84.2;
Adjust some NEW_PMAP code for a slight interface change.
 1.83 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.82 11-Aug-1997  cgd s/bogus/unknown/; just because we don't know about it doesn't mean it's wrong
 1.81 24-Jul-1997  thorpej branches: 1.81.2;
- Two additional arguments to alpha_init(): bootinfo magic number, and
pointer to boot program's bootinfo structure. If the bootinfo magic
matches, save a copy of the bootinfo structure, and use it to determine
booted kernel name, the boot flags, and the location of the kernel symbol
table. If the magic number does not match, revert to the old method
of finding this information (sans symbol table info).
- Add some additonal DDB glue.
 1.80 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.79 08-Jun-1997  veego Initialize machine from MACHINE and machine_arch from MACHINE_ARCH.
 1.78 06-Jun-1997  veego Add 'char machine_arch[] = "xxx";' for the new sysctl hw.machine_arch.
 1.77 06-Jun-1997  cgd fix slight bogons in splhigh() usage, that were introduced when the
behaviour of splhigh() was changed. The new behaviour raised the level to
IPL_HIGH if it was lower, but left it alone if the same or higher. Apparently
the firmware transfers to NetBSD with all interrupts blocked, or something
else blocks all interrupts (including machine checks) before the code
is really started. This meant that machine checks were blocked during
device probes, leading to false device probes _and_ an unexpected (and
therefore fatal) machine check at the spl0() after autoconfiguration.
 1.76 11-Apr-1997  cgd branches: 1.76.2; 1.76.4;
enable reporting of system- and processor-correctable errors. Rework
machine check and correctable error handler. This probably isn't perfect,
yet.
 1.75 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.74 07-Apr-1997  cgd include machine/options.h
 1.73 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.72 07-Apr-1997  cgd more correctly conditionalize ARP code use
 1.71 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.70 02-Apr-1997  christos Add netatalk netisr
 1.69 27-Mar-1997  thorpej Don't allocate mclrefcnt[]; it's dead and gone.
 1.68 26-Mar-1997  gwr Renames: /dumpconf/cpu_dumpconf/, /boot/cpu_reboot/
 1.67 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.66 12-Mar-1997  cgd sanity check rpb_primary_cpu_id
 1.65 03-Feb-1997  cgd branches: 1.65.2; 1.65.4;
print warnings about unrecognized boot flags. accept S/s as recognized,
even though they're redundant.
 1.64 31-Jan-1997  thorpej Don't locally declare root_device; it's not used in the MI kernel.
 1.63 07-Dec-1996  cgd branches: 1.63.2;
oops; have to cast PS_STRINGS away from pointer
 1.62 07-Dec-1996  cgd note what each of the argument registers in setregs() will be used
for by crt0. Actually clear a1 and a2, because unless a shared loader (i.e.
_not_ the kernel) set them when invoking crt0, they should be zero, and
the kernel DEBUG code wouldn't necessarily have them be. Pass a pointer
to the proc's ps_strings structure in a3.
 1.61 07-Dec-1996  cgd add a "machdep.booted_kernel" sysctl, which is the name of the booted
kernel as supplied by the SRM console's BOOTED_FILE variable.
 1.60 03-Dec-1996  cgd branches: 1.60.2;
fix a couple of bogons in the last two, and clean up slightly
 1.59 03-Dec-1996  cgd try that last one again.
 1.58 03-Dec-1996  cgd kill siroff() and resturcture do_sir() to be cleaner and more correct.
 1.57 17-Nov-1996  cgd clean up some 'system not supported' printfs
 1.56 16-Nov-1996  cgd compile with -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wcast-qual, even if DEBUG isn't defined.
 1.55 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.54 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.53 11-Nov-1996  cgd add more system type names, to match new system type numbers. Also, add
appropriate bits of code to support the EB164.
 1.52 06-Nov-1996  cgd Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().
 1.51 25-Oct-1996  cgd first arg to alpha_XXX_dmamap is now a vm_offset_t
 1.50 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.49 18-Oct-1996  cgd Severely clean up netisr handling. Clean up includes for netisr handlers.
Fix PPP netisr handling, add NATM netisr handling.
 1.48 15-Oct-1996  cgd define and call a new function, hwrbp_restart_setup(). It's called after
autoconfiguration to clear the RPB's per-cpu-slot BIP flag and to set up the
RPB's restart function pointers, etc.
 1.47 15-Oct-1996  cgd don't set dumplo to -1 on error. deal with the case where dumplo is
still 0 after dumpconf().
 1.46 13-Oct-1996  christos backout previous kprintf changes
 1.45 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.44 01-Oct-1996  cgd Translate Lev1map to physical address for CPU core header.
 1.43 01-Oct-1996  cgd support for new-style kernel core dumps for the alpha. Could probably
be cleaned up a bit, but it works.
 1.42 01-Oct-1996  cgd implement a simple (mostly brain-dead; old-style) kernel core dump routine,
which dumps all "system"-cluster memory we know about.
 1.41 10-Sep-1996  cgd set a0 to be the initial sp, and set pv to be program entry point.
 1.40 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP. also, fix bug where i wasn't disabling
all reporting of correctable errors on startup, but rather was
just clearing all outstanding correctable errors.
 1.39 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.38 16-Jul-1996  cgd if !OLD_PMAP set up proc0 pcb asn and ptbr before return to assembly.
 1.37 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.36 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Add a boot flag ('H' and 'h') to make sure the kernel never
reboots after panic. Useful for debugging kernels which panic early
on after user processes have started, to fend off infinite reboot cycles.
Sort boot flag switch.
(3) Add unaligned access fixup code to fix unaligned quad, long,
and IEEE S and T floating datum loads and stores. VAX floating data
types not yet supported, and in the future will only be supported if
FIX_UNALIGNED_VAX_FP is defined. (No point in wasting the space when
most of the time there will never be VAX FP loads and stores.) Right
now, these features can be controlled only by sysctl. The (boolean)
integer sysctls machdep.unaligned_print, machdep.unaligned_fix, and
machdep.unaligned_sigbus control printing about unaligned accesses
(defaults on), fixing up of unaligned accesses (defaults on), and
forcing a SIGBUS on unaligned accesses (defaults off). If an access
is not fixed up (for lack of method or explicit decision), a SIGBUS is
always generated to keep programs from using bogus data. At some point,
these three choices should be controlled by per-process flags, as well.
 1.35 11-Jul-1996  cgd don't save and set the USP at every trap entry and exit. It's
unnecessary, and given that there's no reason to waste time and
add complexity in trap handlers. This means that code which sets and
uses the USP has to be a bit more careful, but that doesn't happen much.
 1.34 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.33 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.32 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.31 15-Jun-1996  cgd allocate a flat 10% of memory to buffer pages.
 1.30 14-Jun-1996  cgd add a new machine-dependent sysctl, machdep.root_device, which is the
(string) name of the root device. It's a string so that it can
be used before dev_mkdb has been run.
 1.29 13-Jun-1996  cgd cpu_model must be an array to make sysctl be happy.
 1.28 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.27 13-Jun-1996  cgd note that the DEC 21000 isn't supported in the same way as for the 2000/300
 1.26 13-Jun-1996  cgd We'd like to differentiate case for kernel boot flags, but the Alpha AXP
Architecture Reference Manual says that we shouldn't. 'a' is now back
to ~RB_SINGLE, and 'n' and 'N' now get RB_ASKNAME.
 1.25 12-Jun-1996  cgd don't pass "argc," "argv," and "envp" from boot blocks to kernel;
they're unnecessary and there's no reason to use them. Have the
kernel get necessary values from the PROM directly.
 1.24 12-Jun-1996  cgd don't pass the firmware's console environment variable to the various console
initialization functions any more. None of them used it, and they can
get the same data more easily via the RPB.
 1.23 12-Jun-1996  cgd remove old, unused, framework for boot device detection. It's going
to be replaced by something new and working.
 1.22 12-Jun-1996  cgd GENERIC no longer has any special meaning (don't set RB_ASKNAME #ifdef GENERIC)
 1.21 12-Jun-1996  cgd change the meanings of some boot flags:
a (was ~RB_SINGLE, redundant with 'A') -> askname
n (was RB_ASKNAME) -> no meaning
d (was RB_DFLTROOT) -> no meaning (unnecessary with new setroot() code)
m (was RB_MINIROOT) -> no meaning (miniroots currently unsupported;
#ifdef'd out)
N (was ~RB_ASKNAME) -> no meaning (unnecessary; just don't specify RB_ASKNAME!)
 1.20 03-Jun-1996  cgd fix pasto: s/NETISR_CCITT/NETISR_PPP/ at the appropriate place in
netintr(). From Matt Thomas <matt@lkg.dec.com>.
 1.19 09-May-1996  cgd branches: 1.19.4;
update for changed ecoff headers. minor consistency changes for the
ecoff functions, as well.
 1.18 23-Apr-1996  cgd prototyping cleanups
 1.17 18-Apr-1996  cgd change NLE flag for IOASIC LANCE buffer to NLE_IOASIC, and add comments
 1.16 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.15 12-Apr-1996  cgd define delay() here, rather than in clock.c
 1.14 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.13 20-Dec-1995  cgd IO bus for 3000-family boxes is now "tcasic" when then attaches tc.
esp_iomem is unnecessary, has been unnecessary for a while,
apparently.
 1.12 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.11 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.10 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.9 01-Sep-1995  mycroft SA_ONSTACK --> SS_ONSTACK
 1.8 03-Aug-1995  cgd simplify various configuration code by setting function pointers and
calling the functions they point to. do real console initialization.
always include ecoff code (it's the "native" format, for now).
simplify kernel argument gathering.
 1.7 28-Jun-1995  cgd sync with my current Alpha sources
 1.6 31-May-1995  cgd invoke shutdown hooks
 1.5 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.4 22-Apr-1995  cgd add option HALTLOOP to loop in boot() instead of halting/rebooting
 1.3 24-Mar-1995  cgd better 3000/300-series systype recognition.
remove a while (1); that i added for debugging a while back.
remove support for double-mapping the user area and kernel stack.
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.19.4.7 05-Dec-1996  rat Patch request from Chris Demetriou <cgd@netbsd.org>

>Use '#if NPPP > 0' rather than '#ifdef PPP' to determine
>whether or not to enable PPP netisr handling.
 1.19.4.6 10-Sep-1996  cgd pull up from trunk (for cleaner compatibility with changes coming after 1.2):
>revision 1.41
>date: 1996/09/10 19:13:42; author: cgd; state: Exp; lines: +5 -1
>set a0 to be the initial sp, and set pv to be program entry point.
 1.19.4.5 15-Jun-1996  cgd pull up from trunk:
>allocate a flat 10% of memory to buffer pages.
 1.19.4.4 14-Jun-1996  cgd pull up from trunk:
>add a new machine-dependent sysctl, machdep.root_device, which is the
>(string) name of the root device. It's a string so that it can
>be used before dev_mkdb has been run.
 1.19.4.3 13-Jun-1996  cgd pull up from trunk:
>cpu_model must be an array to make sysctl be happy.
 1.19.4.2 13-Jun-1996  cgd pull up from trunk:
>change the meanings of some boot flags:
>a (was ~RB_SINGLE, redundant with 'A') -> askname
>n (was RB_ASKNAME) -> no meaning
>d (was RB_DFLTROOT) -> no meaning (unnecessary with new setroot() code)
>m (was RB_MINIROOT) -> no meaning (miniroots currently unsupported;
> #ifdef'd out)
>N (was ~RB_ASKNAME) -> no meaning (unnecessary; just don't specify RB_ASKNAME!)
and:
>GENERIC no longer has any special meaning (don't set RB_ASKNAME #ifdef GENERIC)
and:
>remove old, unused, framework for boot device detection. It's going
>to be replaced by something new and working.
and:
>don't pass the firmware's console environment variable to the various console
>initialization functions any more. None of them used it, and they can
>get the same data more easily via the RPB.
and:
>don't pass "argc," "argv," and "envp" from boot blocks to kernel;
>they're unnecessary and there's no reason to use them. Have the
>kernel get necessary values from the PROM directly.
and:
>We'd like to differentiate case for kernel boot flags, but the Alpha AXP
>Architecture Reference Manual says that we shouldn't. 'a' is now back
>to ~RB_SINGLE, and 'n' and 'N' now get RB_ASKNAME.
and:
>note that the DEC 21000 isn't supported in the same way as for the
>2000/300
and:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.19.4.1 03-Jun-1996  cgd pull up from trunk:
>fix pasto: s/NETISR_CCITT/NETISR_PPP/ at the appropriate place in
>netintr(). From Matt Thomas <matt@lkg.dec.com>.
 1.60.2.8 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.60.2.7 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.60.2.6 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.60.2.5 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.60.2.4 01-Feb-1997  cgd add unnecessary, but safe, cnpollc() uses
 1.60.2.3 31-Jan-1997  cgd sync with trunk
 1.60.2.2 07-Dec-1996  cgd sync with changes in trunk.
 1.60.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.63.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.65.4.1 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.65.2.1 12-Feb-1997  mrg don't allocate swap map in allocsys.
 1.76.4.3 05-Jun-1997  thorpej Move the Alpha bus dma support functions into their own file. Suggested
by Chris Demetriou <cgd@netbsd.org>.
 1.76.4.2 05-Jun-1997  thorpej In _bus_dmamap_load():
- Tidy up some types.
- Use vtophys(), not pmap_extract(), for buffers in kernel VA space.
Not all kernel buffers are mapped with the MMU page tables; some
are mapped via K0SEG.
 1.76.4.1 23-May-1997  thorpej Add the `bottom layer' of the alpha port bus dma implementation.
 1.76.2.2 12-Jun-1997  tls Merge MACHINE_ARCH and other changes so branch builds on alpha.
 1.76.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.81.2.5 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.81.2.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.81.2.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.81.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.81.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.84.2.1 08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.91.2.1 06-Nov-1997  thorpej Pull up from trunk: clean up "not configured"/"not supported" messages.
 1.167.2.7 23-Jan-2000  he Pull up revision 1.192 (requested by thorpej):
Fix netisr processing for PPP when only one device is configured.
Fixes PR#9257.
 1.167.2.6 02-Jul-1999  perry pullup 1.176->1.177 (ross)
 1.167.2.5 21-Jun-1999  cgd pull up rev(s) 1.171 from trunk. (cgd)
 1.167.2.4 29-Apr-1999  perry branches: 1.167.2.4.2; 1.167.2.4.4;
pullup 1.116->1.117 (ross)
 1.167.2.3 16-Apr-1999  thorpej Pull up 1.168 -> 1.169.
 1.167.2.2 16-Apr-1999  chs pull up 1.167 -> 1.168:
add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.167.2.1 10-Apr-1999  chs file machdep.c was added on branch netbsd-1-4 on 1999-04-16 16:13:49 +0000
 1.167.2.4.4.2 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.167.2.4.4.1 28-Jun-1999  itojun KAME/NetBSD 1.4 SNAP kit, dated 19990628.

NOTE: this branch (kame) is used just for refernce. this may not compile
due to multiple reasons.
 1.167.2.4.2.3 11-Aug-1999  chs add casts for trunc_page() and round_page() args.
 1.167.2.4.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.167.2.4.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.183.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.184.2.8 23-Apr-2001  bouyer Sync with HEAD.
 1.184.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.184.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.184.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.184.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.184.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.184.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.184.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.207.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.230.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.230.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.245.2.7 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.245.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.245.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.245.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.245.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.245.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.245.2.1 03-Aug-2001  lukem update to -current
 1.248.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.248.2.25 14-Jan-2003  nathanw cpu_getmcontext: Save process-unique value and set _UC_UNIQUE flag.
cpu_setmcontext: Restore process-unique value if _UC_UNIQUE flag is set.
 1.248.2.24 08-Jan-2003  thorpej Sync with HEAD.
 1.248.2.23 16-Dec-2002  nathanw LWPify some MULTIPROCESSOR code.
 1.248.2.22 18-Oct-2002  nathanw Catch up to -current.
 1.248.2.21 17-Sep-2002  nathanw Catch up to -current.
 1.248.2.20 27-Aug-2002  nathanw Catch up to -current.
 1.248.2.19 02-Aug-2002  nathanw LWPify sigexit() call.
 1.248.2.18 01-Aug-2002  nathanw Catch up to -current.
 1.248.2.17 19-Jul-2002  nathanw Invoke upcalls directly, instead of going through a trampoline.
(Since upcalls shouldn't return at all, even the return part of the
trampoline is unnecessary).
 1.248.2.16 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.248.2.15 09-Jul-2002  nathanw #include <sys/sa.h> for type definitions.
 1.248.2.14 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.248.2.13 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.248.2.12 02-Apr-2002  nathanw convert p->p_psstr => l->l_proc->p_psstr in setregs().
 1.248.2.11 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.248.2.10 28-Dec-2001  nathanw Garbage collect cpu_stashcontext().
 1.248.2.9 17-Dec-2001  nathanw Sprinkle const around frametoreg() and regtoframe().
Adapt to new, minimal cpu_upcall().
Adapte to Klaus's mcontext.
 1.248.2.8 17-Nov-2001  thorpej Use sadata_upcall_free(), and use it to plug a memory leak in an
error path (copying out arg onto user stack fails).
 1.248.2.7 17-Nov-2001  nathanw Adapt to new upcall signature and possible argument copying.
 1.248.2.6 21-Sep-2001  nathanw Catch up to -current.
 1.248.2.5 17-Sep-2001  nathanw Same bug, different function:
In cpu_getmcontext(), actually get the USP for the given LWP, not the
USP of the current PCB.
XXX the code is ugly.
 1.248.2.4 14-Sep-2001  nathanw In cpu_stashcontext(), actually get the USP for the given LWP, not the
USP of the current PCB.
XXX the code is ugly.
 1.248.2.3 13-Sep-2001  nathanw P_INMEM -> L_INMEM in a KDASSERT().
 1.248.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.248.2.1 27-Jul-2001  nathanw file machdep.c was added on branch nathanw_sa on 2001-08-30 23:43:40 +0000
 1.254.4.3 30-Aug-2002  gehenna catch up with -current.
 1.254.4.2 16-Jul-2002  gehenna catch up with -current.
 1.254.4.1 16-May-2002  gehenna Replace the access to devsw table with calling devsw API.
 1.270.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.270.2.4 21-Nov-2004  skrll Adapt to branch. Alpha kernels now compile.
 1.270.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.270.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.270.2.1 03-Aug-2004  skrll Sync with HEAD
 1.282.2.1 10-Jul-2004  tron branches: 1.282.2.1.2;
Pull up revision 1.283 (requested by mhitch in ticket #624):
After sending the IPI to halt other CPUs, clear cpus_paused to ensure that
the other CPUs resume execution. If the halt was initiated from DDB, the
CPUs will not have been resume execution and will never halt. If one of the
paused CPUs is the primary CPU, the system will hang. Fixes PR#26159.
 1.282.2.1.2.1 29-Aug-2005  tron Pull up following revision(s) (requested by riz in ticket #5623):
sys/arch/alpha/alpha/machdep.c: revision 1.287
sys/arch/alpha/alpha/trap.c: revision 1.98
sys/arch/alpha/include/pcb.h: revision 1.13
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.283.10.1 30-Jul-2005  tron Pull up revision 1.287 (requested by thorpej in ticket #629):
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.283.4.1 29-Apr-2005  kent sync with -current
 1.286.2.6 17-Mar-2008  yamt sync with head.
 1.286.2.5 07-Dec-2007  yamt sync with head
 1.286.2.4 03-Sep-2007  yamt sync with head.
 1.286.2.3 26-Feb-2007  yamt sync with head.
 1.286.2.2 30-Dec-2006  yamt sync with head.
 1.286.2.1 21-Jun-2006  yamt sync with head.
 1.288.22.2 10-Dec-2006  yamt sync with head.
 1.288.22.1 22-Oct-2006  yamt sync with head
 1.288.20.5 01-Feb-2007  ad Sync with head.
 1.288.20.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.288.20.3 12-Jan-2007  ad Sync with head.
 1.288.20.2 11-Jan-2007  ad Checkpoint work in progress.
 1.288.20.1 18-Nov-2006  ad Sync with head.
 1.290.2.1 06-Jan-2007  bouyer Pull up following revision(s) (requested by elad in ticket #316):
share/examples/secmodel/secmodel_example.c: revision 1.10 via patch
sys/arch/i386/i386/sys_machdep.c: revision 1.79
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.31
share/man/man9/secmodel_bsd44.9: revision 1.9
sys/arch/vax/vax/mem.c: revision 1.34 via patch
sys/arch/sh3/sh3/mem.c: revision 1.23 via patch
sys/arch/sh5/sh5/mem.c: revision 1.14 via patch
sys/secmodel/bsd44/secmodel_bsd44_suser.c: revision 1.22 via patch
sys/arch/powerpc/powerpc/mem.c: revision 1.27 via patch
sys/arch/x86/x86/x86_machdep.c: revision 1.5
sys/arch/alpha/alpha/machdep.c: revision 1.291
sys/arch/arm/arm32/mem.c: revision 1.17 via patch
sys/secmodel/bsd44/secmodel_bsd44_securelevel.c: revision 1.20
sys/sys/kauth.h: revision 1.29 via patch
sys/arch/amd64/amd64/sys_machdep.c: revision 1.10
share/man/man9/kauth.9: revision 1.43 via patch
sys/arch/xen/i386/sys_machdep.c: revision 1.10
sys/kern/kern_auth.c: revision 1.35
sys/arch/pc532/pc532/mem.c: revision 1.43 via patch
Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
 1.293.2.3 20-Mar-2007  yamt adapt alpha.
 1.293.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.293.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.296.10.2 03-Oct-2007  garbled Sync with HEAD
 1.296.10.1 22-May-2007  matt Update to HEAD.
 1.296.8.2 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.296.8.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.296.4.1 11-Jul-2007  mjf Sync with head.
 1.296.2.4 03-Dec-2007  ad Sync with HEAD.
 1.296.2.3 03-Dec-2007  ad Sync with HEAD.
 1.296.2.2 15-Jul-2007  ad Sync with head.
 1.296.2.1 27-May-2007  ad Sync with head.
 1.299.14.1 21-Nov-2007  bouyer Sync with HEAD
 1.299.10.3 23-Mar-2008  matt sync with HEAD
 1.299.10.2 09-Jan-2008  matt sync with HEAD
 1.299.10.1 06-Nov-2007  matt sync with HEAD
 1.299.8.2 03-Dec-2007  joerg Sync with HEAD.
 1.299.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.300.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.302.14.4 17-Jan-2009  mjf Sync with HEAD.
 1.302.14.3 02-Jul-2008  mjf Sync with HEAD.
 1.302.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.302.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.302.10.1 24-Mar-2008  keiichi sync with head.
 1.303.2.1 18-May-2008  yamt sync with head.
 1.304.2.4 11-Mar-2010  yamt sync with head
 1.304.2.3 19-Aug-2009  yamt sync with head.
 1.304.2.2 04-May-2009  yamt sync with head.
 1.304.2.1 16-May-2008  yamt sync with head.
 1.305.4.1 03-Jul-2008  simonb Sync with head.
 1.305.2.5 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.305.2.4 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.305.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.305.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.305.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.306.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.306.2.1 19-Oct-2008  haad Sync with HEAD.
 1.307.4.2 31-Oct-2009  sborrill Pull up the following revisions(s) (requested by mhitch in ticket #1118):
sys/arch/alpha/alpha/machdep.c: revision 1.321

Ensures the cpu running the shutdown waits for the correct cpus to halt
and thus stop the machine hanging at shutdown.
 1.307.4.1 02-Feb-2009  snj branches: 1.307.4.1.2; 1.307.4.1.4;
Pull up following revision(s) (requested by ad in ticket #346):
sys/arch/alpha/alpha/machdep.c: revision 1.311
sys/arch/amiga/amiga/machdep.c: revision 1.211
sys/arch/atari/atari/machdep.c: revision 1.153
sys/arch/hp700/hp700/machdep.c: revision 1.53
sys/arch/i386/i386/dumpsys.c: revision 1.5
sys/arch/mips/mips/mips_machdep.c: revision 1.206
sys/arch/mvme68k/mvme68k/machdep.c: revision 1.132
sys/arch/news68k/news68k/machdep.c: revision 1.75
sys/arch/next68k/next68k/machdep.c: revision 1.88
sys/arch/sparc/sparc/machdep.c: revision 1.285
sys/arch/sparc64/sparc64/machdep.c: revision 1.230
sys/arch/sun2/sun2/machdep.c: revision 1.56
sys/arch/sun3/sun3/machdep.c: revision 1.188
sys/arch/sun3/sun3x/machdep.c: revision 1.114
sys/arch/x68k/x68k/machdep.c: revision 1.153
dumpsys: don't spew numbers into the log.
 1.307.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.307.4.1.2.1 31-Oct-2009  sborrill Pull up the following revisions(s) (requested by mhitch in ticket #1118):
sys/arch/alpha/alpha/machdep.c: revision 1.321

Ensures the cpu running the shutdown waits for the correct cpus to halt
and thus stop the machine hanging at shutdown.
 1.307.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.307.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.307.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.314.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.325.2.3 27-May-2010  uebayasi Fix build.
 1.325.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.325.2.1 28-Apr-2010  uebayasi Always use struct vm_physseg *vm_physmem_ptrs[] in MD code.
 1.326.2.6 12-Jun-2011  rmind sync with head
 1.326.2.5 31-May-2011  rmind sync with head
 1.326.2.4 21-Apr-2011  rmind sync with head
 1.326.2.3 05-Mar-2011  rmind sync with head
 1.326.2.2 25-Apr-2010  rmind - Invent mm_md_getva() and mm_md_relva() routines, provided by MD and
indicated with __HAVE_MM_MD_PREFER_VA. It will be used to deal with
cache aliasing issues and thus fix little MIPS, ARM and friends.

- Convert dev_mem_readwrite() to use unmanaged mappings. Fix a missed
offset addition in a case of direct map. Sprinkle various comments in
the memory device driver.

- Add missing direct map handling on hp700 and vax. Make checks across
m68k ports more consistent, reduce the diffs. Fix kernacc check miss
on news68k. Minor off-by-one fix for alpha. Add MEMC_PHYS_BASE for
mmap() case check on acorn26. Misc clean-up.
 1.326.2.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.328.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.328.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.333.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.335.6.3 02-Jun-2012  mrg sync to latest -current.
 1.335.6.2 24-Feb-2012  mrg sync to -current.
 1.335.6.1 18-Feb-2012  mrg merge to -current.
 1.335.2.4 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.335.2.3 30-Oct-2012  yamt sync with head
 1.335.2.2 23-May-2012  yamt sync with head.
 1.335.2.1 17-Apr-2012  yamt sync with head
 1.337.2.2 16-Nov-2016  snj Pull up following revision(s) (requested by flxd in ticket #1416):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.337.2.1 21-May-2012  riz Pull up following revision(s) (requested by martin in ticket #274):
sys/arch/amd64/amd64/process_machdep.c: revision 1.20
sys/kern/sys_lwp.c: revision 1.54
sys/arch/sparc64/sparc64/machdep.c: revision 1.267
sys/arch/mips/mips/cpu_subr.c: revision 1.16
sys/arch/vax/vax/machdep.c: revision 1.188
sys/sys/lwp.h: revision 1.161
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.98
sys/arch/alpha/alpha/machdep.c: revision 1.339
sys/compat/sys/ucontext.h: revision 1.6
sys/arch/hppa/hppa/hppa_machdep.c: revision 1.28
distrib/sets/lists/tests/mi: revision 1.469
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.42
tests/lib/libc/sys/t_lwp_create.c: revision 1.1
tests/lib/libc/sys/Makefile: revision 1.23
sys/arch/arm/arm/sig_machdep.c: revision 1.42
sys/arch/amd64/include/mcontext.h: revision 1.15
sys/arch/amd64/amd64/machdep.c: revision 1.183
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.99
sys/arch/i386/i386/machdep.c: revision 1.727
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.13
sys/arch/sparc/sparc/machdep.c: revision 1.319
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.76
sys/arch/m68k/m68k/sig_machdep.c: revision 1.49
sys/sys/ucontext.h: revision 1.16
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.9
lib/libc/sys/_lwp_create.2: revision 1.5
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.
To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.
Add an exhaustive atf test case, based partly on code from Joel Sing.
Should finally fix the remaining open part of PR kern/43903.
 1.342.4.1 18-May-2014  rmind sync with head
 1.342.2.2 03-Dec-2017  jdolecek update from HEAD
 1.342.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.344.2.1 10-Aug-2014  tls Rebase.
 1.345.6.1 18-Jan-2017  skrll Sync with netbsd-5
 1.345.4.2 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.345.4.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.345.2.2 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.345.2.1 01-Nov-2016  snj branches: 1.345.2.1.2;
Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.345.2.1.2.1 30-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1677):

sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.346.4.4 20-Mar-2017  pgoyette Sync with HEAD
 1.346.4.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.346.4.2 04-Nov-2016  pgoyette Sync with HEAD
 1.346.4.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.346.2.3 28-Aug-2017  skrll Sync with HEAD
 1.346.2.2 05-Feb-2017  skrll Sync with HEAD
 1.346.2.1 05-Dec-2016  skrll Sync with HEAD
 1.349.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.350.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.350.14.1 10-Jun-2019  christos Sync with HEAD
 1.350.12.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.350.12.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.350.6.1 27-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1173):
sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/riscv/riscv/sig_machdep.c: revision 1.2
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
 1.350.4.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.357.2.1 29-Feb-2020  ad Sync with head.
 1.369.6.3 01-Aug-2021  thorpej Sync with HEAD.
 1.369.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.369.6.1 13-May-2021  thorpej Sync with HEAD.
 1.371.2.1 31-May-2021  cjep sync with head
 1.379.2.1 02-Aug-2025  perseant Sync with HEAD
 1.37 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.36 07-Jul-2021  thorpej branches: 1.36.2;
After attaching CPUs, call alpha_patch() in case there are any function
patches we wish to do based on discovered architecture features.
 1.35 24-Apr-2021  thorpej branches: 1.35.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.34 27-Sep-2020  thorpej branches: 1.34.4;
Add a "qemu" driver to access services provided by the Qemu VM. First
order of business is to use the Qemu "get-time" console service call as
the perferred system timecounter.
 1.33 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.32 09-Jul-2008  joerg branches: 1.32.28; 1.32.32;
device/softc split
 1.31 01-Jan-2003  thorpej branches: 1.31.104; 1.31.108; 1.31.110; 1.31.112; 1.31.114;
Use aprint_normal() for cfprint routines.
 1.30 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.29 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.28 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.27 24-Jun-1998  ross branches: 1.27.26; 1.27.28; 1.27.40;
Use new LOCATE_PCS() macro.
 1.26 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.25 13-May-1998  thorpej Clean up some historical artifacts.
 1.24 12-Jan-1998  thorpej Adjust for config changes.
 1.23 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.22 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.21 07-Apr-1997  cgd branches: 1.21.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.20 07-Apr-1997  cgd include machine/options.h
 1.19 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.18 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.17 12-Mar-1997  cgd pass CPU ID info down to cpu when attaching (duh!)
 1.16 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.15 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.14 13-Nov-1996  cgd branches: 1.14.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.13 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.9 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.8 04-Apr-1996  cgd update for the fact that config_found() and config_rootfound() now
return pointers. (Check vs. NULL, rather than just boolean tests.)
 1.7 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.6 20-Dec-1995  cgd if subdevice not configured, print something out about it.
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 03-Aug-1995  cgd kill MD #ifdefs, pull primary bus name from global
 1.3 28-Jun-1995  cgd sync with my current Alpha sources
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.14.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.14.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.21.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.40.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.27.28.1 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.27.26.3 03-Jan-2003  thorpej Sync with HEAD.
 1.27.26.2 18-Oct-2002  nathanw Catch up to -current.
 1.27.26.1 17-Sep-2002  nathanw Catch up to -current.
 1.31.114.1 19-Oct-2008  haad Sync with HEAD.
 1.31.112.1 18-Jul-2008  simonb Sync with head.
 1.31.110.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.31.108.1 04-May-2009  yamt sync with head.
 1.31.104.1 28-Sep-2008  mjf Sync with HEAD.
 1.32.32.1 18-Feb-2012  mrg merge to -current.
 1.32.28.1 17-Apr-2012  yamt sync with head
 1.34.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.35.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.36.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.23 06-Mar-2024  thorpej Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module. The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.
 1.22 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.21 01-Oct-2020  skrll Fix build
 1.20 01-Oct-2020  skrll KNF
 1.19 29-Sep-2020  thorpej mcclock_init(): Only do our work if called on the primary CPU.
 1.18 21-Nov-2011  christos - don't clear the flags twice in the loop
- reorder calculation to preserve as much precision as possible.
 1.17 01-Jul-2011  dyoung branches: 1.17.2;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16 05-Mar-2009  msaitoh Fix typo(s/interupt/interrupt/)
 1.15 05-Mar-2009  msaitoh Fix typo(s/interupt/interrupt/)
 1.14 03-Feb-2008  tsutsui branches: 1.14.10; 1.14.18; 1.14.24;
Use some loops to prime the cache on measuring the PCC clock frequency.
As per the similar code on mips ports (though no visible difference).
 1.13 10-Jan-2008  tsutsui Move todr_attach(9) calls from each MD attachment to MI mc146818_attach().
 1.12 17-Oct-2007  garbled branches: 1.12.2; 1.12.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.11 21-Jul-2007  tsutsui branches: 1.11.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.10 12-Jan-1998  thorpej branches: 1.10.64; 1.10.106; 1.10.114; 1.10.118; 1.10.120;
Adjust for config changes.
 1.9 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.8 22-Jul-1997  jonathan branches: 1.8.2;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.7 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.5 12-Mar-1997  cgd enabled SQWE as well as PIE in reg B.
 1.4 13-Oct-1996  christos branches: 1.4.2;
backout previous kprintf change
 1.3 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 17-Apr-1996  cgd fix copyrights
 1.1 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.4.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.120.1 15-Aug-2007  skrll Sync with HEAD.
 1.10.118.1 07-Aug-2007  matt Sync with HEAD.
 1.10.114.1 03-Oct-2007  garbled Sync with HEAD
 1.10.106.1 20-Aug-2007  ad Sync with HEAD.
 1.10.64.3 04-Feb-2008  yamt sync with head.
 1.10.64.2 21-Jan-2008  yamt sync with head
 1.10.64.1 03-Sep-2007  yamt sync with head.
 1.11.6.2 23-Mar-2008  matt sync with HEAD
 1.11.6.1 06-Nov-2007  matt sync with HEAD
 1.12.8.1 10-Jan-2008  bouyer Sync with HEAD
 1.12.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.18.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.10.1 04-May-2009  yamt sync with head.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.7 06-Mar-2024  thorpej Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module. The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.
 1.6 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.5 21-Jul-2007  tsutsui branches: 1.5.6; 1.5.8;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.4 22-Jul-1997  jonathan branches: 1.4.30; 1.4.56;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 17-Apr-1996  cgd branches: 1.2.2;
fix copyrights
 1.1 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.2.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.56.1 20-Aug-2007  ad Sync with HEAD.
 1.4.30.1 03-Sep-2007  yamt sync with head.
 1.5.8.2 15-Aug-2007  skrll Sync with HEAD.
 1.5.8.1 21-Jul-2007  skrll file mcclockvar.h was added on branch nick-csl-alignment on 2007-08-15 13:46:58 +0000
 1.5.6.2 07-Aug-2007  matt Sync with HEAD.
 1.5.6.1 21-Jul-2007  matt file mcclockvar.h was added on branch matt-mips64 on 2007-08-07 18:04:52 +0000
 1.12 21-Jan-2002  jdolecek Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.11 17-Mar-1999  sommerfe branches: 1.11.20; 1.11.22;
defopt MINIROOTSIZE
 1.10 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.9 07-Apr-1997  cgd branches: 1.9.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.7 28-Dec-1996  pk branches: 1.7.4;
omission in last commit: ramdisk.h => md.h
 1.6 28-Dec-1996  pk rename: ramdisk => md
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 03-Oct-1996  cgd reword attachment printf
 1.2 03-Oct-1996  cgd clean up
 1.1 15-Sep-1996  cgd add ramdisk root hooks
 1.7.4.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.4.2 24-Jan-1997  cgd sync with trunk
 1.7.4.1 28-Dec-1996  cgd file md_root.c was added on branch alpha-nwscons on 1997-01-24 07:05:45 +0000
 1.9.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.22.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.11.20.1 28-Feb-2002  nathanw Catch up to -current.
 1.42 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.41 08-Feb-2011  rmind branches: 1.41.2;
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.40 14-Mar-2009  dsl branches: 1.40.2; 1.40.4; 1.40.6; 1.40.8;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.39 17-Oct-2007  garbled branches: 1.39.16; 1.39.20; 1.39.28; 1.39.34;
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.38 21-Jul-2007  ad branches: 1.38.6;
Don't depend on uvm_extern.h pulling in proc.h.
 1.37 04-Mar-2007  christos branches: 1.37.2; 1.37.10; 1.37.12; 1.37.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.36 11-Dec-2005  christos branches: 1.36.26;
merge ktrace-lwp.
 1.35 07-Aug-2003  agc branches: 1.35.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.34 01-Apr-2003  thorpej branches: 1.34.2;
Use PAGE_SIZE rather than NBPG.
 1.33 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.32 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.31 27-Feb-2002  christos branches: 1.31.8;
- Use DEV_ constants, instead of documenting the numbers!
- Delete cdev_decl(mm); where appropriate, and other hand-crufting [hi powerpc!]
 1.30 12-Jul-2001  thorpej branches: 1.30.2; 1.30.4;
bzero -> memset
 1.29 07-Jan-2001  thorpej branches: 1.29.4;
No, really, pass the PA to alpha_pa_access(), not the PFN.
 1.28 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.27 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.26 29-Mar-2000  simonb branches: 1.26.4;
Remove redundant decl of msgbufmapped - it's in <sys/msgbuf.h>.
 1.25 04-Dec-1999  ragge CL* discarding.
 1.24 24-Mar-1999  mrg branches: 1.24.8; 1.24.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.23 19-Nov-1998  ross #include <machine/alpha.h>
 1.22 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.21 09-Mar-1998  thorpej Don't do the Segtabzero-for-dev-zero hack.
 1.20 24-Feb-1998  thorpej Add support for UVM.
 1.19 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.18 19-Sep-1997  mjacob Add missing reference.
 1.17 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.16 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.15 07-May-1997  mjacob branches: 1.15.4;
In case someone doesn't compile in DEBUG we need to still
snag the msgbuf. Also, observe protocols about message buffer
being 'mapped'.
 1.14 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.13 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.12 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.11 24-Mar-1997  cgd Optimize the case of writing to /dev/zero, and clean up the
surrounding code a bit. Partly suggested by gwr, them implemented
by mycroft in the i386 port, then cleaned up a bit to fit here.
 1.10 13-Nov-1996  cgd branches: 1.10.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.9 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP
 1.8 11-Jul-1996  cgd compile with new pmap code
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 12-Apr-1996  cgd cast return of phystok0seg() to a caddr_t, to suit uiomove proto
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 28-Jun-1995  cgd sync with my current Alpha sources
 1.3 10-Apr-1995  mycroft Add mmopen(), mmclose(), and mmmmap() where appropriate. Lock vmmap when
needed. Make types consistent.
 1.2 10-Apr-1995  mycroft Add dummy mmopen() and mmclose(); change mmmap() to mmmmap().
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.4.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.8.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.24.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.26.4.2 25-Jan-2001  jhawk Pull up revision 1.29 (requested by thorpej):
Pass the PA (not the PFN) to alpha_pa_access().
 1.26.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.29.4.3 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.29.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.29.4.1 03-Aug-2001  lukem update to -current
 1.30.4.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.30.2.4 11-Nov-2002  nathanw Catch up to -current
 1.30.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.30.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.30.2.1 12-Jul-2001  nathanw file mem.c was added on branch nathanw_sa on 2002-02-28 04:06:09 +0000
 1.31.8.1 16-May-2002  gehenna Add the character device switch.
 1.34.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.35.16.1 03-Sep-2007  yamt sync with head.
 1.36.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.37.12.1 07-Aug-2007  matt Sync with HEAD.
 1.37.10.1 03-Oct-2007  garbled Sync with HEAD
 1.37.2.1 20-Aug-2007  ad Sync with HEAD.
 1.38.6.1 06-Nov-2007  matt sync with HEAD
 1.39.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.39.20.1 04-May-2009  yamt sync with head.
 1.39.16.1 29-Mar-2008  mjf Add a mem_init() function for each architecture that requests a device
node for /dev/mem, /dev/null, /dev/zero, etc.

This will disappear when I move this code (and others) to be a
pseudo-device. When we have machine-independent mem code this will all be
unnecessary anyway.
 1.40.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.40.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.40.4.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.40.2.2 15-Nov-2010  uebayasi Revert xmd(4).
 1.40.2.1 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.41.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.4 05-Feb-2003  nakayama Switch to kern/kern_microtime.c , so these are no longer needed.
 1.3 27-May-2001  sommerfeld branches: 1.3.2; 1.3.6;
Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.2 29-Apr-2001  sommerfeld Correct microtime() to use the microsecond part of the base timestamp.
 1.1 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.3.6.2 27-May-2001  sommerfeld Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.3.6.1 27-May-2001  sommerfeld file microtime.c was added on branch nathanw_sa on 2001-05-27 13:53:25 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15 04-Sep-2020  thorpej Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.14 03-Sep-2020  thorpej Garbage-collect the SWITCH_CONTEXT macro, since it now expands to
just "call_pal PAL_OSF1_swpctx".
 1.13 28-Apr-2008  martin branches: 1.13.80; 1.13.92;
Remove clause 3 and 4 from TNF licenses
 1.12 17-Oct-2007  garbled branches: 1.12.16; 1.12.18; 1.12.20;
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.11 18-May-2007  mhitch branches: 1.11.10;
Fix a couple of problems when starting the idle lwp on secondary
cpus: Set curlwp, and allow interrupts before entering idle loop
(otherwise, IPI interrupts won't be handled on an idle cpu).
 1.10 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.9 05-May-2001  thorpej branches: 1.9.4; 1.9.40; 1.9.78; 1.9.82; 1.9.84; 1.9.90;
No need to have code we don't use anymore.
 1.8 20-Nov-2000  thorpej branches: 1.8.2;
We've fixed enough bugs that we can actually acquire the scheduler
lock, jump into the idle loop, and run user code! Yippee!
 1.7 18-Nov-2000  sommerfeld Loading the cpu_info value into the kgp for the new cpu isn't likely to work
very well.
 1.6 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.5 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.4 31-May-1999  ross branches: 1.4.2; 1.4.8;
Convert to traceback-friendly temporary labels.
 1.3 23-Feb-1999  thorpej branches: 1.3.4;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.2 28-Sep-1998  thorpej Invalidate the TB and I-stream upon entry, and fix a typo in the wrkgp call.
 1.1 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.90.1 22-May-2007  matt Update to HEAD.
 1.9.84.1 11-Jul-2007  mjf Sync with head.
 1.9.82.1 27-May-2007  ad Sync with head.
 1.9.78.1 20-Mar-2007  yamt adapt alpha.
 1.9.40.1 03-Sep-2007  yamt sync with head.
 1.9.4.2 05-May-2001  thorpej No need to have code we don't use anymore.
 1.9.4.1 05-May-2001  thorpej file multiproc.s was added on branch nathanw_sa on 2001-05-05 02:20:54 +0000
 1.11.10.1 06-Nov-2007  matt sync with HEAD
 1.12.20.1 16-May-2008  yamt sync with head.
 1.12.18.1 18-May-2008  yamt sync with head.
 1.12.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.92.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #264):

sys/arch/alpha/include/asm.h: revision 1.45 (patch)
(also applied to locore.s and multiproc.s)

alpha: Add missing barriers in cpu_switchto.
Details in comments.
(accidently missed in original commit for ticket #264)
 1.13.80.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1859):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
(applied also to sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/a9_mpsubr.S,
sys/arch/arm/cortex/cortex_init.S)
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/alpha/include/asm.h: revision 1.45
(applied to sys/arch/alpha/alpha/multiproc.s)
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.3 14-Dec-2000  mycroft osf1_locore.s -> osf1_sigcode.s, to match the global convention.
Add linux_syscall.c.
 1.2 29-Nov-2000  jdolecek remove unneded opt_compat_osf1.h stuff
 1.1 30-Apr-1999  cgd branches: 1.1.2; 1.1.4; 1.1.6;
OSF/1 locore-ish bits. right now just sigcode
 1.1.6.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.6.1 08-Dec-2000  bouyer Sync with HEAD.
 1.1.4.2 21-Jun-1999  cgd pull up rev(s) 1.1 (new file) from trunk. (cgd)
 1.1.4.1 30-Apr-1999  cgd file osf1_locore.s was added on branch netbsd-1-4 on 1999-06-21 19:20:27 +0000
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.3 01-Jul-2002  thorpej branches: 1.3.198;
When delivering a signal, arrange for the signal handler to be invoked
directly, using the trampoline only for the return path.
 1.2 13-May-2002  thorpej branches: 1.2.2;
Make the sigcode no-profile.
 1.1 14-Dec-2000  mycroft branches: 1.1.2; 1.1.4; 1.1.6;
osf1_locore.s -> osf1_sigcode.s, to match the global convention.
Add linux_syscall.c.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 14-Dec-2000  bouyer file osf1_sigcode.s was added on branch thorpej_scsipi on 2001-01-05 17:33:40 +0000
 1.2.2.1 16-Jul-2002  gehenna catch up with -current.
 1.3.198.1 10-Jun-2019  christos Sync with HEAD
 1.36 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.35 07-Mar-2015  christos branches: 1.35.18;
Adjust to new trace_{enter,exit} signature.
 1.34 06-Feb-2012  matt branches: 1.34.6; 1.34.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.33 20-Dec-2010  matt branches: 1.33.8; 1.33.12;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.32 21-Nov-2009  rmind branches: 1.32.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.31 21-Oct-2008  ad Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.
 1.30 21-Oct-2008  ad Undo revivesa damage to userret().
 1.29 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.28 28-Apr-2008  martin branches: 1.28.2; 1.28.6;
Remove clause 3 and 4 from TNF licenses
 1.27 24-Apr-2008  ad branches: 1.27.2;
- Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
 1.26 06-Feb-2008  dsl branches: 1.26.6; 1.26.8;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53
 1.25 05-Jan-2008  dsl Don't pass 'curlwp' into trace_enter() and trace_exit().
 1.24 04-Mar-2007  christos branches: 1.24.20; 1.24.26; 1.24.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 09-Feb-2007  ad branches: 1.23.2;
Merge newlock2 to head.
 1.22 19-Jul-2006  ad branches: 1.22.4;
- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
 1.21 07-Mar-2006  thorpej branches: 1.21.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.20 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.19 05-Mar-2006  christos Add a proc_is_traced_p() macro and use it, instead of copying the same code
in many places. Idea from thorpej.
 1.18 05-Mar-2006  christos branches: 1.18.2;
implement PT_SYSCALL
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 01-Jul-2005  christos branches: 1.16.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.
 1.15 31-Oct-2003  simonb Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
 1.14 29-Oct-2003  mycroft Make sure "args" is pointing somewhere sane before calling trace_exit().
 1.13 27-Oct-2003  chs uninitialized variables
 1.12 17-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11 21-Dec-2002  manu Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
 1.10 15-Nov-2002  manu Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
 1.9 18-Jun-2002  thorpej Fix syscall_intern after systrace (HI CHRISTOS!)
 1.8 17-Jun-2002  christos MD systrace gluons.
 1.7 10-Apr-2002  mycroft branches: 1.7.2;
Oops; fix the second usage.
 1.6 10-Apr-2002  mycroft osf1_errno_rxlist[] -> native_to_osf1_errno[]
 1.5 30-May-2001  mrg branches: 1.5.2; 1.5.4;
use _KERNEL_OPT
 1.4 03-Jan-2001  thorpej branches: 1.4.2;
ANSI'ify, and inline userret().
 1.3 14-Dec-2000  mycroft Some #ifdefs to make LKMs happy.
 1.2 13-Dec-2000  mycroft branches: 1.2.2;
Do the fast/slow path separation, a la x86.
 1.1 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.2.2.1 13-Dec-2000  bouyer file osf1_syscall.c was added on branch thorpej_scsipi on 2000-12-13 14:48:57 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.8 29-Dec-2002  thorpej Sync with HEAD.
 1.5.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.5.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.4.5 09-Jul-2002  nathanw #include <sys/sa.h> for type definitions.
 1.5.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.5.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.5.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.5.4.1 30-May-2001  nathanw file osf1_syscall.c was added on branch nathanw_sa on 2001-08-30 23:43:41 +0000
 1.5.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.2 16-Jul-2002  gehenna catch up with -current.
 1.7.2.1 09-Jul-2002  gehenna catch up with -current.
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.2.6 11-Feb-2008  yamt sync with head.
 1.16.2.5 21-Jan-2008  yamt sync with head
 1.16.2.4 03-Sep-2007  yamt sync with head.
 1.16.2.3 26-Feb-2007  yamt sync with head.
 1.16.2.2 30-Dec-2006  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.3 11-Aug-2006  yamt sync with head
 1.18.2.2 13-Mar-2006  yamt sync with head.
 1.18.2.1 05-Mar-2006  yamt file osf1_syscall.c was added on branch yamt-pdpolicy on 2006-03-13 09:06:51 +0000
 1.21.2.2 07-Mar-2006  thorpej Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.21.2.1 07-Mar-2006  thorpej file osf1_syscall.c was added on branch elad-kernelauth on 2006-03-07 07:21:51 +0000
 1.22.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.22.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.23.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.32.1 08-Jan-2008  bouyer Sync with HEAD
 1.24.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.24.20.2 23-Mar-2008  matt sync with HEAD
 1.24.20.1 09-Jan-2008  matt sync with HEAD
 1.26.8.1 18-May-2008  yamt sync with head.
 1.26.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.26.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.2.3 11-Mar-2010  yamt sync with head
 1.27.2.2 04-May-2009  yamt sync with head.
 1.27.2.1 16-May-2008  yamt sync with head.
 1.28.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.6.1 19-Oct-2008  haad Sync with HEAD.
 1.28.2.3 15-Oct-2008  wrstuden Remove some now-unneeded includes. Matches previous changes to i386 code.
 1.28.2.2 23-May-2008  wrstuden Re-add userret hook. Add a new define, SA_NO_USERRET, which
indicates that upcall support should NOT be included. Add this
for all non-netbsd emulations. They will never be SA apps, so
let's make the invarient pretty blatant.

NetBSD code should include both sys/sa.h and sys/savar.h.
 1.28.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.32.4.1 05-Mar-2011  rmind sync with head
 1.33.12.1 18-Feb-2012  mrg merge to -current.
 1.33.8.1 17-Apr-2012  yamt sync with head
 1.34.24.1 06-Apr-2015  skrll Sync with HEAD
 1.34.6.1 03-Dec-2017  jdolecek update from HEAD
 1.35.18.1 10-Jun-2019  christos Sync with HEAD
 1.16 29-Sep-2020  thorpej Add alpha_pal_wtint(), which invokes the WTINT PALcode call.
 1.15 13-May-2002  thorpej Make alpha_pal_halt, alpha_pal_wrent, and alpha_pal_wrvptptr no-profile.
 1.14 02-Dec-1999  thorpej branches: 1.14.6; 1.14.8;
Inline most of the remaining PALcode calls.
 1.13 30-Nov-1999  thorpej Inline several things from pal.s:
- alpha_rpcc(), alpha_mb(), alpha_wmb() -- these are instructions, and
we win by inlining them: rpcc is generally used for profiling, and
the memory barriers really should execute as quickly as possible with
minimal side-effects (like additional loads/stores required to call the
functions!)
- alpha_pal_imb(), alpha_pal_rdps(), alpha_pal_swpipl(), alpha_pal_tbi(),
alpha_pal_whami() -- these are PALcode ops. We must specify some register
clobbers for these.

We have a very decent size savings as a result. My test system:
text data bss dec hex filename
2671724 235848 377016 3284588 321e6c /netbsd.bak
2617708 235736 377016 3230460 314afc /netbsd

Most of this comes from fewer register saves/restores around spl*() calls
(now that alpha_pal_rdps() and alpha_pal_swpipl() are inlined).

Note that alpha_pal_rdps() and alpha_pal_swpipl() remain in pal.s to
maintain binary compatibility with LKMs that may use spl*() functions.
 1.12 27-Feb-1998  thorpej branches: 1.12.14; 1.12.20;
Implement alpha_pal_swpctx().
 1.11 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.10 17-Sep-1997  thorpej branches: 1.10.2;
Implement a stub for the "implver" instruction, which returns the
implementation version of the processor.
 1.9 16-Sep-1997  thorpej branches: 1.9.2;
Implement alpha_amask(), a stub which reads the "architecture feature mask"
using the "amask" instruction.
 1.8 03-Sep-1997  thorpej Add a few more PALcode operations, as documented in pages (II-B) 2-1 through
(II-B) 2-33 of the Alpha AXP Architecture Reference Manual, Second Edition:

* rdps - Read Processor Status, needed by spl* functions.
* cflush - Cache Flush
* rdval - Read System Value
* wripir - Write Interprocessor Interrupt Request
* wrval - Write System Value

cflush, rdval, wripir, and wrval are used in multi-processor environments.
 1.7 08-Apr-1997  cgd branches: 1.7.2;
include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.5 14-Jul-1996  cgd branches: 1.5.2;
(1) Removed unused (and not likely useful) PALcode assembly stubs.
(2) Minor cleanup.
 1.4 09-Jul-1996  cgd fix a few botched names
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.5.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.9.2.2 16-Sep-1997  thorpej Implement alpha_amask(), a stub which reads the "architecture feature mask"
using the "amask" instruction.
 1.9.2.1 16-Sep-1997  thorpej file pal.s was added on branch bouyer-scsipi on 1997-09-16 06:54:02 +0000
 1.10.2.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.12.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.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.14.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.6.1 20-Jun-2002  nathanw Catch up to -current.
 1.8 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.7 13-Jul-2021  thorpej As with membar_producer() and membar_sync(), initialize the fast-path
lock stubs with "unop" isns where memory barriers need to be, and if
we detect a multiprocessor system, patch those locations with "mb" insns.
 1.6 07-Jul-2021  thorpej Provide a BWX version of alpha_copystr() and patch it into place if
the system supports the BWX extension. The inner loop of the BWX
version is 42% shorter than the non-BWX version (7 vs 12 insns).
 1.5 04-Sep-2020  thorpej branches: 1.5.6;
Include <sys/lwp.h>
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 07-Jan-2008  ad branches: 1.3.2; 1.3.8; 1.3.10; 1.3.12;
Fix dodgy assertions. From Anders Hjalmarsson.
 1.2 28-Nov-2007  ad branches: 1.2.2; 1.2.6; 1.2.10;
Hook in the atomic ops on alpha.
 1.1 19-Apr-2007  thorpej branches: 1.1.2; 1.1.8; 1.1.14;
file patch.c was initially added on branch thorpej-atomic.
 1.1.14.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.8.1 03-Dec-2007  joerg Sync with HEAD.
 1.1.2.1 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.2.10.1 08-Jan-2008  bouyer Sync with HEAD
 1.2.6.3 21-Jan-2008  yamt sync with head
 1.2.6.2 07-Dec-2007  yamt sync with head
 1.2.6.1 28-Nov-2007  yamt file patch.c was added on branch yamt-lazymbuf on 2007-12-07 17:23:49 +0000
 1.2.2.2 03-Dec-2007  ad Sync with HEAD.
 1.2.2.1 28-Nov-2007  ad file patch.c was added on branch vmlocking on 2007-12-03 19:02:25 +0000
 1.3.12.1 16-May-2008  yamt sync with head.
 1.3.10.1 18-May-2008  yamt sync with head.
 1.3.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.2.2 09-Jan-2008  matt sync with HEAD
 1.3.2.1 07-Jan-2008  matt file patch.c was added on branch matt-armv6 on 2008-01-09 01:44:33 +0000
 1.5.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.308 30-Dec-2023  thorpej pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(),
as it is designed to wrap from 1023->0 during the normal course of use.
However, when setting up the initial kernel page tables, if we have a
large enough config that we end up with more than L2 PT page, we rely
on being able to index > 1023 into the adjacent PT pages to initialize
those entries.

Fixes a MM fault panic during early boot on larger memory configs
(reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB
DS25). I've successfully booted at 16GB config in Qemu with this fix.
 1.307 09-Apr-2022  riastradh branches: 1.307.4;
sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.
 1.306 09-Apr-2022  riastradh alpha: Omit needless membar in pmap_reference.

If the pmap is published enough for us to obtain a reference to it
then there's no membar needed. If it's not then something else is
wrong and we can't use pmap_reference here anyway. Membars are
needed only on the destruction side to make sure all use, by any
thread, happens-before all freeing in the last user thread.
 1.305 12-Mar-2022  riastradh sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

Thread A Thread B
obj->foo = 42; obj->baz = 73;
mumble(&obj->bar); grumble(&obj->quux);
/* membar_exit(); */ /* membar_exit(); */
atomic_dec -- not last atomic_dec -- last
/* membar_enter(); */
KASSERT(invariant(obj->foo,
obj->bar));
free_stuff(obj);

The memory barriers ensure that

obj->foo = 42;
mumble(&obj->bar);

in thread A happens before

KASSERT(invariant(obj->foo, obj->bar));
free_stuff(obj);

in thread B. Without them, this ordering is not guaranteed.

So in general it is necessary to do

membar_exit();
if (atomic_dec_uint_nv(&obj->refcnt) != 0)
return;
membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting. (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these. Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that. It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.
 1.304 09-Dec-2021  andvar Few typos slipped in the last review, fixing them.
 1.303 19-Sep-2021  andvar review and fix rest of the typos in alpha pmap.c.
 1.302 19-Sep-2021  andvar fix various typos in comments, messages and documentation.
 1.301 13-Aug-2021  andvar fix multiple typos in comments.
 1.300 31-Jul-2021  thorpej Fix a silly mistake (missing return) in the DEBUG case of the kernel pmap
case of pmap_extract().
 1.299 19-Jul-2021  thorpej Re-arrange the kernel pmap fast-path in pmap_extract() so that
when DEBUG is not enabled, the compiler can emit a tail-call to
vtophys_internal().
 1.298 16-Jul-2021  thorpej The Alpha AXP Architecture Reference Manual is explcit that the only
valid bits in the PSL are the IPL and USER bits, the latter of which
will always be clear when in the kernel, and that all other bits MBZ.
So, when reading the PSL to get the current IPL, don't bother masking
with ALPHA_PSL_IPL_MASK.
 1.297 10-Jul-2021  thorpej Move the optimized pmap_zero_page() from pmap.c to a new pmap_subr.s,
and optimize it a teeny bit little more. Provide an optimized (for 21164,
anyway) pmap_copy_page() as well.
 1.296 05-Jul-2021  thorpej Instrument the number of calls to pmap_growkernel().
 1.295 05-Jul-2021  thorpej Fix a bug introduced in pmap.c,v 1.287 where, when creating the PTE
in pmap_enter(), we would erroneously disregard MOD/REF attributes
already present on the page, thus causing FOW/FOR to be set incorrectly.
Normally this is not a big problem (an extra page fault will be taken
to resolve it), but if you access the mapping in interrupt context
(such as during IDE PIO, for example), a KASSERT can fire due to
acquiring an rwlock in interrupt context while servicing that fault.

Reported and bisected-to-commit by rin@.
 1.294 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.293 31-May-2021  thorpej After a comment by joerg@, go back to using a dedicated field for the
PT page reference count, but add an XXX comment stating the desire to
find a safely-unused field in the vm_page structure when pages are in-
use as PT pages, so that we can save the 8 bytes per page needed for
this.
 1.292 30-May-2021  thorpej Fix DEBUG build.
 1.291 30-May-2021  thorpej Fix unused variable warning when DIAGNOSTIC is disabled. Pointed out
by jklos.
 1.290 30-May-2021  thorpej Implement pmap_remove_all().
 1.289 30-May-2021  thorpej When removing mappings, hang PV entries to be freed off of the
pmap_tlb_context structure, and free them back in bulk after we
release all of our locks (as we do with PT pages that are freed).
 1.288 30-May-2021  thorpej Keep track of a pmap's PV entries with a list hanging off the pmap.
 1.287 30-May-2021  thorpej Store the modified / referenced attribute bits in the lower 2 bits of
the PV entry list pointer in struct vm_page_md. This reduces the size
of that structure from 16 bytes to 8, and will go a fair way to making
up for increasing the size of struct pv_entry in a future commit.
 1.286 30-May-2021  thorpej Define a macro, VM_MDPAGE_PVS(), for fetching the first pv entry
for a page.
 1.285 30-May-2021  thorpej Pages that are in-use as page table pages should never be part of a
UVM loan transaction, so use the vm_page::loan_count field as the PT
page reference count.
 1.284 30-May-2021  thorpej Track the PT pages allocated to a pmap in the pmap itself.
 1.283 30-May-2021  thorpej Change pmap_physpage_alloc() to return the vm_page * so that the
callers have access to it.
 1.282 30-May-2021  thorpej Define a pmap_pagelist LIST_HEAD and use it where we used ad hoc LIST_HEADs
of vm_page structures. Define and use a generic routine to free such a list
back to UVM.

In pmap_remove_internal(), KASSERT that no PT pages are queued up to be
freed when removing mappings from the kernel pmap.
 1.281 29-May-2021  thorpej Move the pointer to the pmap's lev1map out of the shared pmap structure
and into each CPU's pmap_percpu area. This pointer is constant for the
life of the pmap, and moving it gives us an additional 8 bytes in the
shared pmap structure.

Because the kernel pmap does not have per-CPU data, all places where we
need the kernel pmap's lev1map now just reference kernel_lev1map directly.
 1.280 29-May-2021  thorpej Rather than tracking "needs I-sync on return to userspace" in a bitmap,
track it with a separate field in the pmap_percpu. Not only does this
reduce cache line contention ever so slightly, it also frees up a field
in the shared portion of the pmap structure.
 1.279 29-May-2021  thorpej Rename pmap_asn_info to pmap_percpu, and pmap::pm_asni to pmap::pm_percpu.
No functional change.
 1.278 24-May-2021  thorpej pmap_tlb_shootdown_all_user() can be called in the PV scenario as well
as the forward scenario, for example if a pmap_page_protect() to remove
all mappings results in the freeing of a PT page. It therefore needs
to do the same reference counting dance as pmap_tlb_shootdown_pv().

Also fix a use-after-free error in pmap_page_protect().

Add / tweak some assertions, and shrink the pmap::pm_count field from
long to unsigned int (which gave me a spare unsigned int field for
debugging purposes).

PR port-alpha/56201.
 1.277 23-May-2021  thorpej Fix a bug in pmap_tlb_shootdown_all_user(), where it was not
stashing away the pointer to the pmap in the TLB context structure
like pmap_tlb_shootdown() was doing. This would result in the
following failure scenario:

- Page fault handler calls pmap_enter() to map a page. Mapping
is the first one for that L2 PT L3 PT, meaning that an L2 PT
and an L3 PT must be allocated.
- L2 PT allocation succeeds.
- L3 PT allocation fails under memory pressure.
- pmap_enter() goes to drop the reference on the L2 PT, which, because
it was the first of its mappings, frees the L2 PT. Becuse PALcode
may have already tried to service a TLB miss though that L2 PT, we
must issue an all-user-VA shootdown, and call pmap_tlb_shootdown_all_user()
to do so.
- pmap_tlb_shootnow() is called and an assert fires because the TLB
context structure does not point to a pmap.

This did not fail in the pmap_remove() scenario because the TLB context
would have already had at least one call to pmap_tlb_shootdown(), which
was initializing the pmap pointer properly.

PR port-alpha/56200
 1.276 03-Apr-2021  thorpej branches: 1.276.2; 1.276.4;
Slight tweak to last: Our IPL gets raised to IPL_SCHED by simply *trying*
to acquire the pmap activation lock, regardless of whether or not that was
successful. So, in addition to remember if we acquired it, also remember
if we tried, and drop back to IPL_VM if so.
 1.275 03-Apr-2021  thorpej Fix an IPI deadlock scenario that resulted in a TLB shootdown timeout
panic reported by John Klos on port-alpha:

- pmap_tlb_shootnow(): If we acquire a pmap's activation lock, we will
have raised the IPL on the current CPU to IPL_SCHED until we drop
the tlb_lock (due to how nested spin mutexes work). As such, when
we release the activation lock, forcibly lower our IPL back to IPL_VM
so that we can receive and process IPIs while waiting for other CPUs
to process the shootdowns.
- mutex_vector_enter(): Invoke SPINLOCK_SPIN_HOOK while spinning to acquire
a spin mutex. This is a nop on most platforms, but it's important on
the Alpha. Without this, IPIs (and thus TLB shootdowns) cannot be
processed if trying to acquire an IPL_SCHED spin mutex such as those
used by the scheduler.

...and while we're poking around in here:

- Rework the Alpha SPINLOCK_SPIN_HOOK to only check curcpu()->ci_ipis
if the current CPU's IPL is >= IPL_CLOCK (thus ensuring that preemption
is disabled and thus guaranteeing that curcpu() is stable). (Alpha does
not yet support kernel preemption, but this is now one less thing that
would need to be fixed.)
 1.274 29-Dec-2020  thorpej branches: 1.274.2;
From the Infinitesimal Optimizations Department: in pmap_kremove(), update
the globally visible stats outside of the loop.
 1.273 11-Sep-2020  simonb branches: 1.273.2;
Fix shift tyop in a comment.
 1.272 08-Sep-2020  riastradh alpha: Use load-acquire/store-release.

Omit needless membar in pmap_kenter_pa while here -- caller must
ensure pmap_kenter_pa on one CPU happens before use of the VA on
another CPU anyway, so there is no benefit to a membar here.

ok thorpej@
 1.271 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.270 03-Sep-2020  thorpej - Remove redundant memory barriers. For the ones that remain,
use the membar_ops(3) names to make it clear how they pair up (even
though most of them expand to the MB instruction anyway).
 1.269 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.268 17-Aug-2020  thorpej - Track the currently-activated pmap in struct cpu_info.
- Reserve some space in struct cpu_info for future pmap changes.
 1.267 16-Aug-2020  thorpej - Undo part of rev 1.264; go back to not acquiring the pmap lock in
pmap_activate(). As of rev 1.211, the pmap::pm_lev1map field is
stable across the life of the pmap, and so the conditino that
the change in 1.264 was intended to avoid would not have happened
anyway.
- Explicitly use __cacheline_aligned / COHERENCY_UNIT rather than 64
in a couple of places.
- Update comments around the lev1map lifecycle, and add some assertions
to enforce the assumptions being described.
- Remove some dubious DEBUG tests that are not MP-safe.
- Chage some long-form #ifdef DIAGNOSTIC checks / panics to KASSERTs.
- Remove the PMAP_ACTIVATE() macro because it's no longer used anywhere
except for pmap_activate(). Just open-code the equivalent there.
- In pmap_activate(), only perform the SWPCTX if either the PTBR or the
ASN are different than what the PCB already has. Also assert that
preemption is disabled and that the specified lwp is curlwp.
- In pmap_deactivate(), add similar assertions, and add a comment explaining
why a SWPCTX to get off of the deactivated lev1map is not necessaray.
- Refactor some duplicated code in pmap_growkernel() into a new
pmap_kptpage_alloc() function.
- In pmap_growkernel(), assert that any user pmap published on the all-pmaps
list does not reference the kernel_lev1map.
- In pmap_asn_alloc(), get out early if we're called with the kernel pmap,
since all kernel mappings are ASM. Remove bogus assertions around the
value of pmap::pm_lev1map and the current ASN, and simply assert that
pmap::pm_lev1map is never kernel_lev1map. Also assert that preemption
is disabled, since we're manipulating per-cpu data structures.
- Convert the "too much uptime" panic to a simple KASSERT, and update the
comment to reflect that we're only subject to the longer 75 billion year
ASN generation overflow (because CPUs that don't implement ASNs never go
through this code path).
 1.266 17-Jan-2020  skrll Convert #if 0'ed code to uvm_hotplug api
 1.265 17-Jan-2020  skrll Trailing whitespace
 1.264 29-Mar-2019  thorpej branches: 1.264.6;
Fix a couple of latent MP issues in the Alpha pmap:
- In pmap_activate(), even though we manipulate the active mask
with atomic ops, the lev1map pointer needs to stay consistent,
so we do, in fact, have to take the pmap lock there.
- In pmap_emulate_reference(), some of the DEBUG checks done here
are race-prone, so don't do them. (Leave them #if 0'd out for
documentary purposes.)
 1.263 01-Mar-2019  mrg fix a typo in a comment
 1.262 27-Jan-2018  chs branches: 1.262.4;
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.261 23-Dec-2016  cherry branches: 1.261.8;
"Make NetBSD great again!"

Introduce uvm_hotplug(9) to the kernel.

Many thanks, in no particular order to:

TNF, for funding the project.

Chuck Silvers - for multiple API reviews and feedback.
Nick Hudson - for testing on multiple architectures and bugfix patches.
Everyone who helped with boot testing.

KeK (http://www.kek.org.in) for hosting the primary developers.
 1.260 05-Nov-2015  pgoyette branches: 1.260.2;
Remove SYSVSHM-specific code. The value of shminfo.shmall is zero at
the time this pmap initialization code is called, so the increment is
a no-op. (Thanks christos@ for pointing it out.)
 1.259 01-Jan-2014  matt branches: 1.259.6;
Define kernel_pmap_store as a pmap followed by ALPHA_MAXPROCS pmap_asn_info.
kernel_pmap_ptr now points to the pmap in kernel_pmap_store.
 1.258 06-Feb-2012  matt branches: 1.258.6; 1.258.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.257 02-Feb-2012  para - bringing kmeminit_nkmempages back and revert pmaps that called this early
- use nkmempages to scale the kmem_arena
- reducing diff to pre kmem/vmem change
(NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs)
 1.256 27-Jan-2012  para extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
 1.255 12-Nov-2010  uebayasi branches: 1.255.8; 1.255.12;
Put VM_PAGE_TO_MD() definition in one place. No functional changes.
 1.254 10-Nov-2010  uebayasi Use more VM_PHYSMEM_*() accessors. No functional changes.
 1.253 30-Oct-2010  uebayasi Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional
changes.
 1.252 26-Nov-2009  matt branches: 1.252.2; 1.252.4;
Kill proc0paddr. Use lwp0.l_addr instead.
 1.251 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.250 09-Nov-2009  mhitch The tlb shootdown IPI can interrupt the pool_cache_get() in places that
can cause a deadlock or pool cache corruption. Take the shootdown job
queue mutex before calling pool_cache_get(), which will block the IPI
interrupts and seems to fix the remaining tlb shootdown deadlocks and
pool cache corruption I've been seeing. Should address both
PR port-amiga/38335 and PR port-amiga/42174.
 1.249 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.248 26-Oct-2009  thorpej Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.247 26-Oct-2009  thorpej Garbage-collect PMAP_LEV1MAP_SHOOTDOWN() -- it hasn't been used for a long
time.
 1.246 24-Oct-2009  thorpej Ensure coherency between the L1 PT cache and pmap_growkernel() -- protect
allocations from pmap_growkernel() with a r/w lock.
 1.245 22-Oct-2009  rmind Simplify pmap_remove() a little by avoiding pmap_do_remove() layer, since
possibility to skip wired mappings is not needed anymore. Apart from that,
no functional differences are intended.
 1.244 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.243 04-Oct-2009  mhitch IPI interrupts occur above IPL_VM, so using IPL_VM in for the tlb shootdown
queue mutex doesn't work very well. I get various deadlocks and corrupted
queue entries. Change to IPL_SCHED [IPL_CLOCK] to block IPI interrupts
while the cpu is mucking with the shootdown queue.
 1.242 10-Sep-2009  mhitch Alpha will size the mutex structure in pmap_tlb_shootdown_q to 16 bytes.
Change the command and pad accordingly; now pmap_tlb_shootdown_q entries
really are cache-aligned.
 1.241 10-Sep-2009  mhitch Now that secondary cpus are added the cpu_info list earlier, attempt to
send pmap tlb shootdowns to them cause the shootdown job queue to fill up,
but since the cpus aren't running yet, no IPIs get sent. When the job
queue is full, the bit mask of cpus to send the IPI to is not set and no
shootdown IPI ever gets sent after the cpu is marked running. Always
set the cpumask even when the queue is full. Now I get shootdown ipis
on all the secondary cpus.
 1.240 18-Aug-2009  thorpej Add a real API for testing if a page is a managed page, and adjust callers
to stop relying on vm_physseg_find() for this purpose.
 1.239 21-Apr-2009  cegger change pmap flags argument from int to u_int.
discussed with christos@ on source-changes-d@
 1.238 10-Dec-2008  pooka branches: 1.238.2;
Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.237 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.236 28-Apr-2008  martin branches: 1.236.6; 1.236.8; 1.236.10; 1.236.14; 1.236.16;
Remove clause 3 and 4 from TNF licenses
 1.235 10-Mar-2008  ad branches: 1.235.2; 1.235.4;
Finish moving alpha over to the MI atomic ops.
 1.234 10-Mar-2008  ad Convert remaining use of alpha atomic op to an MI one.
 1.233 10-Mar-2008  ad Use atomics to maintain the number of special page references. Should fix
locking problems including in revision 1.232.
 1.232 21-Feb-2008  ad branches: 1.232.2;
Use a hash of locks, instead of one per vm_page.
 1.231 15-Jan-2008  ad branches: 1.231.2;
pmap_do_tlb_shootdown: simplify queue management.
 1.230 12-Jan-2008  ad Fix some problems with TLB shootdown and (hopefully) make it faster. This
had the potential to cause problems prior to 4.99.48 because it called into
the VM system without kernel_lock held.

XXX1 pmap_update() should be waiting for shootdown jobs to complete. It's
not clear how to do that because the shootdowns happen at IPL_VM.
 1.229 02-Jan-2008  ad Merge vmlocking2 to head.
 1.228 07-Nov-2007  ad branches: 1.228.2; 1.228.6;
Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.227 25-Oct-2007  yamt branches: 1.227.2;
defparam PAGER_MAP_SIZE.
 1.226 17-Oct-2007  garbled 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.225 10-Oct-2007  ad branches: 1.225.2;
Comment out references to spinlockmgr().
 1.224 16-Jul-2007  macallan branches: 1.224.8; 1.224.10; 1.224.12;
change pmap_phys_address()s parameter to paddr_t since that's what it gets
fed from mmap*() anyway
approved by gimpy
 1.223 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.222 14-Mar-2007  he branches: 1.222.4; 1.222.6;
Absent documentation as to what the newly added 'ipl' argument to
pool_init() is supposed to do, and actual usage of that argument in
pool_init()'s implementation, add use of IPL_VM to the TLB shootdown
job queue pool initialization to get this building again.
Someone suggested an IPL_XXX_ASK_ANDY constant be introduced...
 1.221 12-Mar-2007  ad branches: 1.221.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.220 04-Mar-2007  yamt branches: 1.220.2;
fix fallout from caddr_t changes.
 1.219 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.218 02-Mar-2007  yamt make this compilable.
(p_flag -> p_sflag, P_WEXIT -> PS_WEXIT)
 1.217 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.216 21-Feb-2007  thorpej 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.215 14-May-2006  elad branches: 1.215.14;
integrate kauth.
 1.214 02-Apr-2006  thorpej Static'ify.
 1.213 24-Dec-2005  perry branches: 1.213.4; 1.213.6; 1.213.8; 1.213.10; 1.213.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.212 11-Dec-2005  christos merge ktrace-lwp.
 1.211 26-Jul-2005  thorpej 1. Disable the lazy allocation of lev1map in pmap_enter(), instead doing
it in pmap_create(), and freeing the lev1map in pmap_destroy(). This
means that pm_lev1map is consistent for the life of the pmap.
2. pmap_extract() now uses vtophys() for the kernel pmap. This avoids
having to lock the kernel pmap, since kernel PT pages are never freed.
3. Because of (1), pmap_asn_alloc() no longer needs to operate on a locked
pmap; pm_lev1map will never change over the life of the pmap, and all
other access to the pmap is done in per-CPU fields or with atomic
operations.
4. Because of (3), pmap_activate() no longer needs to lock the pmap
to do its work, thus eliminating the deadlock with sched_lock described
in PR port-alpha/25599. This is safe because we are guaranteed that
the pmap is still alive, since by definition an LWP that uses that it
is about to run.

Thanks to Michael Hitch for the analysis, and Michael and Ragge for testing.
 1.210 01-Jun-2005  drochner branches: 1.210.2;
fix typos in comments
 1.209 22-May-2005  christos No 0x in front of %p...
 1.208 25-Dec-2004  yamt branches: 1.208.8;
enable debug code in pmap_emulate_reference. ok'ed by Jason Thorpe.
 1.207 13-Jan-2004  nathanw branches: 1.207.2; 1.207.6;
Adjust the DEBUG check in PMAP_ISACTIVE() to special-case process
exit, since the invariant it checks no longer holds there after the
recent reaper changes.
 1.206 30-Dec-2003  pk Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
 1.205 29-Oct-2003  mycroft Remove bogus initializers.
 1.204 27-Oct-2003  chs uninitialized variables
 1.203 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.202 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.201 02-Aug-2003  matt Make this compile with gcc3. Change kernel_pmap_store to array of struct
pmap instead of array u_long. A bit of space is wasted but it supresses
the -Wcast-align warning.
 1.200 10-May-2003  thorpej branches: 1.200.2;
Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.199 09-May-2003  enami - Adjust arguments to pmap_steal_memory() for new interface.
- We no longer able to use uvm_pageboot_alloc() before pmap_bootstrap()
is called. Use pmap_steal_memory() directly instead.

Approved by Jason R. Thorpe.
 1.198 08-May-2003  thorpej Simplify the way the bounds of the managed kernel virtual address
space is advertised to UVM by making virtual_avail and virtual_end
first-class exported variables by UVM. Machine-dependent code is
responsible for initializing them before main() is called. Anything
that steals KVA must adjust these variables accordingly.

This reduces the number of instances of this info from 3 to 1, and
simplifies the pmap(9) interface by removing the pmap_virtual_space()
function call, and removing two arguments from pmap_steal_memory().

This also eliminates some kludges such as having to burn kernel_map
entries on space used by the kernel and stolen KVA.

This also eliminates use of VM_{MIN,MAX}_KERNEL_ADDRESS from MI code,
this giving MD code greater flexibility over the bounds of the managed
kernel virtual address space if a given port's specific platforms can
vary in this regard (this is especially true of the evb* ports).
 1.197 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.196 23-Feb-2003  nathanw In pmap_physpage_alloc() and pmap_physpage_free(): only the DIAGNOSTIC
check is inside the simple_lock()/simple_unlock() pair, so move the locks
inside the #ifdef as well.

Additionally, change the #ifdef from DIAGNOSTIC to DEBUG; the condition
is too weird to be worth checking at DIAGNOSTIC, according ot Jason.
 1.195 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.194 14-Oct-2002  chs eliminate PT_ENTRY_NULL in favor of plain old NULL.
 1.193 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.192 24-Aug-2002  mhitch Add missing PMAP_TLB_SHOOTDOWN() after PMAP_INVALIDATE_TLB() in
pmap_page_protect(). Closes NetBSD Problem Report #18045.
 1.191 08-Mar-2002  thorpej branches: 1.191.6; 1.191.8;
Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.190 03-Jan-2002  thorpej Remove a debug message that should have gone away with the last
commit.
 1.189 02-Jan-2002  chs pmap_page_protect(VM_PROT_NONE) must remove all mappings in the PV list,
even if they are wired. we need to be able to remove all mappings to
pages that are being freed due to (eg.) file truncation.
 1.188 15-Sep-2001  chs a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.187 31-Aug-2001  simonb branches: 1.187.2;
Use comments around the token after a #endif.
 1.186 13-Aug-2001  chs branches: 1.186.2;
add an unlock missing from previous revision.
 1.185 16-Jul-2001  thorpej Don't use pmap_changebit() in pmap_protect(), and remove the
pager mapping check from pmap_changebit().
 1.184 16-Jul-2001  thorpej Remove I-sync stuff from pmap_changebit(). The AARM says that we
only have to sync the I-stream when the mapping is removed or chaged,
and since the I-stream is fetch-only, changing protection bits does
not constitute changing the mapping (the VA->PA translation is still
the same).
 1.183 15-Jul-2001  thorpej Defer sending shootdown IPIs a bit longer. Reduces traffic a fair
bit more.
 1.182 15-Jul-2001  thorpej - Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.181 15-Jul-2001  thorpej UVM never passes us a NULL pmap argument; remove that Mach VM leftover.
 1.180 26-May-2001  chs branches: 1.180.2;
replace vm_page_t with struct vm_page *.
 1.179 05-May-2001  thorpej Fix a deadlock cause by a lock ordering interaction between pmap_enter()
and pmap_growkernel().
 1.178 01-May-2001  ross Fix lock problems with error flow reorg.
 1.177 01-May-2001  thorpej Delete the pmap_copy() calls.
 1.176 01-May-2001  thorpej Use a single linked list for PV entries. This saves 1MB of space
on my 1G RAM AlphaServer.
 1.175 01-May-2001  thorpej 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.174 30-Apr-2001  ross apply recent changes to DEBUG code
 1.173 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.172 29-Apr-2001  thorpej Add glue for page zero'ing in the idle loop.
 1.171 24-Apr-2001  thorpej Remove the PTP and PV entry stealing code. Now that the pmap
module can fail gracefully, it serves little purpose, and the
code is a bit complicated and adds overhead to the context
switching code.
 1.170 24-Apr-2001  thorpej Delete a couple of statistics that are not really worth keeping.
 1.169 24-Apr-2001  thorpej Gather ASN info into a single structure, and place a variable-length
array of those structures at the end of the pmap structure. We compute
the size of the pmap structure based on the maximum CPU ID for a
particular machine. This gives us better cache behavior and better
memory footprint for the ASN info.
 1.168 23-Apr-2001  thorpej The Alpha pmap_virtual_space() can return compile-time constants,
so do so. This allows us to call uvm_pageboot_alloc() before
pmap_bootstrap().

Also, the virtual_start variable is unneeded in the Alpha pmap
module, and virtual_end (and the mostly-unused-except-by-bus_dma
variables avail_start and avail_end) can be `computed' at the
same time.
 1.167 23-Apr-2001  thorpej Panic if all mappings are not removed from a pmap when its
reference count drops to 0.
 1.166 22-Apr-2001  thorpej Remove pmap_kenter_pgs(). It was never really adopted by
anything, and the interface itself wasn't as flexible as
callers would have probably liked.
 1.165 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.164 22-Apr-2001  thorpej Use uvm_pageboot_alloc() for early memory allocation, rather than
calling pmap_steal_memory() directly. On these platforms, since
uvm_pageboot_alloc() is a wrapper around pmap_steal_memory(), there
is no functional change. This is merely for API consistency.
 1.163 22-Apr-2001  thorpej Make pmap_virtual_space() a required pmap function, even on platforms
which have pmap_steal_memory(). This is to reduce the API differences
between pmaps that implement pmap_steal_memory() and pmaps which do
not.

Note that pmap_steal_memory() needs to adjust *vstartp and/or
*vendp only if it used addresses within the range provided to UVM
via the pmap_virtual_space() call. I.e. it is not necessary to do
so in any current pmap_steal_memory() implementation.
 1.162 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.161 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.160 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.159 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.158 21-Mar-2001  chs use ubc_winshift instead of ubc_winsize in pmaps to set up kernel
virtual space. the latter isn't initialized yet when the value is needed.
fixes PR 12440.
 1.157 15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.156 14-Jan-2001  thorpej branches: 1.156.2;
splimp() -> splvm()
 1.155 21-Dec-2000  chs expose the tunables ubc_nwins and ubc_winsize in uvm_param.h.
add the space used by UBC mappings to the initial PTE calculations
for pmaps that do that (mips and alpha).
 1.154 07-Dec-2000  thorpej pmap_growkernel() has been implemented.
 1.153 07-Dec-2000  thorpej Fix MP race condition introduced in the previous.
 1.152 07-Dec-2000  thorpej Use a pool cache for L1 PT pages. When we can allocate a cached,
constructed L1 PT page, this saves us from having to copy the kernel
L1 PTEs into the user L1 PT page at fork time (it's already set up).

A simple test shows a 1 second improvement of a rapid fork/exit operation
10000 times on a 533MHz 21164A (12s to 11s).
 1.151 24-Nov-2000  chs increase PAGER_MAP_SIZE to 16MB and move it to uvm_pager.h
since the alpha and mips pmaps use it.
 1.150 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.149 19-Nov-2000  thorpej Implement pmap_growkernel().
 1.148 22-Sep-2000  thorpej After consultation of the 21164A manual, the I-cache blocks are
indeed tagged with ASM and the ASN, "per the Alpha architecture".
It is therefore safe to cancel any pending lazy I-sync on a
given CPU when a new ASN is assigned on that CPU.
 1.147 19-Sep-2000  thorpej In pmap_ptpage_steal(), don't traverse into the kernel portion
of the address space.
 1.146 14-Sep-2000  thorpej Make sure pmap_collect() doesn't remove wired mappings. Per discussion
w/ Chuq Silvers. Fixes a panic when a program with wired pages that
has run for a long time when the system is under heavy memory load
exits (specific case was ntpd, reported by Simon Burge).
 1.145 26-Aug-2000  thorpej Un-transpose some characters in an abbreviation.
 1.144 26-Aug-2000  thorpej Fix a couple of typos in previous.
 1.143 26-Aug-2000  thorpej Snapshot of TLB shootdown bugfixes.
 1.142 15-Aug-2000  thorpej - Make lazy I-sync a little safer -- always mark the pmap as needing
I-sync in pmap_remove_mapping() if the old mapping had PG_EXEC, and
kick curcpu (IMB) or other CPUs (via an IPI) only if the pmap was
the kernel pmap or active on other CPUs (curcpu is handled in userret()).
- Use lazy I-sync everywhere, (hopefully) eliminating the last of the
I-sync issues for multiprocessor support.
- Eliminate some memory barriers added in a couple of previous revisions,
after some discussion on port-alpha/tech-smp.

Still some lazy I-sync optimization possibilites:
- pmap_changebit() does not need to I-sync when only write-protecting
a page.
- pmap_asn_alloc() may be able to cancel a pending lazy I-sync when a
new ASN is allocated. Need to double check against Green Book or
Brown Book.
 1.141 13-Aug-2000  thorpej More MP cleanup:
- pmap_zero_page() and pmap_copy_page(): if MULTIPROCESSOR, issue
a memory barrier after we zero/copy the page, to ensure that
other CPUs see the correct data.
- XXX Should we use MB, or is WMB good enough?

Also, bzero -> memset, bcopy -> memcpy.
 1.140 13-Aug-2000  thorpej More MP cleanup:
- Make sure to do an MB after a PTE is set to a new value, so that
other processors see it.
- Use lazy I-sync in two pmap_page_protect() and in pmap_changebit(),
so that it is MP-safe. XXX Two more places where IMB is used in
the raw, but they're not in the common path.

There'll be some more lazy I-sync cleanups soon.
 1.139 13-Aug-2000  thorpej Add some XXXSMP to places were imb is still used in the raw.
 1.138 13-Aug-2000  thorpej Add MULTIPROCESSOR versions of PMAP_SYNC_ISTREAM_{KERNEL,USER}().
 1.137 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.136 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.135 05-Jun-2000  thorpej branches: 1.135.2;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.134 04-Jun-2000  thorpej ANSI'ify.
 1.133 04-Jun-2000  thorpej Nuke a couple of unnecessary IMBs. In these cases, the mappings weren't
hanging, only perhaps the permissions being lowered, in which case the
I-stream does not need to be sync'd.
 1.132 23-May-2000  thorpej branches: 1.132.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.131 10-Apr-2000  thorpej Use UVM_PGA_ZERO.
 1.130 02-Apr-2000  thorpej Instead of checking vm_physmem[<physseg>].pgs to determine if
uvm_page_init() has completed, add a boolean uvm.page_init_done,
and test against that. Use this same boolean (rather than
pmap_initialized) in pmap_growkernel() to determine if we are
being called via uvm_page_init() to grow the kernel address space.

This fixes a problem on some i386 configurations where pmap_init()
itself was needing to have the kernel page table grown, and since
pmap_initialized was not yet set to TRUE, pmap_growkernel() was
choosing the wrong code path.

Fix tested by Havard Eidnes.
 1.129 29-Mar-2000  simonb Remove redundant decl for physmem - it's in <sys/systm.h>.
 1.128 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.127 01-Mar-2000  thorpej Do partial lazy I-stream sync -- in the pmap_enter()/pmap_remove() cases
for now. More to come.
 1.126 01-Mar-2000  thorpej PMAP_ISACTIVE() now takes the cpu_id. This serves two purposes:
- Everywhere it was used, the cpu_id was already computed, so this
saves computing it again.
- This will be needed for lazy istream sync.
 1.125 01-Mar-2000  thorpej Use cpu_number() here instead of alpha_pal_whami().
 1.124 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.123 17-Dec-1999  thorpej Hand-tuned pmap_zero_page().
 1.122 02-Dec-1999  thorpej In pmap_page_protect(), don't reference a pmap we're unlocking via
the PV entry we just freed (D'OH!)
 1.121 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.120 30-Nov-1999  thorpej Put some (disabled) debugging code into pmap_steal_memory().
 1.119 29-Nov-1999  thorpej Switch to the new pmap_remove() and nuke the old one. A simple fork/exit
benchmark shows at least a 10% improvement in the tearing down of a large
address space.
 1.118 28-Nov-1999  thorpej - Use alpha_atomic_{add,sub}_q() to update the pmap statistics. We now no
longer need to lock the kernel pmap in pmap_kenter_pa() and pmap_kremove().
- Since locking the kernel pmap in interrupt context is no longer required,
don't go to splimp() when locking the kernel pmap.
- Implement a new pmap_remove() function, not yet enabled by default. It
is structured like pmap_protect, and should be *much* faster. This was
actually written quite some time ago, but never committed because it
didn't work properly. Given the recent bugfix to pmap_protect(), "duh,
of course it didn't work properly before...". It seems to work fine now
(have done several builds and run the UVM regression tests using the new
code), but it is currently run-time optional so that some performance
measurements can be easily run against the old and new code.
 1.117 27-Nov-1999  mycroft In pmap_emulate_reference(), always or in the bits. I know the code is trying
to be clever, but...
Also, a slight optimization for the write case.
 1.116 26-Nov-1999  mycroft Fix bugs in pmap_protect() that were responsible for the `ld.elf_so lossage'.
* We could overrun the eva by as much as L1SEG_SIZE-PAGE_SIZE.
* sva was advanced *twice* for each valid l3 or l2 page, causing it to get out
of sync with the PTE pointers.
 1.115 13-Nov-1999  thorpej Update for pmap_enter() API change, and return failure if possible.
 1.114 02-Nov-1999  thorpej Implement PT page stealing for extreme low memory conditions. This
has the side-effect of eliminating a locking protocol error in some
memory-desperation code in pmap_physpage_alloc().
 1.113 01-Nov-1999  thorpej Simple little speed hack in pmap_is_referenced()/pmap_is_modified(): don't
need to have the pv_head lock in order to test the REFERENCED or MODIFIED
attribute; the load of `pvh_attrs' is atomic.
 1.112 01-Nov-1999  thorpej - Fix a case where we weren't acquiring the pv_head lock when modifying
the page attributes in pmap_enter().
- It's no longer necessary (and hasn't been for a while in this pmap) to
go to splimp() to use the physical->virtual table, so remove all such
uses.
 1.111 12-Sep-1999  chs branches: 1.111.2; 1.111.4; 1.111.6;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.110 17-Aug-1999  thorpej Now that we have read/write spin locks, use them for the pmap_main_lock.
 1.109 14-Aug-1999  ross In pmap_page_protect(), don't (try to) use the pv_entry_t we just
freed in order to find the pmap to unlock.
 1.108 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.107 28-Jul-1999  thorpej Make sure that pmap == pmap_kernel() when skipping pager mappings.
 1.106 08-Jul-1999  thorpej Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.105 26-Jun-1999  thorpej Nuke some code ripe for garbage-collection.
 1.104 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.103 17-Jun-1999  thorpej Remove pmap_pageable(); no pmap implements it, and it is not really useful,
because pmap_enter()/pmap_change_wiring() (soon to be pmap_unwire())
communicate the information in greater detail.
 1.102 31-May-1999  ross In PMAP_ISACTIVE(), check curproc->p_vmspace before using it; this macro
is called early in startup, long before p_vmspace is set to &vmspace0.
 1.101 25-May-1999  thorpej Fix some major locking protocol issues related to pmap_kremove() having
to deal with PG_PVLIST mappings; it no longer has to. Add some DIAGNOSTIC
checks for inconsistent use of pmap_enter/pmap_kremove.
 1.100 24-May-1999  thorpej The kernel pmap can be accessed (and locked!) while in an interrupt
context, so we must block interrupts which may cause memory allocation
before asserting the kernel pmap's lock. Put this all in PMAP_LOCK()
and PMAP_UNLOCK() macros to make it easier.
 1.99 24-May-1999  thorpej Let the caller decide what to do if pmap_physpage_alloc() fails.
 1.98 23-May-1999  thorpej Make the list of all pmaps LRU-ordered, and update a comment regarding
locking.
 1.97 23-May-1999  thorpej Save ourselves some work in some pv list traversal functions; keep a pointer
to the PTE that maps the page in the pv_entry so that we don't have to
compute it from the pmap/va.
 1.96 23-May-1999  thorpej Implement pv_entry stealing for the case when a pool page cannot be
allocated for one.
 1.95 21-May-1999  thorpej Use the pool allocator for pv_entry structures. Set a (patchable/config'able)
low water mark on the pool, so we have some chance of crawling along in
extreme memory shortages.
 1.94 17-May-1999  thorpej Count new resident and wired pages in pmap_kenter*().
 1.93 15-Apr-1999  thorpej DEC_KN300 no longer uses PROM console.
 1.92 15-Apr-1999  thorpej Back out the change to swap Lev1map on MP systems that use the PROM console.

Basically, we have to completely nuke the _PMAP_USES_PROM_CONSOLE code from
orbit before MP is going to properly work.
 1.91 11-Apr-1999  chs add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.90 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.89 09-Apr-1999  thorpej Fix a bug in TBI optimization uncovered by the "access_type" changes. Thanks
to Bernd Ernesti for providing crash dumps to Charles Hannum who tracked
it down.
 1.88 29-Mar-1999  mycroft branches: 1.88.2;
Panic if access_type has bits not in prot.
 1.87 27-Mar-1999  thorpej Pay attention to "access_type" in pmap_enter().
 1.86 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.85 26-Mar-1999  thorpej Don't bother allocating mb_map on these systems. Mbuf clusters are
allocated from a pool, and the MIPS and Alpha use KSEG to map pool
pages. So, mb_map wasn't actually being used. Saves around 4MB of
kernel virtual address space in a typical configuration.

Garbage-collect the related VM_MBUF_SIZE constant.
 1.84 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.83 04-Mar-1999  chs fix printf format types and other stale DEBUG code.
 1.82 25-Feb-1999  thorpej On multiprocessor systems, it is possible that a lev1map might be in use
by two processors concurrently. This means that we cannot modify the
lev1map in use by the processor which wishes to use the PROM.

Fix this by creating a separate lev1map for PROM users. This lev1map
is a copy of the kernel_lev1map, with the exception of the necessary
PROM mapping. When a processor wishes to use the PROM, it switches
its PTBR to point at the prom_lev1map, performs the PROM operation,
and switches back to its previous lev1map.

Note that kernels without multiprocessor support use the old method
of modifying the current lev1map.

Also, serialize access to the PROM via a spin lock.
 1.81 24-Feb-1999  thorpej Explicitly include opt_multiprocessor.h, rather then relying on its
implicit inclusion by pmap.h.
 1.80 24-Feb-1999  thorpej First-cut at multiprocessor TLB shootdown. This simple implementation can
probably be improved somewhat, but an attempt to be efficient has been
made.

Note: TLB shootdowns are NOT YET ENABLED.
 1.79 12-Feb-1999  thorpej Fix printf format problems on Alpha.
 1.78 08-Feb-1999  thorpej Add some missing newlines in printfs.
 1.77 04-Feb-1999  thorpej Print some more info in pmap_alloc_physpage() if no pages are available,
and enhance some DIAGNOSTIC messages.
 1.76 18-Dec-1998  thorpej Correct a panic message.
 1.75 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.74 27-Sep-1998  drochner fix PMAP_ACTIVATE_ASN_SANITY() arguments
 1.73 24-Sep-1998  thorpej NCPU > 1 -> MULTIPROCESSOR
 1.72 22-Sep-1998  thorpej Add some support for multiple processors to the pmap module. Still left
to do: TLB shootdown code, but that will be much easier to write once
the code to spin up the additional CPUs is working.
 1.71 01-Sep-1998  ross Fix off-by-one errors in assertion in DIAGNOSTIC in pmap_remove()
 1.70 28-Aug-1998  thorpej Use the "nointr" pool page allocator for pmap_pmap_pool.
 1.69 28-Aug-1998  thorpej Fix a debug printf.
 1.68 25-Aug-1998  thorpej Always use pmap_kremove() if removing a mapping from the kernel pmap.
 1.67 25-Aug-1998  thorpej Shave yet more translation ops from the inner loops of pmap_protect().
 1.66 25-Aug-1998  thorpej Break the code that cleans out page tables from pmap_remove_mapping() into
separate functions that perform the cleanout starting at the l3pt, l2pt,
or l1pt.
 1.65 25-Aug-1998  thorpej Optimize the pmap_protect() loop. Will make a similar change to pmap_remove()
once some changes are made to how pt pages are cleaned up.
 1.64 25-Aug-1998  thorpej Change pmap_changebit() to take a mask of bits to set, and a PTE mask,
shaving several instructions out of the inner loop.
 1.63 25-Aug-1998  thorpej Oops, use M_VMPMAP as the malloc type in pool_init().
 1.62 25-Aug-1998  thorpej Use the pool allocator to allocate pmap structures.
 1.61 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.60 04-Aug-1998  thorpej Simple instrumentation of pmap_steal_memory().
 1.59 08-Jul-1998  thorpej Place the software PG_EXEC PTE bit into the protection array, instead
of OR'ing it in manually.
 1.58 03-Jul-1998  thorpej Mark the kernel pmap `active' in pmap_bootstrap().
 1.57 12-Jun-1998  mjacob Roll back to 1.55 level since 1.56 will not compile.
 1.56 12-Jun-1998  thorpej Delete a debugging clause that is no longer necessary, and also can't
work properly if we're testing for a pmap active on _other_ processors.
 1.55 12-Jun-1998  thorpej Rename active_pmap() to PMAP_ISACTIVE().
 1.54 11-Jun-1998  thorpej In pmap_enter(): if old PTE was not valid, we don't need to sync
the I-stream, for the same reason we don't need to invalidate the TLB.
 1.53 11-Jun-1998  thorpej Track mappings entered w/ VM_PROT_EXECUTE, and only synchronize the
I-stream when changing PTE bits or removing mappings that were entered
w/ EXECUTE protection.
 1.52 11-Jun-1998  thorpej Garbage-collect the old PMAPSTATS stuff; it didn't compile, and should
just be redone from scratch. Get it out of the way now to make it easier
to restructure a few things.
 1.51 11-Jun-1998  thorpej Significantly reduce the number of I-stream synchronizations by really
decoupling this operation from TLB invalidations (e.g. pull I-stream
syncs out of loops, executing them only once, etc.).
 1.50 11-Jun-1998  thorpej Separate syncing the I-stream from invalidating the translation buffer.
 1.49 11-Jun-1998  thorpej Correct a comment.
 1.48 24-May-1998  ross Rebury an old mach-vm-quirk warning, for mach vm kernels.
 1.47 24-May-1998  ross Fix previous to kill gcc warning in non-DEBUG compile.
 1.46 23-May-1998  ross In pmap_pv_enter() untangle the allocated pv (now "newpv") and the DEBUG
loop temporary so DEBUG kernels don't trap on startup.
 1.45 20-May-1998  thorpej Add fine-grained locking, using a locking protocol modeled after the i386
UVM pmap's locking protocol, written by Chuck Cranor. Not all of the
support for multiple processors is here yet, but the kernel does run
under moderate loads with LOCKDEBUG (all locking operations are no-ops
unless LOCKDEBUG is turned on).

This is by no means complete... there are still some possible snares
to take a look at.
 1.44 19-May-1998  thorpej It is no longer necessary for pmap_pinit() and pmap_release() to be
pmap interface functions, as NetBSD no longer uses statically allocated
pmaps (except for the kernel pmap, which is special-cased anyhow).
 1.43 19-May-1998  thorpej Make function naming consistent, and teach pmap_pv_dump() about page
usage types.
 1.42 19-May-1998  thorpej No need to keep global pointers to the initial kernel level 2 and level 3
page tables. Also, rename Lev1map to kernel_lev1map.
 1.41 19-May-1998  thorpej Nuke `register'.
 1.40 19-May-1998  thorpej Put pmap_initialized in the BSS segment.
 1.39 19-May-1998  thorpej Make PT page reference counting more generic so it can be used for other
special use page types.
 1.38 19-May-1998  thorpej The Alpha architecture has a variable page size; don't hardwire the
number of PV entries per page at compile time.
 1.37 19-May-1998  thorpej Make the page attribute manifest constant names have similar form to
page usage manifest constant names.
 1.36 19-May-1998  thorpej Keep track of page usage inside the pmap (pvent, l{1,2,3}pt page, "normal").
 1.35 01-May-1998  thorpej Fix some whitespace.
 1.34 30-Apr-1998  ross Rewrite active_pmap() and again kill the reborn curproc bug.
 1.33 27-Apr-1998  thorpej Fix the semantics (and the comment describing them) of pmap_update(). This
function is intended to process any deferred pmap operations, and is not
meant as a general means of flushing the TLB. Since this pmap module does
not defer any operations, make pmap_update() do nothing.
 1.32 27-Apr-1998  thorpej Increase the efficiency of pmap_l{2,3}pte() somewhat, by allowing the
caller to pass an optional 3rd argument, which is the previous level
PTE corresponding the virtual address. If this argument is non-NULL,
the table walk otherwise necessary will be bypassed.
 1.31 15-Apr-1998  mjacob add Alpha 4100 support
 1.30 30-Mar-1998  cgd revert back to 1.28
 1.29 28-Mar-1998  thorpej We don't have software-only maps, so a NULL pmap_t will never be passed
to pmap functions.
 1.28 28-Mar-1998  thorpej Remove a comment that is not applicable in NetBSD - we don't have
software-only maps.
 1.27 27-Mar-1998  thorpej Add a PMAP_KERNEL_PTE() macro that returns the PTE for a given KVA. If
DEBUG, this performs a table walk. Othwise, the Virtual Page Table is
used. Use this macro in a few places where this was done by-hand.

Make vtophys() use PMAP_KERNEL_PTE(). In non-DEBUG cases, this is
a fair bit faster.
 1.26 27-Mar-1998  thorpej Add some robustness to pmap_alloc_physpage(): Instead of panic'ing if
we can't get a page, find an inactive pmap and pmap_collect() it,
freeing up a few pages. Go ahead and die if we can't allocate a page
after 5 tries.
 1.25 26-Mar-1998  thorpej Give pmap_collect() some substance: when called, a process is being
swapped out, so remove all of the physical mappings the process has
in order to free up the page table pages.

Since the pmap module is allowed to "forget" mappings, pmap_collect()
may be called in other situations where the memory situation is desperate,
although it's more likely that the pages will simply be needed again the
next time a process runs.
 1.24 26-Mar-1998  thorpej Sanity check the virtual addresses in the kernel and non-kernel cases
of pmap_enter() (and pmap_kenter_*()). Remove diagnostic check for
kernel pmap in pmap_alloc_asn().
 1.23 26-Mar-1998  thorpej If NEW_SCC_DRIVER is defined, the 3000/300 and 3000/500 are not
PROM console candidates.
 1.22 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.21 02-Sep-1997  thorpej - Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
- Clean up some debugging code.
 1.20 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.19 07-Apr-1997  cgd branches: 1.19.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.18 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.17 13-Oct-1996  christos branches: 1.17.2;
backout previous kprintf change
 1.16 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.15 20-Aug-1996  cgd lots of debugging printf flags, serious clean, add pmap_{,de}activate()
 1.14 16-Jul-1996  cgd rework bootstrap/startup process to match the BSD pmap startup model.
start adding back in tracing printfs. add support for the virtual page
table. Now it gets to user-land code, but fails because i've not
added support to the context switch code to activate and deactivate pmaps.
 1.13 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.12 11-Jul-1996  cgd update for new alpha_cpu.h definitions.
 1.11 10-Jul-1996  cgd it compiles, but DEFINITELY does not run
 1.10 02-Jul-1996  cgd minor cleanups to fit into the NetBSD source tree better (e.g. remove
RCS Log messages). Haven't even tried to compile it yet.
 1.9 02-Jul-1996  cgd pull in the Mach3 alpha pmap, as a base for the new pmap module. Modified
from the mach3 versions only as much as necessary to allow the old
NetBSD/Alpha pmap code to compile. THESE WILL NOT WORK AS-IS, and at
minimum will require code to implement reference- and modified-bit
emulation.
 1.8 12-Apr-1996  cgd add some sanity checks to avoid lossage when dealing with unmanaged
pages, and clean up a little bit.
 1.7 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.6 03-Aug-1995  cgd console printf twiddling warning not really necessary now
 1.5 28-Jun-1995  cgd sync with my current Alpha sources
 1.4 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.3 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.17.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.19.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.88.2.6 26-Apr-2000  he Pull up revision 1.130 (requested by thorpej):
Use a more reliable method to determine if uvm_page_init() has
completed. This fixes a problem observed on some i386 configs
(typically with lots of memory) where the kernel page table needs
to grow during initialization.
 1.88.2.5 27-Nov-1999  he Pull up revision 1.116 (requested by mycroft):
Fix bugs in pmap_protect():
o do not overrun eva by L1SEG_SIZE - PAGE_SIZE.
o do not advance sva twice for each valid l3 or l2 page.
 1.88.2.4 18-Jun-1999  perry pullup 1.93->1.94 (thorpej): Count new resident and wired pages in pmap_kenter*()
 1.88.2.3 16-Apr-1999  thorpej branches: 1.88.2.3.2; 1.88.2.3.4;
Pull up 1.92 -> 1.93.
 1.88.2.2 16-Apr-1999  chs pull up 1.90 -> 1.91:
add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.88.2.1 09-Apr-1999  thorpej Pull up 1.88 -> 1.89: fix TBI optimization bug.
 1.88.2.3.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.88.2.3.2.4 11-Aug-1999  chs add casts for trunc_page() and round_page() args.
 1.88.2.3.2.3 02-Aug-1999  thorpej Update from trunk.
 1.88.2.3.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.88.2.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.111.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.111.4.1 14-Nov-1999  fvdl Sync with -current.
 1.111.2.9 23-Apr-2001  bouyer Sync with HEAD.
 1.111.2.8 27-Mar-2001  bouyer Sync with HEAD.
 1.111.2.7 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.111.2.6 05-Jan-2001  bouyer Sync with HEAD
 1.111.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.111.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.111.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.111.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.111.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.132.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.135.2.2 19-Sep-2000  thorpej Pull up rev. 1.146:
Make sure pmap_collect() doesn't remove wired mappings. Per discussion
w/ Chuq Silvers. Fixes a panic when a program with wired pages that
has run for a long time when the system is under heavy memory load
exits (specific case was ntpd, reported by Simon Burge).
 1.135.2.1 19-Sep-2000  thorpej Pull up rev. 1.147:
In pmap_ptpage_steal(), don't traverse into the kernel portion
of the address space.

Addresses the Alpha port part of port-alpha/11034.
 1.156.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.156.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.180.2.7 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.180.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.180.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.180.2.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.180.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.180.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.180.2.1 03-Aug-2001  lukem update to -current
 1.186.2.11 18-Oct-2002  nathanw Catch up to -current.
 1.186.2.10 27-Aug-2002  nathanw Catch up to -current.
 1.186.2.9 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.186.2.8 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.186.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.186.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.186.2.5 11-Jan-2002  nathanw More catchup.
 1.186.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.186.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.186.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.186.2.1 13-Aug-2001  nathanw file pmap.c was added on branch nathanw_sa on 2001-08-30 23:43:41 +0000
 1.187.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.191.8.1 24-Nov-2002  tron Pull up revision 1.192 (requested by mhitch in ticket #722):
Add missing PMAP_TLB_SHOOTDOWN() after PMAP_INVALIDATE_TLB() in
pmap_page_protect(). Closes NetBSD Problem Report #18045.
 1.191.6.1 30-Aug-2002  gehenna catch up with -current.
 1.200.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.200.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.200.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.200.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.200.2.1 03-Aug-2004  skrll Sync with HEAD
 1.207.6.1 07-Aug-2005  riz Pull up revision 1.211 (requested by thorpej in ticket #5528):
1. Disable the lazy allocation of lev1map in pmap_enter(), instead
doing
it in pmap_create(), and freeing the lev1map in pmap_destroy().
This
means that pm_lev1map is consistent for the life of the pmap.
2. pmap_extract() now uses vtophys() for the kernel pmap. This avoids
having to lock the kernel pmap, since kernel PT pages are never
freed.
3. Because of (1), pmap_asn_alloc() no longer needs to operate on a
locked
pmap; pm_lev1map will never change over the life of the pmap,
and all
other access to the pmap is done in per-CPU fields or with atomic
operations.
4. Because of (3), pmap_activate() no longer needs to lock the pmap
to do its work, thus eliminating the deadlock with sched_lock
described
in PR port-alpha/25599. This is safe because we are guaranteed
that
the pmap is still alive, since by definition an LWP that uses
that it
is about to run.
Thanks to Michael Hitch for the analysis, and Michael and Ragge for
testing.
 1.207.2.1 07-Aug-2005  riz Pull up revision 1.211 (requested by thorpej in ticket #5528):
1. Disable the lazy allocation of lev1map in pmap_enter(), instead
doing
it in pmap_create(), and freeing the lev1map in pmap_destroy().
This
means that pm_lev1map is consistent for the life of the pmap.
2. pmap_extract() now uses vtophys() for the kernel pmap. This avoids
having to lock the kernel pmap, since kernel PT pages are never
freed.
3. Because of (1), pmap_asn_alloc() no longer needs to operate on a
locked
pmap; pm_lev1map will never change over the life of the pmap,
and all
other access to the pmap is done in per-CPU fields or with atomic
operations.
4. Because of (3), pmap_activate() no longer needs to lock the pmap
to do its work, thus eliminating the deadlock with sched_lock
described
in PR port-alpha/25599. This is safe because we are guaranteed
that
the pmap is still alive, since by definition an LWP that uses
that it
is about to run.
Thanks to Michael Hitch for the analysis, and Michael and Ragge for
testing.
 1.208.8.1 30-Jul-2005  tron Pull up revision 1.211 (requested by thorpej in ticket #626):
1. Disable the lazy allocation of lev1map in pmap_enter(), instead doing
it in pmap_create(), and freeing the lev1map in pmap_destroy(). This
means that pm_lev1map is consistent for the life of the pmap.
2. pmap_extract() now uses vtophys() for the kernel pmap. This avoids
having to lock the kernel pmap, since kernel PT pages are never freed.
3. Because of (1), pmap_asn_alloc() no longer needs to operate on a locked
pmap; pm_lev1map will never change over the life of the pmap, and all
other access to the pmap is done in per-CPU fields or with atomic
operations.
4. Because of (3), pmap_activate() no longer needs to lock the pmap
to do its work, thus eliminating the deadlock with sched_lock described
in PR port-alpha/25599. This is safe because we are guaranteed that
the pmap is still alive, since by definition an LWP that uses that it
is about to run.
Thanks to Michael Hitch for the analysis, and Michael and Ragge for
testing.
 1.210.2.8 17-Mar-2008  yamt sync with head.
 1.210.2.7 27-Feb-2008  yamt sync with head.
 1.210.2.6 21-Jan-2008  yamt sync with head
 1.210.2.5 15-Nov-2007  yamt sync with head.
 1.210.2.4 27-Oct-2007  yamt sync with head.
 1.210.2.3 03-Sep-2007  yamt sync with head.
 1.210.2.2 26-Feb-2007  yamt sync with head.
 1.210.2.1 21-Jun-2006  yamt sync with head.
 1.213.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.213.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.213.8.3 15-Sep-2006  yamt pmap_emulate_reference: revert unrelated debug code which has been
slipped in with rev.1.213.8.2.
 1.213.8.2 24-May-2006  yamt sync with head.
 1.213.8.1 11-Apr-2006  yamt sync with head
 1.213.6.1 22-Apr-2006  simonb Sync with head.
 1.213.4.1 09-Sep-2006  rpaulo sync with head
 1.215.14.5 20-Apr-2007  yamt update some comments.
XXX now pmap_activate is never called with sched_mutex held.
XXX what to do for PMAP_NO_LAZY_LEV1MAP?
 1.215.14.4 24-Mar-2007  yamt sync with head.
 1.215.14.3 20-Mar-2007  yamt adapt alpha.
 1.215.14.2 12-Mar-2007  rmind Sync with HEAD.
 1.215.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.220.2.7 03-Dec-2007  ad Sync with HEAD.
 1.220.2.6 03-Dec-2007  ad Sync with HEAD.
 1.220.2.5 18-Oct-2007  ad Use pool_cache / update for pool_cache changes.
XXX The locking needs re-doing.
 1.220.2.4 20-Aug-2007  ad Sync with HEAD.
 1.220.2.3 27-May-2007  ad Sync with head.
 1.220.2.2 10-Apr-2007  ad Sync with head.
 1.220.2.1 13-Mar-2007  ad Sync with head.
 1.221.2.1 11-Jul-2007  mjf Sync with head.
 1.222.6.3 16-Oct-2007  garbled Sync with HEAD
 1.222.6.2 03-Oct-2007  garbled Sync with HEAD
 1.222.6.1 22-May-2007  matt Update to HEAD.
 1.222.4.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.224.12.1 14-Oct-2007  yamt sync with head.
 1.224.10.4 23-Mar-2008  matt sync with HEAD
 1.224.10.3 09-Jan-2008  matt sync with HEAD
 1.224.10.2 08-Nov-2007  matt sync with -HEAD
 1.224.10.1 06-Nov-2007  matt sync with HEAD
 1.224.8.3 11-Nov-2007  joerg Sync with HEAD.
 1.224.8.2 28-Oct-2007  joerg Sync with HEAD.
 1.224.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.225.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.227.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.227.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.228.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.228.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.228.2.1 30-Dec-2007  ad Locking changes for alpha.
 1.231.2.1 24-Mar-2008  keiichi sync with head.
 1.232.2.4 17-Jan-2009  mjf Sync with HEAD.
 1.232.2.3 02-Jun-2008  mjf Sync with HEAD.
 1.232.2.2 03-Apr-2008  mjf Sync with HEAD.
 1.232.2.1 21-Feb-2008  mjf file pmap.c was added on branch mjf-devfs2 on 2008-04-03 12:42:10 +0000
 1.235.4.5 11-Mar-2010  yamt sync with head
 1.235.4.4 16-Sep-2009  yamt sync with head
 1.235.4.3 19-Aug-2009  yamt sync with head.
 1.235.4.2 04-May-2009  yamt sync with head.
 1.235.4.1 16-May-2008  yamt sync with head.
 1.235.2.1 18-May-2008  yamt sync with head.
 1.236.16.1 21-Apr-2010  matt sync to netbsd-5
 1.236.14.3 15-Nov-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1137):
sys/arch/alpha/alpha/pmap.c: revision 1.250
The tlb shootdown IPI can interrupt the pool_cache_get() in places that
can cause a deadlock or pool cache corruption. Take the shootdown job
queue mutex before calling pool_cache_get(), which will block the IPI
interrupts and seems to fix the remaining tlb shootdown deadlocks and
pool cache corruption I've been seeing. Should address both
PR port-alpha/38335 and PR port-alpha/42174.
 1.236.14.2 16-Oct-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1073):
sys/arch/alpha/alpha/pmap.c: revision 1.243
IPI interrupts occur above IPL_VM, so using IPL_VM in for the tlb shootdown
queue mutex doesn't work very well. I get various deadlocks and corrupted
queue entries. Change to IPL_SCHED [IPL_CLOCK] to block IPI interrupts
while the cpu is mucking with the shootdown queue.
 1.236.14.1 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #953):
sys/arch/alpha/alpha/pmap.c: revision 1.241
Now that secondary cpus are added the cpu_info list earlier, attempt to
send pmap tlb shootdowns to them cause the shootdown job queue to fill up,
but since the cpus aren't running yet, no IPIs get sent. When the job
queue is full, the bit mask of cpus to send the IPI to is not set and no
shootdown IPI ever gets sent after the cpu is marked running. Always
set the cpumask even when the queue is full. Now I get shootdown ipis
on all the secondary cpus.
 1.236.10.4 15-Nov-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1137):
sys/arch/alpha/alpha/pmap.c: revision 1.250
The tlb shootdown IPI can interrupt the pool_cache_get() in places that
can cause a deadlock or pool cache corruption. Take the shootdown job
queue mutex before calling pool_cache_get(), which will block the IPI
interrupts and seems to fix the remaining tlb shootdown deadlocks and
pool cache corruption I've been seeing. Should address both
PR port-alpha/38335 and PR port-alpha/42174.
 1.236.10.3 16-Oct-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1073):
sys/arch/alpha/alpha/pmap.c: revision 1.243
IPI interrupts occur above IPL_VM, so using IPL_VM in for the tlb shootdown
queue mutex doesn't work very well. I get various deadlocks and corrupted
queue entries. Change to IPL_SCHED [IPL_CLOCK] to block IPI interrupts
while the cpu is mucking with the shootdown queue.
 1.236.10.2 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #954):
sys/arch/alpha/alpha/pmap.c: revision 1.242
Alpha will size the mutex structure in pmap_tlb_shootdown_q to 16 bytes.
Change the command and pad accordingly; now pmap_tlb_shootdown_q entries
really are cache-aligned.
 1.236.10.1 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #953):
sys/arch/alpha/alpha/pmap.c: revision 1.241
Now that secondary cpus are added the cpu_info list earlier, attempt to
send pmap tlb shootdowns to them cause the shootdown job queue to fill up,
but since the cpus aren't running yet, no IPIs get sent. When the job
queue is full, the bit mask of cpus to send the IPI to is not set and no
shootdown IPI ever gets sent after the cpu is marked running. Always
set the cpumask even when the queue is full. Now I get shootdown ipis
on all the secondary cpus.
 1.236.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.236.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.236.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.238.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.252.4.1 05-Mar-2011  rmind sync with head
 1.252.2.10 15-Nov-2010  uebayasi Revert xmd(4).
 1.252.2.9 10-Nov-2010  uebayasi Fix thinko; make vm_physseg ptr swap really work.
 1.252.2.8 10-Nov-2010  uebayasi opt_xip.h isn't needed any more here.
 1.252.2.7 10-Nov-2010  uebayasi Always use VM_PHYSMEM_PTR().
 1.252.2.6 06-Nov-2010  uebayasi Sync with HEAD.
 1.252.2.5 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.252.2.4 07-Jul-2010  uebayasi Clean up; merge options DIRECT_PAGE into options XIP.
 1.252.2.3 31-May-2010  uebayasi Re-define the definition of "device page"; device pages are pages of
device memory. Pages which don't have vm_page (== can't be used for
generic use), but whose PV are tracked, are called "direct pages" from
now.
 1.252.2.2 28-Apr-2010  uebayasi Always use struct vm_physseg *vm_physmem_ptrs[] in MD code.
 1.252.2.1 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.255.12.1 18-Feb-2012  mrg merge to -current.
 1.255.8.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.255.8.1 17-Apr-2012  yamt sync with head
 1.258.10.1 18-May-2014  rmind sync with head
 1.258.6.2 03-Dec-2017  jdolecek update from HEAD
 1.258.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.259.6.2 05-Feb-2017  skrll Sync with HEAD
 1.259.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.260.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.261.8.1 27-Feb-2018  martin Pull up following revision(s) (requested by mrg in ticket #593):
sys/dev/marvell/mvxpsec.c: revision 1.2
sys/arch/m68k/m68k/pmap_motorola.c: revision 1.70
sys/opencrypto/crypto.c: revision 1.102
sys/arch/sparc64/sparc64/pmap.c: revision 1.308
sys/ufs/chfs/chfs_malloc.c: revision 1.5
sys/arch/powerpc/oea/pmap.c: revision 1.95
sys/sys/pool.h: revision 1.80,1.82
sys/kern/subr_pool.c: revision 1.209-1.216,1.219-1.220
sys/arch/alpha/alpha/pmap.c: revision 1.262
sys/kern/uipc_mbuf.c: revision 1.173
sys/uvm/uvm_fault.c: revision 1.202
sys/sys/mbuf.h: revision 1.172
sys/kern/subr_extent.c: revision 1.86
sys/arch/x86/x86/pmap.c: revision 1.266 (via patch)
sys/dev/dtv/dtv_scatter.c: revision 1.4

Allow only one pending call to a pool's backing allocator at a time.
Candidate fix for problems with hanging after kva fragmentation related
to PR kern/45718.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2017/10/23/msg022472.html
Tested by bouyer@ on i386.

This makes one small change to the semantics of pool_prime and
pool_setlowat: they may fail with EWOULDBLOCK instead of ENOMEM, if
there is a pending call to the backing allocator in another thread but
we are not actually out of memory. That is unlikely because nearly
always these are used during initialization, when the pool is not in
use.

Define the new flag too for previous commit.

pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.

Assert that pool_get failure happens only with PR_NOWAIT.
This would have caught the mistake I made last week leading to null
pointer dereferences all over the place, a mistake which I evidently
poorly scheduled alongside maxv's change to the panic message on x86
for null pointer dereferences.

Since pr_lock is now used to wait for two things now (PR_GROWING and
PR_WANTED) we need to loop for the condition we wanted.
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'
Handle the ERESTART case from pool_grow()

don't pass 0 to the pool flags
Guess pool_cache_get(pc, 0) means PR_WAITOK here.
Earlier on in the same context we use kmem_alloc(sz, KM_SLEEP).

use PR_WAITOK everywhere.
use PR_NOWAIT.

Don't use 0 for PR_NOWAIT

use PR_NOWAIT instead of 0

panic ex nihilo -- PR_NOWAITing for zerot

Add assertions that either PR_WAITOK or PR_NOWAIT are set.
- fix an assert; we can reach there if we are nowait or limitfail.
- when priming the pool and failing with ERESTART, don't decrement the number
of pages; this avoids the issue of returning an ERESTART when we get to 0,
and is more correct.
- simplify the pool_grow code, and don't wakeup things if we ENOMEM.

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. This implements the requirement that
pmap_enter(PMAP_CANFAIL) must not fail when replacing an existing
mapping with the first mapping of a new page, which is an unintended
consequence of the changes from the rmind-uvmplock branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706, as well as the failing assertion
about "uvm_page_locked_p(old_pg)". (but only on x86, various other platforms
will need their own changes to handle this issue.)
In uvm_fault_upper_enter(), if pmap_enter(PMAP_CANFAIL) fails, assert that
the pmap did not leave around a now-stale pmap mapping for an old page.
If such a pmap mapping still existed after we unlocked the vm_map,
the UVM code would not know later that it would need to lock the
lower layer object while calling the pmap to remove or replace that
stale pmap mapping. See PR 52706 for further details.
hopefully workaround the irregularly "fork fails in init" problem.
if a pool is growing, and the grower is PR_NOWAIT, mark this.
if another caller wants to grow the pool and is also PR_NOWAIT,
busy-wait for the original caller, which should either succeed
or hard-fail fairly quickly.

implement the busy-wait by unlocking and relocking this pools
mutex and returning ERESTART. other methods (such as having
the caller do this) were significantly more code and this hack
is fairly localised.
ok chs@ riastradh@

Don't release the lock in the PR_NOWAIT allocation. Move flags setting
after the acquiring the mutex. (from Tobias Nygren)
apply the change from arch/x86/x86/pmap.c rev. 1.266 commitid vZRjvmxG7YTHLOfA:

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them. If we are replacing an existing mapping,
reuse the pv structure where possible.

This implements the requirement that pmap_enter(PMAP_CANFAIL) must not fail
when replacing an existing mapping with the first mapping of a new page,
which is an unintended consequence of the changes from the rmind-uvmplock
branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries. This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before. It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706 on the remaining platforms where
this problem existed.
 1.262.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.262.4.1 10-Jun-2019  christos Sync with HEAD
 1.264.6.1 25-Jan-2020  ad Sync with head.
 1.273.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.273.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.274.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.276.4.1 31-May-2021  cjep sync with head
 1.276.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.276.2.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.307.4.1 31-Dec-2023  martin Pull up following revision(s) (requested by thorpej in ticket #530):

sys/arch/alpha/alpha/pmap.c: revision 1.308

pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(),
as it is designed to wrap from 1023->0 during the normal course of use.

However, when setting up the initial kernel page tables, if we have a
large enough config that we end up with more than L2 PT page, we rely
on being able to index > 1023 into the adjacent PT pages to initialize
those entries.

Fixes a MM fault panic during early boot on larger memory configs
(reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB
DS25). I've successfully booted at 16GB config in Qemu with this fix.
 1.69 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.68 25-Mar-1998  thorpej Make pmap_kremove() deal with mappings entered with pmap_enter() as well.
Prevents stale PV entries from lingering around. Fixes a nagging
"kernel stack not valid halt" I was seeing with PMAP_NEW.

Idea from Chuck Cranor.
 1.67 24-Mar-1998  thorpej In pmap_destroy_lev1map(), fix a problem where the pmap's ASN wouldn't
be invalidated if the pmap is not active. A rare thing (in fact, I'm
having trouble thinking of a scenario where it would happen), but it was
incorrect, nonetheless.
 1.66 22-Mar-1998  thorpej Use atomic set/clear bits in pmap_activate()/pmap_deactivate().
 1.65 22-Mar-1998  thorpej Implement support for Address Space Numbers, greatly reducing the number
of TLB and I-cache flushes, significantly speeding up context switches.

Once again, many thanks to Chris Demetriou and Ross Harvey for code
review and debugging assistance!
 1.64 18-Mar-1998  thorpej Add a macro to invalidate the TLB for a given pmap/va pair. TLB
invalidation algorithm:

if (old mapping had PG_ASM set || pmap is active) {
TIBS(va);
if (also sync I-stream)
imb();
}

The check for "old mapping had PG_ASM" will get all kernel mappings (since
kernel mappings always have PG_ASM set).

This allows us to remove the bogus check for the kernel pmap in
active_pmap() - do so.

Use the new TLB invalidation macro whenever such action is needed.
 1.63 18-Mar-1998  thorpej Eliminate the last argument from pmap_remove_mapping(); it makes its own
decisions about TLB invalidation.
 1.62 18-Mar-1998  thorpej Change active_pmap() to use the CPU mask (XXX and check for kernel pmap
as well, until some other changes are made). Nuke active_user_pmap(),
and change the places that used it to use active_pmap() instead (as well
as make some DIAGNOSTIC consistency checks).
 1.61 18-Mar-1998  thorpej Optimize out a TLB invalidation in a common case of pmap_enter(): if
the PTE was previously invalid, no TLB invalidation is necessary because:

(1) when a PTE is invalidated, its entry is flushed from the
TLB

(2) the PALcode won't install an invalid PTE into the TLB.
 1.60 18-Mar-1998  thorpej Keep track of which CPUs are using a pmap by setting/clearing bits
in the pmap's CPU mask in pmap_activate()/pmap_deactivate().
 1.59 18-Mar-1998  thorpej Move the "are we active" macros out of the header file.
 1.58 18-Mar-1998  thorpej Add a DIAGNOSTIC checks for the kernel pmap in pmap_create_lev1map()
and pmap_destroy_lev1map(). Correct a comment in another DIAGNOSTIC
panic.
 1.57 18-Mar-1998  thorpej Change a couple of assert()s to DIAGNOSTIC panics.
 1.56 18-Mar-1998  thorpej Correct a comment in pmap_bootstrap().
 1.55 18-Mar-1998  thorpej Pass the max ASN from the HWRPB to pmap_boostrap().
 1.54 17-Mar-1998  thorpej Implement the PMAP_NEW interface for UVM.
 1.53 12-Mar-1998  thorpej Use vm_page_alloc1() and vm_page_free1() as appropriate.
 1.52 12-Mar-1998  thorpej If not DEBUG, use the Virtual Page Table to get the PTE for kernel mappings
in pmap_enter() and pmap_emulate_reference().
 1.51 12-Mar-1998  thorpej Massive cleanup and partial rewrite of the NetBSD/alpha pmap module.

Major change is that page table page management has been completely
rewritten. Page tables are now accessed via K0SEG (no more KVA space
wasted on user page tables), and a much larger user address space is
supported.

Many thanks to Chris Demetriou and Ross Harvey for helpful insight and
debugging assistance.
 1.50 09-Mar-1998  thorpej Move check for user-pmap-still-using-Lev1map from pmap_enter_ptpage()
to pmap_enter().
 1.49 07-Mar-1998  thorpej Rewrite pmap_extract(), and use it as appropriate in vtophys() rather
than (almost) duplicating the code.
 1.48 07-Mar-1998  thorpej Export a pointer to the Virtual Page Table.
 1.47 07-Mar-1998  thorpej Rename Sysptmap and Sysmap to Lev2map and Lev3map, respectively, and
add some comments describing in better detail what they are and how they
are used.
 1.46 07-Mar-1998  thorpej Nuke kvtopte() and ptetokv().
 1.45 07-Mar-1998  thorpej Nuke the vatopa() macro.
 1.44 06-Mar-1998  thorpej pmap_ste() -> pmap_l2pte(), pmap_pte() -> pmap_l3pte()
 1.43 06-Mar-1998  thorpej Move pmap_pte*() macros into the header file, nuke pmap_ste_v(), add
pmap_lev1pte().
 1.42 02-Mar-1998  thorpej Rename a few macros to better describe what they are:
- kvtol1pte() -> l1pte_index()
- vatoste() -> l2pte_index()
- vatopte() -> l3pte_index()
 1.41 02-Mar-1998  thorpej Rewrite pmap_enter() to have a more sane structure, useful for when
page table page management is rewritten.
 1.40 01-Mar-1998  ross Remove the A12 from the rogue's gallery of the promcons-addicted.
 1.39 28-Feb-1998  thorpej Move the code that enters and removes entries from the pv_table into
functions pmap_enter_pv() and pmap_remove_pv().
 1.38 27-Feb-1998  thorpej Garbage-collect the kpt_page stuff; it was basically unused in this
pmap, and isn't applicable to how dynamically allocated kernel page
tables will work on the Alpha.
 1.37 27-Feb-1998  thorpej Revamp pv_table management:
- Make pv_table an array of struct pv_head's, which contain LIST_HEADs
for the pv_entry's, as well as page attributes (mod, ref, ptpage).
- Use <sys/queue.h> to manipulate pv_entry lists.
- Fix several obvious bugs in pmap_collect_pv().
- Use K0SEG to access pv_page's.
 1.36 27-Feb-1998  thorpej Step 1 of the Grand Alpha Pmap Rototill:
- Clean up pmap_bootstrap() some, and make a slight change to how the
PROM mappings are saved.
- Give each pmap its own level 1 page table, rather than sharing a global
level 1 page table. This will eventually allow for Very Large user
address spaces.
- Keep a list of all pmaps, so that when kernel level 2 page tables are
allocated, all level 1 tables may be updated.
- Add a couple of functions for allocating and freeing page table pages.
- Add a few comments about ASN allocation.
 1.35 24-Feb-1998  thorpej Add support for UVM.
 1.34 18-Feb-1998  cgd nuke pmap_map(). it's an internal MD function, and it's unused
 1.33 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.32 14-Feb-1998  cgd The pmap_emulate_reference warning about the page not being managed should
be a panic instead. If it's hit, "random" memory is going to be corrupted.
 1.31 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.30 31-Jan-1998  ross In some hp300-derived pmaps, in pmap_page_protect(), don't walk off the
end of the list of physical->virtual entires into NULL space if the last
entry is (mysteriously) wired in the pmap. Add a DEBUG printf on alpha.
 1.29 29-Jan-1998  ross Fix an alpha-specific page daemon wedge...the new pmap_clear_reference()
may be faster, but it was supposed to _clear_ PMAP_ATTR_REF, not _set_ it.
 1.28 09-Jan-1998  thorpej - pmap_collect_pv() is broken; #ifdef it out (it's not currently ever
called anyway, but now at least the reason is documented).
- rearrange a few things to make it easier to add support for non-contigous
physical memory.
 1.27 09-Jan-1998  thorpej Gather pv_table and pmap_attributes things togther, and macro'ize
access to them a little better.

Also, improve the performance of pmap_is_{referenced,modified}() and
pmap_clear_{reference,modify}() somewhat.
 1.26 17-Nov-1997  ross Put in Jason's recommended fix for the null-curproc-in-pmap.old.c problem.
 1.25 04-Nov-1997  ross Check for null curproc in pmap_changebit. Fixes the IDE-on-alpha crash
problem reported by Chris Csanady <ccsanady@bob.scl.ameslab.gov>.
this
 1.24 18-Sep-1997  mjacob branches: 1.24.2;
After decommisioning a mapping, an IMB kinda needs to happen.
 1.23 16-Sep-1997  thorpej From page 6-9 of "Alpha AXP Architecture Reference Manual, Second Edition":

An IMB intruction must be executed after software or I/O devices
write into the instruction stream or modify the instruction
stream virtual address mapping, and before the new value is
fetched as an instruction.

We were missing calls to IMB after mappings were changed, which caused
systems with large I-caches (e.g. my AlphaStation 500) to fail miserably
when mapping in new pages of program text, or when context switching
(I couldn't even get the shell from init!).
 1.22 03-Sep-1997  thorpej From hp300 pmap: use mycroft's pv_entry allocator (from i386 port).
 1.21 03-Sep-1997  thorpej Update from hp300 pmap: define an active_user_pmap() macro and use it.
 1.20 02-Sep-1997  thorpej Remove references to vm_pmap.
 1.19 02-Sep-1997  thorpej - Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
- Garbage-collect pmap->pm_stchanged; it's not really used for anything.
 1.18 02-Sep-1997  thorpej branches: 1.18.2;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.17 07-Apr-1997  cgd branches: 1.17.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.16 07-Apr-1997  cgd include machine/options.h
 1.15 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.14 13-Nov-1996  cgd branches: 1.14.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.10 11-Jul-1996  cgd update for new alpha_cpu.h definitions
 1.9 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.8 12-Apr-1996  cgd add some sanity checks to avoid lossage when dealing with unmanaged
pages, and clean up a little bit.
 1.7 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.6 03-Aug-1995  cgd console printf twiddling warning not really necessary now
 1.5 28-Jun-1995  cgd sync with my current Alpha sources
 1.4 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.3 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.14.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.17.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.18.2.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18.2.1 02-Sep-1997  thorpej file pmap.old.c was added on branch bouyer-scsipi on 1997-09-02 13:18:32 +0000
 1.24.2.3 07-Feb-1998  mellon Pull up 1.30 (ross)
 1.24.2.2 17-Nov-1997  thorpej Sync w/ trunk (ross).
 1.24.2.1 04-Nov-1997  mellon Pull rev 1.25 up from trunk (ross)
 1.1 10-Jul-2021  thorpej branches: 1.1.4;
Move the optimized pmap_zero_page() from pmap.c to a new pmap_subr.s,
and optimize it a teeny bit little more. Provide an optimized (for 21164,
anyway) pmap_copy_page() as well.
 1.1.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.1.4.1 10-Jul-2021  thorpej file pmap_subr.s was added on branch thorpej-i2c-spi-conf on 2021-08-01 22:42:00 +0000
 1.30 16-Mar-2017  chs allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.29 16-May-2014  matt branches: 1.29.4; 1.29.8; 1.29.12;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.28 04-Jan-2014  dsl branches: 1.28.2;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.27 06-Feb-2012  matt branches: 1.27.6; 1.27.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.26 07-Jun-2011  matt branches: 1.26.2; 1.26.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.25 21-Nov-2009  rmind branches: 1.25.4; 1.25.10;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.24 04-Mar-2007  christos branches: 1.24.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 11-Dec-2005  christos branches: 1.23.26;
merge ktrace-lwp.
 1.22 01-Jun-2005  scw branches: 1.22.2;
Declare the second arg of process_write_{fp,}regs() to be const.
This permits sh5 to continue to re-use those functions in cpu_setmcontext()
with the recent change to Makefile.kern.inc (revision 1.62).
 1.21 21-Sep-2003  skd Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.20 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.19 17-Jan-2003  thorpej branches: 1.19.2;
Merge the nathanw_sa branch.
 1.18 12-Jul-2001  thorpej branches: 1.18.2;
bcopy -> memcpy
 1.17 04-Jan-2001  itojun branches: 1.17.4;
typo. struct fpregs -> struct fpreg
 1.16 03-Jan-2001  thorpej ANSI'ify, and inline userret().
 1.15 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.14 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.13 10-Aug-1999  thorpej branches: 1.13.2;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.12 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.11 19-Nov-1998  ross #include <machine/alpha.h>
 1.10 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.9 07-Apr-1997  cgd branches: 1.9.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.7 11-Jul-1996  cgd branches: 1.7.2;
don't save and set the USP at every trap entry and exit. It's
unnecessary, and given that there's no reason to waste time and
add complexity in trap handlers. This means that code which sets and
uses the USP has to be a bit more careful, but that doesn't happen much.
 1.6 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.5 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.4 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.13.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.13.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.17.4.1 03-Aug-2001  lukem update to -current
 1.18.2.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.18.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.18.2.1 12-Jul-2001  nathanw file process_machdep.c was added on branch nathanw_sa on 2001-08-30 23:43:41 +0000
 1.19.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.22.2.1 03-Sep-2007  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.44.1 11-Mar-2010  yamt sync with head
 1.25.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.25.4.1 12-Jun-2011  rmind sync with head
 1.26.6.1 18-Feb-2012  mrg merge to -current.
 1.26.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.2.1 17-Apr-2012  yamt sync with head
 1.27.10.1 18-May-2014  rmind sync with head
 1.27.6.2 03-Dec-2017  jdolecek update from HEAD
 1.27.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.2.1 10-Aug-2014  tls Rebase.
 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 28-Aug-2017  skrll Sync with HEAD
 1.5 05-Apr-2014  christos adjust to new signature; return consistent stuff. 0 is ok -1 is error
 1.4 11-Dec-2005  christos branches: 1.4.112; 1.4.122; 1.4.128;
merge ktrace-lwp.
 1.3 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.2 18-Jan-2001  tv branches: 1.2.24;
No-op commit to force update to a non-"-kk" revision.
 1.1 17-Jan-2001  fvdl branches: 1.1.2;
Add machdep file for procfs. Currently only used for linux-style
/proc/cpuinfo (only active when procfs is mounted with -o linux).
For ports other than the i386 this currently produces an empty
string.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 17-Jan-2001  bouyer file procfs_machdep.c was added on branch thorpej_scsipi on 2001-01-18 09:22:06 +0000
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4.128.1 18-May-2014  rmind sync with head
 1.4.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.112.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.59 03-Mar-2024  thorpej prom_uses_prom_console() needs to consider ST_DEC_7000, as well.
 1.58 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.57 27-Sep-2020  thorpej prom_is_qemu -> alpha_is_qemu, and export it outside of prom.c.
 1.56 04-Sep-2020  thorpej Fix a typo.
 1.55 03-Sep-2020  thorpej The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE). We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.
 1.54 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.53 30-Aug-2020  thorpej When initializing the PROM interface, check to see if we're running
inside Qemu by consulting the system serial number, and quickly abort
calls into the PROM if we are.

This is a temporary measure until I can figure out why calling into
the Qemu PROM interface blows up.
 1.52 29-Aug-2020  thorpej Make sure init_prom_interface() only runs once, otherwise we initialize
a mutex twice, and that upsets LOCKDEBUG. But instead of seeing a
proper message about it, the output happens before the PROM console
interfcace is initialized, we would end up with a translation fault
back into SRM.
 1.51 21-Feb-2020  skrll Use designated initialisers
 1.50 03-Sep-2018  riastradh branches: 1.50.4; 1.50.6;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.49 13-Oct-2016  flxd branches: 1.49.14; 1.49.16;
Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000.
OK skrll@
 1.48 06-Feb-2012  matt branches: 1.48.2; 1.48.6; 1.48.22; 1.48.24; 1.48.26; 1.48.28; 1.48.30;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.47 24-May-2011  rmind branches: 1.47.4; 1.47.8;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.46 21-Nov-2009  rmind branches: 1.46.4; 1.46.6;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.45 05-Jan-2008  ad branches: 1.45.10;
Fix includes.
 1.44 08-Mar-2003  he branches: 1.44.18; 1.44.80; 1.44.86; 1.44.94;
Initialize the new function pointers to NULL, so this compiles again.
 1.43 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.42 12-Jul-2001  thorpej branches: 1.42.2;
bcopy -> memcpy
 1.41 03-Jan-2001  thorpej branches: 1.41.4;
ANSI'ify, and inline userret().
 1.40 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.39 06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.38 10-Aug-1999  thorpej branches: 1.38.2;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.37 11-Jul-1999  ross Rewrite of console_restart() with constructed trapframe.
Extract various state elements from the per-cpu-slot in hwrpb.
 1.36 15-Apr-1999  thorpej Back out the change to swap Lev1map on MP systems that use the PROM console.

Basically, we have to completely nuke the _PMAP_USES_PROM_CONSOLE code from
orbit before MP is going to properly work.
 1.35 26-Feb-1999  thorpej branches: 1.35.4;
Move declaration of prom_slock.
 1.34 25-Feb-1999  thorpej On multiprocessor systems, it is possible that a lev1map might be in use
by two processors concurrently. This means that we cannot modify the
lev1map in use by the processor which wishes to use the PROM.

Fix this by creating a separate lev1map for PROM users. This lev1map
is a copy of the kernel_lev1map, with the exception of the necessary
PROM mapping. When a processor wishes to use the PROM, it switches
its PTBR to point at the prom_lev1map, performs the PROM operation,
and switches back to its previous lev1map.

Note that kernels without multiprocessor support use the old method
of modifying the current lev1map.

Also, serialize access to the PROM via a spin lock.
 1.33 24-Feb-1999  thorpej Note that the way the temporary PROM mapping is handled is completely
broken on multiprocessor systems.
 1.32 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.31 19-Nov-1998  ross #include <machine/alpha.h>
 1.30 15-Oct-1998  ross Define ENABLEPROM, which turns on the raw prom interface defs.
 1.29 06-Oct-1998  thorpej Split hwrpb_restart_setup(), putting the code that initializes the vtpb
and primary hwpcb into hwrpb_primary_init(). Call the latter before
performing autoconfiguration().
 1.28 24-Sep-1998  thorpej Make prom_enter() and prom_leave() public.
 1.27 24-Sep-1998  thorpej Use the primary CPU ID on console_restart(), not hard-coded 0.
 1.26 24-Sep-1998  thorpej Actually, yes we do know what the rpb_restart entry point is used for,
so delete some #if 0'd code.
 1.25 24-Sep-1998  thorpej When setting up the hwrpb for restarts, use the primary CPU ID from the
hwrpb.
 1.24 24-Jun-1998  ross Clean up code using new LOCATE_PCS() macro.
 1.23 19-May-1998  thorpej Argh, finish renaming Lev1map to kernel_lev1map.
 1.22 27-Feb-1998  thorpej Changes necessitated by the fact that all pmaps have their own level 1
page tables: use curpcb to determine which level 1 map defines the
current VM context, and use that level 1 map when mapping and unmapping
the PROM.
 1.21 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.20 29-Jan-1998  ross Clean up duplicated code sequences and add an imb (a coherency operation)
whenever the console code is mapped and unmapped.
 1.19 28-Jan-1998  thorpej Use offsetof() from libkern.h
 1.18 17-Oct-1997  mjacob Recover from some include file foo.
 1.17 02-Sep-1997  thorpej Remove references to vm_pmap.
 1.16 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.15 07-Apr-1997  cgd branches: 1.15.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.14 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.13 12-Mar-1997  cgd Set the halt flags in the right per-cpu-slot structure. From Matt Jacob.
 1.12 13-Nov-1996  cgd branches: 1.12.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.11 16-Oct-1996  cgd add a new function, hwrbp_restart_setup(), to be called after
autoconfiguration. It clears the RPB's per-cpu-slot BIP flag and
sets up the RPB's restore_term and restart vectors, etc. add a
console_restart() function, which causes a panic and system dump,
that is invoked (indirectly) via those vectors.
 1.10 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP
 1.9 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.8 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.7 13-Jun-1996  cgd clean up copyright notices
 1.6 12-Jun-1996  cgd null-terminate strings returned by prom_getenv()
 1.5 29-Apr-1996  cgd branches: 1.5.4;
clear BIP; it should really happen at end of autoconfiguration.
 1.4 03-Aug-1995  cgd kill bogus comments, unnecessary functions
 1.3 28-Jun-1995  cgd sync with my current Alpha sources
 1.2 22-Apr-1995  cgd promcnputc now returns void
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.5.4.1 13-Jun-1996  cgd pull up from trunk:
>null-terminate strings returned by prom_getenv()
 1.12.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.4.2 02-Aug-1999  thorpej Update from trunk.
 1.35.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.38.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.38.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.41.4.1 03-Aug-2001  lukem update to -current
 1.42.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.42.2.1 12-Jul-2001  nathanw file prom.c was added on branch nathanw_sa on 2001-08-30 23:43:42 +0000
 1.44.94.1 08-Jan-2008  bouyer Sync with HEAD
 1.44.86.1 18-Feb-2008  mjf Sync with HEAD.
 1.44.80.1 09-Jan-2008  matt sync with HEAD
 1.44.18.1 21-Jan-2008  yamt sync with head
 1.45.10.1 11-Mar-2010  yamt sync with head
 1.46.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.1 31-May-2011  rmind sync with head
 1.47.8.1 18-Feb-2012  mrg merge to -current.
 1.47.4.1 17-Apr-2012  yamt sync with head
 1.48.30.1 18-Jan-2017  skrll Sync with netbsd-5
 1.48.28.1 04-Nov-2016  pgoyette Sync with HEAD
 1.48.26.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.48.24.1 05-Dec-2016  skrll Sync with HEAD
 1.48.22.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.48.6.1 03-Dec-2017  jdolecek update from HEAD
 1.48.2.1 16-Nov-2016  snj Pull up following revision(s) (requested by flxd in ticket #1416):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.49.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.49.16.1 10-Jun-2019  christos Sync with HEAD
 1.49.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.50.6.1 29-Feb-2020  ad Sync with head.
 1.50.4.1 29-Aug-2020  martin Pull up following revision(s) (requested by thorpej in ticket #1069):

sys/arch/alpha/alpha/prom.c: revision 1.52

Make sure init_prom_interface() only runs once, otherwise we initialize
a mutex twice, and that upsets LOCKDEBUG. But instead of seeing a
proper message about it, the output happens before the PROM console
interfcace is initialized, we would end up with a translation fault
back into SRM.
 1.8 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.7 08-Apr-1997  cgd branches: 1.7.8;
include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.5 17-Sep-1996  cgd branches: 1.5.2;
use assembler directives and labels that make both the ELF- and ECOFF-
targeted assemblers happy.
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 02-Feb-1996  mycroft Fix #includes.
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.8.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.41 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.40 09-Aug-2019  rin Add CONSPEED option, which changes baud rate of serial console.
 1.39 25-Jul-2014  dholland branches: 1.39.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.38 16-Mar-2014  dholland branches: 1.38.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.37 06-Feb-2012  matt branches: 1.37.6; 1.37.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.36 24-Apr-2011  rmind branches: 1.36.4; 1.36.8;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.35 21-Nov-2009  rmind branches: 1.35.4; 1.35.6;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.34 19-Nov-2007  ad branches: 1.34.18;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.33 17-Oct-2007  garbled branches: 1.33.2;
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.32 09-Jul-2007  ad branches: 1.32.8; 1.32.10; 1.32.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.31 04-Mar-2007  christos branches: 1.31.2; 1.31.4; 1.31.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30 01-Oct-2006  elad branches: 1.30.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.29 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.28 23-Jul-2006  ad branches: 1.28.4; 1.28.6;
Use the LWP cached credentials where sane.
 1.27 14-May-2006  elad integrate kauth.
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25 06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.24 29-Jun-2003  fvdl branches: 1.24.2; 1.24.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.23 29-Jun-2003  simonb Only one function is this file wasn't ANSIfied, convert it.
 1.22 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.21 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.20 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.19 17-Mar-2002  atatat branches: 1.19.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.18 02-May-2001  scw branches: 1.18.2; 1.18.4; 1.18.6;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.17 03-Jan-2001  thorpej branches: 1.17.2;
ANSI'ify, and inline userret().
 1.16 02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.15 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.14 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.13 21-Mar-1998  mycroft branches: 1.13.14;
Eliminate uses of TS_WOPEN in hard-wired devices.
 1.12 02-Mar-1998  ross Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.11 01-Mar-1998  ross Poll console at 50 Hz, not 1024 Hz! (4 tlb and imb coherency ops per poll
make this exceedingly expensive even on an alpha) Note: only 3 systypes
still use promcons.
 1.10 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.9 02-Sep-1997  thorpej branches: 1.9.4;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.8 07-Apr-1997  cgd branches: 1.8.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.7 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.5 13-Nov-1996  cgd branches: 1.5.2;
update copyright dates
 1.4 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.3 30-May-1996  cgd add tty_attach() calls where appropriate
 1.2 28-Jun-1995  cgd branches: 1.2.6;
sync with my current Alpha sources
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.6.1 03-Jun-1996  cgd pull up from trunk:
>add tty_attach() calls where appropriate
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.4.1 08-May-1998  mycroft Pull up 1.11, per request of ross.
 1.13.14.3 05-Jan-2001  bouyer Sync with HEAD
 1.13.14.2 22-Nov-2000  bouyer Sync with HEAD.
 1.13.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.17.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.18.6.4 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.18.6.3 10-Oct-2001  fvdl Convert all remaining devices.
 1.18.6.2 26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.18.6.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.18.4.4 11-Nov-2002  nathanw Catch up to -current
 1.18.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.18.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.4.1 02-May-2001  nathanw file promcons.c was added on branch nathanw_sa on 2002-04-01 07:38:50 +0000
 1.18.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.18.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.4.1 16-May-2002  gehenna Add the character device switch.
 1.24.18.4 07-Dec-2007  yamt sync with head
 1.24.18.3 03-Sep-2007  yamt sync with head.
 1.24.18.2 30-Dec-2006  yamt sync with head.
 1.24.18.1 21-Jun-2006  yamt sync with head.
 1.24.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.1 21-Nov-2004  skrll Adapt to branch. Alpha kernels now compile.
 1.26.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.26.10.3 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.26.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.26.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.26.8.2 11-Aug-2006  yamt sync with head
 1.26.8.1 24-May-2006  yamt sync with head.
 1.26.6.1 01-Jun-2006  kardel Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.28.6.1 22-Oct-2006  yamt sync with head
 1.28.4.1 18-Nov-2006  ad Sync with head.
 1.30.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.31.10.1 03-Oct-2007  garbled Sync with HEAD
 1.31.4.1 11-Jul-2007  mjf Sync with head.
 1.31.2.2 03-Dec-2007  ad Sync with HEAD.
 1.31.2.1 15-Jul-2007  ad Sync with head.
 1.32.14.1 21-Nov-2007  bouyer Sync with HEAD
 1.32.10.2 09-Jan-2008  matt sync with HEAD
 1.32.10.1 06-Nov-2007  matt sync with HEAD
 1.32.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.33.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.34.18.1 11-Mar-2010  yamt sync with head
 1.35.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.35.4.1 31-May-2011  rmind sync with head
 1.36.8.1 18-Feb-2012  mrg merge to -current.
 1.36.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.36.4.1 17-Apr-2012  yamt sync with head
 1.37.10.1 18-May-2014  rmind sync with head
 1.37.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.1 10-Aug-2014  tls Rebase.
 1.39.28.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6 01-Aug-2023  andvar fix RCSIDs.
 1.5 11-Oct-2020  thorpej initclocks() now fixes up tick and tickadj if hz changes, so we no
longer need to do it.
 1.4 07-Oct-2020  thorpej - qemu_hardclock(): fix check for spurious hardclock call.
- qemu_clock_init(): Initialize qemu_nsec_per_tick *after* adjusting hz.
Error pointed out by Jonathan Kollasch.
 1.3 03-Oct-2020  thorpej Provide an alternate delay function that uses the Qemu get-time hypercall.
 1.2 29-Sep-2020  thorpej Improve time keeping and host CPU usage when running in Qemu:
- clockattach(): Allow multiple calls when running in Qemu. Anything
after this first one is ignored, but this gives us a change to use
a clock source provided by the VM directly, rather than relying on
a more expensive hardware emulation.
- Add cpu_initclocks_secondary(), to handle clock setup on secondary
CPUs, if needed.
- Allow us to use the WTINT PALcode call in cpu_idle() to idle in a lower
power state (Qemu's PALcode supports this).
- Use the Qemu per-cpu set-alarm-rel call as the hardclock interrupt
source. In Qemu environments, reduce hz to 50 (rather than the
default 1024) to give the clock a snowball's chance when running on
a host system with hz=100. XXX We have to manually re-calculate
tick and tickadj. There should be MI code to do this for us. Also
in Qemu environments, let hardclock() drive the sched clock by setting
schedhz=0.
 1.1 27-Sep-2020  thorpej Add a "qemu" driver to access services provided by the Qemu VM. First
order of business is to use the Qemu "get-time" console service call as
the perferred system timecounter.
 1.6 28-Dec-1996  pk rename: ramdisk => md
 1.5 13-Oct-1996  christos branches: 1.5.2;
backout previous kprintf change
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 03-Oct-1996  cgd reword attachment printf
 1.2 03-Oct-1996  cgd clean up
 1.1 15-Sep-1996  cgd add ramdisk root hooks
 1.5.2.1 24-Jan-1997  cgd sync with trunk
 1.2 19-Nov-1996  cgd this has moved to sys/arch/alpha/common.
 1.1 17-Nov-1996  cgd implement a (hack-ish) set of routines to do common chained-interrupt
handler management. It's nasty, but three slightly different copies of
the code is worse.
 1.9 12-Aug-2001  jdolecek Move _insque()/_remque() to libkern. Once remaining uses would
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated
altogether.
 1.8 03-Jan-2001  thorpej branches: 1.8.4;
ANSI'ify, and inline userret().
 1.7 02-Sep-1997  thorpej branches: 1.7.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 07-Apr-1997  cgd branches: 1.6.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 13-Nov-1996  cgd branches: 1.4.2;
update copyright dates
 1.3 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.18.1 05-Jan-2001  bouyer Sync with HEAD
 1.8.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.6 31-Jan-1997  thorpej This file is obsolete; this information is now generated by config(8).
 1.5 12-Jun-1996  cgd branches: 1.5.2;
copy from sparc port, trim bogus swdevt entries
 1.4 13-Apr-1996  cgd branches: 1.4.4;
update for recent config changes: xxcd -> xx_cd
 1.3 24-Mar-1995  cgd allow user to halt system at boot device prompt
 1.2 08-Mar-1995  cgd fix cd major number
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.4.1 13-Jun-1996  cgd pull up from trunk:
>copy from sparc port, trim bogus swdevt entries
 1.5.2.1 31-Jan-1997  cgd sync with trunk
 1.22 28-Feb-2021  tnn support building alpha kernel without PCI bus
 1.21 06-Feb-2012  matt branches: 1.21.60;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 24-Feb-2011  joerg branches: 1.20.4; 1.20.8;
Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.19 07-Jul-2010  chs branches: 1.19.2; 1.19.4;
implement cpu_lwp_setprivate() on several platforms.
 1.18 28-Apr-2008  martin branches: 1.18.2; 1.18.20; 1.18.22;
Remove clause 3 and 4 from TNF licenses
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8; 1.17.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 09-Feb-2007  ad branches: 1.16.24; 1.16.32; 1.16.36;
Merge newlock2 to head.
 1.15 17-Jan-2003  thorpej branches: 1.15.18; 1.15.48;
Merge the nathanw_sa branch.
 1.14 14-Jan-2002  thorpej Add sysarch calls to read and write the full fp_c.
 1.13 26-Apr-2001  ross branches: 1.13.2; 1.13.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.12 03-Jan-2001  thorpej branches: 1.12.2;
ANSI'ify, and inline userret().
 1.11 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.10 30-Apr-1999  ross branches: 1.10.2;
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.9 25-Feb-1998  perry branches: 1.9.8;
note second parm of sysarch() is now void *, + trivial KNF, etc.
 1.8 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 07-Apr-1997  cgd branches: 1.7.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.5 13-Nov-1996  cgd branches: 1.5.2;
update copyright dates
 1.4 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.8.1 30-Apr-1999  perry branches: 1.9.8.1.2;
pullup 1.9->1.10 (ross)
 1.9.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.13.4.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.13.4.4 28-Feb-2002  nathanw LWPify the FP completion calls.
 1.13.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.13.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.13.4.1 26-Apr-2001  nathanw file sys_machdep.c was added on branch nathanw_sa on 2001-08-30 23:43:42 +0000
 1.13.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.15.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.18.2 21-Jan-2008  yamt sync with head
 1.15.18.1 26-Feb-2007  yamt sync with head.
 1.16.36.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.32.1 26-Dec-2007  ad Sync with head.
 1.16.24.1 09-Jan-2008  matt sync with HEAD
 1.17.10.2 11-Aug-2010  yamt sync with head.
 1.17.10.1 16-May-2008  yamt sync with head.
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.22.1 05-Mar-2011  rmind sync with head
 1.18.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.18.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.18.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.19.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.19.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.8.1 18-Feb-2012  mrg merge to -current.
 1.20.4.1 17-Apr-2012  yamt sync with head
 1.21.60.1 03-Apr-2021  thorpej Sync with HEAD.
 1.45 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.44 06-Apr-2019  kamil Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.
 1.43 03-Apr-2019  kamil Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.
 1.42 26-Jun-2013  matt branches: 1.42.34;
Use sy_invoke
 1.41 22-Jul-2012  matt branches: 1.41.2;
Use new style syscall format which uses __predict_* to optimize branches.
 1.40 21-Feb-2012  para follow the sa removal for alpha
 1.39 11-Feb-2012  martin Add a posix_spawn syscall, as discussed on tech-kern.
Based on the summer of code project by Charles Zhang, heavily reworked
later by me - all bugs are likely mine.
Ok: core, releng.
 1.38 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.37 20-Dec-2010  matt branches: 1.37.8; 1.37.12;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.36 25-Feb-2010  skrll branches: 1.36.2;
s/cpu_fork/cpu_lwp_fork/ in comment.
 1.35 21-Nov-2009  rmind branches: 1.35.2;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.34 21-Oct-2008  ad Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.
 1.33 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.32 28-Apr-2008  martin branches: 1.32.2; 1.32.6;
Remove clause 3 and 4 from TNF licenses
 1.31 24-Apr-2008  ad branches: 1.31.2;
- Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
 1.30 06-Feb-2008  dsl branches: 1.30.6; 1.30.8;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53
 1.29 05-Jan-2008  dsl Don't pass 'curlwp' into trace_enter() and trace_exit().
 1.28 17-Oct-2007  garbled branches: 1.28.2; 1.28.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.27 15-Aug-2007  ad branches: 1.27.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.26 04-Mar-2007  christos branches: 1.26.2; 1.26.10; 1.26.14; 1.26.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 21-Feb-2007  thorpej 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.24 09-Feb-2007  ad branches: 1.24.2;
Merge newlock2 to head.
 1.23 19-Jul-2006  ad branches: 1.23.4;
- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
 1.22 07-Mar-2006  thorpej branches: 1.22.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.21 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.20 05-Mar-2006  christos Add a proc_is_traced_p() macro and use it, instead of copying the same code
in many places. Idea from thorpej.
 1.19 05-Mar-2006  christos branches: 1.19.2;
implement PT_SYSCALL
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6;
merge ktrace-lwp.
 1.17 10-Jul-2005  christos No point in declaring syscall_intern and syscall in a zillion places.
 1.16 01-Jul-2005  christos branches: 1.16.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.
 1.15 17-Jul-2004  petrov Update uvmexp's traps and syscalls. Reviewed by Jason Thorpe.
 1.14 13-Feb-2004  drochner branches: 1.14.2;
plug 2 obvious kernel lock leaks
(compile tested only)
 1.13 31-Oct-2003  simonb Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
 1.12 29-Oct-2003  mycroft Make sure "args" is pointing somewhere sane before calling trace_exit().
 1.11 27-Oct-2003  chs uninitialized variables
 1.10 24-Aug-2003  chs avoid taking the kernel lock for MPSAFE syscalls.
add missing unlock in fancy case.
 1.9 29-Jun-2003  fvdl branches: 1.9.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.8 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 21-Dec-2002  manu Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.
 1.5 15-Nov-2002  manu Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.
 1.4 17-Jun-2002  christos MD systrace gluons.
 1.3 03-Jan-2001  thorpej branches: 1.3.2; 1.3.4; 1.3.16;
ANSI'ify, and inline userret().
 1.2 13-Dec-2000  mycroft branches: 1.2.2;
Do the fast/slow path separation, a la x86.
 1.1 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.2.2.1 13-Dec-2000  bouyer file syscall.c was added on branch thorpej_scsipi on 2000-12-13 14:49:09 +0000
 1.3.16.1 09-Jul-2002  gehenna catch up with -current.
 1.3.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.7 29-Dec-2002  thorpej Sync with HEAD.
 1.3.2.6 16-Dec-2002  nathanw The child_return() function only needs struct proc *p if KTRACE is defined.
 1.3.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.2.3 09-Jul-2002  nathanw #include <sys/sa.h> for type definitions.
 1.3.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.9.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.2 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.14.2.1 17-Jul-2004  he Pull up revision 1.15 (requested by petrov in ticket #672):
Update uvmexp's traps and syscalls.
 1.16.2.6 11-Feb-2008  yamt sync with head.
 1.16.2.5 21-Jan-2008  yamt sync with head
 1.16.2.4 03-Sep-2007  yamt sync with head.
 1.16.2.3 26-Feb-2007  yamt sync with head.
 1.16.2.2 30-Dec-2006  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.3 11-Aug-2006  yamt sync with head
 1.19.2.2 13-Mar-2006  yamt sync with head.
 1.19.2.1 05-Mar-2006  yamt file syscall.c was added on branch yamt-pdpolicy on 2006-03-13 09:06:51 +0000
 1.22.2.2 07-Mar-2006  thorpej Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.
 1.22.2.1 07-Mar-2006  thorpej file syscall.c was added on branch elad-kernelauth on 2006-03-07 07:21:51 +0000
 1.23.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.23.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.24.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.24.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.26.18.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.26.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.26.10.1 03-Oct-2007  garbled Sync with HEAD
 1.26.2.1 20-Aug-2007  ad Sync with HEAD.
 1.27.2.3 23-Mar-2008  matt sync with HEAD
 1.27.2.2 09-Jan-2008  matt sync with HEAD
 1.27.2.1 06-Nov-2007  matt sync with HEAD
 1.28.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.28.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.30.8.1 18-May-2008  yamt sync with head.
 1.30.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.3 11-Mar-2010  yamt sync with head
 1.31.2.2 04-May-2009  yamt sync with head.
 1.31.2.1 16-May-2008  yamt sync with head.
 1.32.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.6.1 19-Oct-2008  haad Sync with HEAD.
 1.32.2.2 14-Oct-2008  wrstuden Add a new vp-private flag, SAVP_FLAG_DELIVERING. This flag indicates
that the vp is in the process of delivering a new-thread upcall.
This is a BLOCKED or NEWPROC upcall. Do NOT generate any BLOCKED
upcalls while this is set. Set it at the end of sa_switchcall()
and clear it at syscall entry. Sadly, I have found no other
way to handle this. The old SA interface has no way for
userland to acknowledge that it got the upcall, so use syscall
entry as the indicator that libpthread got it.

This addresses the issue seen on current-users with firefox
dying with a blockedgen != unbockedgen error. The problem is we
deliver a BLOCKED upcall, but between the end of userret()
and when the CPU indicates that it's running in user mode, we take
a page fault. Said page fault blocks, blocking upcall delivery.
The original block, however, was short-lived, and the UNBLOCK
happens shortly. It happens before libpthread actually notices
the BLOCKED upcall. Boom!

Unfortunately a LOCKDEBUG/DIAGNOSTIC kernel still dies before
firefox opens. However this new issue is with uvm code calling
mtsleep when not holding a correct lock; sa_switch() is exploding
at KASSERT(lwp_locked(l, NULL)); before it's done _anything_.

Also, while here, add sa_system_disabled. This is an integer
that we examine when starting SA for a proc. If it's non-zero,
we error out. Once this is hooked into sysctl, you'll be able to
disable SA w/o recompiling.
 1.32.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.35.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.2.1 05-Mar-2011  rmind sync with head
 1.37.12.2 24-Feb-2012  mrg sync to -current.
 1.37.12.1 18-Feb-2012  mrg merge to -current.
 1.37.8.3 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.37.8.2 30-Oct-2012  yamt sync with head
 1.37.8.1 17-Apr-2012  yamt sync with head
 1.41.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.34.1 10-Jun-2019  christos Sync with HEAD
 1.3 10-Apr-2001  ross branches: 1.3.4;
g/c transfer_check
 1.2 31-May-1999  ross branches: 1.2.2; 1.2.14;
Convert to traceback-friendly temporary labels.
 1.1 03-Nov-1997  ross branches: 1.1.2; 1.1.12;
--Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.1.12.1 21-Jun-1999  thorpej Sync w/ -current.
 1.1.2.2 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.1.2.1 03-Nov-1997  thorpej file transfer.s was added on branch netbsd-1-3 on 1997-11-10 21:57:01 +0000
 1.2.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 21-Apr-2001  bouyer Sync with HEAD
 1.3.4.2 10-Apr-2001  ross g/c transfer_check
 1.3.4.1 10-Apr-2001  ross file transfer.s was added on branch nathanw_sa on 2001-04-10 10:09:47 +0000
 1.140 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.139 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.138 23-Jul-2021  thorpej Emulate the IEEE flavors of the FIX extension instructions:
- FTOIS, FTOIT
- ITOFS, ITOFT
- SRQTS, SQRTT

Left out for now are the VAX FP flavors:
- ITOFF
- SQRTF, SQRTG
 1.137 20-Jul-2021  thorpej Emulate the CIX extension instructions (CTPOP, CTTZ, CTLZ).
 1.136 19-Jul-2021  thorpej - In unaligned_fixup(), use defined constants for opcodes, not magic numbers.

- In handle_opdec(), use ufetch_int() to fetch the instruction and
_u{fetch,store}_{8,16}() when emulating BWX instructions rather
than copyin() / copyout() (they're faster).

- Add event counters for BWX instruction emulation.
 1.135 21-Nov-2019  ad branches: 1.135.12;
mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.134 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.133 16-Mar-2017  chs branches: 1.133.14;
allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.132 02-Mar-2015  martin branches: 1.132.2; 1.132.4;
Handle EINVAL in fault path, so mmap() access past EOF gets SIGBUS.
 1.131 16-May-2014  martin branches: 1.131.4;
When creating a SIGFPE siginfo for a gentrap, we have no additional info
(ucode) available, and the pal interface does not provide additional
details either. Hardcode the si_code value to FPE_INTDIV, since the only
callers of gentrap in our kernel seem to be the division routines in libkern.
 1.130 20-Mar-2014  christos branches: 1.130.2;
kill sprintf
 1.129 04-Nov-2013  christos mark variable __diagused
 1.128 19-Feb-2012  rmind branches: 1.128.2; 1.128.4;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.127 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.126 07-Jun-2011  matt branches: 1.126.2; 1.126.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.125 15-Apr-2011  martin branches: 1.125.2;
Delay initialization of FPU related event counters to cpu_startup() - we
do not expect any events of this type before spinup of all cpus.
 1.124 20-Dec-2010  matt branches: 1.124.2;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.123 23-Apr-2010  rmind Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
 1.122 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.121 21-Nov-2009  rmind branches: 1.121.2; 1.121.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.120 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.119 28-Apr-2008  martin branches: 1.119.2; 1.119.6;
Remove clause 3 and 4 from TNF licenses
 1.118 10-Mar-2008  ad branches: 1.118.2; 1.118.4;
Use MI atomic operations.
 1.117 02-Jan-2008  ad branches: 1.117.2; 1.117.6;
Merge vmlocking2 to head.
 1.116 17-Oct-2007  garbled branches: 1.116.2; 1.116.4; 1.116.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.115 19-Jul-2007  tsutsui branches: 1.115.6;
Fix indent in printf message.
 1.114 17-May-2007  yamt branches: 1.114.2; 1.114.4;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.113 04-Mar-2007  christos branches: 1.113.2; 1.113.4; 1.113.8; 1.113.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.112 09-Feb-2007  ad branches: 1.112.2;
Merge newlock2 to head.
 1.111 23-Jul-2006  ad branches: 1.111.4;
Use the LWP cached credentials where sane.
 1.110 19-Jul-2006  ad - Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
 1.109 15-May-2006  yamt - include kauth.h for kauth_cred_geteuid.
- tweak indent for a long line.
 1.108 14-May-2006  elad integrate kauth.
 1.107 10-May-2006  skrll ANSIfy startlwp
 1.106 10-May-2006  skrll Add KERNEL_PROC_UNLOCK(l) before userret in startlwp.
 1.105 15-Mar-2006  drochner branches: 1.105.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.104 22-Feb-2006  drochner branches: 1.104.2; 1.104.4;
don't bother to figure out whether a page was not mapped at all or mapped
with too little permission (physically) on a fault -- uvm knows better
 1.103 12-Jan-2006  christos branches: 1.103.2; 1.103.4;
PR/32502: Anders Hjalmarsson: profiling (ticks) is broken on alpha
 1.102 11-Dec-2005  christos branches: 1.102.2;
merge ktrace-lwp.
 1.101 01-Sep-2005  yamt don't include uvm_extern.h twice.
 1.100 01-Sep-2005  yamt revert rev.1.99 as it is no longer necessary.
 1.99 31-Aug-2005  he Now that uvm_extern.h no longer includes uvm_fault.h, we need to include
the latter explicitly.
 1.98 28-Jul-2005  thorpej - Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.97 01-Jun-2005  drochner branches: 1.97.2;
avoid a shadow warning, and fix a pseudo-comment
 1.96 28-Aug-2004  jdolecek branches: 1.96.10;
use uvm_grow() to update stack segment size on stack page fault instead
of MD code
 1.95 17-Jul-2004  yamt as i386 does, propagete errors from uvm_fault() to users of pcb_onfault
via v0 so that eg. read(2) can return more appropriate errors
rather than always EFAULT.

ok'ed by Jason Thorpe.
 1.94 17-Jul-2004  petrov Update uvmexp's traps and syscalls. Reviewed by Jason Thorpe.
 1.93 17-May-2004  mhitch Add missing KERNEL_PROC_UNLOCK() in upcallret(). This should fix PR#22219
and maybe also PR#23731, which appears to be a duplicate of 22219.
 1.92 23-Mar-2004  matt branches: 1.92.2;
In alpha_ucode_to_ksiginfo, don't adjust ucode since that's already been
done in the FP_C_TO_NETBSD_MASK macro. Constify a read-only static array.
This should fix regress/lib/libc/ieeefp/except failures.
 1.91 14-Mar-2004  cl add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP
 1.90 19-Feb-2004  drochner -on instruction fetch fault from non-executable pages, signal
SIGSEGV/SEGV_ACCERR
-whitespace cleanup
 1.89 13-Nov-2003  chs eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
 1.88 29-Oct-2003  mycroft If we get an unknown fault code, either panic (if DIAGNOSTIC), or fault it with
a 0 access_type (if not). Remove bogus initializer.
 1.87 27-Oct-2003  chs uninitialized variables
 1.86 08-Oct-2003  thorpej * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.
 1.85 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.84 21-Sep-2003  skd Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.83 18-Sep-2003  cl add MD part of SA/pthread pagefault handling on alpha
 1.82 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.81 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.80 23-Jun-2003  martin branches: 1.80.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.79 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.78 08-Jun-2002  yamt branches: 1.78.2;
make auto const variables static.
ok'ed by thorpej.
 1.77 18-Jul-2001  thorpej branches: 1.77.2; 1.77.14; 1.77.16;
Print the stack pointer on a user unaligned access fault.
 1.76 14-Jul-2001  thorpej Oops, only register those event counters if the primary processor.
 1.75 14-Jul-2001  thorpej Instrument the lazy FP context switch path:
- fpevent_use is incremented the first time a process uses FP
for the first time (note, FPUSED is inherited on fork, but
cleared on exec).
- fpevent_reuse is incremented whenever a process that has previously
used FP has to take a FEN trap in order to be able to use it again.
 1.74 12-Jul-2001  thorpej bcopy -> memcpy
 1.73 26-Jun-2001  thorpej branches: 1.73.2;
Panic if we get an MM trans/prot fault in interrupt context.
 1.72 02-Jun-2001  chs replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.71 26-Apr-2001  ross Move fp_complete() outside kernel lock perimeter.
 1.70 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.69 20-Apr-2001  thorpej Alas, we must put pmap_emulate_reference() in the kernel_lock
perimeter as long as we still acquire it in interrupt handlers,
in order to avoid a lock ordering deadlock.
 1.68 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.67 15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.66 03-Jan-2001  thorpej branches: 1.66.2;
ANSI'ify, and inline userret().
 1.65 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.64 13-Dec-2000  mycroft Start cleanup of syscall(), similar to i386 and arm32. getpid() rate on my
AS200 goes from ~279000/s to ~446000/s.
 1.63 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.62 22-Nov-2000  itojun constify
 1.61 20-Nov-2000  thorpej Print the CPU ID while dumping trap info.
 1.60 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.59 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.58 30-Jun-2000  mjacob no more vm includes
 1.57 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.56 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.55 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.54 27-May-2000  sommerfeld branches: 1.54.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()
 1.53 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.52 24-May-2000  thorpej Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
 1.51 01-Mar-2000  thorpej Infrastructure for lazy istream sync in the pmap module:
- Add a bitmask for the CPUs which need an isync before this pmap returns
to userspace on that CPU.
- Define PMAP_USERRET(), a utility macro for userret() to use to process
the deferred isync, and call it as appropriate in userret().
 1.50 04-Dec-1999  ragge CL* discarding.
 1.49 10-May-1999  cgd branches: 1.49.2; 1.49.8;
have to take care to have a valid SP value in the unaligned fixup and
opdec (emulation) handlers.
 1.48 09-May-1999  cgd handle unaligned ldwu/stw instructions. While there, fix a bug in the
unaligned access handler and clean it up some. Add support for emulating
the BWX instructions (ld{b,w}u, st{b,w}, sext{b,w}), which user software
can expect to be emulated. (Thanks, Alpha Architecture!)
 1.47 30-Apr-1999  cgd processes would have vm->vm_ssize screwed up when they faulted
data regions higher than USRSTACK.
 1.46 30-Apr-1999  cgd gross hack for SIGFPE under OSF/1, until ross makes SW completion go
 1.45 23-Apr-1999  cgd support emulation-specified errno mapping tables
 1.44 20-Apr-1999  thorpej - Revert previous, and do debugger entry if kernel BUGCHK or BPT traps
happen. If the debugger doesn't handle the trap, arrange things so the
debugger won't be called again before we panic.
- Before panic'ing, give the debugger a chance to field the trap, and
if the debugger has handled things, allow the kernel to continue running,
like the i386 port does.
 1.43 19-Apr-1999  thorpej Dispatch to the debugger from the Intruction Fault trap vector directly,
rather than doing it from trap(). This so we can switch to a temporary
stack for the debugger (in a forthcoming commit).
 1.42 24-Mar-1999  mrg branches: 1.42.2;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.41 18-Mar-1999  chs if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.
 1.40 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.39 19-Nov-1998  ross #include <machine/alpha.h>
 1.38 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.37 07-Oct-1998  ross g/c leftover `{' in #if notdef; it confuses ctags(1)
 1.36 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.35 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.34 04-Jul-1998  jonathan defopt DDB.
 1.33 26-Jun-1998  thorpej defopt COMPAT_OSF1
 1.32 25-Jun-1998  thorpej defopt KTRACE
 1.31 26-Mar-1998  thorpej Remove references to NEW_PMAP.
 1.30 24-Feb-1998  thorpej Add support for UVM.
 1.29 17-Nov-1997  ross Eliminate %: use from alpha/trap.c; the policy is to get rid of these
anyway. I _still_ have my doubts about the kprintf %: code, though.
 1.28 17-Oct-1997  mjacob branches: 1.28.2;
Recover from some include file foo.
 1.27 02-Sep-1997  thorpej Pull in FIX_UNALIGNED_VAX_FP option.
 1.26 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.25 24-Jul-1997  thorpej branches: 1.25.2;
Add some DDB glue:
- Allow BUGCHK and BPT instruction faults in kernel mode if DDB is enabled,
since they are used to invoke the debugger.
- Add a comment about how we'd like to invoke DDB on a trap panic condition,
in a perfect world.
 1.24 03-Jun-1997  cgd do not spew about processes which have had fatal traps, unless DEBUG
is defined. Actually, it never should do it, but DEBUG should be 'never'
for most users.
 1.23 15-May-1997  mjacob Print some more info on unresolved user traps, mostly for DIAGNOSTIC.
 1.22 10-Apr-1997  cgd adjust 'sticks' to be the same as on other ports (0 if trap in kernel mode).
This is a great example of gcc's bogus -Wuninitialized warnings. even if
'user' is made const, gcc still (incorrectly!) whines.
 1.21 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.20 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.19 27-Nov-1996  cgd branches: 1.19.2;
when panicing because of a fatal trap, print the trap's type name, as well
as its kernel entry number.
 1.18 13-Nov-1996  cgd update copyright dates
 1.17 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.16 13-Oct-1996  christos backout previous kprintf change
 1.15 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 07-Sep-1996  mycroft Use SIGBUS iff we get a legitimate bus fault. Use SIGSEGV for page protection
violations (per Solaris, SVR4, AIX, Linux, Irix, and SunOS).
 1.13 20-Aug-1996  cgd add a bunch of printfs for NEW_PMAP
 1.12 15-Jul-1996  cgd actually implement code to handle unaligned VAX FP reg loads and stores.
Not tested yet, but also not compiled into the standard kernel.
 1.11 14-Jul-1996  cgd print the label for the opcode in unaligned access printf as "op" not "type"
 1.10 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Add unaligned access fixup code to fix unaligned quad, long,
and IEEE S and T floating datum loads and stores. VAX floating data
types not yet supported, and in the future will only be supported if
FIX_UNALIGNED_VAX_FP is defined. (No point in wasting the space when
most of the time there will never be VAX FP loads and stores.) Right
now, these features can be controlled only by sysctl. The (boolean)
integer sysctls machdep.unaligned_print, machdep.unaligned_fix, and
machdep.unaligned_sigbus control printing about unaligned accesses
(defaults on), fixing up of unaligned accesses (defaults on), and
forcing a SIGBUS on unaligned accesses (defaults off). If an access
is not fixed up (for lack of method or explicit decision), a SIGBUS is
always generated to keep programs from using bogus data. At some point,
these three choices should be controlled by per-process flags, as well.
 1.9 11-Jul-1996  cgd don't save and set the USP at every trap entry and exit. It's
unnecessary, and given that there's no reason to waste time and
add complexity in trap handlers. This means that code which sets and
uses the USP has to be a bit more careful, but that doesn't happen much.
 1.8 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.7 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 28-Jun-1995  cgd sync with my current Alpha sources
 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 22-Apr-1995  cgd kill a host of null dereference bugs... tracking down a _different_ bug,
i was getting "KSP INVALID" death. It was being cause by never-ending
MM faults, caused by null derefs (of curproc) in the MM fault trap
handler. the original MM fault was caused by a null deref (of
curproc, again) in the unaligned access handler!
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.19.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.19.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.19.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.25.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 17-Nov-1997  thorpej Sync w/ trunk. (ross).
 1.42.2.3 21-Jun-1999  cgd pull up rev(s) 1.45-1.46 from trunk. (cgd)
 1.42.2.2 18-Jun-1999  perry pullup 1.47->1.49 (cgd): BWX instruction emulation and unaligned access
 1.42.2.1 30-Apr-1999  perry branches: 1.42.2.1.2; 1.42.2.1.4;
pullup 1.46->1.47 (cgd)
 1.42.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.42.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.49.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.49.2.8 23-Apr-2001  bouyer Sync with HEAD.
 1.49.2.7 27-Mar-2001  bouyer Sync with HEAD.
 1.49.2.6 05-Jan-2001  bouyer Sync with HEAD
 1.49.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.49.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.49.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.49.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.49.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.54.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.66.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.66.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.73.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.73.2.1 03-Aug-2001  lukem update to -current
 1.77.16.1 10-Jun-2002  tv Pull up revision 1.78 (requested by thorpej in ticket #213):
make auto const variables static.
ok'ed by thorpej.
 1.77.14.1 09-Jul-2002  gehenna catch up with -current.
 1.77.2.8 07-Jan-2003  thorpej In the SA universe, the switch-to-this-LWP decision is made at a
different level than where preempt() calls are made, which renders
the "newlwp" argument useless. Replace it with a "more work to do"
boolean argument. Returning to userspace preempt() calls pass 0.
"Voluntary" preemptions in e.g. uiomove() pass 1. This will be used
to indicate to the SA subsystem that the LWP is not yet finished in
the kernel.

Collapse the SA vs. non-SA cases of preempt() together, making the
conditional code block much smaller, and don't call sa_preempt() if
more work is to come.

NOTE: THIS IS NOT A COMPLETE FIX TO THE preempt()-in-uiomove() PROBLEM
THAT CURRENTLY EXISTS FOR SA PROCESSES.
 1.77.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.77.2.6 09-Jul-2002  nathanw #include <sys/sa.h> for type definitions.
 1.77.2.5 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.77.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.77.2.3 17-Nov-2001  nathanw The upcallret() function is given the lwp of curproc as its argument; update
declaration, and actually use the argument, instead of using curproc(!).
 1.77.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.77.2.1 18-Jul-2001  nathanw file trap.c was added on branch nathanw_sa on 2001-08-30 23:43:42 +0000
 1.78.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.80.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.80.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.80.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.80.2.2 03-Sep-2004  skrll Sync with HEAD
 1.80.2.1 03-Aug-2004  skrll Sync with HEAD
 1.92.2.2 17-Jul-2004  he branches: 1.92.2.2.2;
Pull up revision 1.94 (requested by petrov in ticket #672):
Update uvmexp's traps and syscalls.
 1.92.2.1 22-May-2004  he Pull up revision 1.93 (requested by mhitch in ticket #355):
Add missing KERNEL_PROC_UNLOCK() in upcallret(). This should
fix PR#22219 and maybe also PR#23731, which appears to be a
duplicate of PR#22219.
 1.92.2.2.2.1 29-Aug-2005  tron Pull up following revision(s) (requested by riz in ticket #5623):
sys/arch/alpha/alpha/machdep.c: revision 1.287
sys/arch/alpha/alpha/trap.c: revision 1.98
sys/arch/alpha/include/pcb.h: revision 1.13
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.96.10.1 30-Jul-2005  tron Pull up revision 1.98 (requested by thorpej in ticket #629):
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.97.2.6 17-Mar-2008  yamt sync with head.
 1.97.2.5 21-Jan-2008  yamt sync with head
 1.97.2.4 03-Sep-2007  yamt sync with head.
 1.97.2.3 26-Feb-2007  yamt sync with head.
 1.97.2.2 30-Dec-2006  yamt sync with head.
 1.97.2.1 21-Jun-2006  yamt sync with head.
 1.102.2.2 01-Mar-2006  yamt sync with head.
 1.102.2.1 15-Jan-2006  yamt sync with head.
 1.103.4.2 01-Jun-2006  kardel Sync with head.
 1.103.4.1 22-Apr-2006  simonb Sync with head.
 1.103.2.1 09-Sep-2006  rpaulo sync with head
 1.104.4.3 11-May-2006  elad sync with head
 1.104.4.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.104.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.104.2.3 11-Aug-2006  yamt sync with head
 1.104.2.2 24-May-2006  yamt sync with head.
 1.104.2.1 01-Apr-2006  yamt sync with head.
 1.105.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.111.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.111.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.112.2.2 20-Mar-2007  yamt adapt alpha.
 1.112.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.113.10.2 03-Oct-2007  garbled Sync with HEAD
 1.113.10.1 22-May-2007  matt Update to HEAD.
 1.113.8.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.113.4.1 11-Jul-2007  mjf Sync with head.
 1.113.2.2 20-Aug-2007  ad Sync with HEAD.
 1.113.2.1 27-May-2007  ad Sync with head.
 1.114.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.114.2.1 07-Aug-2007  matt Sync with HEAD.
 1.115.6.3 23-Mar-2008  matt sync with HEAD
 1.115.6.2 09-Jan-2008  matt sync with HEAD
 1.115.6.1 06-Nov-2007  matt sync with HEAD
 1.116.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.116.4.1 30-Dec-2007  ad Locking changes for alpha.
 1.116.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.117.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.117.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.117.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.117.2.1 24-Mar-2008  keiichi sync with head.
 1.118.4.4 11-Aug-2010  yamt sync with head.
 1.118.4.3 11-Mar-2010  yamt sync with head
 1.118.4.2 04-May-2009  yamt sync with head.
 1.118.4.1 16-May-2008  yamt sync with head.
 1.118.2.1 18-May-2008  yamt sync with head.
 1.119.6.1 19-Oct-2008  haad Sync with HEAD.
 1.119.2.2 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.119.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.121.4.4 12-Jun-2011  rmind sync with head
 1.121.4.3 21-Apr-2011  rmind sync with head
 1.121.4.2 05-Mar-2011  rmind sync with head
 1.121.4.1 30-May-2010  rmind sync with head
 1.121.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.124.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.125.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.126.6.2 24-Feb-2012  mrg sync to -current.
 1.126.6.1 18-Feb-2012  mrg merge to -current.
 1.126.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.126.2.1 17-Apr-2012  yamt sync with head
 1.128.4.1 18-May-2014  rmind sync with head
 1.128.2.2 03-Dec-2017  jdolecek update from HEAD
 1.128.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.130.2.1 10-Aug-2014  tls Rebase.
 1.131.4.2 28-Aug-2017  skrll Sync with HEAD
 1.131.4.1 06-Apr-2015  skrll Sync with HEAD
 1.132.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.132.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.133.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.133.14.1 10-Jun-2019  christos Sync with HEAD
 1.135.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.123 06-Oct-2023  skrll Convert the l2->l_md.md_astpending assignments into KASSERTs.

l_md is zeroised by lwp_create with

memset(&l2->l_startzero, 0, sizeof(*l2) -
offsetof(lwp_t, l_startzero));
 1.122 05-Dec-2021  msaitoh s/specificed/specified/ in comment.
 1.121 16-Jul-2021  thorpej Instrument success/faulure of phyisically contiguous uarea allocation.
 1.120 06-Jul-2021  thorpej - Define STACK_ALIGNBYTES to override the default and ensure that
stacks are 16-byte aligned, an assumption made by the compiler
and recommended by the Alpha Architecture Handbook.
- cpu_lwp_fork(): Ensure 16-byte stack alignment if the caller specified
one.

Addresses root casue of PR port-alpha/54307 and PR toolchain/56153.

Many thanks to rin@ for performing the root cause analysis and testing
changes.
 1.119 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.118 29-May-2021  thorpej Move the pointer to the pmap's lev1map out of the shared pmap structure
and into each CPU's pmap_percpu area. This pointer is constant for the
life of the pmap, and moving it gives us an additional 8 bytes in the
shared pmap structure.

Because the kernel pmap does not have per-CPU data, all places where we
need the kernel pmap's lev1map now just reference kernel_lev1map directly.
 1.117 18-Sep-2020  thorpej branches: 1.117.6; 1.117.8;
Rather than having exception_return() at the root of the call graph for
kernel threads, provide a backstop that will prevent them from ever
accidentally trying to return to user space.
 1.116 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.115 16-Aug-2020  thorpej In cpu_lwp_fork(), make sure that the PTBR field in l2's HWPCB references
the lev1map associated with l2's pmap. Otherwise, the first time we
SWPCTX to l2, we'll be on l1's page tables until the first pmap_activate()
call for l2.
 1.114 19-Mar-2018  martin Nowadays we can create new kernel threads late after boot, so if we are
unable to find physically continous pages for their uarea, just allocate
them via uvm_km_alloc(), that is: make cpu_uarea_alloc() fail instead
of panic. cpu_uarea_free() already deals with this.

Should fix PR port-alpha/53077.

Discussed with maxv and mrg.
 1.113 16-May-2014  matt branches: 1.113.20; 1.113.26;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.112 19-Feb-2012  rmind branches: 1.112.2; 1.112.4; 1.112.12;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.111 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.110 28-Jan-2012  skrll Typo in comment.
 1.109 21-Jan-2012  matt For cpu_uarea, need uvm.h instead of uvm_extern.h
 1.108 14-Jun-2011  matt branches: 1.108.2; 1.108.6;
Add latent support for __HAVE_CPU_UAREA_ROUTINES
 1.107 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.106 24-May-2011  rmind branches: 1.106.2;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.105 10-Feb-2011  pooka Make vmapbuf() return success/error and make physio deal with a
failure.
 1.104 29-Nov-2009  rmind branches: 1.104.4; 1.104.6; 1.104.8;
Replace l_addr with uvm_lwp_getuarea() in various MD code, mostly cpu_lwp_fork().
 1.103 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.102 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.101 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.100 01-Jun-2009  martin Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.99 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.98 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.97 19-Nov-2008  ad branches: 1.97.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.96 17-Oct-2007  garbled branches: 1.96.16; 1.96.20; 1.96.26; 1.96.28; 1.96.30; 1.96.32;
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.95 17-Aug-2007  ad branches: 1.95.2;
cpu_lwp_fork: don't rely on struct mdlwp being zeroed in advance.
 1.94 20-May-2007  mhitch branches: 1.94.4; 1.94.8;
Fix comment: proc_trampoline() -> lwp_trampoline().
 1.93 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.92 04-Mar-2007  christos branches: 1.92.2; 1.92.4; 1.92.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.91 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.90 09-Feb-2007  ad branches: 1.90.2;
Merge newlock2 to head.
 1.89 30-Aug-2006  matt branches: 1.89.2;
Don't include cpu_coredump unless the COREDUMP option is present.
 1.88 10-May-2006  skrll Fix a bunch of cast lvalues.
 1.87 11-Dec-2005  christos branches: 1.87.4; 1.87.6; 1.87.8; 1.87.10; 1.87.12;
merge ktrace-lwp.
 1.86 10-Jun-2005  matt branches: 1.86.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
 1.85 01-Apr-2005  yamt merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.84 17-Sep-2004  skrll branches: 1.84.4; 1.84.6;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.83 28-Aug-2004  thorpej Garbage-collect pagemove(); nothing use it anymore (YAY!!!)
 1.82 05-Jan-2004  nathanw Add a missing { to cpu_exit() so that it compiles.
(Alpha still doesn't boot with the new-reaper changes, though. First
process to exit kills the system).
 1.81 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.80 29-Jun-2003  fvdl branches: 1.80.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.79 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.78 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.77 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.76 26-Feb-2002  simonb Purge CLSIZE, CLSIZELOG2 and MCLOFSET.
Be consistant in the way that MSIZE, MCLSHIFT, MCLBYTES and NMBCLUSTERS
are defined.
Remove old VM constants from cesfic port.
Bump MSIZE to 256 on mipsco (the only one that wasn't already 256).
 1.75 10-Sep-2001  chris 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.74 06-Sep-2001  nathanw branches: 1.74.2;
Remove the infamous "DANGER WILL ROBINSON: FEN SET in cpu_fork!"
diagnostic. It's not indicative of an error condition.

The code sequence in question calls fpusave_proc(), which ultimately
calls alpha_pal_wrfen(0), which clears the FEN bit in the current
PCB. However, the diagnostic message is based on reading that bit from
the PCB representation in memory, which is not guaranteed to be kept
up-to-date with respect to the real PCB contents. According to the
AARM, third edition, II-B 4.2:

"If the PCB is read while ownership resides with the processor, it is
UNPREDICTABLE whether the original or an updated value of a field is
read."

The Alpha architecture does not provide a way to read the true value
of the FEN bit of the current PCB, so the test is simply removed.
 1.73 19-Aug-2001  chs branches: 1.73.2;
in vunmapbuf(), call pmap_*remove() explicitly since uvm_km_free_wakeup()
will soon no longer do it for us.
 1.72 18-Jul-2001  thorpej Duh, to set the user stack pointer, you have to frob the PALcode PCB,
not the trap frame.

Fixes clone(2) on the Alpha.
 1.71 15-Jul-2001  thorpej Defer sending shootdown IPIs a bit longer. Reduces traffic a fair
bit more.
 1.70 12-Jul-2001  thorpej bcopy -> memcpy
 1.69 12-Jul-2001  thorpej bzero -> memset
 1.68 26-Apr-2001  ross branches: 1.68.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.67 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.66 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.65 10-Apr-2001  sommerfeld In cpu_fork(), initialize u_pcb.pcb_context[8] so that the newly
spawned kthread/process runs at IPL_0 instead of whatever IPL the
parent was running at.

This appears to fix the NTP clock stability problems observed on some
alpha systems; the clock appears stable even when there's heavy
raidframe (i.e., kthread-intensive) I/O under way.
 1.64 03-Jan-2001  thorpej branches: 1.64.2;
ANSI'ify, and inline userret().
 1.63 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.62 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.61 26-Aug-2000  thorpej Snapshot of TLB shootdown bugfixes.
 1.60 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.59 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.58 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.57 28-May-2000  thorpej branches: 1.57.2;
Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1(). In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
 1.56 27-May-2000  thorpej branches: 1.56.2;
Update a couple of comments for reality.
 1.55 29-Mar-2000  simonb Remove redundant decl for phys_map - it's in <vm/vm_kern.h>.
 1.54 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.53 20-Jan-2000  sommerfeld Fix PR9240: comment above cpu_fork() out of synch with reality on most ports.
(comment change only, but was wrong for more than just i386).
 1.52 04-Dec-1999  ragge CL* discarding.
 1.51 13-Nov-1999  thorpej Update for pmap_enter() API change.
 1.50 08-Jul-1999  thorpej branches: 1.50.2; 1.50.4; 1.50.8;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.49 26-May-1999  thorpej Generally update the comment above the vmapbuf() implementations.
 1.48 26-May-1999  thorpej No longer need to pmap_emulate_reference() in cpu_fork() or cpu_swapin(),
since uvm_fault_wire() does the right thing with access_type.
 1.47 16-May-1999  thorpej Update the comments above vmapbuf() and vunmapbuf() to reflect reality.
 1.46 13-May-1999  thorpej Allow the caller to specify a stack for the child process. If NULL,
the child inherits the stack pointer from the parent (traditional
behavior). Like the signal stack, the stack area is secified as
a low address and a size; machine-dependent code accounts for stack
direction.

This is required for clone(2).
 1.45 26-Mar-1999  mycroft branches: 1.45.4;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.44 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.43 24-Feb-1999  thorpej First-cut at multiprocessor TLB shootdown. This simple implementation can
probably be improved somewhat, but an attempt to be efficient has been
made.

Note: TLB shootdowns are NOT YET ENABLED.
 1.42 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.41 19-Nov-1998  ross #include <machine/alpha.h>
 1.40 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.39 09-Sep-1998  thorpej In cpu_coredump(), use MID_MACHINE rather than MID_* (whatever it expands
to).
 1.38 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.37 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.36 28-Jul-1998  thorpej Don't cast the null residual pointer passed to vn_rdwr().
 1.35 28-Jul-1998  thorpej Don't cast the null residual pointer passed to vn_rdwr().
 1.34 26-Mar-1998  thorpej Remove references to NEW_PMAP.
 1.33 18-Mar-1998  thorpej In cpu_exit() deactivate the address space before freeing the vmspace
structure. We will continue to run on this context (which is the
global Lev1map at this point) right up until we switch to proc0's
context in switch_exit().
 1.32 09-Mar-1998  thorpej Simplify/speed up pagemove() somewhat by using the Virtual Page Table.
 1.31 07-Mar-1998  thorpej Just use vtophys() to get the PCB phys addr.
 1.30 07-Mar-1998  thorpej Update a comment in pagemove().
 1.29 07-Mar-1998  thorpej Nuke kvtopte(). Also, change pagemove() to lookup the from and to PTEs
in each iteration of the loop, since PT pages may not necessarily be
contiguous.
 1.28 24-Feb-1998  thorpej Add support for UVM.
 1.27 17-Oct-1997  mjacob Recover from some include file foo.
 1.26 02-Sep-1997  thorpej Remove references to vm_pmap.
 1.25 02-Sep-1997  thorpej Adjust for an interface change in a not-NEW_PMAP case in cpu_fork().
 1.24 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.23 07-Apr-1997  cgd branches: 1.23.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.22 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.21 13-Nov-1996  cgd branches: 1.21.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.20 13-Oct-1996  christos backout previous kprintf change
 1.19 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.18 07-Oct-1996  cgd change md_coredump struct to actually reflect the machine-dependent stuff
that's dumped. use it, rather than a hack, to export the info to user-land
(gdb).
 1.17 07-Oct-1996  cgd read user SP into core dump's trapframe
 1.16 21-Aug-1996  cgd wrap a debugging printf in NEW_PMAP
 1.15 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP
 1.14 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.13 11-Jul-1996  cgd rename rei() to exception_return(). rename proc_trampoline() to
switch_trampoline().
 1.12 11-Jul-1996  cgd don't save and set the USP at every trap entry and exit. It's
unnecessary, and given that there's no reason to waste time and
add complexity in trap handlers. This means that code which sets and
uses the USP has to be a bit more careful, but that doesn't happen much.
 1.11 11-Jul-1996  cgd update for new alpha_cpu.h definitions, -Wall cleanups, and make
things compile with the new work-in-progress pmap code.
 1.10 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.9 23-Apr-1996  cgd prototyping cleanups
 1.8 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.7 05-Feb-1996  christos vm prototype changes
 1.6 09-Dec-1995  mycroft cpu_fork() now returns void.
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 28-Jun-1995  cgd sync with my current Alpha sources
 1.3 11-Apr-1995  cgd fix function name in comment.
 1.2 24-Mar-1995  cgd remove support for double-mapping the user area and kernel stack.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.21.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.23.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.4.3 11-Aug-1999  chs add casts for trunc_page() and round_page() args.
 1.45.4.2 02-Aug-1999  thorpej Update from trunk.
 1.45.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.50.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.50.4.1 14-Nov-1999  fvdl Sync with -current.
 1.50.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.50.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.50.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.50.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.50.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.56.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.57.2.1 21-Apr-2001  he Pull up revision 1.65 (via patch, requested by sommerfeld):
In cpu_fork(), make sure the spawned kthread or process runs at
IPL_0 instead of whatever IPL the parent was running at.

This appears to fix the NTP clock stability problems observed on
some alpha systems; the clock appears stable even when there's
heavy raidframe (i.e., kthread-intensive) I/O under way.
 1.64.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.68.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.68.2.3 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.68.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.68.2.1 03-Aug-2001  lukem update to -current
 1.73.2.8 03-Jan-2003  thorpej Merge switch_exit() and switch_lwp_exit().
 1.73.2.7 06-Oct-2002  nathanw Reset the kernel stack pointer in cpu_setfunc().

My eternal gratitude to Gregory McGarry for spotting the problem.
 1.73.2.6 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.73.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.73.2.4 08-Dec-2001  thorpej cpu_fork() -> cpu_lwp_fork(). This logically forks an LWP, not a
complete process. As noted by Gregory McGarry on tech-kern.
 1.73.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.73.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.73.2.1 19-Aug-2001  nathanw file vm_machdep.c was added on branch nathanw_sa on 2001-08-30 23:43:42 +0000
 1.74.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.80.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.80.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.80.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.80.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.80.2.2 03-Sep-2004  skrll Sync with HEAD
 1.80.2.1 03-Aug-2004  skrll Sync with HEAD
 1.84.6.1 25-Jan-2005  yamt convert alpha to new apis.
 1.84.4.1 29-Apr-2005  kent sync with -current
 1.86.2.4 03-Sep-2007  yamt sync with head.
 1.86.2.3 26-Feb-2007  yamt sync with head.
 1.86.2.2 30-Dec-2006  yamt sync with head.
 1.86.2.1 21-Jun-2006  yamt sync with head.
 1.87.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.87.10.1 11-May-2006  elad sync with head
 1.87.8.2 03-Sep-2006  yamt sync with head.
 1.87.8.1 24-May-2006  yamt sync with head.
 1.87.6.1 01-Jun-2006  kardel Sync with head.
 1.87.4.1 09-Sep-2006  rpaulo sync with head
 1.89.2.1 11-Jan-2007  ad Checkpoint work in progress.
 1.90.2.3 20-Mar-2007  yamt adapt alpha.
 1.90.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.90.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.92.10.2 03-Oct-2007  garbled Sync with HEAD
 1.92.10.1 22-May-2007  matt Update to HEAD.
 1.92.4.1 11-Jul-2007  mjf Sync with head.
 1.92.2.2 20-Aug-2007  ad Sync with HEAD.
 1.92.2.1 27-May-2007  ad Sync with head.
 1.94.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.94.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.95.2.1 06-Nov-2007  matt sync with HEAD
 1.96.32.1 09-Jun-2009  snj branches: 1.96.32.1.2;
Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.96.32.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.96.30.1 09-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.96.28.2 28-Apr-2009  skrll Sync with HEAD.
 1.96.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.96.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.96.20.3 11-Mar-2010  yamt sync with head
 1.96.20.2 20-Jun-2009  yamt sync with head
 1.96.20.1 04-May-2009  yamt sync with head.
 1.96.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.97.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.104.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.104.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.104.4.3 12-Jun-2011  rmind sync with head
 1.104.4.2 31-May-2011  rmind sync with head
 1.104.4.1 05-Mar-2011  rmind sync with head
 1.106.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.108.6.2 24-Feb-2012  mrg sync to -current.
 1.108.6.1 18-Feb-2012  mrg merge to -current.
 1.108.2.1 17-Apr-2012  yamt sync with head
 1.112.12.1 10-Aug-2014  tls Rebase.
 1.112.4.1 18-May-2014  rmind sync with head
 1.112.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.113.26.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.113.20.1 20-Mar-2018  bouyer Pull up following revision(s) (requested by martin in ticket #646):
sys/arch/alpha/alpha/vm_machdep.c: revision 1.114
Nowadays we can create new kernel threads late after boot, so if we are
unable to find physically continous pages for their uarea, just allocate
them via uvm_km_alloc(), that is: make cpu_uarea_alloc() fail instead
of panic. cpu_uarea_free() already deals with this.
Should fix PR port-alpha/53077.
Discussed with maxv and mrg.
 1.117.8.1 31-May-2021  cjep sync with head
 1.117.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.117.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.74 26-Jul-2022  andvar s/functin/function/ in copy pasted comment.
 1.73 19-Jul-2021  thorpej There is already a fast-path in pmap_extract() for the kernel pmap, so
don't bother doing a conditional for kernel vs. user-space here.

KASSERT() that pmap_extract() succeeds; it is a programming error if
it does not, and it's not a great idea to insert a garbage address
into the SGMAP page table.
 1.72 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.71 18-Nov-2020  thorpej branches: 1.71.4;
malloc(9) -> kmem(9)
 1.70 11-Oct-2020  thorpej branches: 1.70.2;
Add some bus_dma instrumentation.
 1.69 02-Oct-2012  christos move common/bus_dma/ -> dev/bus_dma/
 1.68 01-Jul-2011  dyoung branches: 1.68.2; 1.68.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.67 21-Aug-2009  thorpej Use bus_dmamem common.
 1.66 04-Jun-2008  ad vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.65 28-Apr-2008  martin branches: 1.65.2;
Remove clause 3 and 4 from TNF licenses
 1.64 04-Mar-2007  yamt branches: 1.64.40; 1.64.42; 1.64.44;
fix fallout from caddr_t changes.
 1.63 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.62 01-Mar-2006  yamt branches: 1.62.20;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.61 11-Dec-2005  christos branches: 1.61.2; 1.61.4; 1.61.6;
merge ktrace-lwp.
 1.60 24-Nov-2005  yamt bus_dmamem_map: honour BUS_DMA_NOWAIT. noted by Manuel Bouyer.
bus_space_map: always do NOWAIT allocation as it used to be before yamt-km.

we have too many copies!
 1.59 30-Jul-2005  mhitch branches: 1.59.6;
Check for stale flags in the DMA map. This was causing crashes on an ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.58 01-Apr-2005  yamt branches: 1.58.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.57 09-Mar-2005  matt branches: 1.57.2;
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.56 09-Mar-2005  simonb Add an extra `i' to notifes/notifed.
 1.55 29-Jun-2003  fvdl branches: 1.55.2; 1.55.10; 1.55.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.54 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.53 09-Apr-2003  thorpej Add support for using cached mbuf and cluster phys addrs.
 1.52 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.51 09-Oct-2002  nathanw In _bus_dmamem_alloc_range(), respect the high end of the caller's range.
 1.50 02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.49 26-Apr-2002  thorpej branches: 1.49.2;
Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.48 10-Sep-2001  chris 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.47 12-Jul-2001  thorpej branches: 1.47.2; 1.47.4;
bzero -> memset
 1.46 26-May-2001  chs branches: 1.46.2;
replace vm_page_t with struct vm_page *.
 1.45 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.44 21-Mar-2001  soren s/vm_page_alloc_memory/uvm_pglistalloc/ in panic message.
 1.43 03-Jan-2001  thorpej branches: 1.43.2;
Some more slight cleanup.
 1.42 03-Jan-2001  thorpej Fix a couple of comments.
 1.41 03-Jan-2001  thorpej ANSI'ify.
 1.40 17-Jul-2000  thorpej When computing the segment size, consider the maximum segment
size in the DMA map.
 1.39 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.38 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.37 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.36 06-Feb-2000  thorpej branches: 1.36.4;
Implement an internal DMA map flag which prevents coalescing of
adjacent DMA segments.
 1.35 20-Jan-2000  mjacob fix misspelling
 1.34 08-Dec-1999  thorpej Slight changes so that bounce buffers can be implemented for the Jensen.
 1.33 13-Nov-1999  thorpej Update for pmap_enter() API change.
 1.32 12-Sep-1999  chs branches: 1.32.2; 1.32.4; 1.32.8;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.31 08-Jul-1999  thorpej Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.30 25-May-1999  thorpej bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.
 1.29 26-Mar-1999  mycroft branches: 1.29.2; 1.29.4;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.28 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.27 21-Sep-1998  thorpej Make bus_dmamap_load_uio() work, from Kevin Lahey <kml@nas.nasa.gov>.
 1.26 17-Aug-1998  thorpej Some internal cleanup; pass a tag around, not individual arguments.
 1.25 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.24 17-Jul-1998  thorpej Implement bus_dmamap_load_uio().
 1.23 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.22 03-Jun-1998  thorpej Sync the bus_dmamap_load back-end functions between alpha and i386. (only
slight, unnecessary differences)
 1.21 29-May-1998  matt more optimizations
 1.20 29-May-1998  matt Add boundary checks to _bus_dma_load...
 1.19 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.18 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.17 17-Mar-1998  thorpej Use pmap_kenter_pa() in _bus_dmamem_map() if PMAP_NEW.
 1.16 24-Feb-1998  thorpej Add support for UVM.
 1.15 11-Feb-1998  thorpej Use kernel_map in bus_dmamem_{map,free}().
 1.14 11-Feb-1998  thorpej Use M_DMAMAP where appropriate.
 1.13 04-Feb-1998  thorpej Flush the CPU write buffer in _bus_dmamap_sync().
 1.12 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.11 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.10 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC toBUS_DMA_COHERENT.
 1.9 27-Jan-1998  thorpej Implement bus_dmamap_load_mbuf().
 1.8 19-Jan-1998  thorpej If mapping only one segment of DMA memory into KVA space, use K0SEG.
 1.7 09-Jan-1998  thorpej Use avail_start/avail_end.
 1.6 05-Sep-1997  thorpej Implement bus_dmamem_mmap().
 1.5 02-Sep-1997  thorpej Remove references to vm_pmap.
 1.4 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.3 25-Aug-1997  thorpej Protect access to kmem_map with splimp()/splx(). From Chuck Cranor.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 05-Jun-1997  thorpej branches: 1.1.2;
file bus_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.2 06-Jun-1997  thorpej Right, that's a bonk on the head! Zero-length arrays aren't legal
in C. Make the bus_dmamap_t variable-length array size 1, and compensate
for the size screw in _bus_dmamap_create(). Pointed out by Chris Demetriou.
 1.1.2.1 05-Jun-1997  thorpej Move the Alpha bus dma support functions into their own file. Suggested
by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.6.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file bus_dma.c was added on branch alpha-nwscons on 1997-06-07 04:42:53 +0000
 1.29.4.2 02-Aug-1999  thorpej Update from current.
 1.29.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.29.2.1 06-Feb-2000  he Pull up revision 1.36 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.32.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.32.4.1 14-Nov-1999  fvdl Sync with -current.
 1.32.2.3 27-Mar-2001  bouyer Sync with HEAD.
 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.4.3 27-Apr-2002  he Pull up revision 1.49 (requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.36.4.2 18-Jul-2000  thorpej Pull up rev. 1.40:
When computing the segment size, consider the maximum segment
size in the DMA map.
 1.36.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.43.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.43.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.46.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.46.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.46.2.1 03-Aug-2001  lukem update to -current
 1.47.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.47.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.47.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.47.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.47.2.1 12-Jul-2001  nathanw file bus_dma.c was added on branch nathanw_sa on 2001-09-21 22:34:56 +0000
 1.49.2.1 09-Jul-2002  gehenna catch up with -current.
 1.55.12.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.55.12.1 25-Jan-2005  yamt convert alpha to new apis.
 1.55.10.1 29-Apr-2005  kent sync with -current
 1.55.2.6 11-Dec-2005  christos Sync with head.
 1.55.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.55.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.55.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.55.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.55.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.57.2.1 04-Aug-2005  tron Pull up revision 1.59 (requested by thorpej in ticket #635):
Check for stale flags in the DMA map. This was causing crashes on an
ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.58.2.2 03-Sep-2007  yamt sync with head.
 1.58.2.1 21-Jun-2006  yamt sync with head.
 1.59.6.1 29-Nov-2005  yamt sync with head.
 1.61.6.1 22-Apr-2006  simonb Sync with head.
 1.61.4.1 09-Sep-2006  rpaulo sync with head
 1.61.2.2 07-Feb-2006  yamt fix crashes introduced by the previous.
 1.61.2.1 05-Feb-2006  yamt adapt alpha.
 1.62.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.64.44.3 16-Sep-2009  yamt sync with head
 1.64.44.2 04-May-2009  yamt sync with head.
 1.64.44.1 16-May-2008  yamt sync with head.
 1.64.42.2 17-Jun-2008  yamt sync with head.
 1.64.42.1 18-May-2008  yamt sync with head.
 1.64.40.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.64.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.68.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.68.2.1 30-Oct-2012  yamt sync with head
 1.70.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.71.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.71.4.1 13-May-2021  thorpej Sync with HEAD.
 1.5 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.4 03-Jan-2001  thorpej ANSI'ify.
 1.3 29-Mar-2000  simonb Don't need to include <sys/conf.h> here.
 1.2 12-Feb-1999  thorpej branches: 1.2.8;
Fix printf format problems on Alpha.
 1.1 08-Jul-1998  mjacob add a common logout printing routine file
 1.2.8.2 05-Jan-2001  bouyer Sync with HEAD
 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.29 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.28 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.27 17-Jun-2020  thorpej branches: 1.27.6;
Switch from an extent mao to a vmem arena to manage SGMAP address space.
 1.26 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.25 01-Jul-2011  dyoung branches: 1.25.2; 1.25.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.24 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.23 04-Mar-2007  christos branches: 1.23.40; 1.23.42; 1.23.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 11-Dec-2005  christos branches: 1.22.26;
merge ktrace-lwp.
 1.21 01-Jun-2005  drochner branches: 1.21.2;
fix constification fallout
 1.20 01-Apr-2003  thorpej branches: 1.20.2;
Use PAGE_SIZE rather than NBPG.
 1.19 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.18 19-Jul-2001  thorpej branches: 1.18.2;
Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.17 12-Jul-2001  thorpej bzero -> memset
 1.16 03-Jan-2001  thorpej branches: 1.16.4;
ANSI'ify.
 1.15 03-Jan-2001  thorpej Restructure alpha_sgmap_dmamap_create() slightly.
 1.14 03-Jan-2001  thorpej The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.13 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 18-Feb-1999  mycroft branches: 1.12.8;
If we have to increase the boundary due to the spill pages, use the old
boundary as an alignment. Otherwise we fail to enforce the old boundary,
causing massive lossage.
 1.11 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.10 06-Jun-1998  thorpej Display information about which sgmap we're attempting to initialize
if we die in alpha_sgmap_init().
 1.9 23-Mar-1998  mjacob Okay, handle the ALLOCNOW case by doing the appropriate adjustments
up front. Do the spacing arithmetic slightly differently.
 1.8 11-Feb-1998  thorpej Use M_DMAMAP where appropriate.
 1.7 21-Jan-1998  thorpej Extent names are const.
 1.6 18-Jan-1998  thorpej Implement a prefetch spill page for SGMAP DMA. This works around a slight
annoyance on systems that prefetch the next page during memory -> device
DMA if the DMA comes within a certain distance of the end of the current
page. This could cause machine checks since the PTE after the last page
would not have the valid bit set.

(I'm not going to complain about this slight kludge too much, since prefetch
makes DMA much faster...)
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Allow specification of a minimum page table alignment to alpha_sgmap_init().
This is to work around an apparent hardware bug in some 2117x chipsets
where the page table must be aligned to at least 32k.
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file sgmap_common.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 03-Jun-1997  thorpej Totally rearrange the SGMAP DMA handling code. Split the functions
into "common" (used unchanged by everyone) and "typedep", which depend
on the type (32-bit or 64-bit) of the SGMAP PTEs.

Fix several bugs, and clean up significantly, eliminating unnecessary
housekeeping overhead in several places.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file sgmap_common.c was added on branch alpha-nwscons on 1997-06-07 04:42:54 +0000
 1.12.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.12.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.16.4.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.16.4.1 03-Aug-2001  lukem update to -current
 1.18.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.18.2.1 19-Jul-2001  nathanw file sgmap_common.c was added on branch nathanw_sa on 2002-10-18 02:34:06 +0000
 1.20.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.1 03-Sep-2007  yamt sync with head.
 1.22.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.44.1 16-May-2008  yamt sync with head.
 1.23.42.1 18-May-2008  yamt sync with head.
 1.23.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 18-Feb-2012  mrg merge to -current.
 1.25.2.1 17-Apr-2012  yamt sync with head
 1.27.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.44 19-Jul-2021  thorpej There is already a fast-path in pmap_extract() for the kernel pmap, so
don't bother doing a conditional for kernel vs. user-space here.

KASSERT() that pmap_extract() succeeds; it is a programming error if
it does not, and it's not a great idea to insert a garbage address
into the SGMAP page table.
 1.43 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.42 24-Jun-2021  thorpej Deal with a scenario where:
- DMA map has a boundary constraint.
- Caller asks us to map a buffer that's exactly the same size as the
boundary constraint, but is not page-aligned.

This results in the size being larger than the boundary constraint after
page-rounding, and and vmem_xalloc() fires a KASSERT for it. This is
easy to trigger by running fsck.

We handle this by detecting the condition and creating an extra DMA
segment for it the spill-over.
 1.41 15-Apr-2021  rin branches: 1.41.2;
Fix inverted logic!!

vmem_xalloc(9) should be used with VM_NOSLEEP for BUS_DMA_NOWAIT.
 1.40 11-Oct-2020  thorpej branches: 1.40.4;
Add some bus_dma instrumentation.
 1.39 17-Jun-2020  thorpej Typo: vmem_free -> vmem_xfree
 1.38 17-Jun-2020  thorpej Switch from an extent mao to a vmem arena to manage SGMAP address space.
 1.37 15-Dec-2010  matt include <uvm/uvm_extern.h> here instead
 1.36 07-Oct-2010  hans fix SGMAP_DEBUG on alpha
 1.35 28-Apr-2008  martin branches: 1.35.20; 1.35.22;
Remove clause 3 and 4 from TNF licenses
 1.34 04-Mar-2007  christos branches: 1.34.40; 1.34.42; 1.34.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.33 01-Mar-2006  yamt branches: 1.33.20;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.32 11-Dec-2005  christos branches: 1.32.2; 1.32.4; 1.32.6;
merge ktrace-lwp.
 1.31 30-Jul-2005  mhitch Check for stale flags in the DMA map. This was causing crashes on an ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.30 28-Jul-2005  thorpej load_mbuf: Don't increase the segment index if we skipped a zero-length
mbuf. From Michael Hitch.
 1.29 28-Nov-2004  thorpej branches: 1.29.10; 1.29.12;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811
 1.28 15-Jul-2003  lukem a .#included .c file needs __KERNEL_RCSID(1, ...
 1.27 29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.25 03-May-2003  wiz DMA, not dma nor Dma.
 1.24 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.23 26-Apr-2002  thorpej Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.22 19-Jul-2001  thorpej branches: 1.22.2;
Since the SGMAP buffer load subroutine doesn't need to modify
the segment index, don't pass it by reference.
 1.21 19-Jul-2001  thorpej Implement dmamap_load_uio for SGMAPs.
 1.20 19-Jul-2001  thorpej Pay attention to BUS_DMA_READ; don't need to allocate a spill
page if it is set.
 1.19 19-Jul-2001  thorpej Since DMA frobbing can be done at interrupt time by devies at
multiple levels, protect the extent map w/ splvm().
 1.18 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.17 19-Jul-2001  thorpej Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.16 12-Jul-2001  thorpej bcopy -> memcpy
 1.15 12-Jul-2001  thorpej bzero -> memset
 1.14 03-Jan-2001  thorpej branches: 1.14.4;
ANSI'ify.
 1.13 08-Jul-1999  thorpej branches: 1.13.2; 1.13.12;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.12 14-Aug-1998  thorpej branches: 1.12.8;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 04-Jul-1998  jonathan defopt DDB.
 1.10 04-Jun-1998  thorpej Export the spill page PTE, and provide a hook to initialize it early.
 1.9 23-Mar-1998  mjacob Okay, handle the ALLOCNOW case by doing the appropriate adjustments
up front. Do the spacing arithmetic slightly differently.
 1.8 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.7 18-Jan-1998  thorpej Implement a prefetch spill page for SGMAP DMA. This works around a slight
annoyance on systems that prefetch the next page during memory -> device
DMA if the DMA comes within a certain distance of the end of the current
page. This could cause machine checks since the PTE after the last page
would not have the valid bit set.

(I'm not going to complain about this slight kludge too much, since prefetch
makes DMA much faster...)
 1.6 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.5 17-Jan-1998  thorpej Make debugging decisions at run-time, and place a handy DDB breakpoint
after a transfer has been mapped in the page table.
 1.4 05-Sep-1997  thorpej Add some debugging code to log sgmap activities. Also, make sure that
we return "no valid mappings" if there is an error while loading the
sgmap.
 1.3 02-Sep-1997  thorpej Remove references to vm_pmap.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file sgmap_typedep.c was initially added on branch thorpej-bus-dma.
 1.1.2.6 06-Jun-1997  thorpej Allow the includer greater flexibility in the naming of these functions.
 1.1.2.5 05-Jun-1997  thorpej - Tidy up the call to alpha_sgmap_alloc().
- Add a bunch of debugging statements, conditional on SGMAP_DEBUG.
- Use vtophys(), not pmap_extract(), for buffers in kernel VA space.
Not all kernel buffers are mapped with the MMU page tables; some
are mapped via K0SEG.
 1.1.2.4 04-Jun-1997  thorpej - Fix a serious bug in PTE index calculation.
- DMA addresses use the PTE index, not the PTE (byte) offset.
- Garbage-collect a now-unused flag.
 1.1.2.3 04-Jun-1997  thorpej - Correct one comment, and nuke an XXX.
- Consider SGMAP_PTE_SPACING when computing the PTE index.
 1.1.2.2 03-Jun-1997  thorpej Allow the includer to specify PTE spacing.
 1.1.2.1 03-Jun-1997  thorpej Totally rearrange the SGMAP DMA handling code. Split the functions
into "common" (used unchanged by everyone) and "typedep", which depend
on the type (32-bit or 64-bit) of the SGMAP PTEs.

Fix several bugs, and clean up significantly, eliminating unnecessary
housekeeping overhead in several places.
 1.2.6.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file sgmap_typedep.c was added on branch alpha-nwscons on 1997-06-07 04:42:55 +0000
 1.12.8.1 02-Aug-1999  thorpej Update from current.
 1.13.12.1 27-Apr-2002  he Pull up revision 1.23 (via patch, requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.13.2.1 05-Jan-2001  bouyer Sync with HEAD
 1.14.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.4.1 03-Aug-2001  lukem update to -current
 1.22.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.22.2.1 19-Jul-2001  nathanw file sgmap_typedep.c was added on branch nathanw_sa on 2002-06-20 03:37:33 +0000
 1.27.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.5 18-Dec-2004  skrll Sync with HEAD.
 1.27.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.2 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.29.12.2 03-Sep-2007  yamt sync with head.
 1.29.12.1 21-Jun-2006  yamt sync with head.
 1.29.10.2 04-Aug-2005  tron Pull up revision 1.31 (requested by thorpej in ticket #635):
Check for stale flags in the DMA map. This was causing crashes on an
ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.29.10.1 30-Jul-2005  tron Pull up revision 1.30 (requested by thorpej in ticket #627):
load_mbuf: Don't increase the segment index if we skipped a zero-length
mbuf. From Michael Hitch.
 1.32.6.1 22-Apr-2006  simonb Sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.32.2.2 07-Feb-2006  yamt fix crashes introduced by the previous.
 1.32.2.1 05-Feb-2006  yamt adapt alpha.
 1.33.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.44.2 09-Oct-2010  yamt sync with head
 1.34.44.1 16-May-2008  yamt sync with head.
 1.34.42.1 18-May-2008  yamt sync with head.
 1.34.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.22.1 05-Mar-2011  rmind sync with head
 1.35.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.40.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.41.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 03-Jan-2001  thorpej branches: 1.5.126; 1.5.128; 1.5.130;
ANSI'ify.
 1.4 04-Jun-1998  thorpej branches: 1.4.14;
Export the spill page PTE, and provide a hook to initialize it early.
 1.3 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.2 06-Jun-1997  thorpej branches: 1.2.2;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file sgmap_typedep.h was initially added on branch thorpej-bus-dma.
 1.1.2.3 06-Jun-1997  thorpej Allow the includer greater flexibility in the naming of these functions.
 1.1.2.2 03-Jun-1997  thorpej Garbage-collect.
 1.1.2.1 03-Jun-1997  thorpej Totally rearrange the SGMAP DMA handling code. Split the functions
into "common" (used unchanged by everyone) and "typedep", which depend
on the type (32-bit or 64-bit) of the SGMAP PTEs.

Fix several bugs, and clean up significantly, eliminating unnecessary
housekeeping overhead in several places.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file sgmap_typedep.h was added on branch alpha-nwscons on 1997-06-07 04:42:56 +0000
 1.4.14.1 05-Jan-2001  bouyer Sync with HEAD
 1.5.130.1 16-May-2008  yamt sync with head.
 1.5.128.1 18-May-2008  yamt sync with head.
 1.5.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.19 05-Sep-2020  maya fix typo
 1.18 05-Sep-2020  thorpej Update a comment.
 1.17 17-Jun-2020  thorpej Switch from an extent mao to a vmem arena to manage SGMAP address space.
 1.16 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 03-May-2003  wiz branches: 1.14.104; 1.14.106; 1.14.108;
DMA, not dma nor Dma.
 1.13 19-Jul-2001  thorpej branches: 1.13.2;
Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.12 03-Jan-2001  thorpej branches: 1.12.4;
ANSI'ify.
 1.11 03-Jan-2001  thorpej The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.10 14-Aug-1998  thorpej branches: 1.10.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.9 24-Jun-1998  ross Protect against multiple inclusion.
 1.8 06-Jun-1998  thorpej Add a comment describing the locking needs of the alpha_sgmap.
 1.7 21-Jan-1998  thorpej Don't conditionally define the sgmap_log_entry structure, and turn off
SGMAP logging by default.
 1.6 18-Jan-1998  thorpej Implement a prefetch spill page for SGMAP DMA. This works around a slight
annoyance on systems that prefetch the next page during memory -> device
DMA if the DMA comes within a certain distance of the end of the current
page. This could cause machine checks since the PTE after the last page
would not have the valid bit set.

(I'm not going to complain about this slight kludge too much, since prefetch
makes DMA much faster...)
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Allow specification of a minimum page table alignment to alpha_sgmap_init().
This is to work around an apparent hardware bug in some 2117x chipsets
where the page table must be aligned to at least 32k.
 1.3 05-Sep-1997  thorpej Add some debugging code to log sgmap activities. Also, make sure that
we return "no valid mappings" if there is an error while loading the
sgmap.
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull the thorpej-bus-dma branch into the mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file sgmapvar.h was initially added on branch thorpej-bus-dma.
 1.1.2.3 04-Jun-1997  thorpej - Fix a serious bug in PTE index calculation.
- DMA addresses use the PTE index, not the PTE (byte) offset.
- Garbage-collect a now-unused flag.
 1.1.2.2 03-Jun-1997  thorpej PTE page frame shift and valid bits are type-dependent now.
 1.1.2.1 03-Jun-1997  thorpej Totally rearrange the SGMAP DMA handling code. Split the functions
into "common" (used unchanged by everyone) and "typedep", which depend
on the type (32-bit or 64-bit) of the SGMAP PTEs.

Fix several bugs, and clean up significantly, eliminating unnecessary
housekeeping overhead in several places.
 1.2.6.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd sync syng thorpej-bus-dma changes with alpha-nwscons branch (pass 2)
 1.2.2.1 07-Jun-1997  cgd file sgmapvar.h was added on branch alpha-nwscons on 1997-06-07 05:47:23 +0000
 1.10.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.12.4.1 03-Aug-2001  lukem update to -current
 1.13.2.2 19-Jul-2001  thorpej Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.13.2.1 19-Jul-2001  thorpej file sgmapvar.h was added on branch nathanw_sa on 2001-07-19 04:27:38 +0000
 1.14.108.1 16-May-2008  yamt sync with head.
 1.14.106.1 18-May-2008  yamt sync with head.
 1.14.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.30 21-Nov-2023  thorpej Don't open-code tailq access.
 1.29 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.28 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.27 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.26 26-Sep-2020  thorpej branches: 1.26.6;
- Fix some bugs in previous, mainly related to indexing the correct
interrupt queue.
- Make sure to update cpu_info::ci_nintrhand if an irq moves from
one CPU to another.
 1.25 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.24 23-Sep-2020  thorpej Use a wrapper to acquire the kernel lock for non-MPSAFE interrupts,
rather than doing it in alpha_shared_intr_establish() directly.
 1.23 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.22 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.21 06-Feb-2012  matt branches: 1.21.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 14-Mar-2009  dsl branches: 1.20.12; 1.20.16;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.19 10-Mar-2008  ad branches: 1.19.4; 1.19.12; 1.19.18;
Finish moving alpha over to the MI atomic ops.
 1.18 11-Dec-2005  christos branches: 1.18.36; 1.18.50; 1.18.70; 1.18.74;
merge ktrace-lwp.
 1.17 29-Mar-2005  thorpej branches: 1.17.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.16 27-Jul-2001  thorpej branches: 1.16.2; 1.16.22; 1.16.28; 1.16.30; 1.16.36;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.15 05-Jun-2000  thorpej branches: 1.15.6;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.14 04-Jun-2000  thorpej ANSI'ify function declarations.
 1.13 19-Mar-2000  thorpej branches: 1.13.2;
Point back to the alpha_shared_intr in the intrhand structure. This
allows platform-specific code to access the `intr_private' data via
the intrhand structure.
 1.12 10-Feb-2000  mjacob Allow (re)setting of maxstrays after establishment of a shared interrupt.
This allows sporadic stray interrupt counts to be reset by an acknowledgement
of the same interrupt.
 1.11 01-Feb-2000  mjacob Do not forget to init intr_private
 1.10 08-Dec-1999  thorpej Revert previous.
 1.9 07-Dec-1999  thorpej Avoid a spurious warning when establishing a pulsed interrupt handler
on an IRQ which was marked "initially-pulsed".
 1.8 29-Nov-1999  thorpej Add a way to get/set a private pointer in the shared interrupt header.
 1.7 17-Sep-1999  thorpej branches: 1.7.2; 1.7.8;
Centralize the declaration and clearing of `cold'.
 1.6 01-Aug-1998  thorpej Implement alpha_shared_intr_disestablish(). Simply removes the handler
fromthe list, allowing the caller to manipulate the sharing type,
if appropriate.
 1.5 07-Jul-1998  thorpej Always count the number of strays we encounter, but don't send a "stopped
logging" message if we're ignoring strays.
 1.4 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.3 07-Apr-1997  cgd branches: 1.3.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.1 17-Nov-1996  cgd branches: 1.1.2;
implement a (hack-ish) set of routines to do common chained-interrupt
handler management. It's nasty, but three slightly different copies of
the code is worse.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.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.13.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.6.1 03-Aug-2001  lukem update to -current
 1.16.36.1 30-Mar-2005  tron Pull up revision 1.17 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.16.30.1 29-Apr-2005  kent sync with -current
 1.16.28.1 11-May-2005  riz Pull up revision 1.17 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.16.22.1 01-Apr-2005  skrll Sync with HEAD.
 1.16.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.16.2.1 27-Jul-2001  thorpej file shared_intr.c was added on branch nathanw_sa on 2001-07-27 00:25:20 +0000
 1.17.2.1 17-Mar-2008  yamt sync with head.
 1.18.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.70.1 24-Mar-2008  keiichi sync with head.
 1.18.50.1 23-Mar-2008  matt sync with HEAD
 1.18.36.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.19.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.4.1 04-May-2009  yamt sync with head.
 1.20.16.1 18-Feb-2012  mrg merge to -current.
 1.20.12.1 17-Apr-2012  yamt sync with head
 1.21.48.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.26.6.1 13-May-2021  thorpej Sync with HEAD.
 1.12 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.11 12-Jan-1998  thorpej Adjust for config changes.
 1.10 24-Oct-1997  thorpej In vga_erasecols(), fix botched count and reversed arguments to
bus_space_set_region_2(). From Chris Demetriou <cgd@pa.dec.com>.
 1.9 25-Sep-1997  thorpej branches: 1.9.2;
Add a "scrollskip" member to wscons_emulfuncs (XXX even though it's not
a function) which specifies how many lines will be skipped when scrolling
up when the bottom of the screen is reached. Dumb framebuffers skip 10
lines (as before) because the copies are s ... l ... o ... w, but it's
silly to skip 10 lines on VGA, since the copies are much faster, so we
only skip one in that case.
 1.8 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 23-Jul-1997  cgd branches: 1.7.2;
update these to use the new 'correct' names for functions/constants
in bus.h.
 1.6 23-Jul-1997  cgd remove a couple of outdated comments (pointed out by Kenneth Stailey
 1.5 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.3 02-Dec-1996  cgd branches: 1.3.2;
convert to use bus_space_set_region_2() and bus_space_copy_2(), rather
than in-line clear and copy loops.
 1.2 23-Nov-1996  cgd move probe and setup code into common functions. always probe (i.e.
even if PCI and the IDs are right), just for sanity, before declaring
success. Split the single 0x3b0 -> 0x3df allocation into three seperate
ones: 0x3b0 -> 0x3bc (leaving the 4 ports available for lpt),
0x3c0 -> 0x3cf, and 0x3d0 -> 0x3df. The former chunk has to be split
off if the lpt can exist there, and it's sort-of pretty to have each
group (based on second hex digit) have its own handle.
 1.1 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.3.2.5 12-Aug-1997  cgd fix sync-o
 1.3.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.3.2.3 22-Jul-1997  cgd a few slight cleanups re: column defns
 1.3.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.7.2.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 24-Oct-1997  thorpej Pull up from trunk:

In vga_erasecols(), fix botched count and reversed arguments to
bus_space_set_region_2(). From Chris Demetriou <cgd@pa.dec.com>.
 1.4 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 23-Nov-1996  cgd branches: 1.2.2;
move probe and setup code into common functions. always probe (i.e.
even if PCI and the IDs are right), just for sanity, before declaring
success. Split the single 0x3b0 -> 0x3df allocation into three seperate
ones: 0x3b0 -> 0x3bc (leaving the 4 ports available for lpt),
0x3c0 -> 0x3cf, and 0x3d0 -> 0x3df. The former chunk has to be split
off if the lpt can exist there, and it's sort-of pretty to have each
group (based on second hex digit) have its own handle.
 1.1 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.2.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.5 12-Apr-1996  cgd kill this; more trouble (for more people) than it was worth
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd update to match my reality
 1.2 28-Jun-1995  cgd update for new kernel names
 1.1 07-May-1995  cgd ignore the kernel compile dirs for which we provide config files.
 1.2 06-Jan-2003  lukem Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.1 13-Feb-1995  cgd branches: 1.1.46;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.46.1 07-Jan-2003  thorpej Sync with HEAD.
 1.1 06-Jan-2003  lukem branches: 1.1.2;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.1.2.2 07-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 06-Jan-2003  thorpej file Makefile was added on branch nathanw_sa on 2003-01-07 20:50:28 +0000
 1.7 12-Aug-1997  cgd branches: 1.7.2;
clean up RCS IDs
 1.6 20-Aug-1996  cgd branches: 1.6.2; 1.6.12;
allow dots in names (but not at start of names), so that
GENERIC.PROF gets built.
 1.5 15-Jun-1996  cgd punt on the grep and do all the file selection in find. don't try
to build kernels from files with '.' anywhere in their names.
 1.4 12-Apr-1996  cgd branches: 1.4.4;
config first, so there's someplace to cd to.
 1.3 12-Apr-1996  cgd oops; forgot to remove a line of debugging/testing code
 1.2 12-Apr-1996  cgd clean up a lot, make work with outline mode, and switch functions:
build now builds from scratch, rebuild just runs make.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.1 15-Jun-1996  cgd pull up from trunk:
>punt on the grep and do all the file selection in find. don't try
>to build kernels from files with '.' anywhere in their names.
 1.6.12.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.2 12-Aug-1997  cgd clean up RCS IDs
 1.7.2.1 12-Aug-1997  cgd file build_all was added on branch alpha-nwscons on 1997-08-12 06:08:22 +0000
 1.7 12-Aug-1997  cgd branches: 1.7.2;
clean up RCS IDs
 1.6 20-Aug-1996  cgd branches: 1.6.2; 1.6.12;
allow dots in names (but not at start of names), so that
GENERIC.PROF gets built.
 1.5 15-Jun-1996  cgd punt on the grep and do all the file selection in find. don't try
to build kernels from files with '.' anywhere in their names.
 1.4 12-Apr-1996  cgd branches: 1.4.4;
config first, so there's someplace to cd to.
 1.3 12-Apr-1996  cgd oops; forgot to remove a line of debugging/testing code
 1.2 12-Apr-1996  cgd clean up a lot, make work with outline mode, and switch functions:
build now builds from scratch, rebuild just runs make.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.1 15-Jun-1996  cgd pull up from trunk:
>punt on the grep and do all the file selection in find. don't try
>to build kernels from files with '.' anywhere in their names.
 1.6.12.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.2 12-Aug-1997  cgd clean up RCS IDs
 1.7.2.1 12-Aug-1997  cgd file rebuild_all was added on branch alpha-nwscons on 1997-08-12 06:08:23 +0000
 1.223 04-Jan-2007  pavel Merge GENERIC and ALPHA configuration, and remove the latter. ALPHA was
supposed to be a superset of GENERIC, but sometimes it was not kept up to
date.

As proposed on port-alpha@.
 1.222 27-Sep-2006  manu branches: 1.222.2; 1.222.4;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.221 14-Sep-2006  plunky branches: 1.221.2;
add bluetooth capability to alpha port
 1.220 26-Aug-2006  christos branches: 1.220.2;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.219 14-Aug-2006  skrll s/adpater/adapter/

Prompted by PR/34195
 1.218 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.217 26-Jul-2006  cube branches: 1.217.2;
Remove "atapibus* at umass?" and "scsibus* at umass?" when there is
already an attachment to the interface attribute (atapi and scsi).

Part of PR#34085, although it is the contrary to what the submitter
suggests (which shows that having both in a config file can be confusing).
 1.216 28-Mar-2006  pavel Add stf to all kernel configs which have INET6 and gif, except the INSTALL
ones and those for specific machines of developers. PR 32304.

OK'ed by rpaulo.

N.B. stf is a cloning device, so it still must be enabled by
"ifconfig stf0 create".
 1.215 05-Feb-2006  cube branches: 1.215.2; 1.215.4; 1.215.6;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.214 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.213 07-Dec-2005  tsutsui branches: 1.213.2; 1.213.4; 1.213.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.212 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.211 19-Aug-2005  christos 64 bit inode changes.
 1.210 05-Aug-2005  skrll Add (commented out) ucycom to various kernel configs.
 1.209 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.208 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.207 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.206 09-Jun-2005  tsutsui branches: 1.206.2;
- Rename options NEW_BUFQ_STRATEGY -> options BUFQ_READPRIO.
(still commented out)
- Add (also commented out) options BUFQ_PRIOCSCAN.

Suggested by perry and soda on tech-kern.
Please refer options(4) for details for these options.
 1.205 31-May-2005  tron Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.204 15-Apr-2005  itohy Add ukyopon(4).
 1.203 25-Mar-2005  cube Add attimer(4) configurations everywhere pcppi(4) exists, with the
following rule:
If a pcppi device is enabled for an attachment, enable an attimer for the
same attachement, otherwise comment it.
 1.202 25-Feb-2005  simonb branches: 1.202.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.201 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.200 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.199 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.198 17-Jan-2005  cube branches: 1.198.2;
Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.197 24-Nov-2004  bouyer branches: 1.197.4;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.196 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.195 23-Oct-2004  augustss s/uax/axe/
 1.194 20-Jul-2004  perseant Change "acardide*at ..." to "acardide* at ..." so adjustkernel will dtrt.
 1.193 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.192 29-Apr-2004  fair Remove specific scsibus* at (hba device)? declarations for the new,
simple:

scsibus* at scsi?
 1.191 13-Feb-2004  wiz branches: 1.191.2;
RealTek -> Realtek.
 1.190 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.189 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.188 27-Nov-2003  simonb Add COMPAT_16.
 1.187 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.186 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.185 08-Oct-2003  bouyer Add atabus
 1.184 06-Aug-2003  bouyer Add esiop at pci to GENERIC which already have siop at pci.
esiop has been tested enouth now.
esiop not added to INSTALL kernels because of possible space constraint.
siop should be able to drive all adapters supported by esiop.
 1.183 01-Jun-2003  martin branches: 1.183.2;
Add support for SMBFS.
 1.182 04-May-2003  gmcgarry Add wsfont support. Addresses PR#18388.
 1.181 27-Apr-2003  tsutsui Add some entries added to GENERIC recently.
 1.180 16-Apr-2003  thorpej Add mpt(4).
 1.179 10-Apr-2003  christos Bye Bye UCONSOLE
 1.178 16-Feb-2003  augustss Add uax(4) (and url(4) in some cases).
 1.177 10-Feb-2003  mjacob Add Sundance TI (stge). Not a largely available card, but since I *did*
test that it worked on alpha....
 1.176 10-Feb-2003  grant add wi at pci and pcmcia, make comments consistent.
 1.175 30-Nov-2002  itohy White space police.
 1.174 05-Nov-2002  fair Add udsbr(4) with radio(4) attachment to standard configs
 1.173 14-Oct-2002  elric Add cgd to the ALPHA.
 1.172 06-Oct-2002  tsutsui Sync with GENERIC. (systrace and other misc options)
 1.171 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.170 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.169 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.168 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.167 22-Jul-2002  wiz Correct some commented out variables from ADW_DISABLE_* to SCSI_ADW_DISABLE_*.
From Julio Merino in port-alpha/17677.
 1.166 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.165 27-May-2002  lukem add puc, and com & lpt at puc
 1.164 25-Apr-2002  atatat branches: 1.164.2; 1.164.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.163 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.162 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.161 10-Feb-2002  wiz Update description for icsphy.
 1.160 07-Feb-2002  ross add ess0
 1.159 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.158 28-Dec-2001  augustss Update for new uhidev device attachment.
 1.157 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.156 04-Nov-2001  itohy Add midi at opl and midi at mpu
 1.155 04-Nov-2001  itohy Add mpu at cmpci and opl at cmpci attachment.
I always test it on alpha, and add cmpci entries to alpha config files.
 1.154 01-Oct-2001  simonb branches: 1.154.2;
Add "asc* at tc?" for PMAZ-A TurboChannel cards.
 1.153 15-Sep-2001  thorpej Attach "agp" to the AMD-751 PCI host controller (Alpha UP1000/UP1100).
 1.152 22-Aug-2001  hubertf branches: 1.152.2; 1.152.4;
More comment changes: 90x[B] -> 90x[BC]
 1.151 08-Jul-2001  abs branches: 1.151.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.150 07-Jul-2001  tsutsui Remove (commented out) ncr* at pci? lines.
 1.149 18-Jun-2001  thorpej Add sf(4), gsip(4), gphyter(4) drivers.
 1.148 07-Jun-2001  lukem add iha(4); it works in my pc164 after thorpej fixed a minor issue
 1.147 06-May-2001  ad Add mlx at eisa.
 1.146 30-Mar-2001  minoura Add yds at pci and children.
Alpha and i386 are the only tested ports.
 1.145 04-Feb-2001  ad branches: 1.145.2;
Add a driver for the Mylex DAC960 family (including DEC SWXCR).
 1.144 27-Jan-2001  lukem add options NTP (ok-ed by thorpej)
 1.143 16-Jan-2001  augustss Add uyap.
 1.142 10-Jan-2001  nathanw Add uftdi and ucom, now that they're tested and known to work.
 1.141 30-Dec-2000  tsutsui Sync with GENERIC:

> PCMCIAVERBOSE (commented out)
> isapnp at isa (commented out)
> midi at pcppi
> ep at isapnp (commented out)
> ix at isa (commented out)
> iy at isa (commented out)
> wdc at isapnp (commented out)
> wss at isapnp (commented out)
>
> The isapnp stuff is commented out because it may crash due to unimplemented
> alloc methods on some machines with some devices. This should really get
> fixed.
 1.140 21-Dec-2000  thorpej Add Sable and Lynx support.
 1.139 19-Dec-2000  tsutsui Add pseudo-device vlan.
 1.138 15-Dec-2000  tsutsui Add options COMPAT_LINUX (sync with GENERIC).
 1.137 26-Nov-2000  ad lsu -> ld, by popular request.
 1.136 19-Nov-2000  tsutsui More cosmetics.

BTW, why these two "generic" config files exist?
 1.135 19-Nov-2000  tsutsui Remove "rnd is EXPERIMENTAL" comment.
 1.134 19-Nov-2000  tsutsui Add some newer stuff from GENERIC and enable rnd.
 1.133 14-Nov-2000  augustss Add uscanner.
 1.132 19-Oct-2000  ad ca -> lsu
 1.131 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.130 11-Aug-2000  thorpej Back out part of previous which was unintended.
 1.129 11-Aug-2000  thorpej Add depca at eisa.
 1.128 12-Jul-2000  thorpej - Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.127 14-Jun-2000  veego branches: 1.127.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.126 01-Jun-2000  thorpej Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.125 28-May-2000  thorpej Add Cyclades-Z.
 1.124 25-May-2000  mycroft branches: 1.124.2;
Add ipfilter-related stuff.
 1.123 23-May-2000  thorpej Note that KN300 is also for AlphaServer 1200.
 1.122 08-May-2000  augustss Add (sometimes commented out) MIIVERBOSE option.
 1.121 02-May-2000  augustss Add bba(4) attachment.
 1.120 28-Apr-2000  ad Attach cac* and ca*.
 1.119 19-Apr-2000  haya Changes the name of RealTek driver. The new name is `rtk'. This used
to be called `rl' and it conflict with RL vax disks, canonical and
historical unix driver name.

This changes are minimal: it only changes the name of RealTek driver.
The filename of source code and a lot of the letter `rl' in source
files should be changed shortly.
 1.118 03-Apr-2000  augustss Add atapibus* at umass?
 1.117 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.116 09-Mar-2000  cjs Add ident and RAID_AUTOCONFIG to bring up to date with GENERIC.
 1.115 22-Feb-2000  tls revert previous change
 1.114 22-Feb-2000  mjacob remove SES driver
 1.113 25-Jan-2000  augustss Update for the ucom(4) addition.
 1.112 20-Jan-2000  mjacob add SES device
 1.111 19-Jan-2000  cjs Make sure that everything in GENERIC is in ALPHA, and that the two files
have config lines in the same order to make diffing easier.
 1.110 19-Jan-2000  cjs Add vr driver and missing phys.
 1.109 17-Jan-2000  augustss Add USB-Ethernet adapters.
 1.108 05-Nov-1999  thorpej branches: 1.108.2;
Add some missing Ethernet cards: rl, ti (not in INSTALL), sip, tlp.
 1.107 29-Sep-1999  kleink branches: 1.107.2; 1.107.4; 1.107.6;
Add missing sv(4).
 1.106 29-Sep-1999  kleink Add eso(4).
 1.105 28-Sep-1999  ad Entries for dpt(4).
 1.104 09-Sep-1999  augustss Add uaudio driver.
 1.103 01-Sep-1999  sommerfeld resync supported mii phy's with GENERIC
 1.102 01-Sep-1999  thorpej Add some missing usb glue.
 1.101 29-Aug-1999  thorpej Add `umass'.
 1.100 16-Aug-1999  augustss Add umodem device.
 1.99 07-Aug-1999  thorpej Add the AdvanSys SCSI boards.
 1.98 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.97 29-Jun-1999  ross Turn on EV6 bits: Tsunami and system type 6600.
 1.96 30-Apr-1999  cgd enable COMPAT_OSF1
 1.95 29-Apr-1999  ross WSEMUL_SUN -> WSEMUL_VT100
 1.94 22-Feb-1999  fvdl branches: 1.94.2;
Add internal 3com PHYs for the ex driver.
 1.93 18-Feb-1999  thorpej Add floppy controller and drives.
 1.92 23-Jan-1999  drochner second round of mouse renaming: psm->pms
 1.91 10-Jan-1999  nathanw wskbd, not wskbs.
 1.90 06-Jan-1999  thorpej - Add adv and adw SCSI controllers, commented out, as they do not yet
work.
- Add USB stuff.
- Add new pcscp SCSI driver.
- Comment out wss driver, as the configuration listed hangs some systems
cold.
 1.89 25-Nov-1998  tv Sync with various options in GENERIC that were not added/changed here.
 1.88 14-Oct-1998  matt Sync with new IDE support (e.g. pciide changes)
 1.87 02-Sep-1998  enami Replace TAB just after the keyword `options' with SPACE.
 1.86 27-Jul-1998  thorpej Back out previous.
 1.85 27-Jul-1998  mjacob Comment out cs device. Kernels don't compile because there is no
cfattach structure found. Leave it to the author to untangle.
 1.84 27-Jul-1998  thorpej Add cs* at isa? port 0x300, wildcard IRQ and memory address, to pull
them from the EEPROM. Wildcard DRQ to force memory-mode operation; this
value is not available in the EEPROM and must be configured manually.
 1.83 02-Jul-1998  mjacob If GENERIC has SCSIVERBOSE on, having it off here makes no sense
 1.82 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.81 26-Jun-1998  thorpej Add DEC_1000A, per GENERIC.
 1.80 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.79 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.78 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.77 03-Jun-1998  mjacob turn on Essential HIPPI for these configurations
 1.76 02-Jun-1998  thorpej Add epic* at pci?
 1.75 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.74 13-May-1998  thorpej No need to hard-code the mcclock offset on the gbus; gbus is direct-config.
 1.73 24-Apr-1998  thorpej Whitespace sanity.
 1.72 18-Apr-1998  thorpej Add PCI IDE.
 1.71 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.70 15-Apr-1998  mjacob add Alpha 4100 support
 1.69 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.68 12-Mar-1998  thorpej Dump maxusers to 32.
 1.67 13-Feb-1998  enami Remove comment which says that fxp is untested (it is known to work now).
Also, make model name closer to what driver prints startup.
 1.66 15-Jan-1998  thorpej Switch to MI IDE drivers, add ATAPI devices.
 1.65 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.64 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.63 20-Oct-1997  explorer comment out rnd, mark as experimental
 1.62 13-Oct-1997  cjs Add pseudo-device rnd.
 1.61 06-Sep-1997  thorpej Add DDB.
 1.60 24-Aug-1997  cgd fix various bogons: copy SCSIVERBOSE option (still commented out) and ISA lc
driver to ALPHA. Also, sort them into their respective lists correctly,
rather than punting completely (SCSIVERBOSE), or mis-sorting(!) (lc).
 1.59 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.58 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.57 13-Jul-1997  hpeyerl branches: 1.57.2;
Move satlink0 to ALPHA.
 1.56 13-Jun-1997  thorpej Add the ext2fs file system.
 1.55 12-Jun-1997  mrg remove now obsolete "swap on..." lines.
 1.54 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.53 05-Jun-1997  thorpej Add fxp* at pci? declarations, marked untested on the Alpha, but they
compile.
 1.52 01-May-1997  cjs branches: 1.52.2;
Ep driver on ISA bus is no longer untested. Also optimistically
removed the `untested' designation from the EISA-bus version, since
there's no reason at all why it won't work.
 1.51 21-Apr-1997  cgd minimal changes to make hacked wd driver work under a different name.
It is configured (in config files) as 'awdc'/'awd', but shows up as
'wdc'/'wd', so that a minimal amount of code had to be modified to make
the name change work. This is only intended to be temporary, anyway.
 1.50 18-Apr-1997  cgd add ep at isa and eisa
 1.49 14-Apr-1997  cgd sort PCI devices, add 'cy' Cyclades Cyclom-Y driver (untested)
 1.48 10-Apr-1997  cgd enabled EB64+ support
 1.47 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.46 06-Apr-1997  cgd add options NETATALK
 1.45 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.44 25-Mar-1997  cgd kill cfb and sfb in the standard configs
 1.43 23-Mar-1997  cgd add the PPP_FILTER option
 1.42 21-Mar-1997  cgd clean up CPU specs a bit. Add entries for the jensen and eb64+ (commented
out since they're not currently supported, but the options are 'known').
Add 'se' Cabletron SCSI Ethernet driver.
 1.41 13-Mar-1997  cgd add ahc and bha at EISA
 1.40 13-Mar-1997  cgd add entries for ahc and bha PCI devices. clean up some
 1.39 12-Mar-1997  cgd enable Matt Jacob's ISP 10x0 driver, now that it's in the source tree.
 1.38 12-Mar-1997  cgd add kn8ae CPU support to GENERIC kernels. Also, add kn8ae devices.
Add "isp", "ahc", and "bha" config lines, but comment them out until
their sources are in the tree and/or their alpha patches are in the tree.
 1.37 27-Feb-1997  thorpej s/esp/asc/g
 1.36 31-Jan-1997  cgd branches: 1.36.4;
add KMEMSTATS to ALPHA, clean up ports diagnostic/debug options
 1.35 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.34 23-Jan-1997  cgd Set LOADADDRESS makeoption so that these kernels can be net-booted.
This is a waste of memory, but is useful in GENERIC kernels.
 1.33 15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.32 14-Jan-1997  cgd comment out 'options GATEWAY' by default.
add PPP_BSDCOMP and PPP_DEFLATE.
add ipfilter pseudo-device, and sort the pseudo-device list to recover
from the renaming of 'rd' to 'md'.
 1.31 28-Dec-1996  pk branches: 1.31.2;
rename: ramdisk => md
 1.30 03-Dec-1996  cgd branches: 1.30.2;
clean up SCSI devices
 1.29 26-Nov-1996  cgd add a comment re: eb164
 1.28 25-Nov-1996  cgd update for recent configuration changes.
 1.27 19-Nov-1996  cgd update for VGA changes, and clean up slightly.
 1.26 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.25 12-Nov-1996  cgd add DEC_EB164 option
 1.24 27-Sep-1996  cgd update for changes to config.
 1.23 16-Sep-1996  cgd sync with GENERIC: add pseudo-device 'rd' with one unit
 1.22 16-Sep-1996  cgd add EISAVERBOSE, TCVERBOSE as appropriate. Add UCONSOLE to all.
slight cleanup + sync.
 1.21 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.20 15-Jul-1996  cgd add FIX_UNALIGNED_VAX_FP. It wastes space, but hey, this kernel includes
netweird...
 1.19 14-Jul-1996  cgd include all PCI drivers that actually compile, clean up list, alphabetize,
and add descriptions.
 1.18 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.17 12-Jun-1996  cgd remove "options GENERIC" since it's not needed with new setroot() code for
GENERIC kernels, and since it no longer has any other special meaning.
 1.16 03-Jun-1996  cgd add "le* at pci?", because it compiles and may actually work.
 1.15 23-May-1996  cgd fix UMAPFS entry, add entry for UNION
 1.14 20-May-1996  cgd branches: 1.14.4;
add 'pseudo-device strip' for Metricom Ricochet packet radio driver
recently kicked in by Jonathan Stone. It compiles on the alpha, and
may even work.
 1.13 20-May-1996  cgd add fta, fpa, and fea drivers, for DEC TC, PCI, and EISA FDDI controllers.
 1.12 01-May-1996  cgd add support for PMAG-B Color Frame Buffer (CFB) option boards. OSF/1
doesn't support these, but they appear to work OK (with an appropriate
monitor) in my 3000/300.
 1.11 01-May-1996  cgd add SFB at tc, wcsons at sfb, and fix up le declarations
 1.10 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.9 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.8 20-Dec-1995  cgd rename TC 'asic' to 'ioasic'
 1.7 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.6 03-Aug-1995  cgd update for all the latest bells and whistles
 1.5 27-Jun-1995  cgd update for current configuration descriptions
 1.4 22-Apr-1995  cgd clean up, change drive -> lun for mi scsi files description.
 1.3 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.14.4.4 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.14.4.3 13-Jun-1996  cgd pull up from trunk:
>remove "options GENERIC" since it's not needed with new setroot() code for
>GENERIC kernels, and since it no longer has any other special meaning.
 1.14.4.2 03-Jun-1996  cgd pull up from trunk:
>add "le* at pci?", because it compiles and may actually work.
 1.14.4.1 25-May-1996  jtc pulled up to the release branch by cgd's request
 1.30.2.8 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.30.2.7 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.30.2.6 06-Jun-1997  cgd sync nwscons with trunk
 1.30.2.5 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.30.2.4 01-Feb-1997  cgd for now, pckbd is needs-count, and therefore can't be cloning
 1.30.2.3 31-Jan-1997  cgd sync with trunk
 1.30.2.2 25-Jan-1997  cgd sync up, update all for new definitions, add back tga devices
 1.30.2.1 24-Jan-1997  cgd sync with trunk
 1.31.2.3 30-Jan-1997  thorpej update from trunk
 1.31.2.2 18-Jan-1997  thorpej Update from trunk.
 1.31.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.36.4.1 11-Mar-1997  is Merge in latest Trunk.
 1.52.2.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.52.2.1 23-May-1997  thorpej Add: aha, bha, uha, le (commented out for now) at isa; ahb, uha at eisa;
scsibus attachments to aha, ahb, and uha.
 1.57.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.94.2.3 02-Jul-1999  perry pullup 1.96->1.97 (ross)
 1.94.2.2 21-Jun-1999  cgd pull up rev(s) 1.96 from trunk. (cgd)
 1.94.2.1 29-Apr-1999  perry branches: 1.94.2.1.2; 1.94.2.1.4;
pullup 1.94->1.95 (ross)
 1.94.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.94.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.94.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.94.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.107.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.107.4.1 14-Nov-1999  fvdl Sync with -current.
 1.107.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.107.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.107.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.107.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.107.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.107.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.107.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.108.2.2 05-Nov-1999  thorpej Add some missing Ethernet cards: rl, ti (not in INSTALL), sip, tlp.
 1.108.2.1 05-Nov-1999  thorpej file ALPHA was added on branch comdex-fall-1999 on 1999-11-05 21:30:22 +0000
 1.124.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.127.2.5 25-Oct-2001  he Apply patch (requested by ad):
Add Mylex DACC960, CAC-EISA, and I2O block/SCSI drivers.
 1.127.2.4 01-May-2001  he Pull up revisions 1.135,1.139 (requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.127.2.3 26-Feb-2001  he Pull up revision 1.134 (via patch, requested by mjacob):
The ``rnd'' device is now required for ssh to work, so enable it.
Also add various other newer entries.
 1.127.2.2 11-Aug-2000  thorpej Pullup from trunk:
Add depca at eisa.
 1.127.2.1 12-Jul-2000  thorpej Update from trunk:
- Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.145.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.145.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.151.2.7 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.151.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.151.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.151.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.151.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.151.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.151.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.152.4.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.152.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.152.2.12 11-Dec-2002  thorpej Sync with HEAD.
 1.152.2.11 11-Nov-2002  nathanw Catch up to -current
 1.152.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.152.2.9 01-Aug-2002  nathanw Catch up to -current.
 1.152.2.8 20-Jun-2002  nathanw Catch up to -current.
 1.152.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.152.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.152.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.152.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.152.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.152.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.152.2.1 22-Aug-2001  nathanw file ALPHA was added on branch nathanw_sa on 2001-09-21 22:34:56 +0000
 1.154.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.164.4.3 26-Oct-2005  jmc Pullup (via patch) requested in ticket #5754 by itohy

Provide a backport for ukyopon(4) and pullup umodem(4) updates.
 1.164.4.2 24-Oct-2002  lukem Pull up upgrade to IPfilter 3.4.29 (requested by martti in ticket #905).
Affected files & revisions:

dist/ipf/HISTORY 1.14
dist/ipf/fils.c 1.17-1.21
dist/ipf/ipf.c 1.11-1.13
dist/ipf/ipfs.c 1.8-1.10
dist/ipf/ipft_ef.c 1.6-1.7
dist/ipf/ipft_td.c 1.6-1.7
dist/ipf/ipft_tx.c 1.7-1.8
dist/ipf/ipmon.c 1.12-1.17
dist/ipf/ipnat.c 1.11-1.12
dist/ipf/ipsend/ip_var.h 1.2
dist/ipf/ipsend/ipsend.c 1.8
dist/ipf/ipsend/iptests.c 1.5
dist/ipf/ipt.c 1.8-1.10
dist/ipf/kmem.c 1.8-1.10
dist/ipf/man/ipf.4 1.10
dist/ipf/man/ipf.5 1.8
dist/ipf/man/ipftest.1 1.3
dist/ipf/man/ipmon.8 1.10
dist/ipf/man/ipnat.5 1.9-1.10
dist/ipf/man/ipnat.8 1.4
dist/ipf/misc.c 1.7
dist/ipf/natparse.c 1.10
dist/ipf/parse.c 1.13
dist/ipf/printnat.c 1.8-1.10
dist/ipf/relay.c 1.5-1.6
dist/ipf/rules/example.9 1.2
etc/rc.d/ipnat 1.8
regress/sys/kern/ipf/Makefile 1.3-1.4
regress/sys/kern/ipf/dotest6 1.2
regress/sys/kern/ipf/expected/f13 1.1.1.2
regress/sys/kern/ipf/expected/i12 1.1.1.1
regress/sys/kern/ipf/expected/ni3 1.1.1.1
regress/sys/kern/ipf/expected/ni5 1.2
regress/sys/kern/ipf/input/f13 1.1.1.2
regress/sys/kern/ipf/input/ipv6.1 1.1.1.1
regress/sys/kern/ipf/input/ni3 1.1.1.1
regress/sys/kern/ipf/regress/i12 1.1.1.1
regress/sys/kern/ipf/regress/ipv6.1 1.1.1.1
regress/sys/kern/ipf/regress/ni3.ipf 1.1.1.1
regress/sys/kern/ipf/regress/ni3.nat 1.1.1.1
sys/arch/alpha/conf/ALPHA 1.169,1.171
sys/arch/amiga/conf/GENERIC 1.185-1.186
sys/arch/arc/conf/GENERIC 1.71-1.72
sys/arch/atari/conf/GENERIC.in 1.24-1.25
sys/arch/cats/conf/GENERIC 1.31-1.32
sys/arch/cobalt/conf/GENERIC 1.34-1.35
sys/arch/hp300/conf/GENERIC 1.83-1.84
sys/arch/i386/conf/CARDBUS 1.66-1.67
sys/arch/i386/conf/GENERIC 1.510,1.512
sys/arch/i386/conf/GENERIC_LAPTOP 1.58-1.59
sys/arch/i386/conf/GENERIC_PS2TINY 1.19-1.20
sys/arch/i386/conf/GENERIC_TINY 1.47-1.48
sys/arch/luna68k/conf/GENERIC 1.33-1.33
sys/arch/mac68k/conf/GENERIC 1.130-1.131
sys/arch/mac68k/conf/GENERICSBC 1.21-1.22
sys/arch/mac68k/conf/SMALLRAM 1.4-1.5
sys/arch/macppc/conf/GENERIC 1.142-1.143
sys/arch/mipsco/conf/GENERIC 1.21-1.22
sys/arch/mmeye/conf/GENERIC 1.44-1.45
sys/arch/news68k/conf/GENERIC 1.36-1.37
sys/arch/news68k/conf/GENERIC_TINY 1.18-1.19
sys/arch/newsmips/conf/GENERIC 1.50-1.51
sys/arch/ofppc/conf/GENERIC 1.56-1.57
sys/arch/pmax/conf/GENERIC 1.103-1.104
sys/arch/prep/conf/GENERIC 1.55-1.56
sys/arch/sbmips/conf/GENERIC 1.11-1.12
sys/arch/sgimips/conf/GENERIC 1.7-1.8
sys/arch/sparc/conf/GENERIC 1.138-1.139
sys/arch/sparc64/conf/GENERIC32 1.46-1.47
sys/arch/vax/conf/GENERIC 1.102-1.103
sys/arch/x68k/conf/ALL 1.55-1.56
sys/arch/x68k/conf/GENERIC 1.80-1.81
sys/lkm/netinet/if_ipl/mln_ipl.c 1.29
sys/netinet/fil.c 1.57-1.58
sys/netinet/ip_auth.c 1.29-1.30
sys/netinet/ip_compat.h 1.30-1.31
sys/netinet/ip_fil.c 1.81-1.86
sys/netinet/ip_fil.h 1.46-1.49
sys/netinet/ip_frag.c 1.33-1.34
sys/netinet/ip_frag.h 1.18
sys/netinet/ip_ftp_pxy.c 1.25-1.26
sys/netinet/ip_h323_pxy.c 1.5-1.6
sys/netinet/ip_log.c 1.22-1.23
sys/netinet/ip_nat.c 1.51-1.53
sys/netinet/ip_nat.h 1.27
sys/netinet/ip_netbios_pxy.c 1.4
sys/netinet/ip_proxy.c 1.35-1.36
sys/netinet/ip_proxy.h 1.18
sys/netinet/ip_state.c 1.41-1.42
sys/netinet/ip_state.h 1.23
sys/netinet/ipl.h 1.14
 1.164.4.1 01-Aug-2002  lukem Pull up revision 1.166 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.164.2.3 30-Aug-2002  gehenna catch up with -current.
 1.164.2.2 09-Jul-2002  gehenna catch up with -current.
 1.164.2.1 30-May-2002  gehenna Catch up with -current.
 1.183.2.11 11-Dec-2005  christos Sync with head.
 1.183.2.10 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.183.2.9 01-Apr-2005  skrll Sync with HEAD.
 1.183.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.183.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.183.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.183.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.183.2.4 29-Nov-2004  skrll Sync with HEAD.
 1.183.2.3 14-Nov-2004  skrll Sync with HEAD.
 1.183.2.2 02-Nov-2004  skrll Sync with HEAD.
 1.183.2.1 03-Aug-2004  skrll Sync with HEAD
 1.191.2.2 15-Jul-2004  he branches: 1.191.2.2.2;
Pull up revision 1.193 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.191.2.1 29-Apr-2004  jmc Pullup rev 1.192 (requested by fair in ticket #232)

Remove specific scsibus* at (hba device)? declarations for the new,
simple:

scsibus* at scsi?
 1.191.2.2.2.2 21-Jul-2005  riz Pull up revision 1.204 (requested by itohy in ticket #1430):
Add ukyopon(4).
 1.191.2.2.2.1 02-Apr-2005  he Pull up revision 1.197 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.197.4.1 29-Apr-2005  kent sync with -current
 1.198.2.3 26-Mar-2005  yamt sync with head.
 1.198.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.198.2.1 12-Feb-2005  yamt sync with head.
 1.202.2.3 18-Jul-2005  riz Pull up revision 1.207 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.202.2.2 01-Jun-2005  riz Pull up revision 1.205 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.202.2.1 17-Apr-2005  tron Pull up revision 1.204 (requested by itohy in ticket #160):
Add ukyopon(4).
 1.206.2.3 26-Feb-2007  yamt sync with head.
 1.206.2.2 30-Dec-2006  yamt sync with head.
 1.206.2.1 21-Jun-2006  yamt sync with head.
 1.213.6.1 22-Apr-2006  simonb Sync with head.
 1.213.4.1 09-Sep-2006  rpaulo sync with head
 1.213.2.1 18-Feb-2006  yamt sync with head.
 1.215.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.215.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.215.2.3 03-Sep-2006  yamt sync with head.
 1.215.2.2 11-Aug-2006  yamt sync with head
 1.215.2.1 01-Apr-2006  yamt sync with head.
 1.217.2.1 14-Aug-2006  tron Pull up following revision(s) (requested by elad in ticket #17):
sys/arch/sparc/conf/KRUPS: revision 1.38
sys/arch/i386/conf/XEN2_DOMU: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.197
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.53
sys/arch/evbsh5/conf/SIMULATOR: revision 1.12
sys/arch/sparc/conf/MRCOFFEE: revision 1.17
sys/arch/next68k/conf/GENERIC: revision 1.104
sys/arch/i386/conf/VIRTUALPC: revision 1.44
sys/arch/ews4800mips/conf/GENERIC: revision 1.11
sys/arch/evbsh5/conf/CAYMAN: revision 1.23
sys/arch/arc/conf/GENERIC: revision 1.141
sys/arch/amd64/conf/GENERIC: revision 1.103
sys/arch/sun3/conf/GENERIC3X: revision 1.90
sys/arch/evbarm/conf/HDL_G: revision 1.3
sys/arch/sun2/conf/GENERIC: revision 1.57
sys/arch/news68k/conf/GENERIC_TINY: revision 1.51
sys/arch/evbppc/conf/EXPLORA451: revision 1.27
sys/arch/amiga/conf/GENERIC.in: revision 1.54
sys/arch/mac68k/conf/GENERIC: revision 1.174
sys/arch/acorn26/conf/GENERIC: revision 1.45
sys/arch/shark/conf/GENERIC: revision 1.64
sys/arch/cesfic/conf/GENERIC: revision 1.44
sys/arch/mvme68k/conf/GENERIC: revision 1.68
sys/arch/i386/conf/XEN2_DOM0: revision 1.4
sys/arch/atari/conf/GENERIC.in: revision 1.63
sys/arch/amiga/conf/GENERIC: revision 1.240
sys/arch/i386/conf/LAMB: revision 1.65
sys/arch/i386/conf/GENERIC: revision 1.773
sys/arch/acorn32/conf/EB7500ATX: revision 1.26
sys/arch/x68k/conf/GENERIC: revision 1.128
sys/arch/vax/conf/GENERIC: revision 1.153
sys/arch/atari/conf/ATARITT: revision 1.81
sys/arch/mipsco/conf/GENERIC: revision 1.60
sys/arch/cobalt/conf/GENERIC: revision 1.101
sys/arch/evbarm/conf/ARMADILLO9: revision 1.13
sys/arch/ofppc/conf/GENERIC: revision 1.93
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.51
sys/arch/arc/conf/RPC44: revision 1.26
sys/arch/sparc64/conf/GENERIC: revision 1.59
sys/arch/i386/conf/XEN3_DOMU: revision 1.2
sys/arch/hp700/conf/GENERIC: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.47
sys/arch/macppc/conf/GENERIC: revision 1.231
sys/arch/dreamcast/conf/GENERIC: revision 1.72
sys/arch/news68k/conf/GENERIC: revision 1.80
sys/arch/hp300/conf/GENERIC: revision 1.133
sys/arch/mmeye/conf/GENERIC: revision 1.82
sys/arch/macppc/conf/MAMBO: revision 1.2
sys/arch/cats/conf/GENERIC: revision 1.107
sys/arch/atari/conf/FALCON: revision 1.79
sys/arch/acorn32/conf/GENERIC: revision 1.71
sys/arch/sparc/conf/GENERIC: revision 1.190
sys/arch/news68k/conf/LIBERO: revision 1.40
sys/arch/amiga/conf/DRACO: revision 1.114
sys/arch/cobalt/conf/INSTALL: revision 1.23
sys/arch/luna68k/conf/GENERIC: revision 1.73
sys/arch/bebox/conf/GENERIC: revision 1.100
sys/arch/pmax/conf/GENERIC: revision 1.147
sys/arch/amiga/conf/WSCONS: revision 1.52
sys/arch/macppc/conf/POWERMAC_G5: revision 1.2
sys/arch/alpha/conf/ALPHA: revision 1.218
sys/arch/sun3/conf/GENERIC: revision 1.133
sys/arch/prep/conf/GENERIC: revision 1.124
sys/arch/alpha/conf/GENERIC: revision 1.291
sys/arch/atari/conf/HADES: revision 1.71
sys/arch/newsmips/conf/GENERIC: revision 1.93
sys/arch/netwinder/conf/GENERIC: revision 1.82
sys/arch/hpcmips/conf/GENERIC: revision 1.190
sys/arch/amiga/conf/AMIGA: revision 1.98
sys/arch/sbmips/conf/GENERIC: revision 1.54
sys/arch/pc532/conf/GENERIC: revision 1.64
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.53
Disable SYSTRACE by default on all kernels (discussed with core)
 1.220.2.2 12-Jan-2007  ad Sync with head.
 1.220.2.1 18-Nov-2006  ad Sync with head.
 1.221.2.1 22-Oct-2006  yamt sync with head
 1.222.4.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.222.2.1 16-May-2007  jdc Removed (requested by pavel in ticket #645).

Merge GENERIC and ALPHA configuration, and remove the latter. ALPHA was
supposed to be a superset of GENERIC, but sometimes it was not kept up to
date.

As proposed on port-alpha@.
 1.19 26-Nov-2000  thorpej `babylon' no longer exists.
 1.18 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.17 12-Jul-2000  thorpej Change from `ncr' to `siop' by default.
 1.16 22-Mar-2000  cgd branches: 1.16.4;
add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.15 29-Jul-1999  augustss branches: 1.15.2;
It's time to be COMPAT_14.
 1.14 30-Apr-1999  cgd update comment re: COMPAT_OSF1
 1.13 18-Feb-1999  thorpej branches: 1.13.2; 1.13.4; 1.13.6;
Add floppy controller and drives.
 1.12 23-Jan-1999  drochner second round of mouse renaming: psm->pms
 1.11 14-Oct-1998  matt Sync with new IDE support (e.g. pciide changes)
 1.10 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.9 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.8 13-May-1998  thorpej No need to hard-code the mcclock offset on the gbus; gbus is direct-config.
 1.7 11-May-1998  thorpej Sync w/ reality
 1.6 24-Apr-1998  thorpej Whitespace sanity.
 1.5 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.4 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.3 12-Mar-1998  thorpej Bump maxusers to 64.
 1.2 13-Feb-1998  enami Remove comment which says that fxp is untested (it is known to work now).
Also, make model name closer to what driver prints startup.
 1.1 10-Feb-1998  thorpej Kernel for babylon.netbsd.org.
 1.13.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.13.4.2 02-Aug-1999  thorpej Update from trunk.
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 21-Jun-1999  cgd pull up rev(s) 1.14 from trunk. (cgd)
 1.15.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.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.16.4.1 12-Jul-2000  thorpej Update from trunk:
Change from `ncr' to `siop' by default.
 1.2 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.1 01-May-1996  cgd branches: 1.1.4;
the kernel config file for my 3000/300LX.
 1.1.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.53 18-Aug-2009  thorpej Delete some vanity configs, esp. now that the machines no longer exist.
 1.52 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.51 24-Nov-2008  ad branches: 1.51.4;
Remove softdep, pass 1. We are focused on improving journalling.

Proposed on tech-kern@.
 1.50 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.49 30-May-2008  tsutsui branches: 1.49.4; 1.49.6;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.48 14-Mar-2007  drochner branches: 1.48.36; 1.48.38; 1.48.40; 1.48.42;
It doesn't make sense to specify "configuration" and "interface"
locators for uhub because a hub can't have sub-devices.
This might be sanity-checked eventually.
Same for ubt now after the change to device attachment.
 1.47 27-Sep-2006  manu branches: 1.47.4; 1.47.8; 1.47.10;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.46 14-Aug-2006  skrll branches: 1.46.2; 1.46.4;
s/adpater/adapter/

Prompted by PR/34195
 1.45 26-Jul-2006  cube Remove "atapibus* at umass?" and "scsibus* at umass?" when there is
already an attachment to the interface attribute (atapi and scsi).

Part of PR#34085, although it is the contrary to what the submitter
suggests (which shows that having both in a config file can be confusing).
 1.44 05-Feb-2006  cube branches: 1.44.2;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.43 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.42 07-Dec-2005  tsutsui branches: 1.42.2; 1.42.4; 1.42.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.41 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.40 19-Aug-2005  christos 64 bit inode changes.
 1.39 05-Aug-2005  skrll Add (commented out) ucycom to various kernel configs.
 1.38 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.37 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.36 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.35 31-May-2005  tron branches: 1.35.2;
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.34 15-Apr-2005  itohy Add ukyopon(4).
 1.33 25-Mar-2005  cube Add attimer(4) configurations everywhere pcppi(4) exists, with the
following rule:
If a pcppi device is enabled for an attachment, enable an attimer for the
same attachement, otherwise comment it.
 1.32 25-Feb-2005  simonb branches: 1.32.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.31 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.30 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.29 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.28 24-Nov-2004  bouyer branches: 1.28.4; 1.28.6;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.27 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.26 23-Oct-2004  augustss s/uax/axe/
 1.25 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.24 13-Feb-2004  wiz branches: 1.24.2;
RealTek -> Realtek.
 1.23 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.22 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.21 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.20 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.19 08-Oct-2003  bouyer Add atabus
 1.18 10-Apr-2003  christos branches: 1.18.2;
Bye Bye UCONSOLE
 1.17 16-Feb-2003  augustss Add uax(4) (and url(4) in some cases).
 1.16 10-Feb-2003  grant add wi at pci and pcmcia, make comments consistent.
 1.15 30-Nov-2002  itohy White space police.
 1.14 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.13 22-Jul-2002  wiz Correct some commented out variables from ADW_DISABLE_* to SCSI_ADW_DISABLE_*.
From Julio Merino in port-alpha/17677.
 1.12 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.11 25-Apr-2002  atatat branches: 1.11.2; 1.11.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.10 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.9 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.8 10-Feb-2002  wiz Update description for icsphy.
 1.7 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.6 28-Dec-2001  augustss Update for new uhidev device attachment.
 1.5 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.4 22-Aug-2001  hubertf branches: 1.4.2;
More comment changes: 90x[B] -> 90x[BC]
 1.3 09-Jul-2001  soren branches: 1.3.2;
ncr(8) is gone from the tree, so remove ^#ncr*.
 1.2 26-Nov-2000  ad branches: 1.2.2;
lsu -> ld, by popular request.
 1.1 26-Nov-2000  thorpej Kernel config file for basil.shagadelic.org, my API UP1000 devel machine.
 1.2.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.1 26-Nov-2000  bouyer file BASIL was added on branch thorpej_scsipi on 2000-12-08 09:23:35 +0000
 1.3.2.7 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.3.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.4.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.4.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 22-Aug-2001  nathanw file BASIL was added on branch nathanw_sa on 2002-01-08 00:22:52 +0000
 1.11.4.2 26-Oct-2005  jmc Pullup (via patch) requested in ticket #5754 by itohy

Provide a backport for ukyopon(4) and pullup umodem(4) updates.
 1.11.4.1 01-Aug-2002  lukem Pull up revision 1.12 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.11.2.2 30-Aug-2002  gehenna catch up with -current.
 1.11.2.1 09-Jul-2002  gehenna catch up with -current.
 1.18.2.12 11-Dec-2005  christos Sync with head.
 1.18.2.11 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.10 01-Apr-2005  skrll Sync with HEAD.
 1.18.2.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.8 15-Feb-2005  skrll Sync with HEAD.
 1.18.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.18.2.6 29-Nov-2004  skrll Sync with HEAD.
 1.18.2.5 14-Nov-2004  skrll Sync with HEAD.
 1.18.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 15-Jul-2004  he branches: 1.24.2.1.2;
Pull up revision 1.25 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.24.2.1.2.2 21-Jul-2005  riz Pull up revision 1.34 (requested by itohy in ticket #1430):
Add ukyopon(4).
 1.24.2.1.2.1 02-Apr-2005  he Pull up revision 1.28 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.28.6.3 26-Mar-2005  yamt sync with head.
 1.28.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.6.1 12-Feb-2005  yamt sync with head.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.32.2.3 18-Jul-2005  riz Pull up revision 1.36 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.32.2.2 01-Jun-2005  riz Pull up revision 1.35 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.32.2.1 17-Apr-2005  tron Pull up revision 1.34 (requested by itohy in ticket #160):
Add ukyopon(4).
 1.35.2.3 03-Sep-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.42.6.1 22-Apr-2006  simonb Sync with head.
 1.42.4.1 09-Sep-2006  rpaulo sync with head
 1.42.2.1 18-Feb-2006  yamt sync with head.
 1.44.2.2 03-Sep-2006  yamt sync with head.
 1.44.2.1 11-Aug-2006  yamt sync with head
 1.46.4.1 22-Oct-2006  yamt sync with head
 1.46.2.1 18-Nov-2006  ad Sync with head.
 1.47.10.1 11-Jul-2007  mjf Sync with head.
 1.47.8.1 10-Apr-2007  ad Sync with head.
 1.47.4.1 24-Mar-2007  yamt sync with head.
 1.48.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.48.40.2 19-Aug-2009  yamt sync with head.
 1.48.40.1 04-May-2009  yamt sync with head.
 1.48.38.1 04-Jun-2008  yamt sync with head
 1.48.36.2 17-Jan-2009  mjf Sync with HEAD.
 1.48.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.49.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.49.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.49.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.51.4.2 24-Oct-2010  jym Sync with HEAD
 1.51.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14 22-May-2000  thorpej bishop.nas.nasa.gov and nostromo.nas.nasa.gov are no more.
 1.13 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.12 03-Dec-1999  thorpej Update my main Alpha development machine's kernel config file to
reflect current reality.
 1.11 29-Jul-1999  augustss branches: 1.11.2; 1.11.8;
It's time to be COMPAT_14.
 1.10 23-Jan-1999  drochner branches: 1.10.4;
second round of mouse renaming: psm->pms
 1.9 11-Aug-1998  thorpej Adapt to MII changes.
 1.8 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.7 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.6 20-May-1998  thorpej Add LOCKDEBUG (commented out).
 1.5 04-May-1998  thorpej Don't need options UVM and PMAP_NEW anymore; they're now standard.
 1.4 24-Apr-1998  thorpej Whitespace sanity.
 1.3 16-Apr-1998  thorpej Add pcppi/spkr drivers, and use DHCP for NFS boots.
 1.2 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.1 26-Mar-1998  thorpej Kernel config file for bishop.nas.nasa.gov and ripley.nas.nasa.gov,
AlphaStation 500 and AlphaStation 600, respectively.
 1.10.4.1 02-Aug-1999  thorpej Update from trunk.
 1.11.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.26 22-May-2000  thorpej These systems haven't been available to NetBSD/alpha developers
for a very very very long time, and there are more up-to-date
example configs for the BUNNY case.
 1.25 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.24 29-Jul-1999  augustss branches: 1.24.2;
It's time to be COMPAT_14.
 1.23 23-Jan-1999  drochner branches: 1.23.4;
second round of mouse renaming: psm->pms
 1.22 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.21 24-Apr-1998  thorpej Whitespace sanity.
 1.20 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.19 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.18 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.17 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.16 06-Apr-1997  cgd branches: 1.16.4;
clean up NetBSD RCS ID strings
 1.15 31-Jan-1997  cgd add KMEMSTATS to ALPHA, clean up ports diagnostic/debug options
 1.14 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.13 15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.12 25-Nov-1996  cgd branches: 1.12.2; 1.12.4;
update for recent configuration changes.
 1.11 19-Nov-1996  cgd update for VGA changes, and clean up slightly.
 1.10 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.9 27-Sep-1996  cgd update for changes to config.
 1.8 16-Sep-1996  cgd add EISAVERBOSE, TCVERBOSE as appropriate. Add UCONSOLE to all.
slight cleanup + sync.
 1.7 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.6 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.5 17-Apr-1996  cgd branches: 1.5.4;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.4 15-Apr-1996  cgd update for current state
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd update for all the latest bells and whistles
 1.1 27-Jun-1995  cgd update for current configuration descriptions
 1.5.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.12.4.3 30-Jan-1997  thorpej update from trunk
 1.12.4.2 18-Jan-1997  thorpej Update from trunk.
 1.12.4.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.12.2.5 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.2.4 01-Feb-1997  cgd for now, pckbd is needs-count, and therefore can't be cloning
 1.12.2.3 31-Jan-1997  cgd sync with trunk
 1.12.2.2 25-Jan-1997  cgd sync up, update all for new definitions, add back tga devices
 1.12.2.1 24-Jan-1997  cgd sync with trunk
 1.16.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.4.1 02-Aug-1999  thorpej Update from trunk.
 1.24.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 22-May-2000  thorpej Rename CANE to MINI-ME to reflect that my Multia hasn't been
parked at my (former) NASA office for quite some time.
 1.7 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.6 29-Jul-1999  augustss branches: 1.6.2;
It's time to be COMPAT_14.
 1.5 18-Feb-1999  thorpej branches: 1.5.4;
Add floppy controller and drives.
 1.4 26-Jan-1999  thorpej Update.
 1.3 23-Jan-1999  drochner second round of mouse renaming: psm->pms
 1.2 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.1 07-Jun-1998  thorpej Kernel configuration for my Multia, an example of how to configure a
Multia w/ PCMCIA support.
 1.5.4.1 02-Aug-1999  thorpej Update from trunk.
 1.6.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.4 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.3 17-Apr-1996  cgd branches: 1.3.4;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.2 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.32 29-Dec-2000  mycroft No need for this to be checked in any more.
 1.31 14-Dec-2000  mycroft Sync with -current, add COMPAT_LINUX.
 1.30 26-Nov-2000  ad lsu -> ld, by popular request.
 1.29 12-Nov-2000  mycroft Sync with GENERIC.
 1.28 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.27 14-Jun-2000  veego Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.26 31-May-2000  mycroft Yessiree! It's softdep time!
 1.25 25-May-2000  mycroft branches: 1.25.2;
Add ipfilter-related stuff.
 1.24 23-May-2000  thorpej Note that KN300 is also for AlphaServer 1200.
 1.23 19-Apr-2000  haya Changes the name of RealTek driver. The new name is `rtk'. This used
to be called `rl' and it conflict with RL vax disks, canonical and
historical unix driver name.

This changes are minimal: it only changes the name of RealTek driver.
The filename of source code and a lot of the letter `rl' in source
files should be changed shortly.
 1.22 03-Apr-2000  mycroft Enable de, since tlp doesn't support one of my cards.
 1.21 03-Apr-2000  augustss Add atapibus* at umass?
 1.20 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.19 27-Feb-2000  mycroft Force polling on pcic, so I get another IRQ for cards.
 1.18 25-Feb-2000  mycroft Add Aviator/RayLink.
 1.17 25-Feb-2000  mycroft Add more PCMCIA stuff, nuke PNP.
 1.16 25-Jan-2000  augustss Update for the ucom(4) addition.
 1.15 19-Jan-2000  mycroft Sync, +IPv6.
 1.14 17-Jan-2000  augustss Add USB-Ethernet adapters.
 1.13 08-Nov-1999  mycroft branches: 1.13.2;
Kill wsmux. DIE DIE DIE!
 1.12 07-Nov-1999  mycroft Make this a little more current.
 1.11 29-Jul-1999  augustss branches: 1.11.2; 1.11.4; 1.11.6;
It's time to be COMPAT_14.
 1.10 31-Mar-1999  mycroft branches: 1.10.4;
Enable rnd.
 1.9 29-Mar-1999  mycroft Add mpu at isapnp, currently commented out.
 1.8 22-Mar-1999  mycroft More PnP/audio goo. Need an Alpha joystick driver. B-)
 1.7 06-Mar-1999  mycroft Update for psm -> pms conversion.
 1.6 05-Mar-1999  mycroft XXX Disable PnP until pcic_isapnp works on this port.
 1.5 18-Feb-1999  mycroft Okay; pcic_isapnp doesn't quite work yet.
 1.4 18-Feb-1999  mycroft Add pcic_isapnp.
 1.3 18-Feb-1999  mycroft Add a floppy drive.
 1.2 18-Feb-1999  mycroft Add:
* PCI VGA (tested with Imagine-128)
* ISA SoundBlaster (tested with SB1!)
* AudioPCI (tested with ... AudioPCI!)
* PnP SoundBlaster (currently loses in 16-bit mode due to extent lossage)
* SonicVibes (currently loses; see sv.c commit log)
 1.1 06-Feb-1999  mycroft Config for for an AS200 with TGA/WSS/PCMCIA (although the TGA and PCMCIA aren't
fully functional yet).
 1.10.4.1 02-Aug-1999  thorpej Update from trunk.
 1.11.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.4.1 14-Nov-1999  fvdl Sync with -current.
 1.11.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.11.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.11.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.13.2.2 08-Nov-1999  mycroft Kill wsmux. DIE DIE DIE!
 1.13.2.1 08-Nov-1999  mycroft file ENIWETOK was added on branch comdex-fall-1999 on 1999-11-08 06:19:55 +0000
 1.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.57 18-Aug-2009  thorpej Delete some vanity configs, esp. now that the machines no longer exist.
 1.56 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.55 24-Nov-2008  ad branches: 1.55.4;
Remove softdep, pass 1. We are focused on improving journalling.

Proposed on tech-kern@.
 1.54 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.53 30-May-2008  tsutsui branches: 1.53.4; 1.53.6;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.52 14-Mar-2007  drochner branches: 1.52.36; 1.52.38; 1.52.40; 1.52.42;
It doesn't make sense to specify "configuration" and "interface"
locators for uhub because a hub can't have sub-devices.
This might be sanity-checked eventually.
Same for ubt now after the change to device attachment.
 1.51 27-Sep-2006  manu branches: 1.51.4; 1.51.8; 1.51.10;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.50 14-Aug-2006  skrll branches: 1.50.2; 1.50.4;
s/adpater/adapter/

Prompted by PR/34195
 1.49 05-Feb-2006  cube branches: 1.49.2;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.48 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.47 07-Dec-2005  tsutsui branches: 1.47.2; 1.47.4; 1.47.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.46 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.45 19-Aug-2005  christos 64 bit inode changes.
 1.44 05-Aug-2005  skrll Add (commented out) ucycom to various kernel configs.
 1.43 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.42 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.41 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.40 31-May-2005  tron branches: 1.40.2;
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.39 15-Apr-2005  itohy Add ukyopon(4).
 1.38 25-Mar-2005  cube Add attimer(4) configurations everywhere pcppi(4) exists, with the
following rule:
If a pcppi device is enabled for an attachment, enable an attimer for the
same attachement, otherwise comment it.
 1.37 25-Feb-2005  simonb branches: 1.37.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.36 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.35 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.34 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.33 24-Nov-2004  bouyer branches: 1.33.4; 1.33.6;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.32 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.31 23-Oct-2004  augustss s/uax/axe/
 1.30 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.29 13-Feb-2004  wiz branches: 1.29.2;
RealTek -> Realtek.
 1.28 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.27 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.26 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.25 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.24 08-Oct-2003  bouyer Add atabus
 1.23 10-Apr-2003  christos branches: 1.23.2;
Bye Bye UCONSOLE
 1.22 16-Feb-2003  augustss Add uax(4) (and url(4) in some cases).
 1.21 10-Feb-2003  grant add wi at pci and pcmcia, make comments consistent.
 1.20 30-Nov-2002  itohy White space police.
 1.19 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.18 22-Jul-2002  wiz Correct some commented out variables from ADW_DISABLE_* to SCSI_ADW_DISABLE_*.
From Julio Merino in port-alpha/17677.
 1.17 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.16 25-Apr-2002  atatat branches: 1.16.2; 1.16.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.15 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.14 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.13 10-Feb-2002  wiz Update description for icsphy.
 1.12 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.11 28-Dec-2001  augustss Update for new uhidev device attachment.
 1.10 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.9 22-Aug-2001  hubertf branches: 1.9.2;
More comment changes: 90x[B] -> 90x[BC]
 1.8 09-Jul-2001  soren branches: 1.8.2;
ncr(8) is gone from the tree, so remove ^#ncr*.
 1.7 24-Sep-2000  jdolecek branches: 1.7.2;
don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.6 11-Aug-2000  thorpej Add depca at eisa.
 1.5 14-Jun-2000  veego branches: 1.5.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.4 08-Jun-2000  thorpej Add the `rnd' driver.
 1.3 23-May-2000  thorpej branches: 1.3.2;
Add an MP version of this config, and add come commented out
debugging options.
 1.2 23-May-2000  thorpej Note that KN300 is also for AlphaServer 1200.
 1.1 23-May-2000  thorpej Add kernel config for my AlphaServer 1200 MP hacking box.
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 11-Aug-2000  thorpej Pullup from trunk:
Add depca at eisa.
 1.7.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.7.2.1 24-Sep-2000  bouyer file FRAU-FARBISSINA was added on branch thorpej_scsipi on 2000-11-20 19:56:42 +0000
 1.8.2.7 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.8.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.8.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.9.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.9.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.9.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.9.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.9.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.9.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.9.2.1 22-Aug-2001  nathanw file FRAU-FARBISSINA was added on branch nathanw_sa on 2002-01-08 00:22:52 +0000
 1.16.4.2 26-Oct-2005  jmc Pullup (via patch) requested in ticket #5754 by itohy

Provide a backport for ukyopon(4) and pullup umodem(4) updates.
 1.16.4.1 01-Aug-2002  lukem Pull up revision 1.17 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.16.2.2 30-Aug-2002  gehenna catch up with -current.
 1.16.2.1 09-Jul-2002  gehenna catch up with -current.
 1.23.2.12 11-Dec-2005  christos Sync with head.
 1.23.2.11 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.10 01-Apr-2005  skrll Sync with HEAD.
 1.23.2.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.8 15-Feb-2005  skrll Sync with HEAD.
 1.23.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.23.2.6 29-Nov-2004  skrll Sync with HEAD.
 1.23.2.5 14-Nov-2004  skrll Sync with HEAD.
 1.23.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.2.1 15-Jul-2004  he branches: 1.29.2.1.2;
Pull up revision 1.30 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.29.2.1.2.2 21-Jul-2005  riz Pull up revision 1.39 (requested by itohy in ticket #1430):
Add ukyopon(4).
 1.29.2.1.2.1 02-Apr-2005  he Pull up revision 1.33 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.33.6.3 26-Mar-2005  yamt sync with head.
 1.33.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.6.1 12-Feb-2005  yamt sync with head.
 1.33.4.1 29-Apr-2005  kent sync with -current
 1.37.2.3 18-Jul-2005  riz Pull up revision 1.41 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.37.2.2 01-Jun-2005  riz Pull up revision 1.40 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.37.2.1 17-Apr-2005  tron Pull up revision 1.39 (requested by itohy in ticket #160):
Add ukyopon(4).
 1.40.2.3 03-Sep-2007  yamt sync with head.
 1.40.2.2 30-Dec-2006  yamt sync with head.
 1.40.2.1 21-Jun-2006  yamt sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.47.2.1 18-Feb-2006  yamt sync with head.
 1.49.2.1 03-Sep-2006  yamt sync with head.
 1.50.4.1 22-Oct-2006  yamt sync with head
 1.50.2.1 18-Nov-2006  ad Sync with head.
 1.51.10.1 11-Jul-2007  mjf Sync with head.
 1.51.8.1 10-Apr-2007  ad Sync with head.
 1.51.4.1 24-Mar-2007  yamt sync with head.
 1.52.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.52.40.2 19-Aug-2009  yamt sync with head.
 1.52.40.1 04-May-2009  yamt sync with head.
 1.52.38.1 04-Jun-2008  yamt sync with head
 1.52.36.2 17-Jan-2009  mjf Sync with HEAD.
 1.52.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.53.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.53.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.53.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.55.4.2 24-Oct-2010  jym Sync with HEAD
 1.55.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2 18-Aug-2009  thorpej Delete some vanity configs, esp. now that the machines no longer exist.
 1.1 23-May-2000  thorpej branches: 1.1.6; 1.1.136; 1.1.150;
Add an MP version of this config, and add come commented out
debugging options.
 1.1.150.1 24-Oct-2010  jym Sync with HEAD
 1.1.136.1 19-Aug-2009  yamt sync with head.
 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-May-2000  bouyer file FRAU-FARBISSINA.MP was added on branch thorpej_scsipi on 2000-11-20 19:56:42 +0000
 1.3 18-Aug-2009  thorpej Delete some vanity configs, esp. now that the machines no longer exist.
 1.2 20-Nov-2001  lukem branches: 1.2.122; 1.2.136;
cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.1 02-Sep-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Profiling version of the FRAU-FARBISSINA kernel.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 08-Jan-2002  nathanw Catch up to -current.
 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 02-Sep-2000  bouyer file FRAU-FARBISSINA.PROF was added on branch thorpej_scsipi on 2000-11-20 19:56:43 +0000
 1.2.136.1 24-Oct-2010  jym Sync with HEAD
 1.2.122.1 19-Aug-2009  yamt sync with head.
 1.421 06-Mar-2024  thorpej Tidy up TLSB autoconfiguration just a bit.
 1.420 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.419 17-Dec-2023  andvar s/keyboad/keyboard/ in wsmux description comment.
 1.418 09-Feb-2023  abs Adjust _all_ cinclude of *.local files

- Ensure always at end
- Use tab rather than spaces
- Add consistent comment
"Pull in optional local configuration - always at end"

The only functional change is that a local file which tried to
override an existing setting (eg with "no foo") would have failed
in some cases before, but now will work
 1.417 22-Dec-2022  nat Driver for DaynaPORT SCSI/Link (dse.4).

Written by Hiroshi Noguchi, of which an updated version was posted to
port-mac68k in 2001.

Attachments were added to kernel configs for platforms that already had
the Cabletron (se.4) driver added, although other platorms may benefit.

Reviewed on tech-net by Izumi Tsutsui.
 1.416 29-Sep-2022  riastradh swwdog(4): Add to GENERIC kernels.

Plus a handful of others that I'm familiar with. Lots of special-
purpose kernels should probably have this too but I'm not going
through all the arm, mips, and ppc evaluation board kernels to see
which ones are relevant.

Omitted from systems I know to be very small:
- sun2/GENERIC
- dreamcast/GENERIC
Feel free to remove it from others that need to be kept smaller.

Compile-tested a few of these just in case:
- alpha/GENERIC
- amd64/GENERIC
- evbmips/OCTEON
- i386/GENERIC
- riscv/GENERIC

PR kern/29702
 1.415 07-Aug-2022  simonb UFS/LFS dirhash:
- Enable UFS_DIRHASH if the architecture or kernel model specific config
file can use 128MB of RAM or more.
- Remove experimental tag from UFS_DIRHASH; it's been with RUMP kernel
and by a number of NetBSD developers for years.
- Add LFS_DIRHASH if LFS was enabled.
- Be somewhat consistent with FS options order.
 1.414 09-Sep-2021  jakllsch Add optional GENERIC.local include in alpha's GENERIC.
 1.413 23-Jul-2021  thorpej Use wildcard matches more consistently, and attach pci, eisa, isa, and
usb to their interface attributes, which makes for easier trimming-down
with "no" directives.
 1.412 29-Jun-2021  nia Remove uscanner(4) driver

This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.
 1.411 28-May-2021  msaitoh Add ixg* (commented out). Tested with rin@'s AlphaServer DS10.
 1.410 28-Sep-2020  thorpej branches: 1.410.6; 1.410.8;
Fix typo in rev 1.408.
 1.409 27-Sep-2020  thorpej Add a "qemu" driver to access services provided by the Qemu VM. First
order of business is to use the Qemu "get-time" console service call as
the perferred system timecounter.
 1.408 27-Sep-2020  roy vether: Add to kernel configurations

It's only enabled if the kernel enabled bridge AND tap.
Otherwise it's commented out.
 1.407 05-Sep-2020  thorpej Add siisata.
 1.406 05-Sep-2020  thorpej Build GENERIC with debug symbols, not just GENERIC.MP.
 1.405 29-Aug-2020  thorpej Enable DIAGNOSTIC by default in -current. Should be commented out
in release branches. Add commented-out LOCKDEBUG option.
 1.404 16-Aug-2020  jdolecek make COMPAT_LINUX option disabled by default

leave the option enabled only in amd64/i386 ALL kernels to make
sure it continues to be compilable also when included in kernel
 1.403 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.402 16-May-2020  maya Remove uyap, USB YAP phone firmware loader.

And the associated ezload EZ-USB code, which is only used by uyap.
It could theoretically be used by other drivers, but none of them are
in tree.

I suspect that this device isn't in use, as phone technology has improved
a lot since 2001 when uyap(4) was added to the tree.

Proposed with no objections on netbsd-users on 13 April 2020
 1.401 25-Mar-2020  jdolecek remove 'file-system SMBFS' and 'pseudo-device nsmb' from all kernel configs
to prepare for their eventual removal
 1.400 25-Jan-2020  thorpej Retire "le* at pci?" from the shipped kernel configs:
- If the config had both an le@pci and a pcn, simply remove le@pci
(pcn would match at a higher priority anyway).
- If the config had le@pci enabled, but no pcn, change le@pci to pcn.
- If the config had le@pci commented out, but no pcn, change le@pci
to pcn and leave it commented out.

The pcn driver supports more chips than le@pci and does DMA directly
to/from mbufs rather than memory copies.
 1.399 20-Jan-2020  thorpej Remove FDDI support.
 1.398 19-Jan-2020  thorpej Remove HIPPI support and the esh(4) driver that uses it. There have not
been any users of HIPPI for some time, and it is unlikely to be resurrected.
 1.397 19-Jan-2020  thorpej Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.396 09-Aug-2019  rin branches: 1.396.2;
Add CONSPEED option, which changes baud rate of serial console.
 1.395 09-Aug-2019  rin Add xhci(4). Just working for me.
 1.394 26-Apr-2019  sevan Enable BUFQ_PRIOCSCAN, CARP, Veriexec by default in GENERIC kernel configs.
On ports without a GENERIC kernel config enable in individul files, e.g evbmips.
Omit on:
atari, dreamcast, emips, epoc32, evbppc/VIRTEX*, ia64, luna68x, mvme68k,
mvmeppc, playstation2, riscv, sun2, sun3, x68k, zaurus due to resource
constraints or port infancy.
 1.393 13-Apr-2019  isaki Add drvctl to kernel which has audio device.
audiocfg(1) requires drvctl(4).
 1.392 05-Apr-2019  thorpej Add (commented out) MODULAR-related options.
 1.391 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.390 16-Mar-2019  maxv Disable COMPAT_OSF1, will be removed.
 1.389 06-Feb-2019  rin Add ure(4) to kernel config files. Also add PHY drivers where necessary.
 1.388 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.387 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.386 06-Sep-2018  maxv Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.385 25-Aug-2018  rin Add (commented out) mue(4) to where appropriate.
Also add MII/PHY drivers for USB NICs if missing.
 1.384 01-Aug-2018  maxv Unreference IPF/PF from all the config files, and enable NPF instead when
wanted. This also fixes some inconsistencies I saw in several files (eg
IPF options while IPF was not compiled, IPF+PF enabled by default, etc).
 1.383 07-Jun-2018  thorpej branches: 1.383.2;
Revert changes that pinned-down i2c parent specs. The i2c subsystem
has been enhanced to make this unnecessary.
 1.382 15-May-2018  thorpej Actully, we can STAR the iic instances (the configuration code can
handle pinned pspecs to STAR'd potential parents).
 1.381 14-May-2018  jakllsch Move iic0 at alipm? to iic1. Using iic0 will conflict with the
iic0 at tsciic? on the API CS20.

XXX: Enumerate the similar-to-DS20L I2C devices on the CS20, which
IIRC are not all on the tsciic(4) I2C bus, and comment GENERIC
accordingly.
 1.380 14-May-2018  thorpej Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.
 1.379 23-Jan-2018  sevan branches: 1.379.2;
Alternate buffer queue strategies no longer considered experimental, update
description.

Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.378 14-Sep-2017  mrg clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.377 13-Sep-2017  sevan Remove support for VERIFIED_EXEC_FP_RMD160, VERIFIED_EXEC_FP_SHA1, and VERIFIED_EXEC_FP_MD5 options.
These algorithms are either broken or on their way to being broken.

Discussed on tech-security
http://mail-index.netbsd.org/tech-security/2017/08/21/msg000936.html

ok riastradh
 1.376 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.375 13-Dec-2016  christos branches: 1.375.8;
wildcard speaker attachments, now that we can handle many of them.
 1.374 10-Dec-2016  christos remove VAUDIOSPEAKER for now, will be done differently.
 1.373 09-Dec-2016  christos kill PCPPISPEAKER
 1.372 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.371 26-Nov-2016  christos mention PAX_SEGVGUARD dependency on FILEASSOC
 1.370 20-Nov-2016  macallan add driver for Permedia 3 based graphics devices
from Naruaki Etomi, via PR 49518
 1.369 15-Oct-2016  flxd Add tcu and gpio for TC-USB support. OK christos@
 1.368 19-Mar-2016  gdt branches: 1.368.2;
Disable uscanner in all kernel configs

As discussed on current-users@, SANE uses ugen via libusb and not
uscanner, so users are not well served by having uscanner. Consensus
is that addressing how to adjust permissions for scanners should not
block restoring basic functionionality.

(Compile-tested only, but there are multiple reports of this being the
right approach.)
 1.367 20-Jan-2016  jklos Change base address to account for later Alpha models with later firmware
which require more space for SRM.
 1.366 26-Sep-2015  maxv Disable PAX_SEGVGUARD.

We actually have a big problem: the fileassocs are never deleted.
Therefore, if a user generates a lot of buggy binaries and launches them
all, the kernel will allocate memory again again and again for all these
entries and will never free them (unless the files are deleted from the
disk). Which means that a user can too easily put the kernel under memory
pressure.
 1.365 08-Aug-2015  maxv Remove KMEMSTATS.
 1.364 06-Jan-2015  macallan attach wsdisplay at wsemuldisplaydev instead of every single driver
 1.363 17-Dec-2014  macallan add pm2fb
 1.362 16-Nov-2014  manu branches: 1.362.2;
Remove unused extended attributes kernel options

As Masao Uebayashi pointed to me, UFS_EXTATTR_AUTOSTART, LFS_EXTATTR_AUTOSTART
and UFS_EXTATTR_AUTOCREATE are not used anywhere in the code. Remove them
as they have been obsolete for a long time:
UFS_EXTATTR_AUTOSTART was replaced by mount -o extattr
LFS_EXTATTR_AUTOSTART was created to match obsolete UFS_EXTATTR_AUTOSTART
UFS_EXTATTR_AUTOCREATE was replaced by sysctl vfs.ffs.extattr_autocreate
 1.361 12-Nov-2014  manu Support for UFS1 extended attributes in GENERIC and GENERIC-like kernels

This change just brings UFS1 extended attribute *support* in the kernel,
extended attributes are not enabled unless three conditions are met:
1) filesystem is UFS1 (newfs -O1)
2) .attribute/system and .attribute/user directories are created at fs root
3) filesystem is mounted with -o extattr

Some GENERIC kernels are obviously memory constrained, the extended
attributes options were not enabled for them, but just added commented out.
(kernel were considered memory constrained if QUOTA option was disabled)
 1.360 23-Aug-2014  dholland Systematize (and in many cases, fix) the comments on options COMPAT_NN.

There are quite a few configs that are missing some COMPAT_NN options
in ways that don't make sense; this should probably get cleaned up
too, but for the time being I've not added or removed anything.
 1.359 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.358 21-Feb-2014  jdc branches: 1.358.4;
Add tsciic and more (commented out) DS20L i2c devices.
 1.357 20-Jan-2014  tsutsui Add and enable radeonfb(4) at pci with options RADEONFB_DEPTH_32.

Requested and tested (with wsfb Xorg server) by Naruaki Etomi in PR/48431.
 1.356 23-Dec-2013  skrll Revert previous commit. It was an accident.
 1.355 18-Dec-2013  skrll Silence gcc 4.8
 1.354 15-Oct-2013  jdc Add devices:
ISA soundblaster (#sb* at isapnp? tested on PC164LX)
Broadcom 570x ethernet (supported cards in DS20L, etc.)
ALI M7101 SMBus controller (found in DS20L)
(commented out) LM81/LM87 enviromental monitoring (found in DS20L)
 1.353 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.352 05-Jun-2013  christos branches: 1.352.2;
remove obsolete networking options
 1.351 27-Apr-2013  christos more bogus number removal
 1.350 27-Apr-2013  christos the bogus number police
 1.349 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.348 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.347 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.346 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.345 17-Aug-2012  abs branches: 1.345.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

Some of the INSTALL configs for larger memory machines are probably suitable
for adding WSDISPLAY_COMPAT_USL.

Now wsconscfg(8) should be able to switch VTs when expected.

Implemented after no objection from tech-kern to the following:

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.344 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.343 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.342 22-Nov-2011  tls branches: 1.342.2;

The rnd pseudo-device is not really optional, because it is in the same
source file as the entropy-pool code itself. Move it to std. This
will be cleaned up more when I split the sources up as they should be.

This fixes build breaks on several ports. Thanks to Havard Eidnes for
pointing them out.
 1.341 23-Jul-2011  jakllsch branches: 1.341.2;
Enable or note aubtfwl(4) wherever ubt(4) is enabled or noted.
 1.340 30-Jun-2011  wiz dependant -> dependent
 1.339 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.338 23-Nov-2010  hannken branches: 1.338.2; 1.338.4;
Remove unused count from pseudo-device md.
 1.337 22-May-2010  plunky add btmagic(4) where other Bluetooth drivers are listed
 1.336 08-May-2010  mrg enable IPFILTER_COMPAT in all kernels that have ipfilter already.
canonicalise several of the ipf option segments in various files
(this mostly means adding commented out IPFILTER_DEFAULT_BLOCK,
or adding commented or uncommented IPFILTER_LOG or IPFILTER_LOOKUP
option statements.)

i built about 20 of these kernels to check, but not all of them.
 1.335 29-Apr-2010  chs enable TMPFS in all GENERICs that have MFS enabled.
 1.334 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.333 07-Apr-2010  jakllsch Clean up accidential commit.
 1.332 07-Apr-2010  jakllsch satafis:
- Add function to parse RDH FIS for use in implementing AT_READREG.
- Correct and clean up some structure definitions.
- Sprinkle a bit of const.
- Remove dependency on <dev/ic/wdcreg.h>, WDCTL_4BIT doesn't seem
to be specified by any recent ATA standard, and it seems to make
no difference in practice.
- Stop using WDSD_IBM, these bits have been obsolete since before SATA.

siisata:
- Implement AT_READREG.
- Reap now-unneeded <dev/ic/wdcreg.h>.
- Whitespace and slight debug code cleanup.
- Some possibly-uncessary code reordering.

ahcisata:
- Implement AT_READREG.
- Reap now-unneeded <dev/ic/wdcreg.h>.
 1.331 07-Mar-2010  plunky branches: 1.331.2;
add uhso(4) device where appropriate
- follow the lead of other USB driver declarations wrt commented out
- (cross-)build tested all these kernels
 1.330 05-Dec-2009  pooka branches: 1.330.2;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.329 14-Sep-2009  mhitch Add the I2O iop controller, as used in the ES40 and ES45.
 1.328 24-Jan-2009  mrg add COMPAT_50 to all the configs with COMPAT_40.
 1.327 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

Proposed on tech-kern@.
 1.326 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.325 10-Aug-2008  tls branches: 1.325.2; 1.325.4; 1.325.8;
Add accept filters to GENERIC kernels where they exist.
 1.324 31-Jul-2008  simonb Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.323 30-May-2008  tsutsui branches: 1.323.4;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.322 07-Jan-2008  christos branches: 1.322.6; 1.322.8; 1.322.10; 1.322.12;
Add PaX ASLR for testing
 1.321 31-Dec-2007  ad Remove systrace. Ok core@.
 1.320 02-Dec-2007  kiyohara branches: 1.320.6;
Add bcsp(4).
 1.319 04-Nov-2007  xtraeme branches: 1.319.2;
Remove System V semaphores and share memory options to set the limits:
SEMMNI, SEMMNS, SEMUME and SHMMAXPGS.

They can be tweaked via sysctl now. Ports that were setting values on
them weren't touched, I only removed the ones that were commented out.
 1.318 17-Oct-2007  garbled 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.317 21-Aug-2007  kiyohara branches: 1.317.2; 1.317.6;
Add slhci at pcmcia.
And reorder.
 1.316 20-Aug-2007  kiyohara Add btbc(4).
 1.315 06-Aug-2007  adrianp Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.314 24-Jun-2007  christos branches: 1.314.2; 1.314.4; 1.314.8;
Add options FILEASSOC; needed for veriexec.
 1.313 04-Jun-2007  martin Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.312 14-Mar-2007  drochner branches: 1.312.6;
It doesn't make sense to specify "configuration" and "interface"
locators for uhub because a hub can't have sub-devices.
This might be sanity-checked eventually.
Same for ubt now after the change to device attachment.
 1.311 01-Mar-2007  kiyohara branches: 1.311.2; 1.311.4;
Add btuart(4).
 1.310 09-Feb-2007  ad branches: 1.310.2;
Merge newlock2 to head.
 1.309 06-Jan-2007  pavel more spaces -> tabs.
 1.308 06-Jan-2007  pavel spaces -> tabs in the new zstty lines.
 1.307 04-Jan-2007  pavel Merge GENERIC and ALPHA configuration, and remove the latter. ALPHA was
supposed to be a superset of GENERIC, but sometimes it was not kept up to
date.

As proposed on port-alpha@.
 1.306 01-Jan-2007  pavel Explicitely configure zstty2 at zsc1. The corresponding /dev special file
is /dev/ttyB1 which has minor 2. If this serial port becomes zstty1,
/dev/ttyB1 becomes unusable because the minor number does not match. (The
problem was introduced when we started using the zstty(4) driver instead of
the scc(4) driver between NetBSD 1.6 and 2.0.)

Suggested by Bill Studenmund a long time ago.

Tested on DEC 3000 - 300LX and DEC 3000 - M600.
 1.305 11-Dec-2006  tsutsui Reduce diffs between GENERIC and INSTALL.
 1.304 09-Dec-2006  tsutsui Use "options<space><tab>"
 1.303 09-Dec-2006  tsutsui Add pcn(4) at pci. Tested on AlphaPC164.
 1.302 04-Dec-2006  tsutsui Add the following network devices:
- wm* at pci?
- makphy* at mii?
- rgephy* at mii?
- rlphy* at mii?
Tested with RTL8139C, RTL8169S-32, and i82544EI on EB164.
 1.301 11-Nov-2006  jmmv branches: 1.301.2;
Remove tmpfs's experimental status. OK'ed by core@.
 1.300 27-Sep-2006  manu - Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.299 26-Sep-2006  elad Oops! forgot "options" in previous commit. Pointed out by freza@, thanks!
 1.298 26-Sep-2006  elad Make PaX mprotect(2) restrictions more accessible.

On amd64, sparc64, i386, and alpha, they will be compiled in and disabled
by default. That means that to use them you either enable the "global"
knob with sysctl, or use paxctl(1) to enable it on a per-program basis.

On sparc and macppc just include a commentd out line in the GENERIC kernel.
 1.297 14-Sep-2006  plunky branches: 1.297.2;
add bluetooth capability to alpha port
 1.296 01-Sep-2006  dyoung branches: 1.296.2;
Delete ath, it is known to be broken on alpha.
 1.295 01-Sep-2006  dyoung Add ath(4) to GENERIC alpha kernel. UNTESTED.
 1.294 26-Aug-2006  christos PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.293 26-Aug-2006  tsutsui Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.292 14-Aug-2006  skrll s/adpater/adapter/

Prompted by PR/34195
 1.291 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.290 31-Jul-2006  hubertf branches: 1.290.2;
spc(4) can also attach to pcmcia(4), as was already in hpcmips/GENERIC
for quite some time. Add it to all systems that have pcmcia SCSI.

Pointed out by Bj�rn Johannesson <rherdware@yahoo.com> in private mail,
OK'd by matt@
 1.289 26-Jul-2006  cube Remove "atapibus* at umass?" and "scsibus* at umass?" when there is
already an attachment to the interface attribute (atapi and scsi).

Part of PR#34085, although it is the contrary to what the submitter
suggests (which shows that having both in a config file can be confusing).
 1.288 28-Jun-2006  liamjfoy Add CARP to GENERIC kernel configs. CARP is not enabled by default.

ok: christos
 1.287 22-May-2006  mrg branches: 1.287.2;
add NULLFS and re(4) (both tested.)
 1.286 28-Mar-2006  pavel branches: 1.286.2;
Add stf to all kernel configs which have INET6 and gif, except the INSTALL
ones and those for specific machines of developers. PR 32304.

OK'ed by rpaulo.

N.B. stf is a cloning device, so it still must be enabled by
"ifconfig stf0 create".
 1.285 05-Feb-2006  cube branches: 1.285.2; 1.285.4; 1.285.6;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.284 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.283 02-Feb-2006  reinoud branches: 1.283.2;
Add commented out UDF file-system entry in all GENERIC configurations.
 1.282 09-Dec-2005  elad branches: 1.282.2; 1.282.4;
Add (commented out) Veriexec options and pseudo-device to GENERIC kernels,
and remove the i386 GENERIC_VERIEXEC config.
 1.281 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.280 25-Nov-2005  thorpej swcr -> swcrypto
 1.279 25-Nov-2005  thorpej "pseudo-device crypto" really refers to the /dev/crypto API to the
opencrypto framework, not the framework itself. Update the comment
accordingly.
 1.278 25-Nov-2005  thorpej Add "pseudo-device swcr" (commented out if "pseudo-device crypto" is also
commented out).
 1.277 03-Nov-2005  chs branches: 1.277.2;
turn off DEBUG and DIAGNOSTIC in GENERIC kernels so that they
are compatible with the LKMs that are part of the release.
 1.276 29-Sep-2005  abs If we're enabling ipfilter then we should really have IPFILTER_LOG
 1.275 10-Sep-2005  jmmv Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.274 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.273 19-Aug-2005  christos 64 bit inode changes.
 1.272 05-Aug-2005  skrll Add (commented out) ucycom to various kernel configs.
 1.271 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.270 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.269 17-Jul-2005  hubertf Add support for reading cloop2 compressed filesystem image,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.268 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.267 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.266 25-Jun-2005  rpaulo branches: 1.266.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.265 09-Jun-2005  tsutsui - Rename options NEW_BUFQ_STRATEGY -> options BUFQ_READPRIO.
(still commented out)
- Add (also commented out) options BUFQ_PRIOCSCAN.

Suggested by perry and soda on tech-kern.
Please refer options(4) for details for these options.
 1.264 31-May-2005  tron Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.263 15-Apr-2005  itohy Add ukyopon(4).
 1.262 25-Mar-2005  cube Add attimer(4) configurations everywhere pcppi(4) exists, with the
following rule:
If a pcppi device is enabled for an attachment, enable an attimer for the
same attachement, otherwise comment it.
 1.261 18-Feb-2005  dsl branches: 1.261.4;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.260 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.259 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.258 28-Jan-2005  rumble Sprinkle options UFS_DIRHASH on GENERIC kernels. It's presently
commented out and labeled experimental pending further review and
testing.
 1.257 24-Nov-2004  bouyer branches: 1.257.4; 1.257.6;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.256 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.255 23-Oct-2004  augustss s/uax/axe/
 1.254 28-Sep-2004  reinoud Cleanup of main config file:

1) Fix small indenting issues

2) Removal of audio* at ... and midi* at ... entries and replace all them with

audio* at audiobus?
midi* at minibus?

3) Adding of USB audio/midi and IrDa entries
 1.253 10-Sep-2004  reinoud Add wsmux and keyboard RAW support for better X
 1.252 10-Sep-2004  reinoud Add USB-2 support to Alpha
 1.251 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.250 09-Aug-2004  mycroft Enable DDB history.
 1.249 09-Aug-2004  mycroft Add {spc,xirc,mhzc}@pcmcia. All tested on a Multia.
 1.248 20-Jul-2004  perseant Change "acardide*at ..." to "acardide* at ..." so adjustkernel will dtrt.
 1.247 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.246 28-Jun-2004  bouyer Add options P1003_1B_SEMAPHORE
to all GENERIC-like kernel config files where SYSV* options were already
present (commented out if the SYSV* options are commented out).
Fix lib/25897 and lib/25898.
 1.245 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.244 22-Jun-2004  itojun have pf and pflog pseudo-device (commented out).
reviewed by matt, perry, christos
 1.243 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.242 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.241 29-Apr-2004  fair Remove specific scsibus* at (hba device)? declarations for the new,
simple:

scsibus* at scsi?
 1.240 13-Feb-2004  wiz branches: 1.240.2;
RealTek -> Realtek.
 1.239 14-Jan-2004  jonathan Add support for opencrypto, PCI accelerators to sys/arch/*/conf/GENERIC
files for machines I know to have genuine PCI slots. As sent to tech-kern
for feedback in December 2003. Based on feedback, opencrypto is commented
out in the macppc GENERIC (due to absense of GENERIC_SOFTINT support),
and added to the sparc64 config (sys/arch/sparc64/conf/GENERIC32).
 1.238 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.237 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.236 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.235 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.234 08-Oct-2003  bouyer Add atabus
 1.233 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.232 22-Aug-2003  itojun add udav*
 1.231 06-Aug-2003  bouyer Add esiop at pci to GENERIC which already have siop at pci.
esiop has been tested enouth now.
esiop not added to INSTALL kernels because of possible space constraint.
siop should be able to drive all adapters supported by esiop.
 1.230 04-May-2003  gmcgarry branches: 1.230.2;
Add wsfont support. Addresses PR#18388.
 1.229 26-Apr-2003  ragge Add pseudo-device ksyms.
 1.228 16-Apr-2003  thorpej Add mpt(4).
 1.227 10-Apr-2003  christos Bye Bye UCONSOLE
 1.226 27-Feb-2003  perseant Make BRIDGE_IPF an option, and document it. Add it (commented) to GENERIC.
Let brconfig tell whether the bridge is using the ipfilter hook, or not.
 1.225 18-Feb-2003  grant add missing networking options, commented.

ok'd by ross.
 1.224 16-Feb-2003  augustss Add uax(4) (and url(4) in some cases).
 1.223 10-Feb-2003  mjacob Add Sundance TI (stge). Not a largely available card, but since I *did*
test that it worked on alpha....
 1.222 10-Feb-2003  grant add wi at pci and pcmcia, make comments consistent.
 1.221 30-Nov-2002  itohy White space police.
 1.220 22-Nov-2002  wiz Fix typo (responsiness -> responsiveness).
 1.219 05-Nov-2002  fair Add udsbr(4) with radio(4) attachment to standard configs
 1.218 18-Oct-2002  junyoung Add NEW_BUFQ_STRATEGY (disabled by default).
 1.217 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.216 24-Sep-2002  provos enable systrace. approved by itojun and perry
 1.215 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.214 24-Sep-2002  jdolecek add options QUOTA; pointed out by Mattias Karlsson
also move options NFSSERVER after options SOFTDEP
 1.213 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.212 14-Sep-2002  nathanw Add the now-tested "autri* at pci?" audio device. Found onboard on the
Samsung UP1500.
 1.211 22-Jul-2002  wiz Correct some commented out variables from ADW_DISABLE_* to SCSI_ADW_DISABLE_*.
From Julio Merino in port-alpha/17677.
 1.210 10-Jul-2002  jdolecek enable KERNFS and PROCFS - this is GENERIC after all, right?

adresses port-alpha/15348 by Ray Phillips
 1.209 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.208 25-Apr-2002  atatat branches: 1.208.2; 1.208.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.207 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.206 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.205 10-Feb-2002  wiz Update description for icsphy.
 1.204 07-Feb-2002  ross add ess0
 1.203 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.202 19-Jan-2002  oster Add new RF_* options for RAIDframe bits that are no longer built by default.

While we're here, enable RAIDframe (and RAID_AUTOCONFIG) by default for
architectures that I'm comfortable can deal with it being on by default.

Also: bump the number of 'raid' devices from 4 to 8, since 4 seems to
be insufficient in practise.
 1.201 28-Dec-2001  augustss Update for new uhidev device attachment.
 1.200 28-Dec-2001  martin Add PPPoE to all generic kernels that should be able to use it.
XXX TODO: do this for INSTALL kernels too, add sysinst support and make the
XXX needed binaries available on the ramdisk root fs.
 1.199 14-Dec-2001  gmcgarry Add a blurb to the top of all GENERIC files. This serves three purposes:
- to clarify some terminology
- to clarify the intention of the GENERIC file
- to cross-reference some useful man pages
 1.198 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.197 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.196 04-Nov-2001  itohy Add midi at opl and midi at mpu
 1.195 04-Nov-2001  itohy Add mpu at cmpci and opl at cmpci attachment.
I always test it on alpha, and add cmpci entries to alpha config files.
 1.194 01-Oct-2001  simonb branches: 1.194.2;
Add "asc* at tc?" for PMAZ-A TurboChannel cards.
 1.193 15-Sep-2001  thorpej Attach "agp" to the AMD-751 PCI host controller (Alpha UP1000/UP1100).
 1.192 01-Sep-2001  atatat branches: 1.192.2;
Add bridge pseudo devices to GENERIC configs
 1.191 22-Aug-2001  hubertf branches: 1.191.2;
More comment changes: 90x[B] -> 90x[BC]
 1.190 20-Aug-2001  mrg add a commented "options NETATALK"
 1.189 07-Jul-2001  tsutsui branches: 1.189.2;
Remove (commented out) ncr* at pci? lines.
 1.188 30-Jun-2001  darcy Add System V semaphore resource limits to each GENERIC file that has an
option for System V semaphores. It appears that there are no overrides
in the code and each file has the following added.

options SYSVSEM # System V semaphores
+#options SEMMNI=10 # number of semaphore identifiers
+#options SEMMNS=60 # number of semaphores in system
+#options SEMUME=10 # max number of undo entries per process
+#options SEMMNU=30 # number of undo structures in system
options SYSVSHM # System V shared memory

If anyone thinks that this is incorrect for any of these files, please
correct it.

Note - the i386 port was not forgotten. It was done separately.
 1.187 18-Jun-2001  thorpej Add sf(4), gsip(4), gphyter(4) drivers.
 1.186 07-Jun-2001  lukem add iha(4); it works in my pc164 after thorpej fixed a minor issue
 1.185 08-May-2001  ross Add DEBUGLIST mechanism. Example config line:
makeoptions DEBUGLIST="uvm* trap ufs*"
This turns on -g for only those files matching a DEBUGLIST pattern word.
 1.184 06-May-2001  ad Add mlx at eisa.
 1.183 30-Mar-2001  minoura Add yds at pci and children.
Alpha and i386 are the only tested ports.
 1.182 05-Feb-2001  itojun branches: 1.182.2;
s/unix/unit/ for ld* on mlx* :-)
 1.181 04-Feb-2001  ad Add a driver for the Mylex DAC960 family (including DEC SWXCR).
 1.180 27-Jan-2001  lukem add options NTP (ok-ed by thorpej)
 1.179 16-Jan-2001  augustss Add uyap.
 1.178 10-Jan-2001  nathanw Add uftdi and ucom, now that they're tested and known to work.
 1.177 29-Dec-2000  mycroft Add some random things I've tested over the years:
PCMCIAVERBOSE (commented out)
isapnp at isa (commented out)
midi at pcppi
ep at isapnp (commented out)
ix at isa (commented out)
iy at isa (commented out)
wdc at isapnp (commented out)
wss at isapnp (commented out)

The isapnp stuff is commented out because it may crash due to unimplemented
alloc methods on some machines with some devices. This should really get
fixed.
 1.176 21-Dec-2000  thorpej Add Sable and Lynx support.
 1.175 19-Dec-2000  bouyer Add pseudo-device vlan
 1.174 14-Dec-2000  mycroft Add COMPAT_LINUX.
 1.173 26-Nov-2000  ad lsu -> ld, by popular request.
 1.172 19-Nov-2000  tsutsui More cosmetics.

BTW, why these two "generic" config files exist?
 1.171 19-Nov-2000  tsutsui Remove "rnd is EXPERIMENTAL" comment.
 1.170 19-Nov-2000  tsutsui - Add bba* at ioasic?
- Some cosmetics
 1.169 14-Nov-2000  augustss Add uscanner.
 1.168 19-Oct-2000  ad ca -> lsu
 1.167 04-Oct-2000  itojun enable rnd device. they are now mandatory for ssh/sshd support,
so it makes more sense to enable it.
please disable them if there's any issues, but in that case, in-tree
ssh/sshd won't work.
 1.166 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.165 13-Aug-2000  itojun move "options PULLDOWN_TEST" into sys/sys/mbuf.h (in #ifdef _KERNEL),
as it is no wthe default setting for everyone.

the reason we still use the name "PULLDOWN_TEST" while it is now default:
kame code sharing.
 1.164 11-Aug-2000  thorpej Back out part of previous which was unintended.
 1.163 11-Aug-2000  thorpej Add depca at eisa.
 1.162 27-Jul-2000  mason Moving to a default of 64 PTYs.
 1.161 12-Jul-2000  thorpej - Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.160 05-Jul-2000  bouyer 3c503 works on alpha, add:
ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3Com 3c503 Ethernet
 1.159 30-Jun-2000  itojun add PULLDOWN_TEST for all the platforms.
XXX should be moved to somewhere else when stabilized
 1.158 22-Jun-2000  fvdl Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.157 14-Jun-2000  veego branches: 1.157.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.156 01-Jun-2000  thorpej Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.155 29-May-2000  matt funciton != function
 1.154 28-May-2000  thorpej Add Cyclades-Z.
 1.153 23-May-2000  thorpej branches: 1.153.2;
Note that KN300 is also for AlphaServer 1200.
 1.152 18-May-2000  matt Add PCMCIA.
 1.151 08-May-2000  augustss Add (sometimes commented out) MIIVERBOSE option.
 1.150 28-Apr-2000  ad Attach cac* and ca*.
 1.149 19-Apr-2000  haya Changes the name of RealTek driver. The new name is `rtk'. This used
to be called `rl' and it conflict with RL vax disks, canonical and
historical unix driver name.

This changes are minimal: it only changes the name of RealTek driver.
The filename of source code and a lot of the letter `rl' in source
files should be changed shortly.
 1.148 19-Apr-2000  itojun add stf pseudo interface (commented out due to possible security risks)
 1.147 03-Apr-2000  augustss Add atapibus* at umass?
 1.146 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.145 09-Mar-2000  cjs Add reminder to add stuff to ALPHA as well as this.
 1.144 29-Feb-2000  simonb Do the "<space><tab>" thing with the RAID_AUTOCONFIG option.
 1.143 26-Feb-2000  oster Defopt 'RAID_AUTOCONFIG'. Adding 'options RAID_AUTOCONFIG' turns on
the component auto-detection and auto-configuration of RAID sets.
Also, add "#options RAID_AUTOCONFIG" to the GENERIC config files.
 1.142 25-Jan-2000  augustss Update for the ucom(4) addition.
 1.141 23-Jan-2000  hubertf Add commented out "ident"-command
 1.140 19-Jan-2000  cjs Make sure that everything in GENERIC is in ALPHA, and that the two files
have config lines in the same order to make diffing easier.
 1.139 19-Jan-2000  mycroft Add a sequencer to go with the midis.
 1.138 17-Jan-2000  augustss Add USB-Ethernet adapters.
 1.137 21-Nov-1999  itojun bring in content of GENERIC.v6 into GENERIC.
remove GENERIC.v6 file (as it is part of GENERIC now).

"faith" interface is commented out by default as it is not really for
general use.
IPsec items are commented out as well, though we can enable "options IPSEC"
without export-related issue ("options IPSEC" will enable authentication
portion only). We may need to think about it again.

if you have problem compiling with INET6 on archs I do not have access to,
please contact me.

XXX what to do with arch/arm32/SHARK{,.v6}?
 1.136 16-Nov-1999  dan Add entries for we[01] (configured as for the i386 GENERIC) to enable
WD/SMC ISA ethernet cards to be used for installation and setup.
 1.135 15-Nov-1999  dante Add WDTR, SDTR and TAGQ disable options
 1.134 15-Nov-1999  fvdl Add commented out option SOFTDEP to all GENERIC kernels.
 1.133 08-Nov-1999  mycroft branches: 1.133.2;
Kill wsmux. DIE DIE DIE!
 1.132 08-Nov-1999  mycroft Disable wsmux for now.
 1.131 05-Nov-1999  thorpej Add some missing Ethernet cards: rl, ti (not in INSTALL), sip, tlp.
 1.130 29-Sep-1999  kleink branches: 1.130.2; 1.130.4; 1.130.6;
Add eso(4).
 1.129 28-Sep-1999  ad Entries for dpt(4).
 1.128 29-Aug-1999  thorpej Add `umass'.
 1.127 16-Aug-1999  augustss Add umodem device.
 1.126 07-Aug-1999  thorpej Add the AdvanSys SCSI boards.
 1.125 05-Aug-1999  jdolecek add file-system NTFS, commented out and marked as experimental
 1.124 29-Jul-1999  augustss Make two wsmux pseudo devices and add mux locators.
 1.123 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.122 29-Jun-1999  ross Turn on EV6 bits: Tsunami and system type 6600.
 1.121 27-Jun-1999  christos Add missing phy's
 1.120 27-Jun-1999  christos add vr* at pci?, sort
 1.119 06-Jun-1999  dante Add adv* entry under ISA devices
 1.118 30-Apr-1999  cgd enable COMPAT_OSF1
 1.117 29-Apr-1999  ross WSEMUL_SUN -> WSEMUL_VT100
 1.116 20-Apr-1999  ross Revert 1/2 of previous change. INSECURE is still OK for alpha.
 1.115 20-Apr-1999  ross options INSECURE, like i386
pckbc* -> pckbc0, like i386
 1.114 25-Feb-1999  ross branches: 1.114.2;
Enable eap (Ensoniq AudioPCI), sb (SoundBlaster), and sv (S3 SonicVibes).
 1.113 22-Feb-1999  fvdl Add internal 3com PHYs for the ex driver.
 1.112 18-Feb-1999  thorpej Add floppy controller and drives.
 1.111 28-Jan-1999  ross Remove the original -g, as a duplicate was (accidently?) added in 1.108,
and comment it out like it used to be, at least for now.
 1.110 25-Jan-1999  ross ne* at pci? ...
 1.109 23-Jan-1999  drochner second round of mouse renaming: psm->pms
 1.108 06-Jan-1999  thorpej - Add adv and adw SCSI controllers, commented out, as they do not yet
work.
- Add USB stuff.
- Add new pcscp SCSI driver.
- Comment out wss driver, as the configuration listed hangs some systems
cold.
 1.107 10-Dec-1998  augustss Add sv driver.
 1.106 25-Nov-1998  hwr Add (commented out) 'gre' pseudo device line. Feedback is welcome.
Inspired by Klaus Klein.
 1.105 25-Nov-1998  tv The wss driver does work (AS200/233 uses it). Uncomment.
 1.104 16-Nov-1998  oster Added a (commented out) configuration line for the RAIDframe device driver.
 1.103 04-Nov-1998  fvdl Add the ex driver.
 1.102 14-Oct-1998  matt Sync with new IDE support (e.g. pciide changes)
 1.101 29-Sep-1998  drochner document CLOCK_COMPAT_OSF1
 1.100 02-Sep-1998  enami Replace TAB just after the keyword `options' with SPACE.
 1.99 11-Aug-1998  thorpej Adapt to MII changes.
 1.98 07-Aug-1998  drochner implemt a simple "beep" device to access the ISA speaker
 1.97 27-Jul-1998  thorpej Back out previous.
 1.96 27-Jul-1998  mjacob Comment out cs device. Kernels don't compile because there is no
cfattach structure found. Leave it to the author to untangle.
 1.95 27-Jul-1998  thorpej Add cs* at isa? port 0x300, wildcard IRQ and memory address, to pull
them from the EEPROM. Wildcard DRQ to force memory-mode operation; this
value is not available in the EEPROM and must be configured manually.
 1.94 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.93 26-Jun-1998  ross Add DEC_1000 support for new Mikasa[/Pinnacle] platform.
INSTALL-FLOPPY will have to wait; it needs attention w.r.t. size.
 1.92 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.91 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.90 24-Jun-1998  ross Add DEC_1000A platform.
 1.89 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.88 02-Jun-1998  thorpej Add epic* at pci?
 1.87 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.86 14-May-1998  matt Fix lc0 (lemac) line(s) so that the de20[345]s will work again. Add depca
for de20[012]s (tested and works on a pc164sx).
 1.85 13-May-1998  thorpej No need to hard-code the mcclock offset on the gbus; gbus is direct-config.
 1.84 01-May-1998  augustss Add Ensoniq AudioPCI driver. Commented out until tested.
 1.83 24-Apr-1998  thorpej Whitespace sanity.
 1.82 18-Apr-1998  thorpej Add PCI IDE.
 1.81 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.80 15-Apr-1998  mjacob add Alpha 4100 support
 1.79 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.78 18-Mar-1998  bouyer Add commented out "options FFS_EI"
 1.77 12-Mar-1998  thorpej Dump maxusers to 32.
 1.76 28-Feb-1998  cgd Use NFS_BOOT_DHCP rather than NFS_BOOT_BOOTP. The former is more
flexible, and the boot blocks use DHCP already(!!!) and it'd be good
for the kernel to be consistent with them.
 1.75 13-Feb-1998  enami Remove comment which says that fxp is untested (it is known to work now).
Also, make model name closer to what driver prints startup.
 1.74 15-Jan-1998  thorpej Switch to MI IDE drivers, add ATAPI devices.
 1.73 09-Jan-1998  drochner Compile in BOOTP support for diskless boot.
 1.72 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.71 26-Nov-1997  mjacob make SCSIVERBOSE default
 1.70 26-Nov-1997  mjacob add SYSVMSG and SYSVSEM to GENERIC kernel
 1.69 20-Oct-1997  explorer branches: 1.69.2;
comment out rnd, mark as experimental
 1.68 13-Oct-1997  cjs Add pseudo-device rnd.
 1.67 10-Oct-1997  cjs Add now-working ipfilter.
 1.66 24-Aug-1997  cgd fix various bogons: copy SCSIVERBOSE option (still commented out) and ISA lc
driver to ALPHA. Also, sort them into their respective lists correctly,
rather than punting completely (SCSIVERBOSE), or mis-sorting(!) (lc).
 1.65 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.64 23-Aug-1997  mjacob add a before tab to SCSIVERBOSE
 1.63 20-Aug-1997  mjacob Commented out SCSIVERBOSE option; reference
 1.62 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.61 31-Jul-1997  matt Add lc* line for DEC EtherWORKS III (it was written initially for a
NetBSD/alpha user).
 1.60 13-Jul-1997  hpeyerl branches: 1.60.2;
Move satlink0 to ALPHA.
 1.59 13-Jul-1997  hpeyerl Satellite receiver driver for ISA cards from PlanetConnect by Jason and
Herb for Canada Connect Corp.
 1.58 10-Jul-1997  mellon Convert spaces to tabs following option declarations
 1.57 12-Jun-1997  mrg remove now obsolete "swap on..." lines.
 1.56 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.55 05-Jun-1997  thorpej Add fxp* at pci? declarations, marked untested on the Alpha, but they
compile.
 1.54 03-Jun-1997  cgd remove DEBUG from GENERIC kernel
 1.53 03-May-1997  cjs branches: 1.53.2;
Oops. ep at eisa is still `untested.'
 1.52 01-May-1997  cjs Ep driver on ISA bus is no longer untested. Also optimistically
removed the `untested' designation from the EISA-bus version, since
there's no reason at all why it won't work.
 1.51 21-Apr-1997  cgd minimal changes to make hacked wd driver work under a different name.
It is configured (in config files) as 'awdc'/'awd', but shows up as
'wdc'/'wd', so that a minimal amount of code had to be modified to make
the name change work. This is only intended to be temporary, anyway.
 1.50 18-Apr-1997  cgd add ep at isa and eisa
 1.49 14-Apr-1997  cgd sort PCI devices, add 'cy' Cyclades Cyclom-Y driver (untested)
 1.48 10-Apr-1997  cgd enabled EB64+ support
 1.47 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.46 25-Mar-1997  cgd kill cfb and sfb in the standard configs
 1.45 21-Mar-1997  cgd clean up CPU specs a bit. Add entries for the jensen and eb64+ (commented
out since they're not currently supported, but the options are 'known').
 1.44 13-Mar-1997  cgd add ahc and bha at EISA
 1.43 13-Mar-1997  cgd add entries for ahc and bha PCI devices. clean up some
 1.42 12-Mar-1997  cgd enable Matt Jacob's ISP 10x0 driver, now that it's in the source tree.
 1.41 12-Mar-1997  cgd add kn8ae CPU support to GENERIC kernels. Also, add kn8ae devices.
Add "isp", "ahc", and "bha" config lines, but comment them out until
their sources are in the tree and/or their alpha patches are in the tree.
 1.40 27-Feb-1997  thorpej s/esp/asc/g
 1.39 08-Feb-1997  cgd kill wdc/wd, which accidentally crept in in the last commit
 1.38 31-Jan-1997  cgd branches: 1.38.2;
add KMEMSTATS to ALPHA, clean up ports diagnostic/debug options
 1.37 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.36 23-Jan-1997  cgd Set LOADADDRESS makeoption so that these kernels can be net-booted.
This is a waste of memory, but is useful in GENERIC kernels.
 1.35 15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.34 14-Jan-1997  cgd add cd9660, msdosfs file system support.
add SysV Shared Memory support, since it can be used by the X server.
add 'ppp' to the list of pseudo-devices, and sort the list to recover
from the renaming of 'rd' to 'md'.
other slight cleanups.
 1.33 11-Jan-1997  mikel branches: 1.33.2;
add 'pseudo-device ccd' where necessary; PR kern/1830.
 1.32 28-Dec-1996  pk rename: ramdisk => md
 1.31 03-Dec-1996  cgd branches: 1.31.2;
clean up SCSI devices
 1.30 26-Nov-1996  cgd add a comment re: eb164
 1.29 25-Nov-1996  cgd update for recent configuration changes.
 1.28 19-Nov-1996  cgd update for VGA changes, and clean up slightly.
 1.27 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.26 12-Nov-1996  cgd resort cpu option list
 1.25 11-Nov-1996  cgd add DEC_EB164 option, to include nascent eb164 support
 1.24 27-Sep-1996  cgd update for changes to config.
 1.23 16-Sep-1996  cgd add EISAVERBOSE, TCVERBOSE as appropriate. Add UCONSOLE to all.
slight cleanup + sync.
 1.22 15-Sep-1996  cgd add one 'rd' pseudo-dev.
 1.21 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.20 14-Jul-1996  cgd include all PCI drivers that actually compile, clean up list, alphabetize,
and add descriptions.
 1.19 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.18 12-Jun-1996  cgd add example 'config' specs for 'root on sd0...' and 'root nfs...'
 1.17 12-Jun-1996  cgd remove "options GENERIC" since it's not needed with new setroot() code for
GENERIC kernels, and since it no longer has any other special meaning.
 1.16 03-Jun-1996  cgd add "le* at pci?", because it compiles and may actually work.
 1.15 20-May-1996  cgd branches: 1.15.4;
add fta, fpa, and fea drivers, for DEC TC, PCI, and EISA FDDI controllers.
 1.14 01-May-1996  cgd add support for PMAG-B Color Frame Buffer (CFB) option boards. OSF/1
doesn't support these, but they appear to work OK (with an appropriate
monitor) in my 3000/300.
 1.13 01-May-1996  cgd add SFB at tc, wcsons at sfb, and fix up le declarations
 1.12 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.11 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.10 20-Dec-1995  cgd rename TC 'asic' to 'ioasic'
 1.9 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.8 03-Aug-1995  cgd update for all the latest bells and whistles
 1.7 27-Jun-1995  cgd update for current configuration descriptions
 1.6 22-Apr-1995  cgd clean up, change drive -> lun for mi scsi files description.
 1.5 26-Mar-1995  cgd make alpha GENERIC kernel have 'options INSECURE' by default
 1.4 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.3 03-Mar-1995  cgd clean up machine type description comment.
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.15.4.3 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.15.4.2 13-Jun-1996  cgd pull up from trunk:
>remove "options GENERIC" since it's not needed with new setroot() code for
>GENERIC kernels, and since it no longer has any other special meaning.
and:
>add example 'config' specs for 'root on sd0...' and 'root nfs...'
 1.15.4.1 03-Jun-1996  cgd pull up from trunk:
>add "le* at pci?", because it compiles and may actually work.
 1.31.2.10 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.31.2.9 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.31.2.8 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.31.2.7 06-Jun-1997  cgd sync nwscons with trunk
 1.31.2.6 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.31.2.5 01-Feb-1997  cgd for now, pckbd is needs-count, and therefore can't be cloning
 1.31.2.4 31-Jan-1997  cgd sync with trunk
 1.31.2.3 25-Jan-1997  cgd sync up, update all for new definitions, add back tga devices
 1.31.2.2 24-Jan-1997  cgd sync with trunk
 1.31.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.33.2.3 30-Jan-1997  thorpej update from trunk
 1.33.2.2 18-Jan-1997  thorpej Update from trunk.
 1.33.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.38.2.1 11-Mar-1997  is Merge in latest Trunk.
 1.53.2.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.53.2.1 23-May-1997  thorpej Add: aha, bha, uha, le (commented out for now) at isa; ahb, uha at eisa;
scsibus attachments to aha, ahb, and uha.
 1.60.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.60.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.60.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.69.2.1 26-Nov-1997  mellon Pull rev 1.70 and 1.71 up from trunk (mjacob)
 1.114.2.6 05-Jul-2000  he Apply patch (requested by he):
Add entry for Alteon ACEnic gigabit Ethernet interface (ti).
 1.114.2.5 02-Jul-1999  perry pullup 1.121->1.122 (ross)
 1.114.2.4 21-Jun-1999  cgd pull up rev(s) 1.118 from trunk. (cgd)
 1.114.2.3 29-Apr-1999  perry branches: 1.114.2.3.2; 1.114.2.3.4;
pullup 1.116->1.117 (ross)
 1.114.2.2 20-Apr-1999  cjs Pull up to HEAD 1.116, per ross.
 1.114.2.1 20-Apr-1999  perry pull up 1.115, as requested by ross:
options INSECURE, like i386
pckbc* -> pckbc0, like i386
 1.114.2.3.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.114.2.3.2.3 02-Aug-1999  thorpej Update from trunk.
 1.114.2.3.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.114.2.3.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.130.6.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.130.6.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.130.4.1 14-Nov-1999  fvdl Sync with -current.
 1.130.2.9 21-Apr-2001  bouyer Sync with HEAD
 1.130.2.8 02-Apr-2001  bouyer ahc compiles now, and it works on sparc64 so I can't see why it wouldn't
work on something else :)
 1.130.2.7 27-Mar-2001  bouyer hac not ready yet.
 1.130.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.130.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.130.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.130.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.130.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.130.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.133.2.2 08-Nov-1999  mycroft Kill wsmux. DIE DIE DIE!
 1.133.2.1 08-Nov-1999  mycroft file GENERIC was added on branch comdex-fall-1999 on 1999-11-08 06:19:55 +0000
 1.153.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.157.2.7 25-Oct-2001  he Apply patch (requested by ad):
Add Mylex DACC960, CAC-EISA, and I2O block/SCSI drivers.
 1.157.2.6 01-May-2001  he Pull up revisions 1.171,1.175 (requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.157.2.5 04-Oct-2000  itojun pullup (approved by releng-1-5)

enable rnd device. they are now mandatory for ssh/sshd support,
so it makes more sense to enable it.
please disable them if there's any issues, but in that case, in-tree
ssh/sshd won't work.

cvs rdiff -r1.166 -r1.167 syssrc/sys/arch/alpha/conf/GENERIC
cvs rdiff -r1.149 -r1.150 syssrc/sys/arch/amiga/conf/GENERIC
cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/arm26/conf/GENERIC
cvs rdiff -r1.72 -r1.73 syssrc/sys/arch/atari/conf/GENERIC
cvs rdiff -r1.60 -r1.61 syssrc/sys/arch/hp300/conf/GENERIC
cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/luna68k/conf/GENERIC
cvs rdiff -r1.35 -r1.36 syssrc/sys/arch/next68k/conf/GENERIC
cvs rdiff -r1.32 -r1.33 syssrc/sys/arch/ofppc/conf/GENERIC
cvs rdiff -r1.73 -r1.74 syssrc/sys/arch/sun3/conf/GENERIC
cvs rdiff -r1.80 -r1.81 syssrc/sys/arch/vax/conf/GENERIC
cvs rdiff -r1.52 -r1.53 syssrc/sys/arch/x68k/conf/GENERIC
 1.157.2.4 11-Aug-2000  mason Move to default of 64 PTYs in GENERIC kernel config.
Requested by mason, approved by jhawk.
 1.157.2.3 11-Aug-2000  thorpej Pullup from trunk:
Add depca at eisa.
 1.157.2.2 12-Jul-2000  thorpej Update from trunk:
- Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.157.2.1 23-Jun-2000  fvdl As on the trunk, update these for the move of ffs_softdep.c into the
kernel source itself. Remove prefix construction, and add the SOFTDEP
option to GENERIC kernels.
 1.182.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.182.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.189.2.8 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.189.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.189.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.189.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.189.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.189.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.189.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.189.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.191.2.13 11-Dec-2002  thorpej Sync with HEAD.
 1.191.2.12 11-Nov-2002  nathanw Catch up to -current
 1.191.2.11 18-Oct-2002  nathanw Catch up to -current.
 1.191.2.10 17-Sep-2002  nathanw Catch up to -current.
 1.191.2.9 01-Aug-2002  nathanw Catch up to -current.
 1.191.2.8 20-Jun-2002  nathanw Catch up to -current.
 1.191.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.191.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.191.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.191.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.191.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.191.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.191.2.1 22-Aug-2001  nathanw file GENERIC was added on branch nathanw_sa on 2001-09-21 22:34:56 +0000
 1.192.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.192.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.194.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.208.4.3 26-Oct-2005  jmc Pullup (via patch) requested in ticket #5754 by itohy

Provide a backport for ukyopon(4) and pullup umodem(4) updates.
 1.208.4.2 31-Aug-2003  tron Pull up revision 1.214 (requested by keihan in ticket #1385):
add options QUOTA; pointed out by Mattias Karlsson
also move options NFSSERVER after options SOFTDEP
 1.208.4.1 01-Aug-2002  lukem Pull up revision 1.209 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.208.2.3 30-Aug-2002  gehenna catch up with -current.
 1.208.2.2 16-Jul-2002  gehenna catch up with -current.
 1.208.2.1 09-Jul-2002  gehenna catch up with -current.
 1.230.2.14 11-Dec-2005  christos Sync with head.
 1.230.2.13 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.230.2.12 01-Apr-2005  skrll Sync with HEAD.
 1.230.2.11 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.230.2.10 15-Feb-2005  skrll Sync with HEAD.
 1.230.2.9 04-Feb-2005  skrll Sync with HEAD.
 1.230.2.8 29-Nov-2004  skrll Sync with HEAD.
 1.230.2.7 14-Nov-2004  skrll Sync with HEAD.
 1.230.2.6 02-Nov-2004  skrll Sync with HEAD.
 1.230.2.5 19-Oct-2004  skrll Sync with HEAD
 1.230.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.230.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.230.2.2 12-Aug-2004  skrll Sync with HEAD.
 1.230.2.1 03-Aug-2004  skrll Sync with HEAD
 1.240.2.4 15-Jul-2004  he branches: 1.240.2.4.2;
Pull up revision 1.247 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.240.2.3 02-Jul-2004  he Pull up revision 1.246 (requested by bouyer in ticket #573):
Add options P1003_1B_SEMAPHORE to all GENERIC-like kernel
config files where SYSV* options were already present
(commented out if the SYSV* options are commented out).
Fixes PR#25897 and PR#25898.
 1.240.2.2 30-Jun-2004  jdc Pull up revision 1.245 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.240.2.1 29-Apr-2004  jmc Pullup rev 1.241 (requested by fair in ticket #232)

Remove specific scsibus* at (hba device)? declarations for the new,
simple:

scsibus* at scsi?
 1.240.2.4.2.4 27-Oct-2005  riz Pull up following revision(s) (requested by abs in ticket #5893):
sys/arch/alpha/conf/GENERIC: revision 1.276
If we're enabling ipfilter then we should really have IPFILTER_LOG
 1.240.2.4.2.3 21-Jul-2005  riz Pull up revision 1.263 (requested by itohy in ticket #1430):
Add ukyopon(4).
 1.240.2.4.2.2 02-Apr-2005  he Pull up revision 1.257 (via patch, requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx)
series of controllers.
 1.240.2.4.2.1 06-Feb-2005  jmc Pullup patch (requested by reinoud in ticket #913)

Cleanup audio and add USB-2 devices
 1.257.6.3 26-Mar-2005  yamt sync with head.
 1.257.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.257.6.1 12-Feb-2005  yamt sync with head.
 1.257.4.1 29-Apr-2005  kent sync with -current
 1.261.4.6 05-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #929):
sys/arch/hp300/conf/GENERIC: revision 1.124
sys/arch/acorn32/conf/GENERIC: revision 1.62
sys/arch/pdp10/conf/GENERIC: revision 1.19
sys/arch/mvme68k/conf/GENERIC: revision 1.61
sys/arch/netwinder/conf/GENERIC: revision 1.70
sys/arch/sbmips/conf/GENERIC: revision 1.46
sys/arch/macppc/conf/GENERIC: revision 1.214
sys/arch/bebox/conf/GENERIC: revision 1.89
sys/arch/cobalt/conf/GENERIC: revision 1.83
sys/arch/cats/conf/GENERIC: revision 1.92
sys/arch/shark/conf/GENERIC: revision 1.53
sys/arch/amiga/conf/GENERIC.in: revision 1.45
sys/arch/acorn26/conf/GENERIC: revision 1.37
sys/arch/cesfic/conf/GENERIC: revision 1.38
sys/arch/iyonix/conf/GENERIC: revision 1.21
sys/arch/alpha/conf/GENERIC: revision 1.277
sys/arch/vax/conf/GENERIC: revision 1.143
sys/arch/atari/conf/GENERIC.in: revision 1.56
sys/arch/mipsco/conf/GENERIC: revision 1.53
sys/arch/ofppc/conf/GENERIC: revision 1.85
sys/arch/next68k/conf/GENERIC: revision 1.96
sys/arch/arc/conf/GENERIC: revision 1.125
sys/arch/dreamcast/conf/GENERIC: revision 1.62
turn off DEBUG and DIAGNOSTIC in GENERIC kernels so that they
are compatible with the LKMs that are part of the release.
 1.261.4.5 01-Oct-2005  tron Pull up following revision(s) (requested by abs in ticket #840):
sys/arch/alpha/conf/GENERIC: revision 1.276
If we're enabling ipfilter then we should really have IPFILTER_LOG
 1.261.4.4 14-Aug-2005  riz Pull up revision 1.269 (requested by hubertf in ticket #625):
Add support for reading cloop2 compressed filesystem images,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.261.4.3 18-Jul-2005  riz Pull up revision 1.267 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.261.4.2 01-Jun-2005  riz Pull up revision 1.264 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.261.4.1 17-Apr-2005  tron Pull up revision 1.263 (requested by itohy in ticket #160):
Add ukyopon(4).
 1.266.2.7 21-Jan-2008  yamt sync with head
 1.266.2.6 07-Dec-2007  yamt sync with head
 1.266.2.5 15-Nov-2007  yamt sync with head.
 1.266.2.4 03-Sep-2007  yamt sync with head.
 1.266.2.3 26-Feb-2007  yamt sync with head.
 1.266.2.2 30-Dec-2006  yamt sync with head.
 1.266.2.1 21-Jun-2006  yamt sync with head.
 1.277.2.1 29-Nov-2005  yamt sync with head.
 1.282.4.1 09-Sep-2006  rpaulo sync with head
 1.282.2.1 18-Feb-2006  yamt sync with head.
 1.283.2.2 01-Jun-2006  kardel Sync with head.
 1.283.2.1 22-Apr-2006  simonb Sync with head.
 1.285.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.285.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.285.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.285.2.4 03-Sep-2006  yamt sync with head.
 1.285.2.3 11-Aug-2006  yamt sync with head
 1.285.2.2 24-May-2006  yamt sync with head.
 1.285.2.1 01-Apr-2006  yamt sync with head.
 1.286.2.1 19-Jun-2006  chap Sync with head.
 1.287.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.290.2.2 22-Sep-2006  riz Pull up following revision(s) (requested by tsutsui in ticket #170):
sys/arch/sparc64/conf/GENERIC: revision 1.63
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.55
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.54
sys/arch/next68k/conf/GENERIC: revision 1.105
sys/arch/ews4800mips/conf/GENERIC: revision 1.12
sys/arch/arc/conf/GENERIC: revision 1.142
sys/arch/sun3/conf/GENERIC3X: revision 1.91
sys/arch/amd64/conf/GENERIC: revision 1.105
sys/arch/sun2/conf/GENERIC: revision 1.58
sys/arch/amiga/conf/GENERIC.in: revision 1.55
sys/arch/mac68k/conf/GENERIC: revision 1.175
sys/arch/acorn26/conf/GENERIC: revision 1.46
sys/arch/shark/conf/GENERIC: revision 1.65
sys/arch/cesfic/conf/GENERIC: revision 1.45
sys/arch/sandpoint/conf/GENERIC: revision 1.36
sys/arch/iyonix/conf/GENERIC: revision 1.32
sys/arch/mvme68k/conf/GENERIC: revision 1.69
sys/arch/evbarm/conf/ARMADILLO210: revision 1.3
sys/arch/vax/conf/GENERIC: revision 1.154
sys/arch/mipsco/conf/GENERIC: revision 1.61
sys/arch/evbarm/conf/ARMADILLO9: revision 1.14
sys/arch/cobalt/conf/GENERIC: revision 1.103
sys/arch/ofppc/conf/GENERIC: revision 1.94
sys/arch/hp700/conf/GENERIC: revision 1.69
sys/arch/playstation2/conf/GENERIC: revision 1.8
sys/arch/dreamcast/conf/GENERIC: revision 1.73
sys/arch/news68k/conf/GENERIC: revision 1.81
sys/arch/macppc/conf/GENERIC: revision 1.234
sys/arch/hp300/conf/GENERIC: revision 1.134
sys/arch/mmeye/conf/GENERIC: revision 1.83
sys/arch/ibmnws/conf/GENERIC: revision 1.26
sys/arch/cats/conf/GENERIC: revision 1.109
sys/arch/sparc/conf/GENERIC: revision 1.191
sys/arch/pdp10/conf/GENERIC: revision 1.27
sys/arch/acorn32/conf/GENERIC: revision 1.75
sys/arch/luna68k/conf/GENERIC: revision 1.74
sys/arch/bebox/conf/GENERIC: revision 1.101
sys/arch/pmax/conf/GENERIC: revision 1.148
sys/arch/x68k/conf/GENERIC: revision 1.130
sys/arch/sun3/conf/GENERIC: revision 1.134
sys/arch/prep/conf/GENERIC: revision 1.126
sys/arch/alpha/conf/GENERIC: revision 1.293
sys/arch/newsmips/conf/GENERIC: revision 1.94
sys/arch/netwinder/conf/GENERIC: revision 1.83
sys/arch/hpcsh/conf/GENERIC: revision 1.69
sys/arch/sbmips/conf/GENERIC: revision 1.55
sys/arch/pc532/conf/GENERIC: revision 1.65
sys/arch/hpcmips/conf/GENERIC: revision 1.192
Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.290.2.1 14-Aug-2006  tron Pull up following revision(s) (requested by elad in ticket #17):
sys/arch/sparc/conf/KRUPS: revision 1.38
sys/arch/i386/conf/XEN2_DOMU: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.197
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.53
sys/arch/evbsh5/conf/SIMULATOR: revision 1.12
sys/arch/sparc/conf/MRCOFFEE: revision 1.17
sys/arch/next68k/conf/GENERIC: revision 1.104
sys/arch/i386/conf/VIRTUALPC: revision 1.44
sys/arch/ews4800mips/conf/GENERIC: revision 1.11
sys/arch/evbsh5/conf/CAYMAN: revision 1.23
sys/arch/arc/conf/GENERIC: revision 1.141
sys/arch/amd64/conf/GENERIC: revision 1.103
sys/arch/sun3/conf/GENERIC3X: revision 1.90
sys/arch/evbarm/conf/HDL_G: revision 1.3
sys/arch/sun2/conf/GENERIC: revision 1.57
sys/arch/news68k/conf/GENERIC_TINY: revision 1.51
sys/arch/evbppc/conf/EXPLORA451: revision 1.27
sys/arch/amiga/conf/GENERIC.in: revision 1.54
sys/arch/mac68k/conf/GENERIC: revision 1.174
sys/arch/acorn26/conf/GENERIC: revision 1.45
sys/arch/shark/conf/GENERIC: revision 1.64
sys/arch/cesfic/conf/GENERIC: revision 1.44
sys/arch/mvme68k/conf/GENERIC: revision 1.68
sys/arch/i386/conf/XEN2_DOM0: revision 1.4
sys/arch/atari/conf/GENERIC.in: revision 1.63
sys/arch/amiga/conf/GENERIC: revision 1.240
sys/arch/i386/conf/LAMB: revision 1.65
sys/arch/i386/conf/GENERIC: revision 1.773
sys/arch/acorn32/conf/EB7500ATX: revision 1.26
sys/arch/x68k/conf/GENERIC: revision 1.128
sys/arch/vax/conf/GENERIC: revision 1.153
sys/arch/atari/conf/ATARITT: revision 1.81
sys/arch/mipsco/conf/GENERIC: revision 1.60
sys/arch/cobalt/conf/GENERIC: revision 1.101
sys/arch/evbarm/conf/ARMADILLO9: revision 1.13
sys/arch/ofppc/conf/GENERIC: revision 1.93
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.51
sys/arch/arc/conf/RPC44: revision 1.26
sys/arch/sparc64/conf/GENERIC: revision 1.59
sys/arch/i386/conf/XEN3_DOMU: revision 1.2
sys/arch/hp700/conf/GENERIC: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.47
sys/arch/macppc/conf/GENERIC: revision 1.231
sys/arch/dreamcast/conf/GENERIC: revision 1.72
sys/arch/news68k/conf/GENERIC: revision 1.80
sys/arch/hp300/conf/GENERIC: revision 1.133
sys/arch/mmeye/conf/GENERIC: revision 1.82
sys/arch/macppc/conf/MAMBO: revision 1.2
sys/arch/cats/conf/GENERIC: revision 1.107
sys/arch/atari/conf/FALCON: revision 1.79
sys/arch/acorn32/conf/GENERIC: revision 1.71
sys/arch/sparc/conf/GENERIC: revision 1.190
sys/arch/news68k/conf/LIBERO: revision 1.40
sys/arch/amiga/conf/DRACO: revision 1.114
sys/arch/cobalt/conf/INSTALL: revision 1.23
sys/arch/luna68k/conf/GENERIC: revision 1.73
sys/arch/bebox/conf/GENERIC: revision 1.100
sys/arch/pmax/conf/GENERIC: revision 1.147
sys/arch/amiga/conf/WSCONS: revision 1.52
sys/arch/macppc/conf/POWERMAC_G5: revision 1.2
sys/arch/alpha/conf/ALPHA: revision 1.218
sys/arch/sun3/conf/GENERIC: revision 1.133
sys/arch/prep/conf/GENERIC: revision 1.124
sys/arch/alpha/conf/GENERIC: revision 1.291
sys/arch/atari/conf/HADES: revision 1.71
sys/arch/newsmips/conf/GENERIC: revision 1.93
sys/arch/netwinder/conf/GENERIC: revision 1.82
sys/arch/hpcmips/conf/GENERIC: revision 1.190
sys/arch/amiga/conf/AMIGA: revision 1.98
sys/arch/sbmips/conf/GENERIC: revision 1.54
sys/arch/pc532/conf/GENERIC: revision 1.64
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.53
Disable SYSTRACE by default on all kernels (discussed with core)
 1.296.2.3 06-Feb-2007  ad Add pseudo-device lockstat.
 1.296.2.2 12-Jan-2007  ad Sync with head.
 1.296.2.1 18-Nov-2006  ad Sync with head.
 1.297.2.3 18-Dec-2006  yamt sync with head.
 1.297.2.2 10-Dec-2006  yamt sync with head.
 1.297.2.1 22-Oct-2006  yamt sync with head
 1.301.2.4 25-Aug-2007  liamjfoy Pull up following revision(s) (requested by adrianp in ticket #820):
sys/arch/hp300/conf/GENERIC: revision 1.141
sys/arch/alpha/conf/GENERIC: revision 1.315
sys/arch/amd64/conf/GENERIC: revision 1.154
sys/arch/cats/conf/GENERIC: revision 1.116
sys/arch/arc/conf/GENERIC: revision 1.148
sys/arch/acorn32/conf/GENERIC: revision 1.80
sys/arch/sparc/conf/GENERIC: revision 1.200
sys/arch/sparc64/conf/GENERIC: revision 1.88
sys/arch/atari/conf/GENERIC.in: revision 1.68
sys/arch/amiga/conf/GENERIC: revision 1.248
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.239
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.66
sys/arch/i386/conf/GENERIC: revision 1.840
sys/arch/amiga/conf/GENERIC.in: revision 1.61
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.68
sys/arch/mac68k/conf/GENERIC: revision 1.182
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.301.2.3 05-Jun-2007  bouyer Pull up following revision(s) (requested by martin in ticket #699):
sys/arch/hpcmips/conf/GENERIC: revision 1.196
sys/arch/hp700/conf/GENERIC: revision 1.74
sys/arch/i386/conf/GENERIC: revision 1.831
sys/arch/next68k/conf/GENERIC: revision 1.108
sys/arch/alpha/conf/GENERIC: revision 1.313
sys/arch/arc/conf/GENERIC: revision 1.146
sys/arch/cats/conf/GENERIC: revision 1.115
sys/arch/ews4800mips/conf/GENERIC: revision 1.18
sys/arch/landisk/conf/GENERIC: revision 1.8 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.85
sys/arch/pmax/conf/GENERIC: revision 1.152
sys/arch/iyonix/conf/GENERIC: revision 1.38 via patch
sys/arch/amiga/conf/GENERIC: revision 1.245
sys/arch/vax/conf/GENERIC: revision 1.157
sys/arch/prep/conf/GENERIC: revision 1.135
sys/arch/pc532/conf/GENERIC: revision 1.70
sys/arch/sbmips/conf/GENERIC: revision 1.61
sys/arch/mipsco/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.108
sys/arch/ofppc/conf/GENERIC: revision 1.98
sys/arch/amd64/conf/GENERIC: revision 1.148
sys/arch/acorn26/conf/GENERIC: revision 1.50
sys/arch/dreamcast/conf/GENERIC: revision 1.78
sys/arch/mac68k/conf/GENERIC: revision 1.181
sys/arch/hp300/conf/GENERIC: revision 1.139
sys/arch/mmeye/conf/GENERIC: revision 1.88
sys/arch/news68k/conf/GENERIC: revision 1.88
sys/arch/mvme68k/conf/GENERIC: revision 1.71
sys/arch/acorn32/conf/GENERIC: revision 1.79
sys/arch/sparc/conf/GENERIC: revision 1.199
sys/arch/luna68k/conf/GENERIC: revision 1.78
sys/arch/bebox/conf/GENERIC: revision 1.105
sys/arch/macppc/conf/GENERIC: revision 1.256 via patch
sys/arch/x68k/conf/GENERIC: revision 1.134
sys/arch/sun3/conf/GENERIC: revision 1.138
sys/arch/newsmips/conf/GENERIC: revision 1.98
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.301.2.2 16-May-2007  jdc Pull up revisions 1.306-1.309 (requested by pavel in ticket #645).

Explicitely configure zstty2 at zsc1. The corresponding /dev special file
is /dev/ttyB1 which has minor 2. If this serial port becomes zstty1,
/dev/ttyB1 becomes unusable because the minor number does not match. (The
problem was introduced when we started using the zstty(4) driver instead of
the scc(4) driver between NetBSD 1.6 and 2.0.)

Suggested by Bill Studenmund a long time ago.

Tested on DEC 3000 - 300LX and DEC 3000 - M600.

Merge GENERIC and ALPHA configuration, and remove the latter. ALPHA was
supposed to be a superset of GENERIC, but sometimes it was not kept up to
date.

As proposed on port-alpha@.

spaces -> tabs in the new zstty lines.

more spaces -> tabs.
 1.301.2.1 20-Dec-2006  bouyer branches: 1.301.2.1.2;
Pull up following revision(s) (requested by tsutsui in ticket #282):
sys/arch/alpha/conf/INSTALL: revision 1.91-1.92
sys/arch/alpha/conf/GENERIC: revision 1.302-1.305
Add the following network devices:
- pcn at pci
- wm at pci
- makphy at mii
- rgephy at mii
- rlphy at mii
Reduce diffs between GENERIC and INSTALL.
 1.301.2.1.2.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.301.2.1.2.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.310.2.2 24-Mar-2007  yamt sync with head.
 1.310.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.311.4.1 11-Jul-2007  mjf Sync with head.
 1.311.2.6 03-Dec-2007  ad Sync with HEAD.
 1.311.2.5 09-Oct-2007  ad Sync with head.
 1.311.2.4 20-Aug-2007  ad Sync with HEAD.
 1.311.2.3 15-Jul-2007  ad Sync with head.
 1.311.2.2 09-Jun-2007  ad Sync with head.
 1.311.2.1 10-Apr-2007  ad Sync with head.
 1.312.6.2 03-Oct-2007  garbled Sync with HEAD
 1.312.6.1 26-Jun-2007  garbled Sync with HEAD.
 1.314.8.4 03-Dec-2007  joerg Sync with HEAD.
 1.314.8.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.314.8.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.314.8.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.314.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.314.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.314.2.1 07-Aug-2007  matt Sync with HEAD.
 1.317.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.317.2.2 09-Jan-2008  matt sync with HEAD
 1.317.2.1 06-Nov-2007  matt sync with HEAD
 1.319.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.319.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.320.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.320.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.322.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.322.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.322.10.4 11-Aug-2010  yamt sync with head.
 1.322.10.3 11-Mar-2010  yamt sync with head
 1.322.10.2 16-Sep-2009  yamt sync with head
 1.322.10.1 04-May-2009  yamt sync with head.
 1.322.8.1 04-Jun-2008  yamt sync with head
 1.322.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.322.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.322.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.323.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.323.4.1 19-Oct-2008  haad Sync with HEAD.
 1.325.8.1 21-Apr-2010  matt sync to netbsd-5
 1.325.4.2 21-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1407):
sys/dev/bluetooth/btdev.h: revision 1.9
sys/arch/iyonix/conf/GENERIC: revision 1.60
sys/arch/sparc64/conf/GENERIC: revision 1.129
sys/dev/usb/hid.c: revision 1.30
sys/dev/usb/hid.h: revision 1.13
sys/arch/i386/conf/GENERIC: revision 1.983
usr.sbin/btdevctl/print.c: revision 1.10
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.16
sys/arch/alpha/conf/GENERIC: revision 1.337
sys/dev/bluetooth/files.bluetooth: revision 1.14
sys/arch/evbarm/conf/GUMSTIX: revision 1.49
sys/dev/usb/usbdevs: revision 1.550
sys/arch/evbppc/conf/OPENBLOCKS266_OPT: revision 1.14
sys/arch/hpcsh/conf/GENERIC: revision 1.91
sys/dev/bluetooth/btmagic.c: revision 1.1
distrib/sets/lists/man/mi: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.279
sys/arch/i386/conf/ALL: revision 1.258
sys/arch/amd64/conf/XEN3_DOM0: revision 1.54
sys/arch/hpcarm/conf/JORNADA720: revision 1.78
sys/dev/usb/hid.c: revision 1.29
share/man/man4/btmagic.4: revision 1.1
hid_get_data() does not work if the size of data is less than
a byte and crosses a byte boundary, and it always returns a
sign-extended value.
fix this by using the algorithm from libusbhid to read bytes,
and provide a hid_get_udata() function to return unsigned data
values.
while here, const args
update DPRINTF to reflect actual function name
add Apple Magic Mouse product-id
regen for Magic Mouse id
allow for vendor-id and product-id properties, passing them
through to child devices
add Magic Mouse driver and manpage btmagic(4)
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.
add btmagic(4) where other Bluetooth drivers are listed
 1.325.4.1 16-Sep-2009  snj Pull up following revision(s) (requested by mhitch in ticket #957):
sys/arch/alpha/conf/GENERIC: revision 1.329
Add the I2O iop controller, as used in the ES40 and ES45.
 1.325.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.325.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.330.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.330.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.331.2.3 21-Apr-2011  rmind sync with head
 1.331.2.2 05-Mar-2011  rmind sync with head
 1.331.2.1 30-May-2010  rmind sync with head
 1.338.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.338.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.341.2.3 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.341.2.2 30-Oct-2012  yamt sync with head
 1.341.2.1 17-Apr-2012  yamt sync with head
 1.342.2.2 11-Mar-2012  mrg sync to latest -current
 1.342.2.1 18-Feb-2012  mrg merge to -current.
 1.345.2.4 03-Dec-2017  jdolecek update from HEAD
 1.345.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.345.2.2 23-Jun-2013  tls resync from head
 1.345.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.352.2.2 18-May-2014  rmind sync with head
 1.352.2.1 28-Aug-2013  rmind sync with head
 1.358.4.2 18-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #251):
sys/arch/acorn26/conf/GENERIC: revision 1.81
sys/arch/acorn32/conf/GENERIC: revision 1.116
sys/arch/alpha/conf/GENERIC: revision 1.362
sys/arch/amd64/conf/ALL: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.404
sys/arch/amd64/conf/XEN3_DOM0: revision 1.112
sys/arch/amd64/conf/XEN3_DOMU: revision 1.60
sys/arch/amiga/conf/GENERIC.in: revision 1.129
sys/arch/amiga/conf/GENERIC: revision 1.311
sys/arch/amigappc/conf/GENERIC: revision 1.24
sys/arch/arc/conf/GENERIC: revision 1.184
sys/arch/bebox/conf/GENERIC: revision 1.145
sys/arch/cats/conf/GENERIC: revision 1.155
sys/arch/cesfic/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.147
sys/arch/dreamcast/conf/GENERIC: revision 1.121
sys/arch/emips/conf/GENERIC: revision 1.15
sys/arch/epoc32/conf/GENERIC: revision 1.8
sys/arch/ews4800mips/conf/GENERIC: revision 1.51
sys/arch/hp300/conf/GENERIC: revision 1.190
sys/arch/hpcmips/conf/GENERIC: revision 1.229
sys/arch/hpcsh/conf/GENERIC: revision 1.106
sys/arch/hppa/conf/GENERIC: revision 1.6
sys/arch/i386/conf/ALL: revision 1.389
sys/arch/i386/conf/GENERIC: revision 1.1118
sys/arch/i386/conf/XEN3_DOM0: revision 1.93
sys/arch/i386/conf/XEN3_DOMU: revision 1.65
sys/arch/ibmnws/conf/GENERIC: revision 1.46
sys/arch/iyonix/conf/GENERIC: revision 1.88
sys/arch/landisk/conf/GENERIC: revision 1.45
sys/arch/luna68k/conf/GENERIC: revision 1.119
sys/arch/mac68k/conf/GENERIC: revision 1.220
sys/arch/macppc/conf/GENERIC: revision 1.320
sys/arch/macppc/conf/MAMBO: revision 1.24
sys/arch/macppc/conf/POWERMAC_G5: revision 1.25
sys/arch/mipsco/conf/GENERIC: revision 1.88
sys/arch/mmeye/conf/GENERIC: revision 1.120
sys/arch/mvme68k/conf/GENERIC: revision 1.94
sys/arch/mvmeppc/conf/GENERIC: revision 1.24
sys/arch/netwinder/conf/GENERIC: revision 1.126
sys/arch/news68k/conf/GENERIC: revision 1.125
sys/arch/newsmips/conf/GENERIC: revision 1.129
sys/arch/next68k/conf/GENERIC: revision 1.139
sys/arch/ofppc/conf/GENERIC: revision 1.157
sys/arch/pmax/conf/GENERIC64: revision 1.21
sys/arch/pmax/conf/GENERIC: revision 1.185
sys/arch/prep/conf/GENERIC: revision 1.174
sys/arch/rs6000/conf/GENERIC: revision 1.33
sys/arch/sandpoint/conf/GENERIC: revision 1.88
sys/arch/sbmips/conf/GENERIC: revision 1.101
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.28
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.104
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.106
sys/arch/shark/conf/GENERIC: revision 1.121
sys/arch/sparc/conf/GENERIC: revision 1.248
sys/arch/sparc/conf/TADPOLE3GX: revision 1.65
sys/arch/sparc64/conf/GENERIC: revision 1.177
sys/arch/sparc64/conf/NONPLUS64: revision 1.44
sys/arch/sun2/conf/GENERIC: revision 1.94
sys/arch/sun3/conf/GENERIC: revision 1.171
sys/arch/vax/conf/GENERIC: revision 1.193
sys/arch/vax/conf/VAX780: revision 1.19
sys/arch/x68k/conf/GENERIC: revision 1.179
sys/arch/zaurus/conf/GENERIC: revision 1.65
sys/ufs/files.ufs: revision 1.38
Remove unused extended attributes kernel options

As Masao Uebayashi pointed to me, UFS_EXTATTR_AUTOSTART, LFS_EXTATTR_AUTOSTART
and UFS_EXTATTR_AUTOCREATE are not used anywhere in the code. Remove them
as they have been obsolete for a long time:
UFS_EXTATTR_AUTOSTART was replaced by mount -o extattr
LFS_EXTATTR_AUTOSTART was created to match obsolete UFS_EXTATTR_AUTOSTART
UFS_EXTATTR_AUTOCREATE was replaced by sysctl vfs.ffs.extattr_autocreate
 1.358.4.1 14-Nov-2014  martin Pull up following revision(s) (requested by manu in ticket #232):
sys/arch/next68k/conf/GENERIC: revision 1.138
sys/arch/cobalt/conf/GENERIC: revision 1.146
sys/arch/mvme68k/conf/GENERIC: revision 1.93
sys/arch/vax/conf/VAX780: revision 1.18
sys/arch/newsmips/conf/GENERIC: revision 1.128
sys/arch/luna68k/conf/GENERIC: revision 1.118
sys/arch/sbmips/conf/GENERIC: revision 1.100
sys/arch/pmax/conf/GENERIC: revision 1.184
sys/arch/alpha/conf/GENERIC: revision 1.361
sys/arch/sparc64/conf/GENERIC: revision 1.176
sys/arch/sun3/conf/GENERIC: revision 1.170
sys/arch/shark/conf/GENERIC: revision 1.120
sys/arch/landisk/conf/GENERIC: revision 1.44
sys/arch/bebox/conf/GENERIC: revision 1.144
sys/arch/sparc64/conf/NONPLUS64: revision 1.43
sys/arch/sandpoint/conf/GENERIC: revision 1.87
sys/arch/emips/conf/GENERIC: revision 1.14
sys/arch/amd64/conf/XEN3_DOM0: revision 1.111
sys/arch/dreamcast/conf/GENERIC: revision 1.120
sys/arch/cesfic/conf/GENERIC: revision 1.64
sys/arch/mmeye/conf/GENERIC: revision 1.119
sys/arch/epoc32/conf/GENERIC: revision 1.7
sys/arch/x68k/conf/GENERIC: revision 1.178
sys/arch/iyonix/conf/GENERIC: revision 1.87
sys/arch/sun2/conf/GENERIC: revision 1.93
sys/arch/ews4800mips/conf/GENERIC: revision 1.50
sys/arch/amd64/conf/XEN3_DOMU: revision 1.59
sys/arch/acorn26/conf/GENERIC: revision 1.80
sys/arch/acorn32/conf/GENERIC: revision 1.115
sys/arch/macppc/conf/POWERMAC_G5: revision 1.24
sys/arch/i386/conf/GENERIC: revision 1.1117
sys/arch/arc/conf/GENERIC: revision 1.183
sys/arch/cats/conf/GENERIC: revision 1.154
sys/arch/amiga/conf/GENERIC.in: revision 1.128
sys/arch/zaurus/conf/GENERIC: revision 1.64
sys/arch/netwinder/conf/GENERIC: revision 1.125
sys/arch/hppa/conf/GENERIC: revision 1.5
sys/arch/mvmeppc/conf/GENERIC: revision 1.23
sys/arch/macppc/conf/GENERIC: revision 1.319
sys/arch/amiga/conf/GENERIC: revision 1.310
sys/arch/pmax/conf/GENERIC64: revision 1.20
sys/arch/macppc/conf/MAMBO: revision 1.23
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.27
sys/arch/amigappc/conf/GENERIC: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.403
sys/arch/ofppc/conf/GENERIC: revision 1.156
sys/arch/mac68k/conf/GENERIC: revision 1.219
sys/arch/i386/conf/XEN3_DOMU: revision 1.64
sys/arch/mipsco/conf/GENERIC: revision 1.87
sys/arch/hp300/conf/GENERIC: revision 1.189
sys/arch/vax/conf/GENERIC: revision 1.192
sys/arch/news68k/conf/GENERIC: revision 1.124
sys/arch/ibmnws/conf/GENERIC: revision 1.45
sys/arch/hpcsh/conf/GENERIC: revision 1.105
sys/arch/sparc/conf/TADPOLE3GX: revision 1.64
sys/arch/i386/conf/XEN3_DOM0: revision 1.92
sys/arch/sparc/conf/GENERIC: revision 1.247
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.105
sys/arch/prep/conf/GENERIC: revision 1.173
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.103
sys/arch/rs6000/conf/GENERIC: revision 1.32
sys/arch/hpcmips/conf/GENERIC: revision 1.228
Support for UFS1 extended attributes in GENERIC and GENERIC-like kernels
This change just brings UFS1 extended attribute *support* in the kernel,
extended attributes are not enabled unless three conditions are met:
1) filesystem is UFS1 (newfs -O1)
2) .attribute/system and .attribute/user directories are created at fs root
3) filesystem is mounted with -o extattr
Some GENERIC kernels are obviously memory constrained, the extended
attributes options were not enabled for them, but just added commented out.
(kernel were considered memory constrained if QUOTA option was disabled)
 1.362.2.8 28-Aug-2017  skrll Sync with HEAD
 1.362.2.7 05-Feb-2017  skrll Sync with HEAD
 1.362.2.6 05-Dec-2016  skrll Sync with HEAD
 1.362.2.5 22-Apr-2016  skrll Sync with HEAD
 1.362.2.4 19-Mar-2016  skrll Sync with HEAD
 1.362.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.362.2.2 22-Sep-2015  skrll Sync with HEAD
 1.362.2.1 06-Apr-2015  skrll Sync with HEAD
 1.368.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.368.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.375.8.1 26-Jan-2018  martin Pull up following revision(s) (requested by sevan in ticket #510):
sys/arch/sun3/conf/GENERIC3X: revision 1.130
sys/arch/sparc64/conf/GENERIC: revision 1.203
sys/arch/news68k/conf/LIBERO: revision 1.66
sys/arch/amiga/conf/DRACO: revision 1.185
sys/arch/evbarm/conf/MV2120: revision 1.35
sys/arch/x68k/conf/GENERIC: revision 1.187
sys/arch/rs6000/conf/GENERIC: revision 1.39
sys/arch/news68k/conf/GENERIC_TINY: revision 1.86
sys/arch/i386/conf/XEN3_DOMU: revision 1.88
sys/arch/iyonix/conf/GENERIC: revision 1.97
sys/arch/evbarm64/conf/A64EMUL: revision 1.11
sys/arch/mvme68k/conf/GENERIC: revision 1.98
sys/arch/acorn32/conf/GENERIC: revision 1.124
sys/arch/i386/conf/XEN3_DOM0: revision 1.125
sys/arch/cobalt/conf/INSTALL: revision 1.65
sys/arch/macppc/conf/GENERIC_601: revision 1.16
sys/arch/hppa/conf/GENERIC: revision 1.17
sys/arch/amiga/conf/GENERIC.in: revision 1.137
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.33
sys/arch/netwinder/conf/GENERIC: revision 1.134
sys/arch/amd64/conf/XEN3_DOMU: revision 1.83
sys/arch/mac68k/conf/GENERIC: revision 1.225
sys/arch/arc/conf/RPC44: revision 1.54
sys/arch/mipsco/conf/GENERIC: revision 1.92
sys/arch/cats/conf/GENERIC: revision 1.166
sys/arch/amd64/conf/XEN3_DOM0: revision 1.145
sys/arch/amigappc/conf/GENERIC: revision 1.33
sys/arch/sun3/conf/GENERIC: revision 1.176
sys/arch/news68k/conf/GENERIC: revision 1.130
sys/arch/hpcsh/conf/GENERIC: revision 1.110
sys/arch/hp300/conf/GENERIC: revision 1.198
sys/arch/atari/conf/GENERIC.in: revision 1.115
sys/arch/sparc/conf/MRCOFFEE: revision 1.54
sys/arch/evbppc/conf/EXPLORA451: revision 1.62
sys/arch/cesfic/conf/GENERIC: revision 1.69
sys/arch/vax/conf/GENERIC: revision 1.204
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.115
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.112
sys/arch/sparc/conf/GENERIC: revision 1.258
sys/arch/next68k/conf/GENERIC: revision 1.145
sys/arch/evbarm/conf/MMNET_GENERIC: revision 1.34
sys/arch/prep/conf/GENERIC: revision 1.185
sys/arch/amiga/conf/INSTALL: revision 1.129
sys/arch/newsmips/conf/GENERIC: revision 1.133
sys/arch/cobalt/conf/GENERIC: revision 1.156
sys/arch/sun2/conf/GENERIC: revision 1.99
sys/arch/luna68k/conf/INSTALL: revision 1.25
sys/arch/amigappc/conf/NULL: revision 1.53
sys/arch/acorn26/conf/GENERIC: revision 1.85
sys/arch/vax/conf/VAX780: revision 1.25
sys/arch/luna68k/conf/GENERIC: revision 1.125
sys/arch/ews4800mips/conf/GENERIC: revision 1.56
sys/arch/macppc/conf/POWERMAC_G5: revision 1.29
sys/arch/arc/conf/GENERIC: revision 1.189
sys/arch/macppc/conf/MAMBO: revision 1.27
sys/arch/acorn32/conf/EB7500ATX: revision 1.64
sys/arch/pmax/conf/GENERIC: revision 1.196
sys/arch/pmax/conf/GENERIC64: revision 1.28
sys/arch/amiga/conf/GENERIC: revision 1.319
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.55
sys/arch/macppc/conf/GENERIC: revision 1.339
sys/arch/emips/conf/GENERIC: revision 1.21
sys/arch/sandpoint/conf/GENERIC: revision 1.97
sys/arch/landisk/conf/GENERIC: revision 1.58
sys/arch/bebox/conf/GENERIC: revision 1.157
sys/arch/alpha/conf/GENERIC: revision 1.379
Alternate buffer queue strategies no longer considered experimental, update
description.
Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.379.2.5 30-Sep-2018  pgoyette Ssync with HEAD
 1.379.2.4 22-Sep-2018  pgoyette Alpha GENERIC requires compat_09 for osf1 compat
 1.379.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.379.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.379.2.1 21-May-2018  pgoyette Sync with HEAD
 1.383.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.383.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.383.2.1 10-Jun-2019  christos Sync with HEAD
 1.396.2.1 25-Jan-2020  ad Sync with head.
 1.410.8.1 31-May-2021  cjep sync with head
 1.410.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.410.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.5 19-Sep-2020  thorpej Enable MULTIPROCESSOR by default, but disable it in the RAMDISK
and INSTALL kernels to save some space.
 1.4 05-Sep-2020  thorpej Build GENERIC with debug symbols, not just GENERIC.MP.
 1.3 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.2 22-Feb-1999  thorpej branches: 1.2.20; 1.2.22;
GENERIC already has DDB.
 1.1 25-Sep-1998  thorpej GENERIC config file + MULTIPROCESSOR + some debugging stuff.
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.20.1 08-Jan-2002  nathanw Catch up to -current.
 1.16 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.15 06-Apr-1997  cgd branches: 1.15.4;
clean up NetBSD RCS ID strings
 1.14 14-Jan-1997  cgd useful suggestion from jason: make this simply an 'include' of the
GENERIC kernel config with the added profiling bits!
 1.13 14-Jan-1997  cgd add cd9660, msdosfs file system support.
add SysV Shared Memory support, since it can be used by the X server.
add 'ppp' to the list of pseudo-devices, and sort the list to recover
from the renaming of 'rd' to 'md'.
other slight cleanups.
 1.12 11-Jan-1997  mikel branches: 1.12.2;
add 'pseudo-device ccd' where necessary; PR kern/1830.
 1.11 28-Dec-1996  pk rename: ramdisk => md
 1.10 03-Dec-1996  cgd branches: 1.10.2;
clean up SCSI devices
 1.9 26-Nov-1996  cgd add a comment re: eb164
 1.8 25-Nov-1996  cgd update for recent configuration changes.
 1.7 19-Nov-1996  cgd update for VGA changes, and clean up slightly.
 1.6 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.5 12-Nov-1996  cgd add DEC_EB164 option
 1.4 27-Sep-1996  cgd update for changes to config.
 1.3 16-Sep-1996  cgd add EISAVERBOSE, TCVERBOSE as appropriate. Add UCONSOLE to all.
slight cleanup + sync.
 1.2 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.1 19-Aug-1996  cgd add a version of GENERIC which is always compiled with
profiling enabled. (named the same as what GENERIC kernel
would be named if configured with config -p, which would end up
generating the same kernel as this.)
 1.10.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.2.1 24-Jan-1997  cgd sync with trunk
 1.12.2.3 30-Jan-1997  thorpej update from trunk
 1.12.2.2 18-Jan-1997  thorpej Update from trunk.
 1.12.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.15.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 27-Mar-2025  riastradh virtio(4): Consolidate kernel configs.

No functional change intended.

Leave `# XXX ?' comments where I don't know why the driver in
question is excluded. (Typical reason is that PAGE_SIZE is not 4096
but I didn't investigate -- if you do investigate, please either
update the comment if you determine a reason, or enable the driver if
you don't.)

PR kern/59211: vio9p(4): missing from various GENERICs and MAKEDEVs
 1.3 16-Jul-2024  riastradh viocon(4): Add to various kernel configs.
 1.2 19-Nov-2023  thorpej branches: 1.2.2;
Add some VirtIO devies. virtio-scsi and virtio-rng are tested a bit,
virtio-blk does not work, virtio-net not yet tested.
 1.1 23-May-2021  thorpej branches: 1.1.2; 1.1.6;
Add a GENERIC.QEMU kernel config. This just includes QEMU and then
sets some options specifically to make the Qemu experience a little
batter.

Currently, this just sets COPY_SYMTAB=1 (Qemu loads the kernel directly,
and does not load the symbol table).
 1.1.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.1 23-May-2021  thorpej file GENERIC.QEMU was added on branch thorpej-i2c-spi-conf on 2021-06-17 04:46:17 +0000
 1.1.2.2 31-May-2021  cjep sync with head
 1.1.2.1 23-May-2021  cjep file GENERIC.QEMU was added on branch cjep_staticlib_x on 2021-05-31 22:15:09 +0000
 1.2.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 21-Nov-1999  itojun bring in content of GENERIC.v6 into GENERIC.
remove GENERIC.v6 file (as it is part of GENERIC now).

"faith" interface is commented out by default as it is not really for
general use.
IPsec items are commented out as well, though we can enable "options IPSEC"
without export-related issue ("options IPSEC" will enable authentication
portion only). We may need to think about it again.

if you have problem compiling with INET6 on archs I do not have access to,
please contact me.

XXX what to do with arch/arm32/SHARK{,.v6}?
 1.2 09-Jul-1999  thorpej branches: 1.2.2; 1.2.8;
Add examples for including the kernel crypto bits from either crypto-us
or crypto-intl, commented out, with instructions to use only one, and
adjust the prefix as necessary.
 1.1 01-Jul-1999  itojun branches: 1.1.2;
kernel configuration for IPv6/IPsec. should be in GENERIC in the future.
(source code will be committed soon)
 1.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 01-Jul-1999  thorpej file GENERIC.v6 was added on branch chs-ubc2 on 1999-07-01 23:00:56 +0000
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11 12-Jun-1996  cgd remove GENERIC_NFS, because:
(1) right now GENERIC can boot via NFS, and
(2) in the long run, GENERIC should autodetect network booting
and pick the correct root device.
Because of (1), GENERIC_NFS is no longer _needed_ in the short term.
Because of (2), GENERIC_NFS is not _wanted_ in the long term.
 1.10 03-Jun-1996  cgd add "le* at pci?", because it compiles and may actually work.
 1.9 20-May-1996  cgd branches: 1.9.4;
add fta, fpa, and fea drivers, for DEC TC, PCI, and EISA FDDI controllers.
 1.8 01-May-1996  cgd add support for PMAG-B Color Frame Buffer (CFB) option boards. OSF/1
doesn't support these, but they appear to work OK (with an appropriate
monitor) in my 3000/300.
 1.7 01-May-1996  cgd add SFB at tc, wcsons at sfb, and fix up le declarations
 1.6 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.5 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.4 20-Dec-1995  cgd rename TC 'asic' to 'ioasic'
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd update for all the latest bells and whistles
 1.1 27-Jun-1995  cgd update for current configuration descriptions
 1.9.4.2 13-Jun-1996  cgd pull up from trunk (remove file):
>remove GENERIC_NFS, because:
> (1) right now GENERIC can boot via NFS, and
> (2) in the long run, GENERIC should autodetect network booting
> and pick the correct root device.
>Because of (1), GENERIC_NFS is no longer _needed_ in the short term.
>Because of (2), GENERIC_NFS is not _wanted_ in the long term.
 1.9.4.1 03-Jun-1996  cgd pull up from trunk:
>add "le* at pci?", because it compiles and may actually work.
 1.120 06-Mar-2024  thorpej Tidy up TLSB autoconfiguration just a bit.
 1.119 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.118 23-Jul-2021  thorpej Use wildcard matches more consistently, and attach pci, eisa, isa, and
usb to their interface attributes, which makes for easier trimming-down
with "no" directives.
 1.117 28-Sep-2020  thorpej branches: 1.117.6;
qemu device for INSTALL, too.
 1.116 19-Sep-2020  thorpej Enable MULTIPROCESSOR by default, but disable it in the RAMDISK
and INSTALL kernels to save some space.
 1.115 05-Sep-2020  thorpej Add siisata.
 1.114 06-Apr-2020  martin Slightly bump ramdisk space
 1.113 25-Jan-2020  thorpej Retire "le* at pci?" from the shipped kernel configs:
- If the config had both an le@pci and a pcn, simply remove le@pci
(pcn would match at a higher priority anyway).
- If the config had le@pci enabled, but no pcn, change le@pci to pcn.
- If the config had le@pci commented out, but no pcn, change le@pci
to pcn and leave it commented out.

The pcn driver supports more chips than le@pci and does DMA directly
to/from mbufs rather than memory copies.
 1.112 20-Jan-2020  thorpej Remove FDDI support.
 1.111 06-Sep-2018  maxv branches: 1.111.6;
Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.110 14-Sep-2017  mrg branches: 1.110.2; 1.110.4;
clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.109 21-Aug-2015  uebayasi Add `pseudo-device ksyms' where `options DDB' is used, because
config(1)/config(5) can't handle module dependency correctly at this
moment.

(This is another proof that shared file definition (`file xxx.c a|b')
is a bad idea.)
 1.108 11-Oct-2014  uebayasi branches: 1.108.2;
Missing agp attachment.
 1.107 23-Aug-2014  dholland Systematize (and in many cases, fix) the comments on options COMPAT_NN.

There are quite a few configs that are missing some COMPAT_NN options
in ways that don't make sense; this should probably get cleaned up
too, but for the time being I've not added or removed anything.
 1.106 24-Jan-2014  martin Add raid to the install kernel
 1.105 22-Jan-2014  tsutsui Add pseudo-device bpfilter to use DHCP client.
 1.104 27-Apr-2013  christos branches: 1.104.4;
remove confusing numeric locators where they are unused.
 1.103 17-Aug-2012  abs branches: 1.103.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

Some of the INSTALL configs for larger memory machines are probably suitable
for adding WSDISPLAY_COMPAT_USL.

Now wsconscfg(8) should be able to switch VTs when expected.

Implemented after no objection from tech-kern to the following:

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.102 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.101 22-Nov-2011  tls branches: 1.101.2;

The rnd pseudo-device is not really optional, because it is in the same
source file as the entropy-pool code itself. Move it to std. This
will be cleaned up more when I split the sources up as they should be.

This fixes build breaks on several ports. Thanks to Havard Eidnes for
pointing them out.
 1.100 23-Nov-2010  hannken branches: 1.100.8;
Remove unused count from pseudo-device md.
 1.99 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.98 29-Mar-2009  tsutsui branches: 1.98.2; 1.98.4;
Remove kernfs and use dmesg(8) on alpha INSTALL kernel.
 1.97 06-Feb-2009  jym branches: 1.97.2;
Changes to MEMORY_RBFLAGS option:
- renamed to MEMORY_DISK_RBFLAGS to better fit the rest of the
MEMORY_DISK options(4)
- change default value to RB_AUTOBOOT instead of RB_SINGLE, and adapt
the config(5) files accordingly
- document this option inside options(4)

See also http://mail-index.netbsd.org/tech-kern/2008/12/25/msg003924.html

Reviewed by abs@ in private mail.
 1.96 31-Jul-2008  simonb branches: 1.96.2;
Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.95 30-May-2008  tsutsui branches: 1.95.4;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.94 01-Jan-2007  pavel branches: 1.94.44; 1.94.46; 1.94.48; 1.94.50;
sync the zstty configuration with GENERIC, for consistency.
 1.93 29-Dec-2006  yamt update comments on NFS_V2_ONLY after nqnfs removal. no functional changes.
from Arnaud Lacombe.
 1.92 11-Dec-2006  tsutsui Reduce diffs between GENERIC and INSTALL.
 1.91 09-Dec-2006  tsutsui Add the following network devices:
- pcn at pci
- wm at pci
- makphy at mii
- rgephy at mii
- rlphy at mii
 1.90 02-Oct-2006  chs branches: 1.90.2;
remove MALLOC_NOINLINE, it doesn't do anything anymore.
 1.89 05-Feb-2006  cube branches: 1.89.14; 1.89.16;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.88 07-Dec-2005  tsutsui branches: 1.88.2; 1.88.4; 1.88.6;
Remove obsolete options VNODE_OP_NOINLINE.
 1.87 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.86 31-May-2005  tron branches: 1.86.2;
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.85 18-Feb-2005  dsl branches: 1.85.4;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.84 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.83 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.82 24-Nov-2004  bouyer branches: 1.82.4; 1.82.6;
pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) serie of
controllers. Tested with a PDC20375 (2 SATA, one PATA) controller on sparc64.
Added to all kernel config file which had pdcide(4).
 1.81 10-Nov-2004  christos Add COMPAT_BSDPTY to the rest of the config files.
 1.80 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.79 13-Feb-2004  wiz branches: 1.79.2;
RealTek -> Realtek.
 1.78 14-Dec-2003  thorpej Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
 1.77 13-Dec-2003  thorpej Split out the Silicon Image SATALink support into its own driver,
"satalink".
 1.76 18-Oct-2003  lukem Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.75 08-Oct-2003  bouyer Add new per-chip pciide drivers.
 1.74 08-Oct-2003  bouyer Add atabus
 1.73 06-Sep-2003  itojun add rnd(4) device to installation media.
necessary for many purposes, including password seeding, tcp sequence number,
and more. see tech-security
 1.72 16-Apr-2003  thorpej branches: 1.72.2;
Add mpt(4).
 1.71 10-Apr-2003  christos Bye Bye UCONSOLE
 1.70 10-Feb-2003  grant add wi at pci and pcmcia, make comments consistent.
 1.69 30-Nov-2002  itohy White space police.
 1.68 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.67 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.66 22-Jul-2002  wiz Correct some commented out variables from ADW_DISABLE_* to SCSI_ADW_DISABLE_*.
From Julio Merino in port-alpha/17677.
 1.65 05-Jul-2002  abs Ensure all INSTALL config files consistantly include PIPE_SOCKETPAIR,
MALLOC_NOINLINE, and VNODE_OP_NOINLINE. The exceptions are when they
include another config files that already defines the options, or if
they are for an embedded board, just define a few extra options, and
do not already define PIPE_SOCKETPAIR.
 1.64 25-Apr-2002  atatat branches: 1.64.2;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.63 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.62 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.61 02-Apr-2002  lukem Rename MEMORY_DISK_SIZE (formerly MINIROOTSIZE) to MEMORY_DISK_ROOT_SIZE,
which was suggested by Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> as
being more consistent with what it's controlling...
 1.60 10-Mar-2002  lukem * rename MINIROOTSIZE to MEMORY_DISK_SIZE, so that all md(4) options
are now consistently named
* fold opt_mdsize.h into opt_md.h
 1.59 10-Feb-2002  wiz Update description for icsphy.
 1.58 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.57 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.56 22-Aug-2001  hubertf branches: 1.56.2;
More comment changes: 90x[B] -> 90x[BC]
 1.55 07-Jul-2001  tsutsui branches: 1.55.2;
Remove (commented out) ncr* at pci? lines.
 1.54 18-Jun-2001  thorpej Add sf(4), gsip(4), gphyter(4) drivers.
 1.53 07-Jun-2001  lukem add iha(4); it works in my pc164 after thorpej fixed a minor issue
 1.52 06-May-2001  ad Add mlx at eisa.
 1.51 12-Feb-2001  minoura branches: 1.51.2;
Correct typo (s/unit/unix/).
 1.50 04-Feb-2001  ad Add a driver for the Mylex DAC960 family (including DEC SWXCR).
 1.49 21-Dec-2000  thorpej Add Sable and Lynx support.
 1.48 26-Nov-2000  ad lsu -> ld, by popular request.
 1.47 19-Oct-2000  ad ca -> lsu
 1.46 02-Oct-2000  abs Ensure all INSTALL* kernels have two ptys, and a note explaining why:
pseudo-device pty 2 # pseudo-terminals (Sysinst needs two)
(Some installers may not be using sysinst, in which case this just reduces
the number of ptys from 16 that are not used to 2 that are not used)
For i386 conf files, no change other than comments.
 1.45 25-Sep-2000  abs Use "options<SPACE><TAB>" not "options<TAB>" - noted by simonb.
Move VNODE_OP_NOINLINE and NFS_V2_ONLY into '# Filesystem options' section.
Consistently label '# Filesystem options' and '#File systems' sections.
 1.44 25-Sep-2000  abs Ensure all INSTALL config files have (at least) COPTS="-Os", cincluding bebox
based on it working already for macppc.
Also add commented out:
#options VNODE_OP_NOINLINE # Don't inline vnode op calls
#options NFS_V2_ONLY # Exclude NFS3 and NQNFS code
as suggestions for additional savings
 1.43 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.42 11-Aug-2000  thorpej Back out part of previous which was unintended.
 1.41 11-Aug-2000  thorpej Add depca at eisa.
 1.40 12-Jul-2000  thorpej - Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.39 01-Jun-2000  thorpej branches: 1.39.2;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.38 23-May-2000  thorpej branches: 1.38.2;
Note that KN300 is also for AlphaServer 1200.
 1.37 08-May-2000  augustss Add (sometimes commented out) MIIVERBOSE option.
 1.36 28-Apr-2000  ad Attach cac* and ca*.
 1.35 22-Apr-2000  thorpej rl -> rtk
 1.34 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.33 16-Nov-1999  dan Add entries for we[01] (configured as for the i386 GENERIC) to enable
WD/SMC ISA ethernet cards to be used for installation and setup.
 1.32 15-Nov-1999  dante Add WDTR, SDTR and TAGQ disable options
 1.31 05-Nov-1999  thorpej branches: 1.31.2;
Add some missing Ethernet cards: rl, ti (not in INSTALL), sip, tlp.
 1.30 28-Sep-1999  ad branches: 1.30.2; 1.30.4; 1.30.6;
Entries for dpt(4).
 1.29 07-Aug-1999  thorpej Add the AdvanSys SCSI boards.
 1.28 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.27 29-Jun-1999  ross Turn on EV6 bits: Tsunami and system type 6600.
 1.26 27-Jun-1999  christos Add missing phy's. Increase miniroot size
 1.25 27-Jun-1999  christos add vr* at pci?, sort
 1.24 29-Apr-1999  ross WSEMUL_SUN -> WSEMUL_VT100
 1.23 22-Mar-1999  ross branches: 1.23.2;
PCI: +bha
+en
+ex
+fxp
+le
+pcscp
MII: +exphy
EISA: +ahb
+uha
 1.22 18-Feb-1999  thorpej Add floppy controller and drives.
 1.21 25-Jan-1999  ross ne* at pci? ...
 1.20 23-Jan-1999  drochner second round of mouse renaming: psm->pms
 1.19 14-Oct-1998  matt Sync with new IDE support (e.g. pciide changes)
 1.18 11-Aug-1998  thorpej Adapt to MII changes.
 1.17 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.16 05-Jun-1998  thorpej Add DEC_550 (Miata).
 1.15 02-Jun-1998  thorpej Add epic* at pci?
 1.14 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.13 13-May-1998  thorpej No need to hard-code the mcclock offset on the gbus; gbus is direct-config.
 1.12 24-Apr-1998  thorpej Whitespace sanity.
 1.11 18-Apr-1998  thorpej Add PCI IDE.
 1.10 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.9 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.8 28-Feb-1998  cgd Use NFS_BOOT_DHCP rather than NFS_BOOT_BOOTP. The former is more
flexible, and the boot blocks use DHCP already(!!!) and it'd be good
for the kernel to be consistent with them.
 1.7 01-Feb-1998  thorpej Bump the ramdisk size to 3M.
 1.6 01-Feb-1998  thorpej le* at isa? isn't ready for prime-time yet.
 1.5 15-Jan-1998  thorpej Switch to MI IDE drivers, add ATAPI devices.
 1.4 13-Jan-1998  cjs Make INSTALL a fully-loaded kernel (for booting from network or CD), and
INSTALL-FLOPPY a stripped-down version to fit on a floppy.
 1.3 12-Jan-1998  thorpej Add (commented out) COMPAT_13
 1.2 31-Dec-1997  cjs Add kernfs; remove more stuff we don't need.
 1.1 19-Oct-1997  cjs First go at an INSTALL kernel (add ramdisk, remove unnecessary stuff).
 1.23.2.2 02-Jul-1999  perry pullup 1.26->1.27 (ross)
 1.23.2.1 29-Apr-1999  perry branches: 1.23.2.1.2; 1.23.2.1.4;
pullup 1.23->1.24 (ross)
 1.23.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.23.2.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.23.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.23.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.30.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.4.1 14-Nov-1999  fvdl Sync with -current.
 1.30.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.30.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.30.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.30.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.30.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.31.2.2 05-Nov-1999  thorpej Add some missing Ethernet cards: rl, ti (not in INSTALL), sip, tlp.
 1.31.2.1 05-Nov-1999  thorpej file INSTALL was added on branch comdex-fall-1999 on 1999-11-05 21:30:22 +0000
 1.38.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.39.2.3 26-Nov-2001  he Apply patch (requested by he):
Add Mylex DACC960 (mlx), change ca* to ld*.
 1.39.2.2 11-Aug-2000  thorpej Pullup from trunk:
Add depca at eisa.
 1.39.2.1 12-Jul-2000  thorpej Update from trunk:
- Add Jensen support/devices.
- Add commented-out Sable/Lynx support/devices.
- Switch from `ncr' to `siop' by default.
- Add some missing `scsibus' configs to INSTALL.
 1.51.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.55.2.7 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.55.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.55.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.55.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.55.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.55.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.55.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.56.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.56.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.56.2.7 01-Aug-2002  nathanw Catch up to -current.
 1.56.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.56.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.56.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.56.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.56.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.56.2.1 22-Aug-2001  nathanw file INSTALL was added on branch nathanw_sa on 2002-01-08 00:22:53 +0000
 1.64.2.2 30-Aug-2002  gehenna catch up with -current.
 1.64.2.1 16-Jul-2002  gehenna catch up with -current.
 1.72.2.10 11-Dec-2005  christos Sync with head.
 1.72.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.72.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.72.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.72.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.72.2.5 29-Nov-2004  skrll Sync with HEAD.
 1.72.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.72.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.72.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.72.2.1 03-Aug-2004  skrll Sync with HEAD
 1.79.2.1 15-Jul-2004  he branches: 1.79.2.1.2;
Pull up revision 1.80 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.79.2.1.2.1 02-Apr-2005  he Pull up revision 1.82 (requested by bouyer in ticket #1019):
Add pdcsata(4), a driver for the Promise SATA150 (aka PDC203xx) series of
controllers.
 1.82.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.82.6.1 12-Feb-2005  yamt sync with head.
 1.82.4.1 29-Apr-2005  kent sync with -current
 1.85.4.1 01-Jun-2005  riz Pull up revision 1.86 (requested by tron in ticket #362):
Remove attachment for the piixide(4) driver from all non-x86 kernel
configurations because Intel IDE disk controllers only exist as part
of Intel chipsets for x86 systems.
 1.86.2.3 26-Feb-2007  yamt sync with head.
 1.86.2.2 30-Dec-2006  yamt sync with head.
 1.86.2.1 21-Jun-2006  yamt sync with head.
 1.88.6.1 22-Apr-2006  simonb Sync with head.
 1.88.4.1 09-Sep-2006  rpaulo sync with head
 1.88.2.1 18-Feb-2006  yamt sync with head.
 1.89.16.3 18-Dec-2006  yamt sync with head.
 1.89.16.2 10-Dec-2006  yamt sync with head.
 1.89.16.1 22-Oct-2006  yamt sync with head
 1.89.14.2 12-Jan-2007  ad Sync with head.
 1.89.14.1 18-Nov-2006  ad Sync with head.
 1.90.2.2 16-May-2007  jdc Pull up revision 1.94 (requested by pavel in ticket #645).

sync the zstty configuration with GENERIC, for consistency.
 1.90.2.1 20-Dec-2006  bouyer branches: 1.90.2.1.2;
Pull up following revision(s) (requested by tsutsui in ticket #282):
sys/arch/alpha/conf/INSTALL: revision 1.91-1.92
sys/arch/alpha/conf/GENERIC: revision 1.302-1.305
Add the following network devices:
- pcn at pci
- wm at pci
- makphy at mii
- rgephy at mii
- rlphy at mii
Reduce diffs between GENERIC and INSTALL.
 1.90.2.1.2.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.94.50.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.94.50.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.94.48.2 11-Aug-2010  yamt sync with head.
 1.94.48.1 04-May-2009  yamt sync with head.
 1.94.46.1 04-Jun-2008  yamt sync with head
 1.94.44.2 28-Sep-2008  mjf Sync with HEAD.
 1.94.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.95.4.1 19-Oct-2008  haad Sync with HEAD.
 1.96.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.96.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.97.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.98.4.2 05-Mar-2011  rmind sync with head
 1.98.4.1 30-May-2010  rmind sync with head
 1.98.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.100.8.3 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.100.8.2 30-Oct-2012  yamt sync with head
 1.100.8.1 17-Apr-2012  yamt sync with head
 1.101.2.1 18-Feb-2012  mrg merge to -current.
 1.103.2.3 03-Dec-2017  jdolecek update from HEAD
 1.103.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.103.2.1 23-Jun-2013  tls resync from head
 1.104.4.1 18-May-2014  rmind sync with head
 1.108.2.1 22-Sep-2015  skrll Sync with HEAD
 1.110.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.110.4.1 10-Jun-2019  christos Sync with HEAD
 1.110.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.111.6.1 25-Jan-2020  ad Sync with head.
 1.117.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.16 16-Oct-1998  ross History. INSTALL is now used on the floppy set and combo CD/HD/tape image.
 1.15 05-Oct-1998  ross The 2-disk install floppy allows us to add:

* 3000-series CPU support, plus all the tc devices
* 4100-series CPU support
* misc SCSI HBA support (removed earlier for space reasons)
 1.14 24-Sep-1998  ross Put back ahc and bha scsi HBA driver configs.
 1.13 11-Aug-1998  thorpej Adapt to MII changes.
 1.12 01-Jul-1998  ross Add support for:

DEC_1000
DEC_1000A
DEC_ALPHABOOK1
DEC_EB66

Remove support (ran out of space) for: ahc and bha. SCSI must be ncr or isp.
This will be fixed soon by defining an optional, two-floppy install
alternative.
 1.11 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.10 05-Jun-1998  thorpej Add DEC_550 (Miata).
 1.9 02-Jun-1998  thorpej Add epic* at pci?
 1.8 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.7 13-May-1998  thorpej No need to hard-code the mcclock offset on the gbus; gbus is direct-config.
 1.6 03-May-1998  ross Add file-system MFS to support ftp download of sysinst.
 1.5 24-Apr-1998  thorpej Whitespace sanity.
 1.4 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.3 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.2 15-Jan-1998  thorpej Switch to MI IDE drivers, add ATAPI devices.
 1.1 13-Jan-1998  cjs Make INSTALL a fully-loaded kernel (for booting from network or CD), and
INSTALL-FLOPPY a stripped-down version to fit on a floppy.
 1.24 22-May-2000  thorpej These systems haven't been available to NetBSD/alpha developers
for a very very very long time, and there are more up-to-date
example configs for the BUNNY case.
 1.23 29-Jul-1999  augustss branches: 1.23.2;
It's time to be COMPAT_14.
 1.22 23-Jan-1999  drochner branches: 1.22.4;
second round of mouse renaming: psm->pms
 1.21 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.20 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.19 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.18 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.17 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.16 19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.15 06-Apr-1997  cgd branches: 1.15.4;
clean up NetBSD RCS ID strings
 1.14 31-Jan-1997  cgd add KMEMSTATS to ALPHA, clean up ports diagnostic/debug options
 1.13 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.12 15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.11 25-Nov-1996  cgd branches: 1.11.2; 1.11.4;
update for recent configuration changes.
 1.10 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.9 27-Sep-1996  cgd update for changes to config.
 1.8 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.7 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.6 17-Apr-1996  cgd branches: 1.6.4;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.5 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd update for all the latest bells and whistles
 1.2 27-Jun-1995  cgd update for current configuration descriptions
 1.1 22-Apr-1995  cgd kernel config files for jura.pdl.cs.cmu.edu and scapa.pdl.cs.cmu.edu,
the DECpc AXP 150 and the AlphaStation 400 4/233 in my office.
NEITHER TYPE OF MACHINE WORKS YET, and i'm not even going to be
working on the DECpc AXP 150 support any more.
 1.6.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.11.4.3 30-Jan-1997  thorpej update from trunk
 1.11.4.2 18-Jan-1997  thorpej Update from trunk.
 1.11.4.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.11.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.2.3 01-Feb-1997  cgd for now, pckbd is needs-count, and therefore can't be cloning
 1.11.2.2 31-Jan-1997  cgd sync with trunk
 1.11.2.1 24-Jan-1997  cgd sync with trunk
 1.15.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.4.1 02-Aug-1999  thorpej Update from trunk.
 1.23.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 12-Apr-1996  cgd i no longer can do anything with macallan, so kill its kernel config.
However, Jason has a turbochannel alpha, so add its config file.
 1.7 20-Dec-1995  cgd rename TC 'asic' to 'ioasic'
 1.6 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5 03-Aug-1995  cgd update for all the latest bells and whistles
 1.4 27-Jun-1995  cgd update for current configuration descriptions
 1.3 22-Apr-1995  cgd clean up, change drive -> lun for mi scsi files description.
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 03-Mar-1995  cgd add config file for my 3000/400, macallan.
 1.8 17-Apr-2002  mycroft These machines are gone.
 1.7 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.6 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.5 09-Jul-2001  soren branches: 1.5.2; 1.5.4;
ncr(8) is gone from the tree, so remove ^#ncr*.
 1.4 24-Sep-2000  jdolecek branches: 1.4.2;
don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.3 12-Jul-2000  thorpej Change from `ncr' to `siop' by default.
 1.2 23-May-2000  thorpej branches: 1.2.4;
Note that KN300 is also for AlphaServer 1200.
 1.1 22-May-2000  thorpej Rename CANE to MINI-ME to reflect that my Multia hasn't been
parked at my (former) NASA office for quite some time.
 1.2.4.1 12-Jul-2000  thorpej Update from trunk:
Change from `ncr' to `siop' by default.
 1.4.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.4.2.1 24-Sep-2000  bouyer file MINI-ME was added on branch thorpej_scsipi on 2000-11-20 19:56:44 +0000
 1.5.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.5.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.5.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.4.1 09-Jul-2001  nathanw file MINI-ME was added on branch nathanw_sa on 2002-02-28 04:06:13 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.8 25-Mar-1998  mjacob With new pmap stuff, the need for MSS3 goes away.
 1.7 13-Feb-1998  enami Remove comment which says that fxp is untested (it is known to work now).
Also, make model name closer to what driver prints startup.
 1.6 05-Jan-1998  perry RCSID Police.
 1.5 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.4 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.3 20-Oct-1997  mjacob MSS3 needs full SYSV stuff.
 1.2 19-Sep-1997  mjacob branches: 1.2.2;
An oops- MSS3 referred to a device not yet integrated.
 1.1 19-Sep-1997  mjacob Add a config file for large memory 8200s- this is temporary until a
more gracious self correcting (for large memory, e.g., > 1GB) startup happens.
 1.2.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 19-Sep-1997  thorpej file MSS3 was added on branch marc-pcmcia on 1997-09-22 06:30:13 +0000
 1.88 26-Jul-2023  rin Use OBJCOPY_STRIPFLAGS instead of STRIPFLAGS.
 1.87 05-May-2021  thorpej branches: 1.87.14;
Remove unneeded Makefile dependency for things which have long since
used opt_*.h headers.
 1.86 05-May-2021  thorpej Add a linker script for the kernel. The main difference vs the
standard built-in for "ld -N" is to actually process the
.data.cacheline_aligned and .data.read_mostly sections correctly.
 1.85 22-Sep-2018  rin branches: 1.85.16;
- Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
 1.84 20-Jan-2016  jklos branches: 1.84.16; 1.84.18;
Change base address to account for later Alpha models with later firmware
which require more space for SRM.
 1.83 10-Mar-2013  christos branches: 1.83.14;
Explicitly set KERN_AS (this could be done in /usr/src/sys/conf/Makefile.*)
so that modules work, on config files that did not set it explicitly. All
the files now use the standard logic, except the ones that set KERN_AS=obj
and Makefile.usermode which sets KERN_AS=library.
 1.82 09-Nov-2009  mhitch branches: 1.82.12; 1.82.22;
Loading the kernel at 0xfffffc0000300000 doesn't work on my ES40 when I've
got raid drives configured on the iop(4) adapter and the mlx(4) adapter.
Change the kernel text to 0xfffffc0000430000 (which is where Tru64 has its
kernel).
 1.81 11-Dec-2008  alc Clean-up makefile stub used to include in the build the binary HAL object
 1.80 25-Oct-2008  apb branches: 1.80.2; 1.80.4; 1.80.10;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.79 17-Oct-2007  garbled branches: 1.79.16; 1.79.20; 1.79.26;
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.78 05-Jun-2007  yamt branches: 1.78.10;
add a missing dependency.
 1.77 01-Sep-2006  dyoung branches: 1.77.12; 1.77.14; 1.77.18; 1.77.20;
Add ath(4) to GENERIC alpha kernel. UNTESTED.
 1.76 11-Dec-2005  christos branches: 1.76.4; 1.76.8;
merge ktrace-lwp.
 1.75 31-May-2005  christos branches: 1.75.2;
s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.74 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.73 24-Sep-2002  ad branches: 1.73.6; 1.73.10;
Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.72 09-Dec-2001  atatat Fix a couple of rcsids.
 1.71 23-Nov-2001  atatat Oops. Add in missing entry point settings.
 1.70 23-Nov-2001  atatat Instead of checking for previous usage, just append to some make
variables. Tweak some variables to provide for more uniform defaults.
Minor adaption to makefiles for already converted ports.
 1.69 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.68 16-Nov-2001  atatat Abstract out a large chunk of the kernel build machinery so that new
build features (such as ross's DEBUGLIST) can easily be applied to all
ports. This should reduce the complexity of each port's kernel
Makefile considerably. Line counts:

227 arch/i386/conf/Makefile.i386.orig
98 arch/i386/conf/Makefile.i386
227 arch/alpha/conf/Makefile.alpha.orig
99 arch/alpha/conf/Makefile.alpha
219 arch/sparc/conf/Makefile.sparc.orig
102 arch/sparc/conf/Makefile.sparc
215 arch/vax/conf/Makefile.vax.orig
102 arch/vax/conf/Makefile.vax
253 conf/Makefile.kern.inc

Roll i386, alpha, sparc, and vax over to the new build machinery.
 1.67 26-Oct-2001  jmc Change defaults for kernel compiles. Default all to USETOOLS?=no and have
the etc Makefile override that by putting USETOOLS into $.MAKEOVERRIDES
This way the default for kernel compiles is still to use the installed
toolchain instead of depending on $TOOLDIR. $TOOLDIR can be used by
simply adding USETOOLS=yes to the command line as usual.

Adjust each ports template to set the default no setting and also pull in
bsd.own.mk if they weren't already to ensure they'll build correctly
with the new toolchain setup.
 1.66 23-Oct-2001  thorpej branches: 1.66.2;
Set MACHINE_ARCH explicitly in Makefiles for which it is constant.
Also, since config(8) now explcitly sets MACHINE, there is no need
to do it here in the Makefile.
 1.65 31-May-2001  enami branches: 1.65.2; 1.65.4;
define _KERNEL_OPT as well as _KERNEL. we will use this in the future to
get kernel "opt_foo.h" headers, rather than _KERNEL && !_LKM.
 1.64 14-May-2001  ross Fix new DEBUGLIST feature.
 1.63 08-May-2001  ross Add DEBUGLIST mechanism. Example config line:
makeoptions DEBUGLIST="uvm* trap ufs*"
This turns on -g for only those files matching a DEBUGLIST pattern word.
 1.62 17-Dec-2000  jdolecek branches: 1.62.2;
delete obsolete comment
 1.61 07-Dec-2000  jdolecek generate dependencies for assym.h for make depend, fix dependency
for maxusers (make assym.h depend on Makefile)
 1.60 29-Nov-2000  jdolecek remove rules for genassym.c, it's no longer pertinent
 1.59 29-Nov-2000  jdolecek convert to use common genassym.cf
 1.58 09-May-2000  hubertf Add "install" target, so "make install" after building the kernel
does something useful. The target can be redefined by putting a
install-kernel-${MACHINE_NAME} target that fits your needs into
/etc/mk.conf.
 1.57 09-May-2000  thorpej HAVE_GCC28 -> HAVE_EGCS, and make it match gcc 2.9 as well. Also,
make the use of -Wno-uninitialized explicit, don't rely on a compiler
hack to do it for us.
 1.56 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.55 24-Jan-2000  tron Add "dependall" target for comfort.
 1.54 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.53 26-Jul-1999  cgd branches: 1.53.2;
be more efficient when doing the SYSTEM_LD_TAIL for -g kernels: don't
copy them just to strip them, use strip -o.
 1.52 09-Jul-1999  mrg clean up a bit after jason :)

- fix emitrules() like emitfiles() to deal with the prefix (otherwise it
would attempt to find the file in the normal base for the NORMAL_C rule).
- add emitincludes() which adds include directives for each prefix to the
$INCLUDES variable in the makefile.
- add %INCLUDES to each Makefile.arch to deal with the above.

this makes "prefix" actually work in a usable manner, and now i can move
on to fixing compiler warnings (errors) in the ESP code. :)
 1.51 31-May-1999  ross Be less drastic when running strip(1) on DEBUG=-g kernels.
 1.50 31-May-1999  ross Fix generation of locore.s dependencies.
 1.49 23-Feb-1999  thorpej branches: 1.49.2; 1.49.4; 1.49.6;
Do all the fancy printf format checking.
 1.48 01-Feb-1999  tron Fix bug exposed by new "mkdep" program:
"${SFILES}" is empty so that "cc" will fail with "No input files"
during "mkdep".
 1.47 15-Jan-1999  thorpej Some minor, mostly costmetic, changes to CPPFLAGS/CFLAGS.
 1.46 08-Jan-1999  augustss Add -Wpointer-arith warning since `void *' arithmetic is not ANSI C.
 1.45 15-Oct-1998  drochner change handling of libkern:
-sys/lib/libkern builds as library per default (as it was documented all
the time)
-ports able to LKM set "KERN_AS=obj" explicitely in their Makefiles
(for now; should depend on actual "option LKM" or -better- functions
included for LKM use should be pulled in by a stub)
-always link libcompat before libkern - libkern stuff can be referred to
by libcompat, but not the other way
 1.44 05-Sep-1998  lukem distclean is a synonym for cleandir
 1.43 31-May-1998  thorpej Specify a non-profiling C rule.
 1.42 12-Apr-1998  tv Add -Wno-main conditional on compiler being gcc 2.8 or egcs. (This adds
a HAVE_GCC28 check-variable that can now be used to add other gcc-2.8
flags in cases where they may be useful, or to remove gcc 2.7.2 "bug
workaround" flags.)
 1.41 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.40 12-Nov-1997  thorpej Make sure CPP, AR, AS, and RANLIB are defined.
 1.39 12-Nov-1997  thorpej Define LORDER, NM, and TSORT here, like we do the rest of the tools.
 1.38 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.37 04-Oct-1997  gwr branches: 1.37.2;
use common genassym.awk
 1.36 30-Sep-1997  christos PR/4162: Chris Jones: make cleandir does not work properly; it does not
remove the object files and the .depend file in the kernel build directory.
 1.35 22-Aug-1997  cgd lie to the compiler when doing mkdep so that it depends .s files correctly.
 1.34 19-Jul-1997  cgd branches: 1.34.2;
* move COPTS out of the 'program variables' section of the makefile and
into the 'argument variables' section.
* define variables for CPP and SIZE, defaulting to cpp and size, respectively.
* kill HOSTED_C*, since it's no longer used.
* use ${SIZE} rather than using 'size' directly, so it can be overridden for
cross-builds.
* generate assym.h via assym.s and an awk script.
 1.33 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.32 04-Feb-1997  perry Nuke some options GENERIC residue.
 1.31 04-Feb-1997  perry Nuke some GENERIC residue.
 1.30 23-Jan-1997  cgd update for new kernel library Makefile.inc rules
 1.29 21-Jan-1997  cgd make load address settable via LOADADDRESS make option
 1.28 22-Dec-1996  cgd branches: 1.28.2;
for now, -Wcast-qual is just not practical in the kernel
 1.27 01-Dec-1996  jonathan branches: 1.27.2;
* Replace explicit -O2 in CFLAGS with COPTS macro. Default COPTS?= -O2.
Lets users over-ride with makeoptions COPTS="..." in kernel config files.

Leave `mandatory' flags (like -msoft-float which on m68k enforces no
FP in kernel) in CFLAGS.
 1.26 13-Nov-1996  cgd Set CWARNFLAGS to:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wcast-qual -Wno-format
(if not already set). -Wno-format is necessary because of the few
bits of code in the tree that use NetBSD's special kernel printf()
formats, and because there are a few bits of code that try to use the 'q'
modifier to print int64_t's (but int64_t's are only 'long' on the
alpha, not 'long long').
 1.25 27-Sep-1996  cgd compile .S files with cpp | sed | as, to work around a bug with the
ELF-outputting version of the assembler. (It was dying when it saw
some CPP line number markers.) This is temporary. (Workaround suggested
by Matt Thomas.)
 1.24 09-Sep-1996  mycroft Move strip(1) flags into a separate variable, so that $STRIP can
be passed to subordinate make(1)s. Remove $TOUCH. Add HOSTED_CC,
HOSTED_CPPFLAGS, and HOSTED_CFLAGS, and use them when depending genassym.
 1.23 31-Aug-1996  mycroft Wrap the default definition of `S' in `.ifndef'.
 1.22 20-Aug-1996  cgd kill 'microcode' Makefile.inc include, define CWARNFLAGS with ?=.
 1.21 12-Aug-1996  mycroft Put into . Remove hooks for `config-dependent' and
`device-driver' flags.
 1.20 10-Aug-1996  mycroft * Add a HOSTED_C_C variable, which strips `-p', `-pg', and
`-nostdinc', and use it when building genassym.
* Use `-nostdinc' just to be sure we're self-contained.
 1.19 10-Aug-1996  mycroft * Define CWARNFLAGS and MKDEP in some moderately consistent fashion.
* Make S expand to an absolute path at compile time.
* Use `-S' rather than `-x' to remove debugging symbols.
* Garbage collect unused variables.
* Reverse a handful of port-specific changes that do not correspond to
the common build model and are not needed.
 1.18 14-Jul-1996  cgd include 'microcode' dependencies, in case the aic7xxx driver is ever made
to work on 64-bit systems or in case other drivers need it eventually.
 1.17 09-Jul-1996  cgd add -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes as
CWARNFLAGS in the Makefile, but (for the time being, i.e. until that
works) override that with 'makeoptions' in std.alpha.
 1.16 19-May-1996  cgd add -O2 to the optimization flags. A reason why optimization seemed
to fail on some systems was never found; hopefully it's gone away (or
was never really there).
 1.15 11-May-1996  mycroft Make `make depend' work for libraries.
 1.14 29-Feb-1996  cgd Do not build vnode_if.[ch] for each kernel. Build them once, like the
various syscall sources/headers, and just compile them. From PR 2142, OK'd
by mycroft.
 1.13 26-Feb-1996  mycroft Define build programs with `?=', so they can be overridden with `makeoptions'.
 1.12 09-Feb-1996  mycroft Fix mkdep problems due to missing flags.
 1.11 03-Feb-1996  mycroft Use `-traditional-cpp' when building .s and .S files.
 1.10 02-Feb-1996  mycroft Clone these, and fix many bugs.
 1.9 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.8 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.7 19-Sep-1995  thorpej Compile the kernel with -fno-builtin.
 1.6 03-Aug-1995  cgd update for all the latest bells and whistles
 1.5 24-Jun-1995  christos Makefile.`arch`: - Add -lcompat
- Change clean: target to be a double dep one,
so libraries can use the clean target too
 1.4 16-May-1995  jtc Removing -DKERNEL, transition to _KERNEL has been completed
 1.3 22-Apr-1995  cgd kill some non-gnu-tools cruft, allow rest of programs to be parameterized
 1.2 23-Mar-1995  jtc Added -D_KERNEL to CFLAGS alongside each -DKERNEL.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.27.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.27.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.27.2.1 24-Jan-1997  cgd sync with trunk
 1.28.2.1 30-Jan-1997  thorpej update from trunk
 1.34.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.2.2 12-Nov-1997  thorpej Pull up "make sure tools are defined" changes from trunk.
 1.37.2.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.49.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.49.4.2 02-Aug-1999  thorpej Update from trunk.
 1.49.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.49.2.2 22-Sep-1999  cgd pull up rev 1.53 from trunk (requested by cgd):
Be more efficient when linking kernels with debugging symbols. (Don't
copy them just to strip them, use strip -o.)
 1.49.2.1 21-Jun-1999  perry pullup 1.49->1.50 (ross): Fix generation of locore.s dependencies
 1.53.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.53.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.53.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.53.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.53.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.62.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.65.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.65.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.65.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.65.4.1 31-May-2001  nathanw file Makefile.alpha was added on branch nathanw_sa on 2001-11-14 19:12:40 +0000
 1.65.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.65.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.66.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.73.10.1 06-Feb-2005  jmc Pull up patch (requested by martti in ticket #1086)
Move ipf to sys/dist/ipf and sync w. trunk
 1.73.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.73.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.73.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.73.6.1 03-Aug-2004  skrll Sync with HEAD
 1.75.2.2 03-Sep-2007  yamt sync with head.
 1.75.2.1 30-Dec-2006  yamt sync with head.
 1.76.8.1 03-Sep-2006  yamt sync with head.
 1.76.4.1 09-Sep-2006  rpaulo sync with head
 1.77.20.1 26-Jun-2007  garbled Sync with HEAD.
 1.77.18.1 18-Apr-2007  thorpej Do the KERN_AS dance for LKMs.
 1.77.14.1 11-Jul-2007  mjf Sync with head.
 1.77.12.1 09-Jun-2007  ad Sync with head.
 1.78.10.1 06-Nov-2007  matt sync with HEAD
 1.79.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.79.20.2 11-Mar-2010  yamt sync with head
 1.79.20.1 04-May-2009  yamt sync with head.
 1.79.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.80.10.1 21-Apr-2010  matt sync to netbsd-5
 1.80.4.2 15-Nov-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1135):
sys/arch/alpha/conf/Makefile.alpha: revision 1.82
Loading the kernel at 0xfffffc0000300000 doesn't work on my ES40 when I've
got raid drives configured on the iop(4) adapter and the mlx(4) adapter.
Change the kernel text to 0xfffffc0000430000 (which is where Tru64 has its
kernel).
 1.80.4.1 07-Aug-2009  snj Pull up following revision(s) (requested by sborrill in ticket #905):
sys/arch/alpha/conf/Makefile.alpha: revision 1.81
sys/arch/amd64/conf/Makefile.amd64: revision 1.26
sys/arch/i386/conf/Makefile.i386: revision 1.162
sys/arch/macppc/conf/Makefile.macppc: revision 1.31
sys/arch/mips/conf/Makefile.mips: revision 1.52
sys/arch/sparc64/conf/Makefile.sparc64: revision 1.68
sys/arch/xen/conf/Makefile.xen: revision 1.28
Clean-up makefile stub used to include in the build the binary HAL object
 1.80.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.82.22.2 03-Dec-2017  jdolecek update from HEAD
 1.82.22.1 23-Jun-2013  tls resync from head
 1.82.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.83.14.1 19-Mar-2016  skrll Sync with HEAD
 1.84.18.1 10-Jun-2019  christos Sync with HEAD
 1.84.16.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.85.16.1 13-May-2021  thorpej Sync with HEAD.
 1.87.14.1 11-Sep-2023  martin Pull up following revision(s) (requested by rin in ticket #363):

sys/arch/aarch64/conf/Makefile.aarch64: revision 1.24
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.25
sys/arch/shark/conf/Makefile.shark.inc: revision 1.28
sys/arch/alpha/conf/Makefile.alpha: revision 1.88
sys/arch/mips/conf/Makefile.mips: revision 1.73
sys/conf/Makefile.kern.inc: revision 1.298
sys/conf/Makefile.kern.inc: revision 1.299
sys/arch/cats/conf/Makefile.cats.inc: revision 1.37
sys/arch/arm/conf/Makefile.arm: revision 1.56
sys/arch/arm/conf/Makefile.arm: revision 1.57
sys/arch/riscv/conf/Makefile.riscv: revision 1.10

Always use arm-elf2aout; no a.out support both for binutils{,.old}

Fix kernel size inflation for arm and aarch64 (PR toolchain/57146)

For some conditions, SYSTEM_LD_TAIL is set for arm and aarch64.
Then, ctfmerge(1) in default SYSTEM_LD_TAIL is unintentionally
skipped, which results in the catastrophic kernel size inflation,
as reported in the PR.

Also, introduce and use OBJCOPY_STRIPFLAGS variable instead of
STRIPFLAGS, as strip(1) is replaced by objcopy(1) during MI
kernel build procedure.

For Makefile.{arm,aarch64}, weird logic is used to determine how
to handle debug symbols; MKDEBUG{,KERNEL} are taken into account
later in sys/conf/Makefile.kern.inc.

Use OBJCOPY_STRIPFLAGS instead of STRIPFLAGS.
Simplify fix for PR toolchain/57146

Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.
 1.4 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.3 17-Apr-1996  cgd branches: 1.3.4;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.2 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.31 22-May-2000  thorpej bishop.nas.nasa.gov and nostromo.nas.nasa.gov are no more.
 1.30 29-Jul-1999  augustss branches: 1.30.2;
It's time to be COMPAT_14.
 1.29 30-Apr-1999  cgd update comment re: COMPAT_OSF1
 1.28 26-Jun-1998  lukem branches: 1.28.8; 1.28.10; 1.28.12;
remove options FIFO; it's now the default
 1.27 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.26 04-May-1998  thorpej Don't need options UVM and PMAP_NEW anymore; they're now standard.
 1.25 15-Apr-1998  drochner convert to new wscons
(pcppi->pckbc, pms->psm, wscons->wsdisplay)
 1.24 26-Mar-1998  thorpej Enable DDB history, netbsd.gdb.
 1.23 26-Mar-1998  thorpej Add options UVM, PMAP_NEW, and NEW_SCC_DRIVER.
 1.22 24-Mar-1998  thorpej Update my DEC 3000/400 kernel config to reflect usage of the MI SCC driver.

Do not try this at home. Caution: hot coffee is hot.
 1.21 12-Mar-1998  thorpej Bump maxusers to 64.
 1.20 30-Nov-1997  mjacob add missing COMPAT_13 that kleink putzed
 1.19 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.18 06-Sep-1997  thorpej Enable DDB.
 1.17 24-Aug-1997  cgd fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.16 06-Apr-1997  cgd branches: 1.16.4;
clean up NetBSD RCS ID strings
 1.15 27-Feb-1997  thorpej s/esp/asc/g
 1.14 31-Jan-1997  cgd branches: 1.14.4;
add KMEMSTATS to ALPHA, clean up ports diagnostic/debug options
 1.13 31-Jan-1997  thorpej Oops, remove straggler NFSCLIENT.
 1.12 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.11 15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.10 15-Nov-1996  cgd branches: 1.10.2; 1.10.4;
move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.9 27-Sep-1996  cgd update for changes to config.
 1.8 21-Aug-1996  cgd add COMPAT_12 to all configs
 1.7 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.6 11-Jun-1996  thorpej Sync up with my local tree:
- add union filesystem
- add DEFTA device
 1.5 01-May-1996  cgd branches: 1.5.4;
add sfb at tc, wscons at sfb
 1.4 26-Apr-1996  thorpej Yes, folks, there was a REASON that maxusers -> 32 slipped through the
cracks when I mentioned it to Chris. (Read: it doesn't work.)
 1.3 26-Apr-1996  thorpej Correction I mentioned to Chris that slipped through the cracks...
maxusers -> 32.
 1.2 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.1 12-Apr-1996  cgd i no longer can do anything with macallan, so kill its kernel config.
However, Jason has a turbochannel alpha, so add its config file.
 1.5.4.2 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.5.4.1 13-Jun-1996  cgd pull up from trunk (trunk commit by thorpej):
>Sync up with my local tree:
> - add union filesystem
> - add DEFTA device
 1.10.4.3 30-Jan-1997  thorpej update from trunk
 1.10.4.2 18-Jan-1997  thorpej Update from trunk.
 1.10.4.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.10.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.2.3 31-Jan-1997  cgd sync with trunk
 1.10.2.2 25-Jan-1997  cgd sync up, update all for new definitions, add back tga devices
 1.10.2.1 24-Jan-1997  cgd sync with trunk
 1.14.4.1 11-Mar-1997  is Merge in latest Trunk.
 1.16.4.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.12.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.28.10.2 02-Aug-1999  thorpej Update from trunk.
 1.28.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.28.8.1 21-Jun-1999  cgd pull up rev(s) 1.29 from trunk. (cgd)
 1.30.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.18 19-Sep-2020  thorpej Enable MULTIPROCESSOR by default, but disable it in the RAMDISK
and INSTALL kernels to save some space.
 1.17 06-Feb-2009  jym Changes to MEMORY_RBFLAGS option:
- renamed to MEMORY_DISK_RBFLAGS to better fit the rest of the
MEMORY_DISK options(4)
- change default value to RB_AUTOBOOT instead of RB_SINGLE, and adapt
the config(5) files accordingly
- document this option inside options(4)

See also http://mail-index.netbsd.org/tech-kern/2008/12/25/msg003924.html

Reviewed by abs@ in private mail.
 1.16 02-Apr-2002  lukem branches: 1.16.116; 1.16.124;
Rename MEMORY_DISK_SIZE (formerly MINIROOTSIZE) to MEMORY_DISK_ROOT_SIZE,
which was suggested by Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> as
being more consistent with what it's controlling...
 1.15 10-Mar-2002  lukem * rename MINIROOTSIZE to MEMORY_DISK_SIZE, so that all md(4) options
are now consistently named
* fold opt_mdsize.h into opt_md.h
 1.14 24-Aug-1997  cgd branches: 1.14.30; 1.14.32;
fix spaces/tabs lossage: if we're going to do "options<space><tab>", be
consistent about it (fix it in all files)! Also, there's no point at all
in doing "file-system<space><tab>", so kill the spaces.
 1.13 06-Apr-1997  cgd branches: 1.13.4;
clean up NetBSD RCS ID strings
 1.12 24-Feb-1997  leo Force root to be on the ram-disk.
 1.11 14-Jan-1997  cgd branches: 1.11.4;
useful suggestion from jason: make this simply an 'include' of the
GENERIC kernel config with the added ramdisk-hook-enabling bits!
 1.10 28-Dec-1996  pk branches: 1.10.2;
rename: ramdisk => md
 1.9 03-Dec-1996  cgd branches: 1.9.2;
clean up SCSI devices
 1.8 26-Nov-1996  cgd add a comment re: eb164
 1.7 25-Nov-1996  cgd update for recent configuration changes.
 1.6 19-Nov-1996  cgd update for VGA changes, and clean up slightly.
 1.5 15-Nov-1996  cgd move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.4 03-Oct-1996  cgd switch to 'swap generic' since that works now (minimal diffs from GENERIC)
 1.3 27-Sep-1996  cgd update for changes to config.
 1.2 16-Sep-1996  cgd add EISAVERBOSE, TCVERBOSE as appropriate. Add UCONSOLE to all.
slight cleanup + sync.
 1.1 15-Sep-1996  cgd like GENERIC, but uses built-in ramdisk image for root
 1.9.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.1 24-Jan-1997  cgd sync with trunk
 1.10.2.3 30-Jan-1997  thorpej update from trunk
 1.10.2.2 18-Jan-1997  thorpej Update from trunk.
 1.10.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.11.4.1 11-Mar-1997  is Merge in latest Trunk.
 1.13.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.32.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.32.1 16-Mar-2002  jdolecek Catch up with -current.
 1.14.30.2 17-Apr-2002  nathanw Catch up to -current.
 1.14.30.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.16.124.1 03-Mar-2009  skrll Sync with HEAD.
 1.16.116.1 04-May-2009  yamt sync with head.
 1.46 05-Sep-2020  thorpej Remove the RAWHIDE kernel; there is not need to keep it around.
 1.45 20-Jan-2020  thorpej Remove FDDI support.
 1.44 19-Jan-2020  thorpej Remove HIPPI support and the esh(4) driver that uses it. There have not
been any users of HIPPI for some time, and it is unlikely to be resurrected.
 1.43 06-Sep-2018  maxv branches: 1.43.6;
Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.42 01-Aug-2018  maxv Unreference IPF/PF from all the config files, and enable NPF instead when
wanted. This also fixes some inconsistencies I saw in several files (eg
IPF options while IPF was not compiled, IPF+PF enabled by default, etc).
 1.41 14-Sep-2017  mrg branches: 1.41.2; 1.41.4;
clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.40 21-Aug-2015  uebayasi Add `pseudo-device ksyms' where `options DDB' is used, because
config(1)/config(5) can't handle module dependency correctly at this
moment.

(This is another proof that shared file definition (`file xxx.c a|b')
is a bad idea.)
 1.39 07-Aug-2015  maxv Remove the KMEMSTATS option. It no longer exists.
 1.38 23-Aug-2014  dholland branches: 1.38.2;
Systematize (and in many cases, fix) the comments on options COMPAT_NN.

There are quite a few configs that are missing some COMPAT_NN options
in ways that don't make sense; this should probably get cleaned up
too, but for the time being I've not added or removed anything.
 1.37 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.36 27-Apr-2013  christos branches: 1.36.4;
remove confusing numeric locators where they are unused.
 1.35 23-Nov-2010  hannken branches: 1.35.8; 1.35.18;
Remove unused count from pseudo-device md.
 1.34 08-May-2010  mrg enable IPFILTER_COMPAT in all kernels that have ipfilter already.
canonicalise several of the ipf option segments in various files
(this mostly means adding commented out IPFILTER_DEFAULT_BLOCK,
or adding commented or uncommented IPFILTER_LOG or IPFILTER_LOOKUP
option statements.)

i built about 20 of these kernels to check, but not all of them.
 1.33 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.32 05-Dec-2009  pooka branches: 1.32.2; 1.32.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.31 30-May-2008  tsutsui Add options COMPAT_40 to files which have options COMPAT_30.
 1.30 27-Sep-2006  manu branches: 1.30.52; 1.30.54; 1.30.56; 1.30.58;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.29 05-Feb-2006  cube branches: 1.29.14; 1.29.16;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.28 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.27 07-Dec-2005  tsutsui branches: 1.27.2; 1.27.4; 1.27.6;
Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.26 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.25 19-Aug-2005  christos 64 bit inode changes.
 1.24 25-Feb-2005  simonb branches: 1.24.4;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.23 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.22 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.21 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.20 10-Nov-2004  christos branches: 1.20.4; 1.20.6;
Add COMPAT_BSDPTY to the rest of the config files.
 1.19 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.18 10-Apr-2003  christos branches: 1.18.2; 1.18.4;
Bye Bye UCONSOLE
 1.17 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.16 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.15 25-Apr-2002  atatat branches: 1.15.2; 1.15.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.14 17-Apr-2002  mycroft Switch from de to tlp by default.
 1.13 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.12 09-Jul-2001  soren branches: 1.12.2; 1.12.4;
ncr(8) is gone from the tree, so remove ^#ncr*.
 1.11 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.10 12-Jul-2000  thorpej Change from `ncr' to `siop' by default.
 1.9 23-May-2000  thorpej branches: 1.9.4;
Note that KN300 is also for AlphaServer 1200.
 1.8 22-Mar-2000  cgd add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.7 29-Jul-1999  augustss branches: 1.7.2;
It's time to be COMPAT_14.
 1.6 18-Feb-1999  thorpej branches: 1.6.4;
Add floppy controller and drives.
 1.5 02-Sep-1998  enami Replace TAB just after the keyword `options' with SPACE.
 1.4 03-Jun-1998  mjacob turn on Essential HIPPI for these configurations
 1.3 05-May-1998  mjacob update for new ws stuff, plus cleanup
 1.2 05-May-1998  mjacob carry over new ws words from GENERIC
 1.1 15-Apr-1998  mjacob add an AlphaServer 4100 Specific config file
 1.6.4.1 02-Aug-1999  thorpej Update from trunk.
 1.7.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.9.4.1 12-Jul-2000  thorpej Update from trunk:
Change from `ncr' to `siop' by default.
 1.12.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.12.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.12.4.2 17-Apr-2002  nathanw Catch up to -current.
 1.12.4.1 09-Jul-2001  nathanw file RAWHIDE was added on branch nathanw_sa on 2002-04-17 00:02:10 +0000
 1.12.2.3 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.12.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.4.1 01-Aug-2002  lukem Pull up revision 1.16 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.15.2.1 09-Jul-2002  gehenna catch up with -current.
 1.18.4.1 15-Jul-2004  he Pull up revision 1.19 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.18.2.9 11-Dec-2005  christos Sync with head.
 1.18.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.6 15-Feb-2005  skrll Sync with HEAD.
 1.18.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.18.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.6.1 12-Feb-2005  yamt sync with head.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.4.2 30-Dec-2006  yamt sync with head.
 1.24.4.1 21-Jun-2006  yamt sync with head.
 1.27.6.1 22-Apr-2006  simonb Sync with head.
 1.27.4.1 09-Sep-2006  rpaulo sync with head
 1.27.2.1 18-Feb-2006  yamt sync with head.
 1.29.16.1 22-Oct-2006  yamt sync with head
 1.29.14.1 18-Nov-2006  ad Sync with head.
 1.30.58.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.56.3 11-Aug-2010  yamt sync with head.
 1.30.56.2 11-Mar-2010  yamt sync with head
 1.30.56.1 04-May-2009  yamt sync with head.
 1.30.54.1 04-Jun-2008  yamt sync with head
 1.30.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.4.2 05-Mar-2011  rmind sync with head
 1.32.4.1 30-May-2010  rmind sync with head
 1.32.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.32.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.18.3 03-Dec-2017  jdolecek update from HEAD
 1.35.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.18.1 23-Jun-2013  tls resync from head
 1.35.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.4.1 28-Aug-2013  rmind sync with head
 1.38.2.1 22-Sep-2015  skrll Sync with HEAD
 1.41.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.41.4.1 10-Jun-2019  christos Sync with HEAD
 1.41.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.41.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.43.6.1 25-Jan-2020  ad Sync with head.
 1.2 27-Jun-1995  cgd update for current configuration descriptions
 1.1 22-Apr-1995  cgd kernel config files for jura.pdl.cs.cmu.edu and scapa.pdl.cs.cmu.edu,
the DECpc AXP 150 and the AlphaStation 400 4/233 in my office.
NEITHER TYPE OF MACHINE WORKS YET, and i'm not even going to be
working on the DECpc AXP 150 support any more.
 1.30 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.29 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.28 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.27 25-Apr-2002  atatat branches: 1.27.2; 1.27.4;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.26 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.25 22-Feb-2002  ad Note that INSECURE is needed for X with a px or pxg.
 1.24 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.23 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.22 23-Aug-2001  nisimura branches: 1.22.2;
Add MX (PMAG-A) and TX (PMAG-RO/PMAG[B]-J) supports and replace CX
(PMAG-B) code with one found in dev/tc/ directory.
 1.21 05-Mar-2001  ad branches: 1.21.4;
Typo in previous.
 1.20 04-Mar-2001  ad Hook in px & pxg devices.
 1.19 23-Feb-2001  nisimura Make sure to have sfbp.h and add sfbp* line in TCWSCONS left #ed-out.
Pointed by Matthew Jacob <mjacob@feral.com>.
 1.18 12-Feb-2001  tsutsui - Add options NTP (sync with GENERIC)
- Fix ident (s/GENERIC/TCWSCONS/)
 1.17 19-Dec-2000  tsutsui Add pseudo-device vlan.
 1.16 15-Dec-2000  tsutsui Add options COMPAT_LINUX (sync with GENERIC).
 1.15 19-Nov-2000  tsutsui Remove "rnd is EXPERIMENTAL" comment.
 1.14 19-Nov-2000  tsutsui Sync with GENERIC.
 1.13 17-Oct-2000  nisimura Have zstty/zskbd/zsms attached appropriately with standard hardware
configuration.
 1.12 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.11 14-Jun-2000  veego branches: 1.11.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.10 13-Jun-2000  tron Add entry for "bba(4)".
 1.9 22-Mar-2000  cgd branches: 1.9.2;
add commented out option PCI_CONFIG_DUMP whever there's a PCIVERBOSE.
 1.8 16-Mar-2000  nisimura Note that HX (PMAGB-B) has no support for small (less than 8 pixel width)
font. If attempted, kernel will explode.
 1.7 14-Mar-2000  nisimura - Comment out cfb (PMAG-B) 1024x768 framebuffer.
- Have Gallant19 font by default.
 1.6 14-Mar-2000  nisimura Redo the previous commit; duplicated lines.
 1.5 14-Mar-2000  nisimura Synchronize with recent progress of GENERIC.
 1.4 08-Nov-1999  mycroft branches: 1.4.2;
Kill wsmux. DIE DIE DIE!
 1.3 04-Aug-1999  nisimura branches: 1.3.2; 1.3.4; 1.3.6;
- Replace device node names of zskbd/zsms into lkkbd/vsms, respectively.
No functionality was changed at this moment.
- Apply recent changes in GENERIC to TCWSCONS.
 1.2 29-Jul-1999  augustss It's time to be COMPAT_14.
 1.1 22-Oct-1998  briggs branches: 1.1.8;
Kernel config for wscons/serial console support for TC alphas, based on
GENERIC. This can go away when NEW_SCC_DRIVER hits prime-time.
 1.1.8.1 02-Aug-1999  thorpej Update from trunk.
 1.3.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.1 14-Nov-1999  fvdl Sync with -current.
 1.3.2.5 23-Mar-2001  bouyer Make sure files that shouldn't change are identical to HEAD.
 1.3.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.3.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.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.4.2.2 08-Nov-1999  mycroft Kill wsmux. DIE DIE DIE!
 1.4.2.1 08-Nov-1999  mycroft file TCWSCONS was added on branch comdex-fall-1999 on 1999-11-08 06:19:55 +0000
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.1 01-May-2001  he Pull up revisions 1.15,1.15 (via patch, requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.21.4.7 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.21.4.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.21.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.21.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.21.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.22.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.22.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.22.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.22.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.22.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.22.2.1 23-Aug-2001  nathanw file TCWSCONS was added on branch nathanw_sa on 2002-01-08 00:22:53 +0000
 1.27.4.1 01-Aug-2002  lukem Pull up revision 1.28 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.27.2.1 09-Jul-2002  gehenna catch up with -current.
 1.6 13-Jun-1996  cgd get rid of now-unnecessary kernel config files (now that swap generic
works) for my machines and now-nonexistent test machines. Clean up
options in existing config files so that they're more consistent. Add
more units of various pseudo-devices to several.
 1.5 17-Apr-1996  cgd branches: 1.5.4;
clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.4 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.3 25-Nov-1995  cgd no DDB
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 03-Aug-1995  cgd update for all the latest bells and whistles
 1.5.4.1 13-Jun-1996  cgd pull up from trunk:
>get rid of now-unnecessary kernel config files (now that swap generic
>works) for my machines and now-nonexistent test machines. Clean up
>options in existing config files so that they're more consistent. Add
>more units of various pseudo-devices to several.
 1.13 17-Apr-2002  mycroft These machines are gone.
 1.12 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.11 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.10 28-Dec-2001  augustss Update for new uhidev device attachment.
 1.9 20-Nov-2001  lukem whitespace cleanup
add (commented out) RAID_AUTOCONFIG below raidframe entry
 1.8 22-Aug-2001  hubertf branches: 1.8.2;
More comment changes: 90x[B] -> 90x[BC]
 1.7 09-Jul-2001  soren branches: 1.7.2;
ncr(8) is gone from the tree, so remove ^#ncr*.
 1.6 08-Jul-2001  abs Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.5 24-Sep-2000  jdolecek branches: 1.5.2;
don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.4 14-Jun-2000  thorpej Enable uhid.
 1.3 14-Jun-2000  veego Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.2 23-May-2000  thorpej branches: 1.2.2;
Note that KN300 is also for AlphaServer 1200.
 1.1 22-May-2000  thorpej Kernel config for my Alphastation 200 file server + wireless network
gateway.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.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.5.2.1 24-Sep-2000  bouyer file YEAH-BABY was added on branch thorpej_scsipi on 2000-11-20 19:56:45 +0000
 1.7.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.7.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.8.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.2.1 22-Aug-2001  nathanw file YEAH-BABY was added on branch nathanw_sa on 2002-01-08 00:22:53 +0000
 1.200 09-Mar-2025  thorpej Kernel config file parsing technology has advanced significantly in
the past decade, to the point where options can, in fact, have dependencies
on other attributes.
 1.199 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.198 06-Mar-2024  thorpej branches: 1.198.2;
Tidy up TLSB autoconfiguration just a bit.
 1.197 06-Mar-2024  thorpej Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.
 1.196 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.195 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.194 21-Oct-2020  christos make process_machdep.c included always since it provides register i/o used by
sys_process_getlwpstatus.c which is always included.
 1.193 20-Oct-2020  christos harmonize process_machdep.c inclusion.
 1.192 27-Sep-2020  thorpej Add a "qemu" driver to access services provided by the Qemu VM. First
order of business is to use the Qemu "get-time" console service call as
the perferred system timecounter.
 1.191 21-Aug-2019  msaitoh Fix typo (s/contoller/controller/).
 1.190 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.189 22-Feb-2018  mrg branches: 1.189.4;
move "define tcbus {}" into files.alpha. it isn't wanted for general
ports, and generates an unused symbol for pmax. with this both alpha
and pmax kernel work with gcc 5 and 6.
 1.188 17-Oct-2014  uebayasi PCI controller doesn't rely on (depend on) AGP bus, but provide it. If one
specific architecture is known to have some specific AGP implementation, such
suggestion must be done in the "selection" part, not the "definition" part.

This is also an indirect (across bus attachment), circular dependency.
 1.187 22-Feb-2014  martin Allow kernels without tsciic to build.
 1.186 21-Feb-2014  jdc Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.
 1.185 02-Oct-2012  christos branches: 1.185.2;
move common/bus_dma/ -> dev/bus_dma/
 1.184 17-Jun-2011  matt branches: 1.184.2; 1.184.12;
Remove Avalon A12 support.
ok ross@
 1.183 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.182 18-Jan-2010  pooka branches: 1.182.4; 1.182.10;
if_ade doesn't build, suggesting nobody has tried to do anything
else than rototill it for the past n+1 years. The comments at the
top note a number of clauses after which it can be removed. I'm
sure that in the past 10+ years those have either been met or become
irrelevant, so remove this.
 1.181 21-Aug-2009  thorpej Use bus_dmamem common.
 1.180 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.179 20-Feb-2008  drochner branches: 1.179.6; 1.179.10; 1.179.16; 1.179.18;
Since files.wscons et al. are included by ~all ports anyway, include
them in the mi "files" file, and remove include statements from md files.
These shouldn't pull in additional kernel code when not in use, so it
shouldn't do any harm except a risk of namespace collisions which
should be easy to fix.
 1.178 25-Jan-2008  joerg Refactor in_cksum/in4_cksum/in6_cksum implementations:
- All three functions are included in the kernel by default.
They call a backend function cpu_in_cksum after possibly
computing the checksum of the pseudo header.
- cpu_in_cksum is the core to implement the one-complement sum.
The default implementation is moderate fast on most platforms
and provides a 32bit accumulator with 16bit addends for L32 platforms
and a 64bit accumulator with 32bit addends for L64 platforms.
It handles edge cases like very large mbuf chains (could happen with
native IPv6 in the future) and provides a good base for new native
implementations.
- Modify i386 and amd64 assembly to use the new interface.

This disables the MD implementations on !x86 until the conversion is
done. For Alpha, the portable version is faster.
 1.177 06-Jan-2008  ad Add MODULAR option. Include kernel linker stuff if MODULAR.
 1.176 28-Nov-2007  ad branches: 1.176.6;
Hook in the atomic ops on alpha.
 1.175 17-Oct-2007  garbled branches: 1.175.2;
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.174 21-Jul-2007  tsutsui branches: 1.174.4; 1.174.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.173 07-Jul-2007  tsutsui branches: 1.173.2; 1.173.4;
Remove leftover netns stuff.
 1.172 10-Apr-2007  macallan branches: 1.172.2; 1.172.4;
include files.wsfb
 1.171 09-Feb-2007  ad branches: 1.171.2; 1.171.6; 1.171.8;
Merge newlock2 to head.
 1.170 14-Sep-2006  plunky add bluetooth capability to alpha port
 1.169 29-Jul-2006  ad branches: 1.169.4;
Remove RASTERCONSOLE support from the pmax port.
 1.168 11-Dec-2005  christos branches: 1.168.4; 1.168.8;
merge ktrace-lwp.
 1.167 30-Aug-2004  drochner branches: 1.167.12;
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.166 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.165 20-Jan-2004  jdolecek cleanup old lpt(4) attachment, and glue ppbus in so that they can coexist:
* lpt device is defined in MI place (dev/ppbus/files.ppbus), dev/ic/lpt.c
is included there too; dev/ic/lpt.c is not included if ppbus is
configured or if there is alternative platform lpt (like for pc532)
* g/c MD lpt definitions and custom puc/upc attachments,
glue moved to conf/files and dev/pci/files.pci respectively; remove
device lpt definition from dev/isa/files.isa
* add ppbus parport attribute, atppc device attachments, adjust plip and lpt
glue
 1.164 08-Oct-2003  bouyer pciide_machdep.c depends on pciide_common, not pciide.
Pointed out and fix tested by Marc Recht.
 1.163 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.162 27-Jul-2003  thorpej Since everyone uses clock_subr.c (or should, if they don't currently),
list it in conf/files instead of in every port's files.*.
 1.161 05-Feb-2003  nakayama branches: 1.161.2;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.160 13-Jan-2003  bouyer As pceb pulls in sio.c and sio_pci.c, is also needs the alpha_shared_intr
attribute.
 1.159 26-Oct-2002  jdolecek now that mem_no is emitted by config(8), there is no reason to keep
copy of more or less identical iskmemdev() for every arch; move the function
to spec_vnop.c, and g/c machine-dependant copies
 1.158 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.157 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.156 27-May-2002  lukem add lpt_puc support (from files.i386)
 1.155 16-Apr-2002  thorpej branches: 1.155.2; 1.155.4;
* Move the mii_bitbang attribute into dev/mii/files.mii
* Pull in dev/mii/files.mii from conf/files, rather than playing
the magic "files include order" dance in N machine-dependent
configuration definitions.
 1.154 13-Mar-2002  ad Give wskbdmap_lk201.c its own attribute.
 1.153 25-Feb-2002  ad Argh, dont reference any wscons parts in files.dec yet.
 1.152 25-Feb-2002  ad Move the dz driver to dev/dec, since it can be shared with pmax.
 1.151 22-Jan-2002  ross we need the compat_13 sys_sigreturn to do osf1 emulation
closes port-alpha/8788
 1.150 21-Jan-2002  jdolecek Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.149 28-Nov-2001  lukem - convert usage of "defopt" to "defflag" where the relevant option does
not support a value (e.g., it's to be used as "options FOO" instead of
"options FOO=xxx"). options that take a value were converted to
defparam recently.
- minor whitespace & formatting cleanups
 1.148 20-Nov-2001  lukem - replace "defopt" with "defparam" for options which must take a value,
as config(8) will warn for value-less defparam options
- minor whitespace/formatting cleanup
- consolidate opt_tcp_recvspace.h and opt_tcp_sendspace.h into opt_tcp_space.h
 1.147 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.146 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.145 01-Oct-2001  simonb Move asc_tc and asc_tcds config info to dev/tc/files.tc now that pmax
uses MI SCSI.
 1.144 18-Sep-2001  ad Hook in the `stic' device. With any luck this should be temporary.
 1.143 15-Sep-2001  thorpej Attach "agp" to the AMD-751 PCI host controller (Alpha UP1000/UP1100).
 1.142 23-Aug-2001  nisimura branches: 1.142.2; 1.142.4;
Add MX (PMAG-A), CX (PMAG-B), TX (PMAG-RO/PMAG[B]-J) TC framebuffer
supports. None of them has any acceleration capability.
 1.141 12-Aug-2001  jdolecek Move _insque()/_remque() to libkern. Once remaining uses would
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated
altogether.
 1.140 18-Jun-2001  christos branches: 1.140.2;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.139 29-Apr-2001  thorpej Disable the optimized in4_cksum() for now -- there seem to be problems.
 1.138 29-Apr-2001  thorpej Optimized in4_cksum().
 1.137 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.136 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.135 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.134 04-Mar-2001  ad branches: 1.134.2;
Hook in px & pxg devices.
 1.133 23-Feb-2001  nisimura Make sure to have sfbp.h and add sfbp* line in TCWSCONS left #ed-out.
Pointed by Matthew Jacob <mjacob@feral.com>.
 1.132 17-Jan-2001  fvdl Add machdep file for procfs. Currently only used for linux-style
/proc/cpuinfo (only active when procfs is mounted with -o linux).
For ports other than the i386 this currently produces an empty
string.
 1.131 01-Jan-2001  mrg the tcds cards work in pmaxen. move tcds attachment to files.tc. leave asc
at tcds in files.alpha for now, and add a new `xasc at tcds' to files.pmax.
after pmax has moved fully to MI scsi (and `asc' is MI scsi), we should move
the device asc, etc., lines to files.tc.
 1.130 14-Dec-2000  mycroft osf1_locore.s -> osf1_sigcode.s, to match the global convention.
Add linux_syscall.c.
 1.129 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.128 27-Nov-2000  jdolecek split linux signal code off locore.s
 1.127 26-Nov-2000  ad lsu -> ld, by popular request.
 1.126 08-Nov-2000  ad Pull in dev/i2o/files.i2o.
 1.125 05-Nov-2000  matt Add files.ieee1394
 1.124 19-Oct-2000  ad ca -> lsu
 1.123 29-Jul-2000  thorpej Add code to read the EISA configuration NVRAM as set up by
an EISA Configuration Utility. Code to access this data
is forthcoming.

XXX This could probably be made MI at some point.
 1.122 12-Jul-2000  thorpej Uncomment the `fdc at sableio' lines.
 1.121 05-Jul-2000  nisimura Use dev/tc/ directory for DEC3000 Z85C30s.
 1.120 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.119 25-Jun-2000  thorpej For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.118 11-Jun-2000  thorpej branches: 1.118.2;
jensenio gets isadma_bounce attribute.
 1.117 11-Jun-2000  thorpej Add Jensen files glue.
 1.116 06-Jun-2000  thorpej Give the `sio' and `pceb' drivers the `82c693' attribute.
 1.115 01-Jun-2000  thorpej Typo.
 1.114 01-Jun-2000  thorpej Add placeholders for the support files for the Alpha Processor, Inc.
UP1000 EV6 system.
 1.113 23-Apr-2000  thorpej branches: 1.113.2;
Carve off the ISA configuration bits from the floppy driver. Driver is
still ISA-specific, but we can attach ISA instances with different
configuration mechanisms now.
 1.112 07-Apr-2000  nathanw Restore sysbeep (accidentally removed in last commit).
 1.111 07-Apr-2000  thorpej Use dev/isa/fd.c.
 1.110 23-Mar-2000  thorpej Use a software interrupt for tty input processing, not a callout.
 1.109 14-Mar-2000  oster Add the RAIDframe device major to the machine-dependent config files
so that the right entries get added to dev_name2blk[]. Needed for / on RAID.
(Whoops! I missed checking these in when adding the RAID_AUTOCONFIG stuff.)
 1.108 14-Mar-2000  nisimura Switch to MI sfb (PMAGB-B) TC framebuffer driver which sports faster
text rendering assisted by SFB ASIC.
 1.107 14-Feb-2000  thorpej Allow arch-specific code to specify in4_cksum() like it can specify
in_cksum().
 1.106 07-Dec-1999  thorpej Add options, files, etc. for the AlphaServer 2100 (Sable, Sable-Gamma).
Actual source files not yet committed. Very Soon.
 1.105 03-Dec-1999  thorpej lock_machdep.c is gone.
 1.104 04-Aug-1999  nisimura branches: 1.104.2; 1.104.8;
- Replace device node names of zskbd/zsms into lkkbd/vsms, respectively.
No functionality was changed at this moment.
- Apply recent changes in GENERIC to TCWSCONS.
 1.103 29-Jun-1999  ross Turn on EV6 bits: Tsunami and system type 6600.
 1.102 07-Jun-1999  thorpej Only declare block major numbers for devices which can be the root device.
 1.101 30-Apr-1999  cgd OSF/1 locore-ish bits. right now just sigcode
 1.100 18-Feb-1999  mycroft branches: 1.100.2; 1.100.4; 1.100.6;
Add pcic_isapnp.
 1.99 26-Nov-1998  pk Export the `pcmciabus' attribute on the `pcic' controller.
 1.98 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.97 14-Oct-1998  matt Remove pciide definitions in files.alpha since they are now in files.pci
 1.96 05-Oct-1998  ross Track compat/linux/arch/* reorg.
 1.95 05-Oct-1998  matt Add files.usb. It should work.
 1.94 01-Oct-1998  erh Add linux compat includes.
 1.93 29-Sep-1998  drochner Allow to use the RTC chip in a way compatible to OSF/1: use an offset
of 52 years between RTC and UNIX time.
This is controlled by "option CLOCK_COMPAT_OSF1".
 1.92 26-Sep-1998  thorpej Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP.

XXX HALT is not yet implemented, it's just a stub.
 1.91 24-Sep-1998  thorpej Machine-dependent spin lock operations for Alpha, included if MULTIPROCESSOR
is specified.
 1.90 24-Sep-1998  ross Move if_ade* from alpha/pci/ to alpha/a12/
 1.89 13-Sep-1998  thorpej Make signal delivery work again.
 1.88 11-Aug-1998  thorpej Pull in files.mii
 1.87 07-Aug-1998  drochner implemt a simple "beep" device to access the ISA speaker
 1.86 31-Jul-1998  thorpej Add unused zskbd and zsms entries, and ISA PnP entry.
 1.85 08-Jul-1998  mjacob branches: 1.85.2;
add common logout printing routine file
 1.84 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.83 26-Jun-1998  ross Add DEC_1000 support for new Mikasa[/Pinnacle] platform.
INSTALL-FLOPPY will have to wait; it needs attention w.r.t. size.
 1.82 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.81 24-Jun-1998  ross Add DEC_1000A platform.
 1.80 07-Jun-1998  sommerfe Hopefully avoid breaking PCMCIA on alpha.
 1.79 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.78 26-May-1998  thorpej Make the TCDS attachment of the ASC driver a proper attachment (i.e.
attach it with asc_tcds).
 1.77 24-May-1998  thorpej - Change the tcds child locator from "slot" to "chip", making it look less
like a TurboChannel locator, and more like what is actually going on.
- Allow tcds and asc children of tcds to be cloned.
 1.76 23-May-1998  matt Add PCMCIA hooks (taken from files.i386)
 1.75 13-May-1998  thorpej Add a few files related to the Digital Personal Workstation.
 1.74 29-Apr-1998  thorpej Build EB64+ PCI support if DEC_EB64PLUS is configured.
 1.73 26-Apr-1998  mjacob "Whitespace" does not mean uncommenting a reference to a file that does not, as yet, exist in the tree
 1.72 24-Apr-1998  thorpej Whitespace sanity.
 1.71 18-Apr-1998  thorpej Add PCI IDE goop.
 1.70 15-Apr-1998  drochner use mi wscons and device drivers
 1.69 15-Apr-1998  mjacob add Alpha 4100 support
 1.68 26-Mar-1998  thorpej defopt NEW_SCC_DRIVER
 1.67 26-Mar-1998  thorpej Remove references to "new_pmap".
 1.66 24-Mar-1998  thorpej Define attachments for the MI SCC driver - only hooks up to ioasic
for now.
 1.65 12-Mar-1998  thorpej Adjust the default and low-bound maxusers, now that the pmap can deal.
 1.64 02-Mar-1998  ross Second part of cdev_decl() migration. Declare cputype variable.
Add config info for a12 switch driver and console driver.
 1.63 16-Feb-1998  thorpej Remove "class" declarations, and add "devclass" declarations where
appropriate. Fix several inconsistencies between device class and
attributes. Mostly from Chris Demetriou.
 1.62 29-Jan-1998  ross defopt for AVALON_A12 and specifiers for all the platform modules.
 1.61 15-Jan-1998  thorpej Switch to the MI IDE drivers.
 1.60 12-Jan-1998  thorpej Adjust for config changes.
 1.59 06-Nov-1997  thorpej Clean up the messages displayed when either platform support is not
configured into the kernel, or when the platform is not supported.
Use the defopt'ed options, rather than NDEC_... and remove the needs-flag
hack that's existed for a while.
 1.58 06-Sep-1997  thorpej branches: 1.58.4;
Add DDB files.
 1.57 02-Sep-1997  thorpej Oops, missed one.
 1.56 02-Sep-1997  thorpej More garbage-collection.
 1.55 02-Sep-1997  thorpej Pull in alpha/cpuconf.c
 1.54 02-Sep-1997  thorpej Garbage-collect.
 1.53 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.52 12-Aug-1997  cgd sort miata defs
 1.51 12-Aug-1997  cgd update for moved files, placeholder for miata flag header
 1.50 12-Aug-1997  cgd rewire a few file dependencies for cleanliness
 1.49 12-Aug-1997  cgd define a defopt for the miata systype
 1.48 22-Jul-1997  jonathan branches: 1.48.2;
Create sys/dev/dec and cleanup sys/dev/tc:

* Move clockvar.h (header file for generic clock code) to sys/dev/dec.
* Move if_le_dec.c with DEC padded LANCE-dma (pmax/pmax, ioasic, vax 3400)
to sys/dev/dec. Remove from sys/dev/tc.
* Declare attribute le_dec_subr in /sys/dev/dec/files.dec,
use if_le_dec.c when it's defined.
* Move IOCTL asic declaration from pmax and Alpha MD machine
files to sys/dev/tc/files.tc.
* move TurboChannel and ioasic if_le attachments from pmax and Alpha machine
config files to /sys/dev/tc/files.tc. Add le_dec_subr attribute.
* Add if_le_dec attribute to if_le_ibus (pmax ds3100 pmax) LANCE attachment.
 1.47 06-Jun-1997  thorpej branches: 1.47.2;
Pull thorpej-bus-dma branch into mainline.
 1.46 21-Apr-1997  cgd branches: 1.46.2;
minimal changes to make hacked wd driver work under a different name.
It is configured (in config files) as 'awdc'/'awd', but shows up as
'wdc'/'wd', so that a minimal amount of code had to be modified to make
the name change work. This is only intended to be temporary, anyway.
 1.45 14-Apr-1997  mjacob Add kn8ae for needing shared_intr.o
 1.44 10-Apr-1997  cgd move cpu configuration tables into conf.c (cpuconf.c removed).
define CPU options and FIX_UNALIGNED_VAX_FP as header-generating options.
add pci_swiz_*_common.c when appropriate.
clean up a bit and sort more carefully.
 1.43 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.42 24-Mar-1997  cgd eb64+ needs shared_intr.c
 1.41 21-Mar-1997  cgd files file entry for eb64+
 1.40 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.39 12-Mar-1997  cgd tlsb bus and device file specs, s/21000/kn8ae. From Matt Jacob.
 1.38 27-Feb-1997  thorpej s/esp/asc/g, and make it carry the ncr53c9x attribute.
 1.37 31-Jan-1997  cgd branches: 1.37.4;
add 'major' declaration for wd
 1.36 23-Jan-1997  cgd actually, include a file for fd/fdc, so that the flag file gets generated.
 1.35 21-Jan-1997  cgd define names for the ISA floppy disk controller/drives, even though they
aren't supported yet. (conf.c needs a header for them, since i already
added their device switch table entries.)
 1.34 21-Jan-1997  thorpej "md" driver declared in sys/conf/files now.
 1.33 28-Dec-1996  pk branches: 1.33.2;
rename: ramdisk => md
 1.32 25-Nov-1996  cgd branches: 1.32.2;
update for eb164 file addition, apecs & lca bus space function split
file additions/deletions, pcppi file addition, and pckbd & pms attachment
changes. also, clean up a couple of comments.
 1.31 19-Nov-1996  cgd update for VGA changes and shared_intr.c move
 1.30 17-Nov-1996  cgd use the new common chained-interrupt support code.
 1.29 12-Nov-1996  cgd convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.28 11-Nov-1996  cgd alphabetize and clean up machine-specific files, add eb164's machine file
 1.27 22-Oct-1996  cgd there is no TC I/O space, so in the new bus.h world order there
is no tc_bus_io.c.
 1.26 27-Sep-1996  cgd update for changes to config.
 1.25 09-Sep-1996  cgd add specs for 'rd'
 1.24 20-Aug-1996  cgd switch 'old_pmap' option to 'new_pmap', since getting the new pmap code
is going to take a while...
 1.23 14-Jul-1996  cgd allow people to use the (slower) MI in_cksum.c vi 'options GENERIC_IN_CKSUM'
 1.22 02-Jul-1996  cgd if OLD_PMAP defined, don't usee alpha/pmap.c and use alpha/pmap.old.c instead.
 1.21 30-May-1996  cgd now that the bug has been fixed, we can go back to using the
Alpha-optimized in_cksum().
 1.20 23-May-1996  cgd disable alpha-specific in_cksum.c; it seems slightly buggy
 1.19 19-May-1996  cgd branches: 1.19.4;
Tuned in_cksum() from Matt Thomas <matt@3am-software.com>. According
to him, this implementation is approximately 50% faster than the
machine-independent portable version.
 1.18 17-May-1996  cgd add files for the implementation of the TC 'bus' mem & I/O functions
 1.17 07-May-1996  thorpej *** empty log message ***
 1.16 01-May-1996  cgd add support for PMAG-B Color Frame Buffer (CFB) option boards. OSF/1
doesn't support these, but they appear to work OK (with an appropriate
monitor) in my 3000/300.
 1.15 01-May-1996  cgd add the right (raster, wsconsdev) attributes to sfb
 1.14 18-Apr-1996  cgd attach le with different attributes, depending on parent (i.e. tc or
ioasic), and use those attributes to pull in appropriate files.
le_ioasic now has needs-flag, but le doesn't; the flag is only necessary
on systems configured with IOASIC-attached LANCE chips.
 1.13 17-Apr-1996  cgd ioasic doesn't need a flag, and correctly conditionalize inclusion of
machines' tc configuration files.
 1.12 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.11 12-Apr-1996  cgd update for present alpha reality:
add drivers for ps/2-style mice (on the PC-ish alphas), and for the
workstation console glue code. also, update for config changes, etc.
 1.10 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.9 20-Dec-1995  cgd rename TC 'asic' to 'ioasic'
 1.8 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.7 20-Sep-1995  thorpej Use `files.osf1'
 1.6 03-Aug-1995  cgd update for all the latest bells and whistles
 1.5 27-Jun-1995  cgd update for current configuration descriptions
 1.4 22-Apr-1995  cgd clean up a bit, use MI files lists. add a bunch of comments.
Also, include the EISA, ISA, and PCI files lists.
 1.3 03-Mar-1995  cgd kill redundant 'cd' major number definition
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.19.4.2 30-May-1996  cgd pull up from trunk:
>now that the bug has been fixed, we can go back to using the
>Alpha-optimized in_cksum().
 1.19.4.1 25-May-1996  jtc pulled up to the release branch by cgd's request
 1.32.2.9 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.32.2.8 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.32.2.7 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.32.2.6 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.32.2.5 01-Feb-1997  cgd for now, pckbd is needs-count, and therefore can't be cloning
 1.32.2.4 31-Jan-1997  cgd sync with trunk
 1.32.2.3 24-Jan-1997  cgd sync with trunk
 1.32.2.2 08-Dec-1996  cgd move wscons file specs into their own file, since eventually I hope this to
be a MI kernel subsystem (and until then, it's nice to keep modifications
localized. 8-)
 1.32.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.33.2.1 30-Jan-1997  thorpej update from trunk
 1.37.4.1 11-Mar-1997  is Merge in latest Trunk.
 1.46.2.6 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.46.2.5 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.46.2.4 05-Jun-1997  thorpej Add arch/alpha/common/bus_dma.c
 1.46.2.3 03-Jun-1997  thorpej Add TurboChannel DMA-related files. Also, allow whether or not
common SGMAP code should be included to be specified in a slightly
"better" way.
 1.46.2.2 03-Jun-1997  thorpej Update for new common sgmap code.
 1.46.2.1 23-May-1997  thorpej Add PCI DMA support files.
 1.47.2.4 14-Aug-1997  bouyer Sync with trunk.
 1.47.2.3 30-Jul-1997  bouyer Sync with trunk.
 1.47.2.2 22-Jul-1997  bouyer Sync with trunk.
 1.47.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.48.2.4 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.48.2.3 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.48.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.48.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.58.4.1 06-Nov-1997  thorpej Pull up from trunk: clean up "not configured"/"not supported" messages.
 1.85.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.100.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.100.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.100.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.100.2.2 02-Jul-1999  perry pullup 1.102->1.103 (ross)
 1.100.2.1 21-Jun-1999  cgd pull up rev(s) 1.101 from trunk. (cgd)
 1.104.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.104.2.9 23-Apr-2001  bouyer Sync with HEAD.
 1.104.2.8 12-Mar-2001  bouyer Sync with HEAD.
 1.104.2.7 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.104.2.6 05-Jan-2001  bouyer Sync with HEAD
 1.104.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.104.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.104.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.104.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.104.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.113.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.118.2.5 29-Jan-2002  he Pull up revision 1.151 (requested by simonb):
We need the compat_13 sys_sigreturn to do OSF1 emulation. Fixes
PR#8788.
 1.118.2.4 25-Oct-2001  he Pull up revision 1.126 (via patch, requested by ad):
Add Mylex DACC960, CAC-EISA, and I2O block/SCSI drivers.
 1.118.2.3 11-Aug-2000  thorpej Pullup from trunk:
Add EISA configuration readining infrastructure.
 1.118.2.2 12-Jul-2000  thorpej Pull up rev. 1.122:
Uncomment the `fdc at sableio' lines.
 1.118.2.1 27-Jun-2000  thorpej Update from trunk:
For systems which have different systypes but share a common
support module, make consistent with other systems which options
you must enable for it to work. Treat ``Lynx'' (2100A_A500) like
``Sable'' (2100_A500).
 1.134.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.140.2.6 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.140.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.140.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.140.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.140.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.140.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.142.4.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.142.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.142.2.11 15-Jan-2003  thorpej Sync with HEAD.
 1.142.2.10 11-Nov-2002  nathanw Catch up to -current
 1.142.2.9 18-Oct-2002  nathanw Catch up to -current.
 1.142.2.8 17-Sep-2002  nathanw Catch up to -current.
 1.142.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.142.2.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.142.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.142.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.142.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.142.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.142.2.1 23-Aug-2001  nathanw file files.alpha was added on branch nathanw_sa on 2001-09-21 22:34:56 +0000
 1.155.4.1 30-Jun-2003  grant Pull up revision 1.160 (requested by bouyer in ticket #1352):

As pceb pulls in sio.c and sio_pci.c, is also needs the
alpha_shared_intr attribute.
 1.155.2.3 30-May-2002  gehenna Catch up with -current.
 1.155.2.2 17-May-2002  gehenna Remove old block majors list.
 1.155.2.1 16-May-2002  gehenna Include the list of block/character major numbers.
 1.161.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.161.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.161.2.2 03-Sep-2004  skrll Sync with HEAD
 1.161.2.1 03-Aug-2004  skrll Sync with HEAD
 1.167.12.7 27-Feb-2008  yamt sync with head.
 1.167.12.6 04-Feb-2008  yamt sync with head.
 1.167.12.5 21-Jan-2008  yamt sync with head
 1.167.12.4 07-Dec-2007  yamt sync with head
 1.167.12.3 03-Sep-2007  yamt sync with head.
 1.167.12.2 26-Feb-2007  yamt sync with head.
 1.167.12.1 30-Dec-2006  yamt sync with head.
 1.168.8.1 11-Aug-2006  yamt sync with head
 1.168.4.1 09-Sep-2006  rpaulo sync with head
 1.169.4.2 11-Jan-2007  ad Checkpoint work in progress.
 1.169.4.1 18-Nov-2006  ad Sync with head.
 1.171.8.1 11-Jul-2007  mjf Sync with head.
 1.171.6.4 03-Dec-2007  ad Sync with HEAD.
 1.171.6.3 20-Aug-2007  ad Sync with HEAD.
 1.171.6.2 15-Jul-2007  ad Sync with head.
 1.171.6.1 10-Apr-2007  ad Sync with head.
 1.171.2.1 15-Apr-2007  yamt sync with head.
 1.172.4.1 03-Oct-2007  garbled Sync with HEAD
 1.172.2.1 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.173.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.173.2.1 07-Aug-2007  matt Sync with HEAD.
 1.174.6.3 23-Mar-2008  matt sync with HEAD
 1.174.6.2 09-Jan-2008  matt sync with HEAD
 1.174.6.1 06-Nov-2007  matt sync with HEAD
 1.174.4.1 03-Dec-2007  joerg Sync with HEAD.
 1.175.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.175.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.176.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.179.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.179.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.179.10.3 11-Mar-2010  yamt sync with head
 1.179.10.2 16-Sep-2009  yamt sync with head
 1.179.10.1 04-May-2009  yamt sync with head.
 1.179.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.182.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.182.4.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.184.12.3 03-Dec-2017  jdolecek update from HEAD
 1.184.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.184.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.184.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.184.2.1 30-Oct-2012  yamt sync with head
 1.185.2.1 18-May-2014  rmind sync with head
 1.189.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.189.4.1 10-Jun-2019  christos Sync with HEAD
 1.198.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 28-Apr-1995  cgd rename files files for new config/config.old naming
 1.4 22-Apr-1995  cgd clean up a bit, use MI files lists. add a bunch of comments.
Also, include the EISA, ISA, and PCI files lists.
 1.3 03-Mar-1995  cgd kill redundant 'cd' major number definition
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1 05-May-2021  thorpej branches: 1.1.4;
Add a linker script for the kernel. The main difference vs the
standard built-in for "ld -N" is to actually process the
.data.cacheline_aligned and .data.read_mostly sections correctly.
 1.1.4.2 13-May-2021  thorpej Sync with HEAD.
 1.1.4.1 05-May-2021  thorpej file kern.ldscript was added on branch thorpej-i2c-spi-conf on 2021-05-13 00:47:20 +0000
 1.37 29-Jun-2021  nia Remove uscanner(4) driver

This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.
 1.36 04-Apr-2020  jdolecek branches: 1.36.8;
mark nsmb major obsolete
 1.35 29-Jan-2020  maya remove urio(4), a driver for the Rio500 MP3 player.

At this point it is highly unlikely this 1999 device still has users,
but it still comes up in the context of maxv's USB-fuzzing (and any device
could pretend to be a urio(4)), so it's best to get rid of it.

Renamed all major entries to obsolete, as was done in previous removals.

This still requires an update to sanitizers, but they're located in
"external", perhaps it should be first committed upstream?

Proposed on tech-kern a month ago.
 1.34 28-Jan-2019  dholland branches: 1.34.6;
Systematize handling of removed drivers.

- Every driver that was removed and whose number hasn't already been
reused is now listed with a commented-out "obsolete" line.
- The format of these has been systematized. Future format changes can
probably be safely done with a script.
- This does not include a few cases of assignments that only lasted a
couple days, or stuff from before major reorgs. Some of these may
be included nonetheless, because there was a lot of ground to cover
and therefore not a lot of time to dig into history in detail.

Note that the obsolete listings do not mean the major numbers can
never be reused; that's up to portmasters and/or core. It does mean
that they won't be reused by accident, however, which in some cases
(depending on the driver, how widely used it was, its family of device
nodes, their default permissions, etc.) can be quite dangerous.

Note that some of the things now explicitly listed as obsolete are
really ancient history. My scan went back as far as when the majors
files were added. (But not before that.)
 1.33 27-Jan-2019  dholland Restore satlink's majors entries commented out and marked obsolete.
Otherwise they might accidentally get reused later and cause a
security problem.
 1.32 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.31 23-Sep-2018  maxv Remove ISDN from the kernel. It has remained unmaintained for a long time,
is of poor quality, and is now an obstacle to MP-ification. It was removed
ten years ago from FreeBSD for the same reason.

This retires a big user of the mbuf API, and will ease maintenance of the
kernel.
 1.30 08-Dec-2016  nat branches: 1.30.14; 1.30.16;
Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.29 23-Apr-2015  pgoyette branches: 1.29.2;
Update device dependency information - the sysmon major device now depends on the sysmon module itself, not on the individual components.
 1.28 15-Oct-2013  jdc branches: 1.28.6;
Add sysmon (required for the envsys framework).
 1.27 30-Jun-2011  wiz branches: 1.27.2; 1.27.12; 1.27.16;
dependant -> dependent
 1.26 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.25 06-Mar-2010  plunky branches: 1.25.8;
use a MI major number for uhso(4) driver
(requested by mrg)
 1.24 06-Mar-2010  plunky add major device for usho(4) driver
 1.23 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.22 31-Dec-2007  ad branches: 1.22.6; 1.22.10; 1.22.16; 1.22.18;
Remove systrace. Ok core@.
 1.21 24-Nov-2006  wiz branches: 1.21.28; 1.21.34; 1.21.42;
s/independant/independent/, from Zafer.
 1.20 11-Dec-2005  christos branches: 1.20.20; 1.20.22;
merge ktrace-lwp.
 1.19 14-Oct-2005  heas Add major for twe(4), so that management applications have a /dev entry to use.
 1.18 17-Sep-2005  yamt make VMSWAP optional again.
 1.17 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.16 30-Jul-2005  yamt defflag VMSWAP.
 1.15 13-Sep-2004  drochner branches: 1.15.12;
add "joy"
 1.14 10-Dec-2003  jmc Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
 1.13 10-Oct-2003  jdolecek reassing majors for crypto and pf to use the newly defined MI major
range
 1.12 10-Oct-2003  jdolecek update the comment - the space for machine-dependant majors
is reduced to 0-143
follows discussion on tech-kern
 1.11 05-Oct-2003  jdolecek Add some framework for MI assignment of device majors - add sys/dev/majors
which is automatically included during kernel config, and add comments
to individual machine-dependant majors.* files to assign new MI majors
in MI file.

Range 0-191 is reserved for machine-specific assignments, range
192+ are MI assignments.

Follows recent discussion on tech-kern@
 1.10 22-Aug-2003  itojun create /dev/crypto
 1.9 27-Jul-2003  itojun reserve cdev major # for PF. ok'ed by technical-exec
 1.8 01-Jun-2003  martin branches: 1.8.2;
Add nsmb.
 1.7 04-May-2003  gmcgarry Add wsfont support. Addresses PR#18388.
 1.6 25-Apr-2003  ragge Add ksyms device major.
 1.5 05-Nov-2002  fair Add the radio(4) driver to NetBSD/alpha
 1.4 04-Oct-2002  elric branches: 1.4.2;
assign majors for raw and cooked cgd's.
 1.3 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.2 06-Sep-2002  gehenna branches: 1.2.2;
Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.1 16-May-2002  gehenna branches: 1.1.2;
file majors.alpha was initially added on branch gehenna-devsw.
 1.1.2.4 16-Jul-2002  gehenna catch up with -current.
 1.1.2.3 09-Jul-2002  gehenna catch up with -current.
 1.1.2.2 30-May-2002  gehenna Add $NetBSD$
 1.1.2.1 16-May-2002  gehenna Add the list of block/character majors.
 1.2.2.4 11-Nov-2002  nathanw Catch up to -current
 1.2.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.1 06-Sep-2002  nathanw file majors.alpha was added on branch nathanw_sa on 2002-09-17 21:12:46 +0000
 1.4.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.4.2.1 04-Oct-2002  jdolecek file majors.alpha was added on branch kqueue on 2002-10-10 18:31:00 +0000
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.12.3 21-Jan-2008  yamt sync with head
 1.15.12.2 30-Dec-2006  yamt sync with head.
 1.15.12.1 21-Jun-2006  yamt sync with head.
 1.20.22.1 10-Dec-2006  yamt sync with head.
 1.20.20.1 12-Jan-2007  ad Sync with head.
 1.21.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.21.28.1 09-Jan-2008  matt sync with HEAD
 1.22.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.10.1 04-May-2009  yamt sync with head.
 1.22.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.25.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27.16.1 18-May-2014  rmind sync with head
 1.27.12.2 03-Dec-2017  jdolecek update from HEAD
 1.27.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.6.2 05-Feb-2017  skrll Sync with HEAD
 1.28.6.1 06-Jun-2015  skrll Sync with HEAD
 1.29.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.16.1 10-Jun-2019  christos Sync with HEAD
 1.30.14.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.34.6.1 29-Feb-2020  ad Sync with head.
 1.36.8.1 01-Aug-2021  thorpej Sync with HEAD.
 1.28 14-Jul-2021  thorpej Enable VMSWAP_DEFAULT_PLAINTEXT as default.
 1.27 19-Sep-2020  thorpej branches: 1.27.6;
Enable MULTIPROCESSOR by default, but disable it in the RAMDISK
and INSTALL kernels to save some space.
 1.26 07-Apr-2010  jakllsch let ath(4) build on alpha
 1.25 17-Oct-2007  garbled branches: 1.25.20; 1.25.40; 1.25.42;
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.24 07-Jul-2007  tsutsui branches: 1.24.10;
Add "options HZ=1024" by default for alpha.

All alpha machines use arch/alpha/alpha/mcclock.c for hardclock(9)
and it always sets MC_RATE_1024_Hz.
The default HZ value also affects tick and tickadj in conf/param.c.
 1.23 11-Dec-2005  christos branches: 1.23.30; 1.23.32; 1.23.38;
merge ktrace-lwp.
 1.22 17-Sep-2005  yamt include "conf/std".
 1.21 03-May-2002  thorpej branches: 1.21.10; 1.21.26;
Revert revision 1.20.
 1.20 03-May-2002  eeh Provide _LP64 definition if we are generating LP64 binaries.
 1.19 22-Jun-2000  fvdl branches: 1.19.2; 1.19.4;
Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.18 15-Nov-1999  fvdl branches: 1.18.4;
Add

prefix ../gnu/sys
cinclude "conf/files.softdep"
prefix

to all std.* files, so that soft dependencies can be activated using
"options SOFTDEP".
 1.17 12-Sep-1999  chs branches: 1.17.2; 1.17.8;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.16 24-Mar-1999  mrg clean up kernel/config files files for machVM lossage.
 1.15 04-May-1998  thorpej Make UVM+PMAP_NEW the standard VM system on NetBSD/alpha.
 1.14 25-Mar-1998  ross 1. Always link at the high address, now that we can use free ram below
the kernel on most platforms, including all of the entry-level platforms.
2. Kill the comments and options for load address selection.
3. Kill the default -g.
 1.13 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.12 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.11 15-Nov-1996  cgd branches: 1.11.2;
move DEVPAGER, SWAPPAGER, VNODEPAGER options into std.alpha since they're
mandatory, and clean up their descriptions.
 1.10 13-Nov-1996  cgd kill the makeoptions spec of CWARNFLAGS
 1.9 25-Oct-1996  cgd add -Wcast-qual
 1.8 27-Sep-1996  cgd add EXEC_ELF64 and EXEC_SCRIPT as standard options
 1.7 20-Aug-1996  cgd kill OLD_PMAP, since it now takes 'NEW_PMAP' to get the new pmap code.
 1.6 09-Jul-1996  cgd add -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes as
CWARNFLAGS in the Makefile, but (for the time being, i.e. until that
works) override that with 'makeoptions' in std.alpha.
 1.5 02-Jul-1996  cgd define OLD_PMAP for all Alpha kernels. Eventually, when a new pmap module
works, this will be removed.
 1.4 25-Nov-1995  cgd pull in ECOFF exec code with EXEC_ECOFF
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 27-Jun-1995  cgd update for current configuration descriptions
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.11.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.17.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 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.18.4.1 23-Jun-2000  fvdl As on the trunk, update these for the move of ffs_softdep.c into the
kernel source itself. Remove prefix construction, and add the SOFTDEP
option to GENERIC kernels.
 1.19.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.21.26.2 03-Sep-2007  yamt sync with head.
 1.21.26.1 21-Jun-2006  yamt sync with head.
 1.21.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.38.1 03-Oct-2007  garbled Sync with HEAD
 1.23.32.1 11-Jul-2007  mjf Sync with head.
 1.23.30.1 15-Jul-2007  ad Sync with head.
 1.24.10.1 06-Nov-2007  matt sync with HEAD
 1.25.42.1 30-May-2010  rmind sync with head
 1.25.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.25.20.1 11-Aug-2010  yamt sync with head.
 1.27.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 25-Sep-2021  thorpej Make all of the EISA chipset functions call through real functions,
rather the macros.
 1.13 18-Nov-2020  thorpej malloc(9) -> kmem(9)
 1.12 29-Mar-2014  christos branches: 1.12.42;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.11 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.10 27-Jun-2013  christos don't forget to insert the io to the list
http://M00nBSD.net/ae123a9bae03f7dde5c6d654412daf5a.html
 1.9 06-Feb-2012  matt branches: 1.9.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 28-Apr-2008  martin branches: 1.8.34; 1.8.38;
Remove clause 3 and 4 from TNF licenses
 1.7 17-Oct-2007  garbled branches: 1.7.16; 1.7.18; 1.7.20;
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.6 22-Jul-2007  tsutsui branches: 1.6.6;
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
 1.5 01-Jun-2002  lukem branches: 1.5.22; 1.5.58; 1.5.64; 1.5.72; 1.5.74; 1.5.76; 1.5.78;
SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.4 11-Aug-2000  thorpej branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8; 1.4.20;
#if 0 out a debugging printf.
 1.3 11-Aug-2000  thorpej Add functions to read EISA configuration data for MEM, IRQ, DMA, and IO.

XXX Just error stubs on the i386 right now -- someone needs to write
XXX EISA BIOS code for i386.
 1.2 10-Aug-2000  thorpej Declare the ECU data in an MI location, so that drivers can
use it.
 1.1 29-Jul-2000  thorpej Add code to read the EISA configuration NVRAM as set up by
an EISA Configuration Utility. Code to access this data
is forthcoming.

XXX This could probably be made MI at some point.
 1.4.20.1 09-Jul-2002  gehenna catch up with -current.
 1.4.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.6.1 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.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.4.4.1 11-Aug-2000  bouyer file eisa_machdep.c was added on branch thorpej_scsipi on 2000-11-20 19:56:46 +0000
 1.4.2.2 11-Aug-2000  thorpej Pullup from trunk:
Add EISA configuration readining infrastructure.
 1.4.2.1 11-Aug-2000  thorpej file eisa_machdep.c was added on branch netbsd-1-5 on 2000-08-11 18:00:05 +0000
 1.5.78.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.76.1 07-Aug-2007  matt Sync with HEAD.
 1.5.74.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.5.72.1 03-Oct-2007  garbled Sync with HEAD
 1.5.64.1 20-Aug-2007  ad Sync with HEAD.
 1.5.58.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.5.22.1 03-Sep-2007  yamt sync with head.
 1.6.6.1 06-Nov-2007  matt sync with HEAD
 1.7.20.1 16-May-2008  yamt sync with head.
 1.7.18.1 18-May-2008  yamt sync with head.
 1.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.38.1 18-Feb-2012  mrg merge to -current.
 1.8.34.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.8.34.1 17-Apr-2012  yamt sync with head
 1.9.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.42.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.3 19-Mar-1999  cgd move eisa/eisa_machdep.h to include/eisa_machdep.h. (can't do it via
repository copy because alpha already had an include/eisa_machdep.h in
the attic.)
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
define all of the appropriate functions, as indirections through
a function switch.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file eisa_machdep.h was added on branch alpha-nwscons on 1997-04-06 23:18:05 +0000
 1.2 06-Mar-2024  thorpej Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.
 1.1 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.1 06-Mar-2024  thorpej Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.
 1.1 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.2 06-Mar-2024  thorpej Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.
 1.1 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.5 06-Mar-2024  thorpej Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module. The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.
 1.4 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.3 06-Mar-2024  thorpej bus_space-ify.
 1.2 02-Mar-2024  thorpej tlsb -> gbus. No functional change.
 1.1 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.37 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.36 04-Nov-2024  christos Undo previous lwp.h change.
 1.35 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.34 12-Jul-2018  maxv branches: 1.34.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.33 23-Aug-2016  christos branches: 1.33.14; 1.33.16;
fenv.h for alpha
 1.32 12-Aug-2011  dyoung branches: 1.32.12; 1.32.30;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.31 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.30 09-Jul-2011  dyoung Don't install alpha/bus.h any more.
 1.29 10-Mar-2008  ad Finish moving alpha over to the MI atomic ops.
 1.28 09-Feb-2007  ad branches: 1.28.12; 1.28.24; 1.28.40; 1.28.44;
Merge newlock2 to head.
 1.27 26-Jul-2006  drochner branches: 1.27.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.8;
merge ktrace-lwp.
 1.25 07-Jul-2004  drochner branches: 1.25.12;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 1.24 08-May-2004  kleink Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.23 17-Jan-2003  thorpej branches: 1.23.2;
Merge the nathanw_sa branch.
 1.22 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.21 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.20 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.19 16-Jan-2002  ross branches: 1.19.4; 1.19.8;
install fpu.h, needed for new lib/csu features
 1.18 19-Sep-2001  thorpej Remove alpha/include/fbio.h -- it hasn't been used for a Long Time.
 1.17 15-Apr-2001  kleink branches: 1.17.2; 1.17.4; 1.17.6;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.16 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.15 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.14 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.13 26-Jun-2000  kleink branches: 1.13.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.12 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.11 29-Apr-2000  thorpej branches: 1.11.2;
Oops, install <machine/lock.h> on these systems, too.
 1.10 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.9 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.8 26-Feb-2000  mycroft Install pio.h.
 1.7 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.6 04-Dec-1999  lukem add atomic.h (missed by thorpej; approved by thorpej)
 1.5 02-Dec-1999  thorpej Inline the BWX instructions.
 1.4 30-Apr-1999  ross branches: 1.4.2; 1.4.8;
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.3 17-Apr-1999  drochner wsconsio.h is gone
 1.2 15-Jan-1999  bouyer branches: 1.2.4;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 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.2.4.2 30-Apr-1999  perry branches: 1.2.4.2.2;
pullup 1.3->1.4 (ross)
 1.2.4.1 17-Apr-1999  ross Pull up 1.3 from trunk. Approved by cjs. (drochner)
Really, really kill off old wscons. (wsconsio.h)
 1.2.4.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.17.4.6 17-Sep-2002  nathanw Catch up to -current.
 1.17.4.5 13-Aug-2002  nathanw Catch up to -current.
 1.17.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.17.4.3 25-Sep-2001  nathanw Install mcontext.h
 1.17.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.17.4.1 15-Apr-2001  nathanw file Makefile was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.17.2.4 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.17.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.8.2 30-Aug-2002  gehenna catch up with -current.
 1.19.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.19.4.2 14-Mar-2002  thorpej Alpha rwlock primitives implementation.
 1.19.4.1 11-Mar-2002  thorpej Install mutex_impl.h
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.12.3 17-Mar-2008  yamt sync with head.
 1.25.12.2 26-Feb-2007  yamt sync with head.
 1.25.12.1 30-Dec-2006  yamt sync with head.
 1.26.8.1 11-Aug-2006  yamt sync with head
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.4.1 01-Feb-2007  ad Header file cleanup.
 1.28.44.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.40.1 24-Mar-2008  keiichi sync with head.
 1.28.24.1 23-Mar-2008  matt sync with HEAD
 1.28.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.32.30.1 05-Oct-2016  skrll Sync with HEAD
 1.32.12.1 03-Dec-2017  jdolecek update from HEAD
 1.33.16.1 10-Jun-2019  christos Sync with HEAD
 1.33.14.1 28-Jul-2018  pgoyette Sync with HEAD
 1.34.36.1 02-Aug-2025  perseant Sync with HEAD
 1.2 05-Oct-2001  simonb Multiple include protection.
 1.1 10-Mar-1999  ross branches: 1.1.20; 1.1.22; 1.1.24;
New file, included if present for ${MACHINE_ARCH} by bsd.kmod.mk.
 1.1.24.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.1.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.20.1 22-Oct-2001  nathanw Catch up to -current.
 1.48 16-Mar-2025  thorpej Add an alpha_fp_init() function, and move the initialization of
FP-related event counters there.

No functional change intended.
 1.47 23-Jul-2021  thorpej branches: 1.47.16;
- Expose alpha_fp_complete_at() to callers outside fp_complete.c.
- Use ufetch_32() instead of copyin() to fetch the instruction.
 1.46 20-Jul-2021  thorpej Define the f_float in-memory format. Line of the fields in s_float and
t_float.
 1.45 05-May-2021  thorpej Remove unused dot_conv() function.
 1.44 14-Oct-2020  thorpej branches: 1.44.6;
Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.43 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.42 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.41 27-Sep-2020  thorpej prom_is_qemu -> alpha_is_qemu, and export it outside of prom.c.
 1.40 18-Sep-2020  thorpej Rather than having exception_return() at the root of the call graph for
kernel threads, provide a backstop that will prevent them from ever
accidentally trying to return to user space.
 1.39 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.38 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.37 19-Apr-2018  christos branches: 1.37.2;
s/static inline/static __inline/g for consistency.
 1.36 16-Jun-2017  jdolecek branches: 1.36.4;
dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.35 16-Mar-2017  chs allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.34 16-May-2014  matt branches: 1.34.4; 1.34.8; 1.34.12;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.33 16-May-2014  rmind pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.
 1.32 22-Aug-2013  drochner branches: 1.32.2;
-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt
 1.31 26-Dec-2012  matt branches: 1.31.2;
Update to new pcu_state_{load,save,release} definitions
 1.30 06-Feb-2012  matt branches: 1.30.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.29 17-Jul-2011  joerg branches: 1.29.2; 1.29.6;
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.28 06-Jul-2011  dyoung Oops, missed one: #include <sys/bus.h> instead of <machine/bus.h>.
 1.27 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.26 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.25 08-Feb-2011  rmind branches: 1.25.2;
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.24 01-Jun-2009  martin branches: 1.24.4; 1.24.6; 1.24.8;
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23 28-Nov-2007  ad branches: 1.23.18; 1.23.28; 1.23.34;
Hook in the atomic ops on alpha.
 1.22 17-Oct-2007  garbled branches: 1.22.2;
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.21 17-May-2007  yamt branches: 1.21.8; 1.21.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.20 11-Dec-2005  christos branches: 1.20.26; 1.20.30; 1.20.32; 1.20.36; 1.20.38;
merge ktrace-lwp.
 1.19 07-Aug-2003  agc branches: 1.19.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.18 17-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 14-Jun-2001  thorpej branches: 1.17.4;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.16 14-May-2001  ross o Deal with stray machine checks
o Add for alpha a security-sensitive rate-limiting printf(9) wrapper based
on ratecheck(9): void rlprintf(struct timeval *t, const char *fmt, ...);
 1.15 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.14 13-Dec-2000  mycroft branches: 1.14.2;
Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.13 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.12 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.11 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.10 08-Jun-2000  thorpej branches: 1.10.2;
And more ANSI'ification!
 1.9 01-Jun-2000  thorpej Add a global patchable variable to enable debugging printfs in the
code that finds the boot device.
 1.8 10-Apr-2000  simonb branches: 1.8.2;
Remove duplicate CTL_MACHDEP definitions (duplicated in <alpha/cpu.h>).
 1.7 29-Feb-2000  thorpej Put machine check info in cpu_info in the multiprocessor case, and
just have one statically allocate machine check info structure in the
single processor config case.
 1.6 17-Sep-1999  thorpej branches: 1.6.2;
Centralize the declaration and clearing of `cold'.
 1.5 11-Jul-1999  ross New signature for console_restart().
 1.4 29-Jun-1999  ross Prototype dot_conv(), new routine in machdep.c that formats an alpha
long like this: e081.8000.8000.0004
 1.3 20-Apr-1999  thorpej Move the inclusion of <machine/bus.h> to within a _KERNEL section.
 1.2 23-Feb-1999  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.1 19-Nov-1998  ross New module to hold the alpha-specific prototypes that don't need to be
exported to the MI kernel. Almost everything here was formerly in cpu.h.
Optionally, this module could in the future be used to #include anything
that is always needed by arch/alpha modules.
 1.2.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.2.4.1 02-Jul-1999  perry pullup 1.3->1.4 (ross)
 1.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.2.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.6.2.2 08-Dec-2000  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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.1 15-May-2001  he Pull up revision 1.16 (via patch, requested by ross):
Deal with stray machine checks.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.4.4 03-Jan-2003  thorpej Merge switch_exit() and switch_lwp_exit().
 1.17.4.3 17-Dec-2001  nathanw Sprinkle a little const around frametoreg() and regtoframe().
 1.17.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.17.4.1 14-Jun-2001  nathanw file alpha.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.16.2 07-Dec-2007  yamt sync with head
 1.19.16.1 03-Sep-2007  yamt sync with head.
 1.20.38.1 22-May-2007  matt Update to HEAD.
 1.20.36.1 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.20.32.1 11-Jul-2007  mjf Sync with head.
 1.20.30.3 03-Dec-2007  ad Sync with HEAD.
 1.20.30.2 03-Dec-2007  ad Sync with HEAD.
 1.20.30.1 27-May-2007  ad Sync with head.
 1.20.26.1 20-Mar-2007  yamt adapt alpha.
 1.21.10.2 09-Jan-2008  matt sync with HEAD
 1.21.10.1 06-Nov-2007  matt sync with HEAD
 1.21.8.1 03-Dec-2007  joerg Sync with HEAD.
 1.22.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.23.34.1 09-Jun-2009  snj branches: 1.23.34.1.2;
Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23.34.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.23.28.1 09-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23.18.1 20-Jun-2009  yamt sync with head
 1.24.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.24.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.3 12-Jun-2011  rmind sync with head
 1.24.4.2 05-Mar-2011  rmind sync with head
 1.24.4.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.25.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.29.6.1 18-Feb-2012  mrg merge to -current.
 1.29.2.3 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.29.2.2 23-Jan-2013  yamt sync with head
 1.29.2.1 17-Apr-2012  yamt sync with head
 1.30.6.3 03-Dec-2017  jdolecek update from HEAD
 1.30.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.6.1 25-Feb-2013  tls resync with head
 1.31.2.2 18-May-2014  rmind sync with head
 1.31.2.1 28-Aug-2013  rmind sync with head
 1.32.2.1 10-Aug-2014  tls Rebase.
 1.34.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.34.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.34.4.1 28-Aug-2017  skrll Sync with HEAD
 1.36.4.1 22-Apr-2018  pgoyette Sync with HEAD
 1.37.2.1 10-Jun-2019  christos Sync with HEAD
 1.44.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.44.6.1 13-May-2021  thorpej Sync with HEAD.
 1.47.16.1 02-Aug-2025  perseant Sync with HEAD
 1.56 20-Jul-2022  thorpej Make alpha_wmb() actually a WMB rather than an MB (all uses of
alpha_wmb() have been audited and fixed-up as necessary).
 1.55 02-Nov-2021  ryo In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.54 27-May-2021  thorpej Define the arithmetic exception summary bits passed in a0 to entArith.
 1.53 15-Oct-2020  thorpej branches: 1.53.6; 1.53.8;
Fix the bit position for the PMI bit in ALPHA_AMASK_BITS.
 1.52 29-Sep-2020  thorpej Add alpha_pal_wtint(), which invokes the WTINT PALcode call.
 1.51 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.50 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.49 07-Oct-2010  hans branches: 1.49.8; 1.49.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.48 16-Feb-2006  perry branches: 1.48.72; 1.48.92; 1.48.94;
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.47 24-Dec-2005  perry branches: 1.47.2; 1.47.4; 1.47.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.46 11-Dec-2005  christos merge ktrace-lwp.
 1.45 28-Jul-2005  rpaulo Added a new AMASK bit (ALPHA_AMASK_PMI) and a new IMPLVER family ID:
ALPHA_IMPLVER_EV7.

ok christos@
 1.44 17-Jan-2003  thorpej branches: 1.44.2; 1.44.18;
Merge the nathanw_sa branch.
 1.43 18-Dec-2001  thorpej Add a memory clobber to alpha_pal_swapctx() and alpha_pal_swpipl();
the former affects the address space, and the latter can let interrupt
handlers in to clobber memory.
 1.42 17-Jul-2001  thorpej branches: 1.42.2;
Protect userland from the inlines and kernel variable decls.
 1.41 08-Jun-2000  thorpej branches: 1.41.6;
And more ANSI'ification!
 1.40 08-Jun-2000  thorpej ANSI'ify.
 1.39 03-Apr-2000  thorpej branches: 1.39.2;
Fix a typo in a previous revision, and add bit names for amask bits for
use with bitmask_snprintf().
 1.38 20-Mar-2000  thorpej Update the amask bits.
 1.37 05-Mar-2000  thorpej Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.36 02-Dec-1999  thorpej Inline most of the remaining PALcode calls.
 1.35 02-Dec-1999  thorpej Inline the BWX instructions.
 1.34 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.33 01-Dec-1999  thorpej After reading the GCC `documentation' a little more, improve the inline
__asm() statements added previously for PALcode operations.
 1.32 30-Nov-1999  thorpej Inline several things from pal.s:
- alpha_rpcc(), alpha_mb(), alpha_wmb() -- these are instructions, and
we win by inlining them: rpcc is generally used for profiling, and
the memory barriers really should execute as quickly as possible with
minimal side-effects (like additional loads/stores required to call the
functions!)
- alpha_pal_imb(), alpha_pal_rdps(), alpha_pal_swpipl(), alpha_pal_tbi(),
alpha_pal_whami() -- these are PALcode ops. We must specify some register
clobbers for these.

We have a very decent size savings as a result. My test system:
text data bss dec hex filename
2671724 235848 377016 3284588 321e6c /netbsd.bak
2617708 235736 377016 3230460 314afc /netbsd

Most of this comes from fewer register saves/restores around spl*() calls
(now that alpha_pal_rdps() and alpha_pal_swpipl() are inlined).

Note that alpha_pal_rdps() and alpha_pal_swpipl() remain in pal.s to
maintain binary compatibility with LKMs that may use spl*() functions.
 1.31 28-Nov-1999  thorpej Implement atomic addition and subtraction on quadwords.
 1.30 25-Sep-1998  thorpej branches: 1.30.12; 1.30.18;
Implement atomic quadword load-and-latch.
 1.29 25-Sep-1998  thorpej The processor unique value in the PCB is used as a backup kernel stack
pointer when booting secondary CPUs. Add an alias for it.
 1.28 24-Sep-1998  thorpej Implement atomic test-and-set for longwords (32-bit).
 1.27 23-Sep-1998  thorpej "Gee, there was already a function to do that."
 1.26 23-Sep-1998  thorpej Implement a function to recompute the HWRPB checksum.
 1.25 22-Sep-1998  thorpej Implement quadword atomic test-and-set.
 1.24 20-Sep-1998  thorpej Add definitions for the maximum allowable `whami' procssor ID and the
maximum number of processors we'll allow (64, assuming procssor IDs start
at 0).
 1.23 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.22 08-Jul-1998  mjacob stale beer- place structure in right file
 1.21 08-Jul-1998  thorpej Define a shorthand macro that represents the mask of PTE bits that the
PALcode cares about.
 1.20 08-Jul-1998  thorpej Cosmetic change.
 1.19 08-Jul-1998  mjacob Add machine check type definitions. Structure the expected/received
machine check items.
 1.18 22-Mar-1998  thorpej Implement a set of `atomic' (using load-locked and store-conditional)
operations. Initial set includes:

alpha_atomic_setbits_q() set bits in a quad
alpha_atomic_clearbits_q() clear bits in a quad
 1.17 27-Feb-1998  thorpej Implement alpha_pal_swpctx().
 1.16 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.15 20-Sep-1997  mjacob Add some defines for alpha interrupt types.
 1.14 17-Sep-1997  thorpej Prototype alpha_implver(), and fix a think-o in a previous commit.
 1.13 16-Sep-1997  thorpej Add stubs for the Alpha Byte/Word Extension (BWX) instructions, present
on EV56 and later processors that have the "amask BWX" bit clear. These
instructions will be used to implement non-swizzle bus access functions
on newer systems, such as the new AlphaStation 500s with EV56 and 21172
PCI chipsets.

See "Alpha Architecture Handbook, Version 3", DEC order number EC-QD2KB-TE.
 1.12 16-Sep-1997  thorpej - Define bits used in the "amask" instruction.
- Define processor family IDs returned by the "implver" instruction.
- Prototype alpha_amask().
 1.11 03-Sep-1997  thorpej branches: 1.11.2;
Add a few more PALcode operations, as documented in pages (II-B) 2-1 through
(II-B) 2-33 of the Alpha AXP Architecture Reference Manual, Second Edition:

* rdps - Read Processor Status, needed by spl* functions.
* cflush - Cache Flush
* rdval - Read System Value
* wripir - Write Interprocessor Interrupt Request
* wrval - Write System Value

cflush, rdval, wripir, and wrval are used in multi-processor environments.
 1.10 02-Sep-1997  thorpej Fix a typo: ALPHA_PTE_WRITE needs to include the "user write" bit.
 1.9 24-Apr-1997  cgd branches: 1.9.2;
comment out text after #endif. "Pasto!" pointed out by Kevin Sullivan
in PR 3529.
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 23-Nov-1996  cgd branches: 1.7.2;
make ALPHA_K0SEG_TO_PHYS and ~0xfffffc00000000000 with the address,
rather than and-ing 16G-1. That just strips the k0seg bits, rather
than making the false assumption that the physical address is going
to be in the lower 16G. That doesn't apply for CIA device-space
addresses, for instance.
 1.6 20-Aug-1996  cgd K0SEG_END is inclusive
 1.5 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.4 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Restructure and improve machine check and correctable error
handling based on information in the 2nd Ed. of the Alpha Architecture
Reference Manual.
(3) Removed unused (and not likely useful) PALcode assembly stubs.
 1.3 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.2 11-Jul-1996  cgd Add definitions for:
Process Control Block
Interrupt/Exception/Syscall Stack Frame
Machine Check Error Summary Register
Machine Check Logout Area
clean up some, and add prototypes for all of the CPU instruction and
PALcode function stubs.
 1.1 09-Jul-1996  cgd definitions and constants which are part of the Alpha AXP
Architecture, and which relate to the OSF/1 PALcode.
 1.7.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.7.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.11.2.2 03-Sep-1997  thorpej Add a few more PALcode operations, as documented in pages (II-B) 2-1 through
(II-B) 2-33 of the Alpha AXP Architecture Reference Manual, Second Edition:

* rdps - Read Processor Status, needed by spl* functions.
* cflush - Cache Flush
* rdval - Read System Value
* wripir - Write Interprocessor Interrupt Request
* wrval - Write System Value

cflush, rdval, wripir, and wrval are used in multi-processor environments.
 1.11.2.1 03-Sep-1997  thorpej file alpha_cpu.h was added on branch bouyer-scsipi on 1997-09-03 23:09:06 +0000
 1.30.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.12.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.39.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.41.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.41.6.1 03-Aug-2001  lukem update to -current
 1.42.2.3 14-Jan-2003  nathanw Add alpha_pal_rdunique() and alpha_pal_wrunique().
 1.42.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.42.2.1 17-Jul-2001  nathanw file alpha_cpu.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.44.18.1 21-Jun-2006  yamt sync with head.
 1.44.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.47.2.1 18-Feb-2006  yamt sync with head.
 1.48.94.1 05-Mar-2011  rmind sync with head
 1.48.92.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.48.72.1 09-Oct-2010  yamt sync with head
 1.49.12.1 18-Feb-2012  mrg merge to -current.
 1.49.8.1 17-Apr-2012  yamt sync with head
 1.53.8.1 31-May-2021  cjep sync with head
 1.53.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.2 21-Nov-2023  thorpej Expose alpha_print_instruction_context to not-_KERNEL.
 1.1 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.26 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.25 17-Jun-2015  martin branches: 1.25.18;
Make clock_t unsigned
 1.24 17-Jul-2011  joerg branches: 1.24.12; 1.24.28; 1.24.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.23 27-Mar-2010  tnozaki 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
it may pass through compiler type check, it's harmful.
so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
 1.22 11-Jan-2009  christos branches: 1.22.4; 1.22.6;
merge christos-time_t
 1.21 17-Oct-2007  garbled branches: 1.21.16; 1.21.18; 1.21.22; 1.21.30;
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.20 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.19 04-Oct-2006  tnozaki branches: 1.19.8; 1.19.16; 1.19.22; 1.19.26; 1.19.28;
fix gcc -Werror -Wmissing-braces problem
mbstate_t(this is opaque object)'s initializer should be ``{ 0 }'',
so changed 1st field of union from character array to integer.
 1.18 11-Dec-2005  christos branches: 1.18.20; 1.18.22;
merge ktrace-lwp.
 1.17 07-Aug-2003  agc branches: 1.17.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 02-Mar-2003  tshiozak branches: 1.16.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.15 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.14 26-Dec-2000  itojun make mbstate_t bigger (32 -> 128 bytes).
XXX if you have libc after citrus locale import, please recompile libc,
and your applications that use mbstate_t (rather rare). really sorry
for the mess.
 1.13 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.12 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.11 10-May-2000  thorpej branches: 1.11.2;
Make stdarg/varargs work with GCC 2.96.
 1.10 27-Apr-1998  kleink branches: 1.10.14;
Provide definitions for intptr_t and uintptr_t, signed resp. unsigned integral
types large enough to hold any pointer.
 1.9 23-Nov-1997  kleink Add _BSD_SUSECONDS_T_ and _BSD_USECONDS_T_; do some space vs. tab formatting
cleanup
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.6 15-Nov-1996  jtc branches: 1.6.2;
Define _BSD_CLOCKID_T_ and _BSD_TIMER_T_
 1.5 09-Oct-1996  cgd change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.4 16-Mar-1996  jtc Add _BSD_WINT_T_ definition so we can handle wint_t type added in NA1.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.14.2 05-Jan-2001  bouyer Sync with HEAD
 1.10.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.11.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.16.2 27-Oct-2007  yamt sync with head.
 1.17.16.1 30-Dec-2006  yamt sync with head.
 1.18.22.1 22-Oct-2006  yamt sync with head
 1.18.20.1 18-Nov-2006  ad Sync with head.
 1.19.28.1 06-Nov-2007  matt sync with HEAD
 1.19.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.19.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.19.16.1 03-Oct-2007  garbled Sync with HEAD
 1.19.8.1 09-Oct-2007  ad Sync with head.
 1.21.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.22.2 11-Aug-2010  yamt sync with head.
 1.21.22.1 04-May-2009  yamt sync with head.
 1.21.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.21.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.21.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 30-May-2010  rmind sync with head
 1.22.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.30.1 22-Sep-2015  skrll Sync with HEAD
 1.24.28.1 16-Jul-2015  riz Pull up following revision(s) (requested by martin in ticket #846):
sys/arch/mips/include/ansi.h: revision 1.29
sys/arch/sh3/include/ansi.h: revision 1.16
sys/arch/sparc64/include/ansi.h: revision 1.18
sys/arch/m68k/include/ansi.h: revision 1.24
sys/arch/powerpc/include/ansi.h: revision 1.30
sys/arch/hppa/include/ansi.h: revision 1.14
sys/arch/i386/include/ansi.h: revision 1.27
sys/arch/alpha/include/ansi.h: revision 1.25
sys/arch/usermode/include/ansi.h: revision 1.5
sys/arch/sparc/include/ansi.h: revision 1.24
Make _BSD_CLOCK_T_ unsigned int so it's the same for IPL32 and LP64
environments. We don't really have a powerpc64 native userland
and the mips64 native userland is IPL32 so this shouldn't affect anything.
Make clock_t unsigned
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.24.12.1 03-Dec-2017  jdolecek update from HEAD
 1.25.18.1 10-Jun-2019  christos Sync with HEAD
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 10-Dec-2002  thorpej branches: 1.3.146; 1.3.150;
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.2 06-Apr-1997  cgd branches: 1.2.34;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.2;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.34.1 11-Dec-2002  thorpej Sync with HEAD.
 1.3.150.1 18-Feb-2012  mrg merge to -current.
 1.3.146.1 17-Apr-2012  yamt sync with head
 1.46 09-Jun-2024  riastradh alpha/asm.h: Respect _NETBSD_REVISIONID.
 1.45 23-Feb-2023  riastradh alpha: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.44 04-Sep-2020  thorpej branches: 1.44.20;
Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.43 04-Sep-2020  thorpej Missed one in last change.
 1.42 04-Sep-2020  thorpej Garbage-collect GET_CPUINFO; it's no longer used.
 1.41 04-Sep-2020  thorpej - Make the GET_CURLWP actually return curlwp, not &curlwp.
- exception_return(): Use GET_CURLWP directly, rather than a dance
acount GET_CPUINFO.
- Introduce SET_CURLWP(), to set the curlwp value.
- Garbage-collect GET_FPCURLWP.
 1.40 03-Sep-2020  thorpej The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE). We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.
 1.39 29-Aug-2020  thorpej G/C GET_IDLE_PCB -- it hasn't been used for some time.
 1.38 18-Apr-2020  martin Fix copy & pasto in previous (to fix the build)
 1.37 17-Apr-2020  joerg Mark the .ident section as mergable string section to avoid redundant
entries.
 1.36 14-Jan-2017  christos branches: 1.36.16; 1.36.26;
Undo; the correct fix was applied in csu/arch/alpha/crtbegin.h
 1.35 14-Jan-2017  martin Avoid stupid gcc redefinition warnings by #undef before redefine.
 1.34 11-Jul-2013  matt branches: 1.34.8; 1.34.12;
Add a RCSID macro for non _KERNEL use
 1.33 06-Feb-2012  matt branches: 1.33.6; 1.33.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.32 12-Feb-2011  matt branches: 1.32.4; 1.32.8;
Use .pushsection/.popsection for __KERNEL_RCSID/__KERNEL_COPYRIGHT.
Add an explicit .text to linux_sigcode.s
 1.31 20-Dec-2010  joerg branches: 1.31.2; 1.31.4;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.30 09-Feb-2007  ad branches: 1.30.70;
Merge newlock2 to head.
 1.29 20-Jan-2006  christos branches: 1.29.18;
Add a STRONG_ALIAS macro
 1.28 11-Dec-2005  christos branches: 1.28.2;
merge ktrace-lwp.
 1.27 04-Dec-2003  keihan branches: 1.27.16;
netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.26 18-Dec-2001  thorpej branches: 1.26.16;
We haven't done ECOFF for a long time; garbage-collect all the
__ELF__ #ifdefs (thus setting ELF in stone).
 1.25 18-Dec-2001  thorpej Disable .loc in macros for now; the new assembler is a lot more
picky about having the file number defined.
 1.24 05-Sep-2001  nathanw The return address register ($ra) is callee-saved, not caller-saved.
 1.23 23-Jun-2000  kleink branches: 1.23.2; 1.23.4;
Add a WEAK_ALIAS() macro.
 1.22 02-Dec-1998  thorpej branches: 1.22.10; 1.22.20;
Implement WARN_REFERENCES().
 1.21 13-Oct-1998  kleink Since libc is not ready for enabling weak symbol support yet, disable the
WEAK_ALIAS() macro for now (like cdefs.h).
 1.20 01-Oct-1998  erh Macros to call a linux syscall.
 1.19 27-Mar-1998  ross Get rid of a /* in a comment.
 1.18 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.17 06-Sep-1997  thorpej branches: 1.17.4;
Split off PALcode functions into their own header file.
 1.16 29-Aug-1997  thorpej Define PAL_cflush, PAL_ipir, and PAL_OSF1_wrperfmon PALcode operations.
 1.15 14-Apr-1997  cgd branches: 1.15.4;
clean up some ELF vs. ECOFF bogons
 1.14 08-Apr-1997  cgd align after RCS ID strings if placing them in text
 1.13 08-Apr-1997  cgd include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.12 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.11 30-Nov-1996  jtc branches: 1.11.2;
PROF -> GPROF
 1.10 17-Oct-1996  cgd add a WEAK_ALIAS macro if building on an ELF-capable system, which creates
a weak alias for a symbol.
 1.9 17-Oct-1996  cgd Add __CONCAT and ___CONCAT to concatenate identifiers. Add LLABEL to
create an assembly label, and SYSCALLNUM to convert a syscall name into
the macro that's defined to be its number. Add a CALLSYS_NOERROR macro
which invokes the named system call. (CALLSYS_NOERROR is here since
it's used in locore, for sigcode.)
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 15-Sep-1996  cgd simplify profiling entry. add 'label' argument tp PANIC, PRINTF, and MSG,
which is the label that the message string should be stored with.
 1.5 09-Jul-1996  cgd clean up comments, add OSF/1 rdmces and wrmces PALcode function calls.
 1.4 12-Apr-1996  cgd update copyright
 1.3 12-Apr-1996  cgd use jmp, rather than br, in the JMP macro
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.11.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.4.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.17.4.2 08-May-1998  mycroft Pull up 1.19, per request of ross.
 1.17.4.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.22.20.1 25-Jul-2000  kleink Pull up rev. 1.23 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.22.10.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.23.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.26.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.16.1 03-Aug-2004  skrll Sync with HEAD
 1.27.16.2 26-Feb-2007  yamt sync with head.
 1.27.16.1 21-Jun-2006  yamt sync with head.
 1.28.2.1 01-Feb-2006  yamt sync with head.
 1.29.18.1 11-Jan-2007  ad Checkpoint work in progress.
 1.30.70.1 05-Mar-2011  rmind sync with head
 1.31.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.8.1 18-Feb-2012  mrg merge to -current.
 1.32.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.32.4.1 17-Apr-2012  yamt sync with head
 1.33.10.1 28-Aug-2013  rmind sync with head
 1.33.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.12.1 20-Mar-2017  pgoyette Sync with HEAD
 1.34.8.1 05-Feb-2017  skrll Sync with HEAD
 1.36.26.1 20-Apr-2020  bouyer Sync with HEAD
 1.36.16.1 21-Apr-2020  martin Sync with HEAD
 1.44.20.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #264):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/riscv/riscv/cpu_switch.S: revision 1.3
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

riscv: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.10 10-Mar-2008  ad Finish moving alpha over to the MI atomic ops.
 1.9 28-Dec-2005  perry branches: 1.9.36; 1.9.50; 1.9.70; 1.9.74;
inline -> __inline
 1.8 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.7 17-Dec-2001  thorpej branches: 1.7.32;
Fix constraints in __asm statements (err, again). Kernels compiled
with GCC 2.95.3 work now.
 1.6 16-Apr-2001  thorpej branches: 1.6.2; 1.6.4;
Oops, properly mark a memory operand as both an input and an
output as necessary.
 1.5 08-Jun-2000  thorpej branches: 1.5.4; 1.5.6;
ANSI'ify.
 1.4 23-May-2000  thorpej branches: 1.4.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.3 05-Mar-2000  thorpej Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.2 03-Dec-1999  thorpej branches: 1.2.2;
Remove now-obsolete atomic operations.
 1.1 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.3 21-Apr-2001  bouyer Sync with HEAD
 1.5.4.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.5.4.1 08-Jun-2000  bouyer file atomic.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.6.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.4.1 16-Apr-2001  nathanw file atomic.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.32.2 17-Mar-2008  yamt sync with head.
 1.7.32.1 21-Jun-2006  yamt sync with head.
 1.9.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.70.1 24-Mar-2008  keiichi sync with head.
 1.9.50.1 23-Mar-2008  matt sync with HEAD
 1.9.36.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.24 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.23 06-Feb-2012  matt branches: 1.23.84;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 11-Dec-2005  christos branches: 1.22.112; 1.22.116;
merge ktrace-lwp.
 1.21 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.20 22-Mar-2003  simonb branches: 1.20.2;
Fix a grammatical nit.
 1.19 08-Jun-2000  thorpej And more ANSI'ification!
 1.18 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.17 01-Jun-2000  matt Make booted_device global (and booted_parition for consitency).
Eliminate it from header files and other extern definitions.
 1.16 14-May-1998  thorpej branches: 1.16.14; 1.16.22;
Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.15 13-May-1998  thorpej Clean up some historical artifacts.
 1.14 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.13 13-Feb-1998  thorpej Define a lookup table for Alpha platform variation names.
 1.12 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.11 11-Aug-1997  cgd clean up bootinfo v1 struct a bit: add a hwrpb size field (in a backward-
compatible way), and clean up the comments to make things a bit clearer.
 1.10 25-Jul-1997  cgd branches: 1.10.2;
fix comment glitch in the last change
 1.9 25-Jul-1997  cgd clean up bootinfo structure comments so they're more readable (to me,
at least 8-). Add structure offssets for structure members, so we
know how much space we're using. Make the version in the bootinfo
structure be a u_long, so there's no implicit padding in the structure.
Add a few more pointers to the bootinfo v1 structure, which will all
be set to NULL for now.
 1.8 25-Jul-1997  thorpej Define the bootinfo magic number and bootinfo (version 1) structure.
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
(2) Clean up badaddr() definition.
 1.4 13-Jun-1996  cgd clean up copyright notices
 1.3 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.2 23-Nov-1995  cgd branches: 1.2.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.4.1 13-Jun-1996  cgd pull up from trunk:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.6.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.16.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.20.2.1 02-Nov-2004  skrll Sync with HEAD.
 1.22.116.1 18-Feb-2012  mrg merge to -current.
 1.22.112.1 17-Apr-2012  yamt sync with head
 1.23.84.1 02-Aug-2025  perseant Sync with HEAD
 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.55 13-Jul-2011  dyoung On alpha, good-bye <machine/bus.h>.
 1.54 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.53 04-Mar-2007  christos branches: 1.53.40; 1.53.42; 1.53.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 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.51 11-Dec-2005  christos branches: 1.51.26;
merge ktrace-lwp.
 1.50 09-Mar-2005  matt branches: 1.50.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.49 15-Jun-2003  fvdl branches: 1.49.2; 1.49.10; 1.49.12;
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.48 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.47 26-Apr-2002  thorpej Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.46 04-Sep-2001  thorpej Implement bus_space_mmap().
 1.45 19-Jul-2001  thorpej branches: 1.45.2;
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.44 19-Jul-2001  thorpej Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.43 21-Jun-2001  wiz branches: 1.43.2;
constraint, not contraint.
 1.42 07-Mar-2001  thorpej Add the BUS_DMA_STREAMING flag.
 1.41 31-Jul-2000  briggs branches: 1.41.2;
Define bus_space_*_stream_N functions as their non-stream counterparts.
 1.40 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.39 08-Jun-2000  thorpej branches: 1.39.2;
And more ANSI'ification!
 1.38 17-Apr-2000  drochner branches: 1.38.2;
implement bus_space_vaddr()
 1.37 15-Mar-2000  drochner explicitely #include <sys/systm.h> #if BUS_SPACE_DEBUG to get a printf()
prototype
 1.36 26-Feb-2000  thorpej Pull in <sys/types.h> for the benefit of those things which include
<machine/sysarch.h> but don't pull in <sys/types.h>.
 1.35 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.34 25-Feb-2000  thorpej Protect a few things from userland with _KERNEL.
 1.33 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.32 06-Feb-2000  thorpej Implement an internal DMA map flag which prevents coalescing of
adjacent DMA segments.
 1.31 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.30 08-Dec-1999  thorpej Slight changes so that bounce buffers can be implemented for the Jensen.
 1.29 18-Jun-1999  cgd branches: 1.29.2; 1.29.8;
nuke current definitions provided by __BUS_SPACE_COMPAT_OLDDEFS.
I'll do what I can to make new ones soon. 8-)
 1.28 23-Mar-1999  drochner branches: 1.28.2; 1.28.4;
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.27 04-Mar-1999  mjacob Well, sizeof needs to be printed with a %lu- I guess not many people build
debug kernels!
 1.26 30-Aug-1998  cgd don't define __BUS_SPACE_COMPAT_OLDDEFS by default. As stated in
bus_space(9), if drivers want it (they shouldn't; easy to convert) they
can define it right before including bus.h. There's been a release since
the interfaces were (slightly) changed, and no code in the source tree
uses the old interfaces as far as I can tell.
 1.25 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.24 08-Jun-1998  thorpej branches: 1.24.2;
Add debugging support to the bus_space macros. If BUS_SPACE_DEBUG (or DEBUG)
is defined, the bus_space macros will check to ensure that the bus address
and the target buffer (if applicable) are aligned properly for the size
of the type being used. If they are not, a message will be displayed on
the console.

Strict alignment is required by the Alpha architecture, and a trap will
occur of unaligned access is performed. These changes will aid debugging
of broken device drivers.
 1.23 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.22 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.21 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.20 04-Feb-1998  thorpej The _dmamap_sync method is no longer optional.
 1.19 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.18 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.17 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.16 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.15 13-Aug-1997  cgd branches: 1.15.2;
don't define __BUS_SPACE_COMPAT_OLDDEFS if it's already been defined
 1.14 23-Jul-1997  cgd branches: 1.14.2;
when i was documenting the bus_space interfaces (the document
was sent to developers, but will eventually become a man page or
something), i noticed a few in various names:
(1) _map and _alloc should take a flags argument, rather than a
'cacheable' boolean.
(2) BUS_BARRIER_* flags should be BUS_SPACE_BARRIER_*.
(3) bus_space_copy_* should be bus_space_copy_region_* for consistency
with other region ops.
Fix all of these (in a backward-compatible way, at least for now). Redefine
internal usees of those names to use the new names. Also, while at it,
clean up the copy functions (remove unnecessary variables) and make sure
that they and other functions conform to the spec.
 1.13 07-Jun-1997  thorpej bus_dmamap_t's always have a pointer to an sgmap cookie. (oops, forgot
to commit this to the branch!)
 1.12 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.11 06-Apr-1997  cgd branches: 1.11.2;
clean up NetBSD RCS ID strings
 1.10 02-Dec-1996  cgd branches: 1.10.2;
implement bus_space_copy_*().
 1.9 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.8 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.7 27-Nov-1996  cgd #ifdef DEBUG, check {read,write}_{multi,region} ops' pointer arg for alignment.
 1.6 22-Oct-1996  cgd clean up the recent reimplementation, and kill several bogons in the new
definitions.
 1.5 22-Oct-1996  cgd update alpha bus.h for new bus space interfaces. chipsets haven't
been updated yet, and the hacked DMA vto(busphys) macro is gone and
hasn't yet been replaced.
 1.4 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.3 03-Jun-1996  cgd gross hack to get around the fact that there are currently devices with
common back-ends that live on multiple very-different busses (e.g. PCI and
TC), which need bus-specific DMA mapping support. As a nice side effect,
this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
to go away in favor of less nasty bus-specific function calls.
 1.2 18-Apr-1996  cgd branches: 1.2.4;
define bus_io_{read,write}_multi_{1,2,4,8} functions, which read/write
multiple values from a single I/O port in to/out of an array of values.
 1.1 12-Apr-1996  cgd the Alpha implementation of <machine/bus.h>
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
 1.2.4.1 03-Jun-1996  cgd pull up from trunk:
>gross hack to get around the fact that there are currently devices with
>common back-ends that live on multiple very-different busses (e.g. PCI and
>TC), which need bus-specific DMA mapping support. As a nice side effect,
>this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
>to go away in favor of less nasty bus-specific function calls.
 1.10.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.10.2.3 07-Jun-1997  cgd sync syng thorpej-bus-dma changes with alpha-nwscons branch (pass 2)
 1.10.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.2.2 06-Jun-1997  thorpej Right, that's a bonk on the head! Zero-length arrays aren't legal
in C. Make the bus_dmamap_t variable-length array size 1, and compensate
for the size screw in _bus_dmamap_create(). Pointed out by Chris Demetriou.
 1.11.2.1 23-May-1997  thorpej Add constants, types, and methods for alpha bus dma support.
 1.14.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.2 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.15.2.1 13-Aug-1997  thorpej file bus.h was added on branch marc-pcmcia on 1997-09-01 20:00:20 +0000
 1.24.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.28.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.28.2.1 06-Feb-2000  he Pull up revision 1.32 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.29.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.29.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.38.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.39.2.3 27-Apr-2002  he Pull up revision 1.47 (requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.39.2.2 06-Aug-2000  briggs Pull up revision 1.41 -- Approved by thorpej --
Define bus_space_*_stream_N functions as their non-stream counterparts.
 1.39.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.41.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.43.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.43.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.43.2.1 03-Aug-2001  lukem update to -current
 1.45.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.45.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.45.2.1 19-Jul-2001  nathanw file bus.h was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.49.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.49.10.1 29-Apr-2005  kent sync with -current
 1.49.2.1 01-Apr-2005  skrll Sync with HEAD.
 1.50.4.2 03-Sep-2007  yamt sync with head.
 1.50.4.1 26-Feb-2007  yamt sync with head.
 1.51.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.51.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.53.44.1 16-May-2008  yamt sync with head.
 1.53.42.1 18-May-2008  yamt sync with head.
 1.53.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.5 23-Sep-2019  skrll branches: 1.5.12;
Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.4 22-Jun-2017  flxd branches: 1.4.6;
spelling (DEC called it "TURBOchannel")
 1.3 06-Feb-2012  matt branches: 1.3.6; 1.3.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.2 12-Aug-2011  dyoung branches: 1.2.2; 1.2.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 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.2.6.1 18-Feb-2012  mrg merge to -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.3.24.1 28-Aug-2017  skrll Sync with HEAD
 1.3.6.1 03-Dec-2017  jdolecek update from HEAD
 1.4.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 11-Oct-2020  thorpej Add some bus_dma instrumentation.
 1.2 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.1 01-Jul-2011  dyoung branches: 1.1.2; 1.1.6;
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.6.1 18-Feb-2012  mrg merge to -current.
 1.1.2.1 17-Apr-2012  yamt sync with head
 1.3 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.2 24-Jan-2016  christos branches: 1.2.18;
use __paddr_t since this is a userland API.
 1.1 12-Aug-2011  dyoung branches: 1.1.12; 1.1.30;
Straggler from last: add bus_user.h to the repository.
 1.1.30.1 19-Mar-2016  skrll Sync with HEAD
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.38;
Remove clause 3 and 4 from TNF licenses
 1.5 16-Feb-2006  perry branches: 1.5.68; 1.5.70; 1.5.72;
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.4 24-Dec-2005  perry branches: 1.4.2; 1.4.4; 1.4.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 08-Jun-2000  thorpej branches: 1.3.4; 1.3.44;
ANSI'ify.
 1.2 05-Mar-2000  thorpej branches: 1.2.2;
Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.1 02-Dec-1999  thorpej branches: 1.1.2;
Inline the BWX instructions.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.44.1 21-Jun-2006  yamt sync with head.
 1.3.4.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.3.4.1 08-Jun-2000  bouyer file bwx.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 18-Feb-2006  yamt sync with head.
 1.5.72.1 16-May-2008  yamt sync with head.
 1.5.70.1 18-May-2008  yamt sync with head.
 1.5.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.38.1 18-Feb-2012  mrg merge to -current.
 1.6.34.1 17-Apr-2012  yamt sync with head
 1.13 18-Mar-2014  christos Make all __ALIGNBYTES macros return the same type (size_t)
 1.12 20-Jan-2012  joerg branches: 1.12.6; 1.12.10;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.11 20-Mar-1999  thorpej branches: 1.11.182; 1.11.186;
Garbage-collect.
 1.10 04-Nov-1997  thorpej Bug fixes and cleanup from Chris Demetriou <cgd@pa.dec.com>:
- fix _C_LABEL so that it actually works.
- make __RENAME use _C_LABEL.
- fix __RENAME so that it expects an unquoted argument.
- fix __indr_reference and __warn_references so that they
supply their own final semicolon.
- define __warn_references to nothing if not GNU C (required
by the way it's used).

The __warn_references semicolon change has to be made
so that __warn_references can be defined into nothing.
(A ; all by itself isn't a great idea.) The __indr_reference
change was made for consistency.
 1.9 22-Oct-1997  thorpej Implement __RENAME() in <machine/cdefs.h>
 1.8 07-Apr-1997  cgd branches: 1.8.8;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 16-Dec-1996  cgd disable weak aliases in libc until something actually uses them. When
using __weak_alias in libc, __indr_reference should probably be defined
to do nothing (but defined, so that duplicate functions/variables aren't
compiled). However, when not using __weak_alias, __indr_reference causes
them to be omitted completely, which is a lose. So, until weak aliases
are going to be used, don't define __weak_alias or __indr_reference.
 1.5 12-Oct-1996  cgd branches: 1.5.2;
don't forget to switch back to the .text after emitting warning
strings in their own sections.
 1.4 09-Oct-1996  cgd add support for ELF toolchain, including weak alias support (for upcoming
libc changes) and reference warnings.
 1.3 04-Oct-1996  cgd kill misnamed __indr_references() macro, that would have broken things
if it _had_ been properly named.
 1.2 03-May-1995  cgd make an __indr_references macro, that expands to nothing...
 1.1 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.5.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.1 24-Jan-1997  cgd sync with trunk
 1.8.8.2 04-Nov-1997  thorpej Pull up from trunk: bug fixes and cleaups.
 1.8.8.1 22-Oct-1997  thorpej Pull up from trunk: Implement __RENAME() in <machine/cdefs.h>
 1.11.186.1 18-Feb-2012  mrg merge to -current.
 1.11.182.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.11.182.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 03-Jun-2022  andvar remove reference to gatekeeper.dec.com ftp.
 1.3 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.2 06-Apr-1997  cgd branches: 1.2.206; 1.2.226;
clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
Preliminary CFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap, cursor,
etc.) support. Digital UNIX does not support CFB frame buffers in the
Alpha, but they appear to work OK (with an appropriate monitor) in my
3000/300.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.226.1 28-Aug-2017  skrll Sync with HEAD
 1.2.206.1 03-Dec-2017  jdolecek update from HEAD
 1.3 09-May-1996  cgd remove redundant header, now that ECOFF_SEGMENT_ALIGNMENT macro for
<sys/exec_ecoff.h> is fixed.
 1.2 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 06-Sep-2002  gehenna branches: 1.5.2;
Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.4 10-Apr-2000  chs branches: 1.4.6; 1.4.8; 1.4.20;
add decls for fd driver.
 1.3 24-Mar-1998  thorpej branches: 1.3.14;
cdev_decl the "zs" device (which is really zstty).
 1.2 02-Mar-1998  ross branches: 1.2.2;
Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.1 07-Apr-1997  cgd branches: 1.1.2;
add machine/conf.h, right now a minimal placeholder
 1.1.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.2.2.2 02-Mar-1998  ross Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.2.2.1 02-Mar-1998  ross file conf.h was added on branch alpha-nwscons on 1998-03-02 07:44:19 +0000
 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.20.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.4.8.1 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.4.6.1 17-Sep-2002  nathanw Catch up to -current.
 1.5.2.2 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.5.2.1 06-Sep-2002  gehenna file conf.h was added on branch bouyer-scsipi on 2002-09-06 13:19:05 +0000
 1.106 31-Mar-2024  thorpej Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.
 1.105 22-Nov-2023  thorpej If not _KERNEL, include <stddef.h> to make sure we have offsetof().
 1.104 14-Aug-2021  ryo Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.103 22-Jul-2021  thorpej Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.102 26-Jun-2021  skrll Fix typo in comment
 1.101 20-Apr-2021  thorpej branches: 1.101.2;
Slight tweak to previous changes:

Rather than simply increment the interrupt depth for the clock interrupt,
we add 0x10. Why? Because while we only use a single Alpha IPL (4) for
IPL_{BIO,NET,TTY,VM}, technically the architecture specification suports
two in the OSF/1 PALcode (3 [low-pri] and 4 [high-pri]), meaning we could
conceiveably have intrdepth > 1 just for device interrupts.

Adding 0x10 here means that cpu_intr_p() can check for "intrdepth != 0" for
"in interrupt context" and CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
"was processing interrupts when the clock interrupt happened".
 1.100 15-Apr-2021  rin Fix fallout from alpha/interrupt.c rev 1.93:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/alpha/alpha/interrupt.c#rev1.93

by which interrupts *seem* to occupy 100% CPU time.

Now, we bump ci_intrdepth for clock interrupt. Therefore, if ci_intrdepth > 1
is observed in statclock(), CPU is actually occupied by interrupts.

Thanks jklos and thorpej for notice!
 1.99 15-Oct-2020  thorpej branches: 1.99.4;
Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.98 29-Sep-2020  thorpej Improve time keeping and host CPU usage when running in Qemu:
- clockattach(): Allow multiple calls when running in Qemu. Anything
after this first one is ignored, but this gives us a change to use
a clock source provided by the VM directly, rather than relying on
a more expensive hardware emulation.
- Add cpu_initclocks_secondary(), to handle clock setup on secondary
CPUs, if needed.
- Allow us to use the WTINT PALcode call in cpu_idle() to idle in a lower
power state (Qemu's PALcode supports this).
- Use the Qemu per-cpu set-alarm-rel call as the hardclock interrupt
source. In Qemu environments, reduce hz to 50 (rather than the
default 1024) to give the clock a snowball's chance when running on
a host system with hz=100. XXX We have to manually re-calculate
tick and tickadj. There should be MI code to do this for us. Also
in Qemu environments, let hardclock() drive the sched clock by setting
schedhz=0.
 1.97 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.96 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.95 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.94 04-Sep-2020  thorpej Put the MI cpu_data at the beginning of cpu_info so that it is
cache line aligned.
 1.93 04-Sep-2020  thorpej Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.92 04-Sep-2020  thorpej Shuffle fields in cpu_info for better cache behavior.
XXX More changes to come after curlwp is overhauled.
 1.91 03-Sep-2020  thorpej Garbage-collect fpcurlwp -- it has been obsolete since FPU tracking
was converted over to PCU.
 1.90 03-Sep-2020  thorpej Garabage-collect curpcb / cpu_info::ci_curpcb.
 1.89 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.88 29-Aug-2020  thorpej - cpu_need_resched(): Explicitly cover each RESCHED_* case, and add a
comment explaining why we don't need to act on IDLE+REMOTE.
- cpu_signotify(): Move to machdep.c, and if we're asked to notify
an LWP running on another CPU, send an AST IPI to that CPU. Add some
assertions.
- cpu_need_proftick(): Move to machdep.c, add some assertions.
 1.87 17-Aug-2020  thorpej - Track the currently-activated pmap in struct cpu_info.
- Reserve some space in struct cpu_info for future pmap changes.
 1.86 01-Dec-2019  ad Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.
 1.85 24-Nov-2019  ad Make ci_want_resched a u_int.
 1.84 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.83 17-Dec-2016  flxd branches: 1.83.14; 1.83.16;
Fix typo "one the" and architecture where appropriate.
 1.82 22-Jan-2014  christos branches: 1.82.6; 1.82.10;
undo rump workaround
 1.81 21-Jan-2014  christos rumpkernel needs ci_pcc_freq
 1.80 10-Nov-2013  christos use __unused instead of __USE and void cast to mark iterator variable unused
where needed (from phone)
 1.79 03-Nov-2013  christos use __USE() in the iterator variable
 1.78 21-Jan-2012  matt branches: 1.78.6; 1.78.10;
cpu_uarea_free returns bool, not void
 1.77 14-Jun-2011  matt branches: 1.77.2; 1.77.6;
Add latent support for __HAVE_CPU_UAREA_ROUTINES
 1.76 08-Feb-2011  rmind branches: 1.76.2;
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.75 26-Dec-2010  he branches: 1.75.2; 1.75.4;
Since struct cpu_data isn't the first member in struct cpu_info, instead
expose the initial portion of struct cpu_info if _KMEMUSER is defined.
 1.74 28-Apr-2008  martin branches: 1.74.22;
Remove clause 3 and 4 from TNF licenses
 1.73 27-Feb-2008  xtraeme branches: 1.73.2; 1.73.4;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.72 17-Oct-2007  garbled branches: 1.72.12; 1.72.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.71 21-Jul-2007  tsutsui branches: 1.71.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.70 19-May-2007  mhitch branches: 1.70.2; 1.70.4;
Fix multiprocessor operation: move a couple of fields in struct cpu_info
to the beginning so they can still be accessed in assymbly code using 8 bit
offsets. The addition of a big structure in cpu_data moved these outside
the range of the addq instruction. Gas should have complained that the
immediate value was too large, but just silently truncated it. I can now
run multiprocessor again.
 1.69 18-May-2007  mhitch Fix alpha MP for idlelwp: ci_idle_lwp was added to cpu_info
structure, but never initialized. There's already a cpu_idlelwp
in ci_data, which appears to be the same thing, so use that instead.
 1.68 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.67 16-Feb-2007  ad branches: 1.67.2; 1.67.6; 1.67.8; 1.67.12; 1.67.14;
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.66 09-Feb-2007  ad Merge newlock2 to head.
 1.65 24-Dec-2005  perry branches: 1.65.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.64 11-Dec-2005  christos merge ktrace-lwp.
 1.63 22-Sep-2004  yamt branches: 1.63.12;
move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.62 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.61 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.60 05-Feb-2003  nakayama branches: 1.60.2;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.59 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.58 30-May-2001  mrg branches: 1.58.4;
use _KERNEL_OPT
 1.57 27-May-2001  sommerfeld Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.56 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.55 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.54 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.53 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.52 27-Feb-2001  mjacob branches: 1.52.2;
revert previous commit while the longbeards ponder
 1.51 27-Feb-2001  mjacob Remove cpu_wait #define because it's now prototyped in <sys/proc.h> which
means it has to really exist.
 1.50 19-Jan-2001  thorpej Make ASTs per-process.
 1.49 13-Dec-2000  mycroft Oops; add PROC_PC().
 1.48 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.47 20-Nov-2000  thorpej Make ci_ipis volatile.
 1.46 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.45 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.44 08-Jun-2000  thorpej And more ANSI'ification!
 1.43 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.42 04-Jun-2000  thorpej Increment an interrupt depth counter in non-clock interrupt cases
so that we can get time spent in interrupt statistics.
 1.41 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.40 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.39 26-May-2000  thorpej branches: 1.39.2;
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.38 03-Apr-2000  thorpej Print any architecture extensions present on the primary CPU.
 1.37 29-Feb-2000  thorpej Put machine check info in cpu_info in the multiprocessor case, and
just have one statically allocate machine check info structure in the
single processor config case.
 1.36 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.35 17-Sep-1999  thorpej branches: 1.35.2; 1.35.8;
Centralize the declaration and clearing of `cold'.
 1.34 16-Aug-1999  thorpej Pull in <machine/alpha_cpu.h>.
 1.33 15-Aug-1999  thorpej Protect userland from the vast majority of this file.
 1.32 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.31 10-Aug-1999  thorpej Define cpu_number() as discussed on tech-smp.
 1.30 19-Nov-1998  ross Rip out 70 lines of (all of) the port-alpha-specific decls and prototypes.
They should not be visible to the MI kernel and the MI kernel shouldn't
depend on this junk. Most of it moves to new module <machine/alpha.h>.

Leave badaddr() here, though, because it's used so widely.
 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 29-Sep-1998  thorpej Prototype cpu_halt_secondary().
 1.25 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.24 13-Jul-1998  ross Kill the old extern mchkinfo pointer and prototype cpu_mchkinfo().
This file has been collecting prototypes and other things used in the MD
code...that's bad...because this is exported to the MI kernel.
 1.23 08-Jul-1998  mjacob stale beer- place structure in right file
 1.22 08-Jul-1998  mjacob Add machine check type definitions. Structure the expected/received
machine check items.
 1.21 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.20 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.19 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.18 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.17 25-Jul-1997  thorpej branches: 1.17.2;
Update alpha_init() prototype; takes two more args.
 1.16 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.15 24-Jan-1997  cgd astpending and want_resched are kernel-only
 1.14 07-Dec-1996  cgd add a "machdep.booted_kernel" sysctl, which is the name of the booted
kernel as supplied by the SRM console's BOOTED_FILE variable.
 1.13 13-Nov-1996  cgd branches: 1.13.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.12 14-Jul-1996  cgd (1) Add unaligned access fixup code to fix unaligned quad, long,
and IEEE S and T floating datum loads and stores. VAX floating data
types not yet supported, and in the future will only be supported if
FIX_UNALIGNED_VAX_FP is defined. (No point in wasting the space when
most of the time there will never be VAX FP loads and stores.) Right
now, these features can be controlled only by sysctl. The (boolean)
integer sysctls machdep.unaligned_print, machdep.unaligned_fix, and
machdep.unaligned_sigbus control printing about unaligned accesses
(defaults on), fixing up of unaligned accesses (defaults on), and
forcing a SIGBUS on unaligned accesses (defaults off). If an access
is not fixed up (for lack of method or explicit decision), a SIGBUS is
always generated to keep programs from using bogus data. At some point,
these three choices should be controlled by per-process flags, as well.
 1.11 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.10 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.9 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.8 14-Jun-1996  cgd add a new machine-dependent sysctl, machdep.root_device, which is the
(string) name of the root device. It's a string so that it can
be used before dev_mkdb has been run.
 1.7 21-Dec-1995  mycroft branches: 1.7.4;
Remove deprecated cpu_setstack().
 1.6 28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.5 28-Jun-1995  cgd update for various (old) NetBSD changes
 1.4 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 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 24-Mar-1995  cgd remove support for double-mapping the user area/kernel stack
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.7.4.1 14-Jun-1996  cgd pull up from trunk:
>add a new machine-dependent sysctl, machdep.root_device, which is the
>(string) name of the root device. It's a string so that it can
>be used before dev_mkdb has been run.
 1.13.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.13.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.2 24-Jan-1997  cgd sync with trunk
 1.13.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.17.2.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.35.2.7 23-Apr-2001  bouyer Sync with HEAD.
 1.35.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.35.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.35.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.35.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.35.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.35.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.39.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.52.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.58.4.4 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.58.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.58.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.58.4.1 30-May-2001  nathanw file cpu.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.60.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.12.4 17-Mar-2008  yamt sync with head.
 1.63.12.3 03-Sep-2007  yamt sync with head.
 1.63.12.2 26-Feb-2007  yamt sync with head.
 1.63.12.1 21-Jun-2006  yamt sync with head.
 1.65.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.67.14.2 03-Oct-2007  garbled Sync with HEAD
 1.67.14.1 22-May-2007  matt Update to HEAD.
 1.67.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.67.8.1 11-Jul-2007  mjf Sync with head.
 1.67.6.2 20-Aug-2007  ad Sync with HEAD.
 1.67.6.1 27-May-2007  ad Sync with head.
 1.67.2.1 20-Mar-2007  yamt adapt alpha.
 1.70.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.70.2.1 07-Aug-2007  matt Sync with HEAD.
 1.71.6.2 23-Mar-2008  matt sync with HEAD
 1.71.6.1 06-Nov-2007  matt sync with HEAD
 1.72.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.72.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.72.12.1 24-Mar-2008  keiichi sync with head.
 1.73.4.1 16-May-2008  yamt sync with head.
 1.73.2.1 18-May-2008  yamt sync with head.
 1.74.22.1 05-Mar-2011  rmind sync with head
 1.75.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.75.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.76.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.77.6.1 18-Feb-2012  mrg merge to -current.
 1.77.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.2.1 17-Apr-2012  yamt sync with head
 1.78.10.1 18-May-2014  rmind sync with head
 1.78.6.2 03-Dec-2017  jdolecek update from HEAD
 1.78.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.82.6.1 05-Feb-2017  skrll Sync with HEAD
 1.83.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.83.16.1 10-Jun-2019  christos Sync with HEAD
 1.83.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.99.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.101.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 17-Oct-2007  garbled branches: 1.5.16; 1.5.18; 1.5.20;
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.4 21-Jul-2007  tsutsui branches: 1.4.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.3 16-Feb-2006  perry branches: 1.3.24; 1.3.32; 1.3.36; 1.3.38;
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.2 24-Dec-2005  perry branches: 1.2.2; 1.2.4; 1.2.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 05-Feb-2003  nakayama branches: 1.1.18;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.1.18.1 03-Sep-2007  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.38.1 15-Aug-2007  skrll Sync with HEAD.
 1.3.36.1 07-Aug-2007  matt Sync with HEAD.
 1.3.32.1 03-Oct-2007  garbled Sync with HEAD
 1.3.24.1 20-Aug-2007  ad Sync with HEAD.
 1.4.6.1 06-Nov-2007  matt sync with HEAD
 1.5.20.1 16-May-2008  yamt sync with head.
 1.5.18.1 18-May-2008  yamt sync with head.
 1.5.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.16 28-Sep-2020  thorpej Remove a no-longer-accurate comment.
 1.15 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 14-Jun-2011  matt branches: 1.14.2; 1.14.6;
struct device * -> device_t
 1.13 27-Jul-2001  thorpej branches: 1.13.2; 1.13.160;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.12 08-Jun-2000  thorpej branches: 1.12.6;
And more ANSI'ification!
 1.11 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.10 01-Jun-2000  thorpej Rearrange things a little so we can deal with systypes that aren't
densely packed.
 1.9 29-Mar-2000  simonb branches: 1.9.2;
Don't declare a variable in the 'struct platform' declaration - we declare
an extern for 'struct platform platform' further down this file anyway,
and this would have declared a 'platform' variable in any userland code
including this file.
 1.8 06-Jun-1998  thorpej branches: 1.8.14;
Clean up a little, and add a `powerdown' hook in the platform structure.
 1.7 06-Nov-1997  thorpej Clean up the messages displayed when either platform support is not
configured into the kernel, or when the platform is not supported.
Use the defopt'ed options, rather than NDEC_... and remove the needs-flag
hack that's existed for a while.
 1.6 23-Sep-1997  mjacob branches: 1.6.2;
Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.5 02-Sep-1997  thorpej branches: 1.5.2;
Oops, wrap cpu_decl()s inside #ifdef _KERNEL/#endif.
 1.4 02-Sep-1997  thorpej Clean this up a bit; defopt has rendered the #undef hacks unnecessary.
Also, put the cpu_decl()s in cpuconf.h, so that platform support files
can pull in the prototypes from there, and pull in options for those
systems for which there is code in the source tree.
 1.3 02-Sep-1997  thorpej Ressurect from the Attic.
 1.2 10-Apr-1997  cgd reorganize cpu configuration and device configuration tables. Now all macro
definitions and prototypes are in machine/conf.h, and all tables are in
alpha/conf.c.
 1.1 12-Nov-1996  cgd branches: 1.1.2;
convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.2.1 02-Sep-1997  thorpej file cpuconf.h was added on branch marc-pcmcia on 1997-09-04 00:53:08 +0000
 1.6.2.1 06-Nov-1997  thorpej Pull up from trunk: clean up "not configured"/"not supported" messages.
 1.8.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.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.12.6.1 03-Aug-2001  lukem update to -current
 1.13.160.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.13.2.1 27-Jul-2001  thorpej file cpuconf.h was added on branch nathanw_sa on 2001-07-27 00:25:20 +0000
 1.14.6.1 18-Feb-2012  mrg merge to -current.
 1.14.2.1 17-Apr-2012  yamt sync with head
 1.6 15-Oct-2020  thorpej Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.5 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.4 28-Apr-2008  martin branches: 1.4.32;
Remove clause 3 and 4 from TNF licenses
 1.3 23-Jun-2003  martin branches: 1.3.104; 1.3.106; 1.3.108;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.2 18-Nov-2000  thorpej branches: 1.2.2;
Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.1 05-Jun-2000  thorpej branches: 1.1.4;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 05-Jun-2000  minoura file cpuvar.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:27 +0000
 1.2.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.2.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.2.2.1 18-Nov-2000  bouyer file cpuvar.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.3.108.1 16-May-2008  yamt sync with head.
 1.3.106.1 18-May-2008  yamt sync with head.
 1.3.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.23 22-Nov-2023  thorpej Changes to let the Alpha DDB code build in user-space for crash(8).
 1.22 21-Nov-2023  thorpej Adjust proc/lwp access for user-space (crash(8)).
 1.21 21-Nov-2023  thorpej Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.
 1.20 21-Nov-2023  riastradh ddb: New db_stack_trace_print_ra.

Takes an optional extra argument for the return address so that the
stack parser has a chance to use instruction-dependent interpretation
of the frame to find parent frames.

Implemented only on Alpha for now, which needs it. Other
architectures just ignore the extra argument.

PR port-alpha/57716

XXX pullup-10
XXX pullup-9
XXX pullup-8
 1.19 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.18 26-May-2011  joerg branches: 1.18.14;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.17 21-Feb-2007  thorpej branches: 1.17.68; 1.17.74;
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.16 17-May-2006  drochner branches: 1.16.14;
remove a typecast in a macro which is used on the LHS. gcc4 doesn't like it
 1.15 01-Apr-2006  cherry closes: PR kern/32359

modifies machine/db_machdep.h: BKPT_SET(inst) to BKPT_SET(inst, addr) for all archs ie; passess the
breakpoint address as well.

Patch from cherry@mahiti.org
 1.14 29-Apr-2003  scw branches: 1.14.18; 1.14.32; 1.14.34; 1.14.36; 1.14.38; 1.14.40;
Add a BKPT_ADDR() macro which gives MD code a chance to munge a
breakpoint address before it's used. Currently a no-op on all but sh5.

This is useful on sh5, for example, to mask off the instruction
type encoding in the bottom two address bits, and makes it possible
to do "db> break $rXX" instead of manually munging the address.
 1.13 19-Apr-2001  thorpej branches: 1.13.4;
Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.12 22-Nov-2000  thorpej branches: 1.12.2;
Just access the trapframe directly for DDB registers.
 1.11 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.10 08-Jun-2000  thorpej ANSI'ify.
 1.9 20-Apr-1999  thorpej branches: 1.9.2; 1.9.10;
After reviewing the Green Book, BPT traps do indeed leave the PC pointing
to the instruction _after_ the `call_pal bpt' instruction.
 1.8 20-Apr-1999  thorpej Prototype alpha_debug(), and add some definitions for KGDB.
 1.7 14-Aug-1998  thorpej branches: 1.7.8;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.6 06-Sep-1997  thorpej Prototype db_register_value().
 1.5 25-Jul-1997  thorpej branches: 1.5.2;
More DDB support:
- Add support for software single-stepping (Alpha does not have hardware
support for single-stepping)
- Alpha uses Elf64 symbols.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 06-Feb-1997  gwr FIXUP_PC_AFTER_BREAK now takes an arg of type db_regs_t *
 1.2 11-Jul-1996  cgd branches: 1.2.2;
Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.9.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.9.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.13.4.2 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.13.4.1 19-Apr-2001  thorpej file db_machdep.h was added on branch nathanw_sa on 2001-04-19 17:48:48 +0000
 1.14.40.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.14.38.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.14.36.2 24-May-2006  yamt sync with head.
 1.14.36.1 11-Apr-2006  yamt sync with head
 1.14.34.2 01-Jun-2006  kardel Sync with head.
 1.14.34.1 22-Apr-2006  simonb Sync with head.
 1.14.32.1 09-Sep-2006  rpaulo sync with head
 1.14.18.2 26-Feb-2007  yamt sync with head.
 1.14.18.1 21-Jun-2006  yamt sync with head.
 1.16.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.17.74.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.68.1 31-May-2011  rmind sync with head
 1.18.14.1 03-Dec-2017  jdolecek update from HEAD
 1.11 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.10 23-Nov-2009  pooka If cpu_disklabel includes struct dkbad, define __HAVE_DISKLABEL_DKBAD.
This allows use of subr_disk_mbr on all archs. Default to it for
the rump disk component. No functional change for regular kernels.
(The other option would've been to include dkbad in disklabels
everywhere, but arguably this approach has less possible side-effects,
especially given that wedges and related magic will take over the
world any second now).
 1.9 11-Dec-2005  christos branches: 1.9.78;
merge ktrace-lwp.
 1.8 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.7 03-Apr-2002  lukem branches: 1.7.10;
remove boot_block stuff from include/disklabel.h, and migrate to
alpha_boot_block stuff in dev/dec/dec_boot.h
 1.6 13-Mar-2000  soren branches: 1.6.6; 1.6.8;
Fix doubled 'the's in comments.
 1.5 05-Apr-1999  cgd branches: 1.5.2; 1.5.8;
clean up slightly, do a little #define trick to make checksumming
the boot block a little easier/more 'clean', and provide a macro to
checksum the boot block.
 1.4 02-Apr-1999  cgd define 'struct boot_block' which is the alpha (SRM) boot block
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 03-Feb-1997  cgd add bad sector information to cpu disklabel
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 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.5.2.2 05-Apr-1999  cgd clean up slightly, do a little #define trick to make checksumming
the boot block a little easier/more 'clean', and provide a macro to
checksum the boot block.
 1.5.2.1 05-Apr-1999  cgd file disklabel.h was added on branch netbsd-1-4 on 1999-04-05 02:45:48 +0000
 1.6.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.1 17-Apr-2002  nathanw Catch up to -current.
 1.7.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.78.1 11-Mar-2010  yamt sync with head
 1.4 26-Sep-1996  cgd rename <machine/ecoff.h> to <machine/ecoff_machdep.h> for clarity and
consistency with the way machdep headers for other things are done.
(the creation of the ecoff_machdep.h files was done on the CVS server, to
keep the RCS logs intact.)
 1.3 09-May-1996  cgd change structure member names to be in line with what various ECOFF
documentation I have calls them, and update for new definitions in
sys/exec_ecoff.h. Also, fix ECOFF_SEGMENT_ALIGNMENT macro so that it
actually returns the right alignment.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 27-Apr-1999  cgd Alpha ECOFF object type definitions
 1.4 06-Apr-1997  cgd branches: 1.4.16; 1.4.18; 1.4.20;
clean up NetBSD RCS ID strings
 1.3 09-May-1996  cgd branches: 1.3.2;
change structure member names to be in line with what various ECOFF
documentation I have calls them, and update for new definitions in
sys/exec_ecoff.h. Also, fix ECOFF_SEGMENT_ALIGNMENT macro so that it
actually returns the right alignment.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.20.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.4.18.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.16.1 21-Jun-1999  cgd pull up rev(s) 1.5 from trunk. (cgd)
 1.13 25-Sep-2021  thorpej Make all of the EISA chipset functions call through real functions,
rather the macros.
 1.12 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.11 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.10 14-Jun-2011  matt branches: 1.10.2; 1.10.12; 1.10.16;
struct device * -> device_t
 1.9 17-Oct-2007  garbled branches: 1.9.52;
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.8 22-Jul-2007  tsutsui branches: 1.8.6;
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
 1.7 11-Aug-2000  thorpej branches: 1.7.40; 1.7.76; 1.7.82; 1.7.90; 1.7.92; 1.7.94; 1.7.96;
Add functions to read EISA configuration data for MEM, IRQ, DMA, and IO.

XXX Just error stubs on the i386 right now -- someone needs to write
XXX EISA BIOS code for i386.
 1.6 29-Jul-2000  thorpej Add code to read the EISA configuration NVRAM as set up by
an EISA Configuration Utility. Code to access this data
is forthcoming.

XXX This could probably be made MI at some point.
 1.5 04-Jun-2000  cgd branches: 1.5.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 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.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
move eisa/eisa_machdep.h to include/eisa_machdep.h. (can't do it via
repository copy because alpha already had an include/eisa_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd these have moved elsewhere
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 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.5.2.1 11-Aug-2000  thorpej Pullup from trunk:
Add EISA configuration readining infrastructure.
 1.7.96.1 15-Aug-2007  skrll Sync with HEAD.
 1.7.94.1 07-Aug-2007  matt Sync with HEAD.
 1.7.92.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.7.90.1 03-Oct-2007  garbled Sync with HEAD
 1.7.82.1 20-Aug-2007  ad Sync with HEAD.
 1.7.76.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.7.40.1 03-Sep-2007  yamt sync with head.
 1.8.6.1 06-Nov-2007  matt sync with HEAD
 1.9.52.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.16.1 18-May-2014  rmind sync with head
 1.10.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16 18-Apr-2025  riastradh ld.elf_so on alpha: Add support for secureplt.

ok thorpej

PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
PR port-alpha/57717: Alpha linker generates LOAD segments (and
generates warnings about them)
 1.15 10-Oct-2020  thorpej branches: 1.15.26;
Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926
 1.14 08-Apr-2019  thorpej Add the R_ALPHA_BRSGP relocation type.
 1.13 06-Nov-2017  christos branches: 1.13.4;
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.12 30-Sep-2010  skrll branches: 1.12.18;
Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.
 1.11 30-May-2009  skrll branches: 1.11.2; 1.11.4;
Add TLS relocation definitions.
 1.10 09-Dec-2001  thorpej branches: 1.10.122;
Add support for dumping ELF-cormat core files.
 1.9 01-Nov-2001  drochner protect against multiple inclusion
 1.8 31-Oct-2001  thorpej Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.
 1.7 31-Oct-2001  thorpej Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).
 1.6 02-Apr-2000  minoura branches: 1.6.6; 1.6.8; 1.6.12;
Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
 1.5 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.4 03-Oct-1998  christos branches: 1.4.12; 1.4.14; 1.4.16;
Add em_alpha_exp
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 14-Dec-1996  cgd add endianness constants, relocation types
 1.1 26-Sep-1996  cgd branches: 1.1.2;
add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 24-Jan-1997  cgd sync with trunk
 1.4.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.1 14-Nov-1999  fvdl Sync with -current.
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.12.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.10.122.2 09-Oct-2010  yamt sync with head
 1.10.122.1 20-Jun-2009  yamt sync with head
 1.11.4.1 05-Mar-2011  rmind sync with head
 1.11.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.18.1 03-Dec-2017  jdolecek update from HEAD
 1.13.4.1 10-Jun-2019  christos Sync with HEAD
 1.15.26.1 02-Aug-2025  perseant Sync with HEAD
 1.11 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.10 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.9 21-Aug-1999  simonb branches: 1.9.2;
Include <sys/endian.h> after defining whether where are little- or
big-endian. i386, pc532 and vax still include <machine/byte_swap.h>
and define macros for the {n,h}to{h,n}*() functions. mips also
defines some endian-independent assembly-code aliases for unaligned
memory accesses.
 1.8 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.7 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.6 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.5 09-Oct-1997  bouyer branches: 1.5.4;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.4 06-Apr-1997  cgd branches: 1.4.4;
clean up NetBSD RCS ID strings
 1.3 13-Oct-1996  cgd branches: 1.3.2;
typedef, not typeded
 1.2 13-Oct-1996  christos in_addr_t and in_port_t changes
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.9.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.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 22:35:40 +0000
 1.2 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 19-Sep-2001  thorpej Remove alpha/include/fbio.h -- it hasn't been used for a Long Time.
 1.4 06-Apr-1997  cgd branches: 1.4.34; 1.4.36; 1.4.38;
clean up NetBSD RCS ID strings
 1.3 23-Aug-1996  cgd branches: 1.3.2;
define a new frame buffer type code for the TGA2
 1.2 01-May-1996  cgd add an entry for the SFB+, and clean up entries some
 1.1 12-Apr-1996  cgd keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.3.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.4.38.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.36.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.34.1 21-Sep-2001  nathanw Catch up to -current.
 1.4 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.3 27-Oct-2019  christos branches: 1.3.32;
elide gcc-8 shadow warnings.
 1.2 24-Aug-2016  christos branches: 1.2.2; 1.2.4; 1.2.18; 1.2.22;
restore the constants to the old values to match what the kernel expects
internally.
 1.1 23-Aug-2016  christos fenv.h for alpha
 1.2.22.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.18.2 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 24-Aug-2016  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:35:46 +0000
 1.2.4.2 05-Oct-2016  skrll Sync with HEAD
 1.2.4.1 24-Aug-2016  skrll file fenv.h was added on branch nick-nhusb on 2016-10-05 20:55:23 +0000
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 24-Aug-2016  pgoyette file fenv.h was added on branch pgoyette-localcount on 2016-09-14 03:04:16 +0000
 1.3.32.1 02-Aug-2025  perseant Sync with HEAD
 1.11 12-May-2003  kleink Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.10 19-Apr-2003  christos PR/3012: Greg A. Woods: Write all float.h files [except the vax of course]
in terms of float_ieee.h
 1.9 08-Jun-2000  thorpej And more ANSI'ification!
 1.8 18-Feb-1998  mycroft branches: 1.8.14; 1.8.22;
Minor changes to make all the float.h files match.
 1.7 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.6 17-Jul-1997  thorpej branches: 1.6.6;
Turn the extern declaration of __flt_rounds() into a proper prototype.
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4 20-Jun-1995  jtc branches: 1.4.4;
Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.3 20-Jun-1995  jtc #include <sys/cdefs.h>.
Wrap __flt_rounds() declaration with __BEGIN_DECLS/__END_DECLS.
 1.2 29-Apr-1995  cgd make FLT_ROUNDS call __flt_rounds, so dynamic rounding mode is grabbed.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.4.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.6.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.8.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.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.9 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.8 22-Jul-2021  thorpej branches: 1.8.16;
Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.7 17-Oct-2017  maya branches: 1.7.20;
Explain our implementation choice for implementation-defined values
 1.6 10-May-2008  martin branches: 1.6.42;
Backout previous: the license sweep touched these files in error, so
restore the old license.
 1.5 28-Apr-2008  martin branches: 1.5.2;
Remove clause 3 and 4 from TNF licenses
 1.4 26-Apr-2001  ross branches: 1.4.2; 1.4.6;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.3 25-Apr-1999  ross Never used, and work-in-progress uses a different header.
 1.2 18-Jan-1999  ross branches: 1.2.2;
NetBSD RCS id.
 1.1 18-Jan-1999  ross branches: 1.1.1;
Initial revision
 1.1.1.1 18-Jan-1999  ross FreeBSD's fpu.h.
 1.2.2.1 26-Apr-1999  perry removed at ross's request
 1.4.6.2 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.4.6.1 26-Apr-2001  ross file fpu.h was added on branch nathanw_sa on 2001-04-26 03:10:47 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.42.1 03-Dec-2017  jdolecek update from HEAD
 1.7.20.1 01-Aug-2021  thorpej Sync with HEAD.
 1.8.16.1 02-Aug-2025  perseant Sync with HEAD
 1.11 25-Apr-2025  riastradh alpha: Align signal pointer on entry to signal handler.

PR kern/59327: user stack pointer is not aligned properly
 1.10 25-Mar-2019  maxv branches: 1.10.36;
Remove compat_osf1, discussed on tech-kern@.
 1.9 06-Feb-2012  matt branches: 1.9.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 24-Apr-2008  he branches: 1.8.36; 1.8.40;
This file needs <sys/signal.h> included, so that siginfo_t and
ucontext_t are properly defined before they're used.
 1.7 11-Dec-2005  christos branches: 1.7.74; 1.7.76;
merge ktrace-lwp.
 1.6 20-Jan-2005  drochner expose struct sigcontext* just as much as necessary
 1.5 07-Oct-2003  skd branches: 1.5.8;
Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.4 06-Apr-1997  cgd branches: 1.4.56;
clean up NetBSD RCS ID strings
 1.3 11-Jul-1996  cgd branches: 1.3.2;
Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.2 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.56.4 24-Jan-2005  skrll Sync with HEAD.
 1.4.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.56.1 03-Aug-2004  skrll Sync with HEAD
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.7.76.1 18-May-2008  yamt sync with head.
 1.7.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.40.1 18-Feb-2012  mrg merge to -current.
 1.8.36.1 17-Apr-2012  yamt sync with head
 1.9.48.1 10-Jun-2019  christos Sync with HEAD
 1.10.36.1 02-Aug-2025  perseant Sync with HEAD
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 15-Apr-2005  kleink Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.4 26-Oct-2003  kleink branches: 1.4.8; 1.4.14;
Use <sys/ieee754.h> where applicable.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.56.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.14.1 19-Apr-2005  tron Pull up revision 1.5 (requested by kleink in ticket #163):
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.
IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.10 25-Aug-2016  christos match the name with the FE_ constant from fenv.h
 1.9 23-Aug-2016  christos fenv.h for alpha
 1.8 06-Feb-2012  matt branches: 1.8.6; 1.8.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 06-Aug-2008  matt branches: 1.7.28; 1.7.32;
Fix typo FP_ -> FE_
 1.6 05-Aug-2008  matt Update <machine/ieeefp.h> to use the C99 FE_* definitions instead of the
NetBSD defined ones. Redefine the NetBSD ones in terms of the C99 ones.
Step 1 to having <fenv.h>
 1.5 17-Jan-2003  thorpej branches: 1.5.104; 1.5.108; 1.5.110; 1.5.114;
Merge the nathanw_sa branch.
 1.4 26-Apr-2001  ross branches: 1.4.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.3 29-Apr-1999  ross branches: 1.3.14;
#ifdef _KERNEL, define the machine FPCR bits and a rounding mode macro
 1.2 06-Apr-1997  cgd branches: 1.2.16;
clean up NetBSD RCS ID strings
 1.1 29-Apr-1995  cgd branches: 1.1.4;
first cut of the alpha version.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.16.1 29-Apr-1999  perry branches: 1.2.16.1.2;
pullup 1.2->1.3 (ross)
 1.2.16.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.4.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.4.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.4.4.1 26-Apr-2001  nathanw file ieeefp.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.5.114.1 19-Oct-2008  haad Sync with HEAD.
 1.5.110.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.108.1 04-May-2009  yamt sync with head.
 1.5.104.1 28-Sep-2008  mjf Sync with HEAD.
 1.7.32.1 18-Feb-2012  mrg merge to -current.
 1.7.28.1 17-Apr-2012  yamt sync with head
 1.8.24.1 05-Oct-2016  skrll Sync with HEAD
 1.8.6.1 03-Dec-2017  jdolecek update from HEAD
 1.4 13-Aug-2014  matt Include <sys/common_int_const.h> if __INTMAX_C_SUFFIX__ is defined.
 1.3 29-May-2010  tnozaki branches: 1.3.18;
fix wrong integer promotion rule(removed U suffix from UINT{8,16}_C).
see ISO/IEC 9899:1999 7.18.4.3.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.8; 1.1.130; 1.1.132; 1.1.134;
Add definitions of C99 integer constant macros.
 1.1.134.2 11-Aug-2010  yamt sync with head.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.8.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.8.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:34 +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:04 +0000
 1.2.22.1 30-May-2010  rmind sync with head
 1.2.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.18.1 03-Dec-2017  jdolecek update from HEAD
 1.5 13-Aug-2014  matt include <sys/common_int_fmtio.h> if __INTPTR_FMTd__ is defined
 1.4 28-Apr-2008  martin branches: 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 19-Sep-2001  simonb branches: 1.3.120; 1.3.122; 1.3.124;
Fix typo in PRId64.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 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:04 +0000
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 26-Apr-2001  nathanw file int_fmtio.h was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.124.1 16-May-2008  yamt sync with head.
 1.3.122.1 18-May-2008  yamt sync with head.
 1.3.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.9 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.8 06-Feb-2012  matt branches: 1.8.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 28-Apr-2008  martin branches: 1.7.34; 1.7.38;
Remove clause 3 and 4 from TNF licenses
 1.6 17-Oct-2007  garbled branches: 1.6.16; 1.6.18; 1.6.20;
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.5 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.38; 1.4.44; 1.4.48; 1.4.50;
merge ktrace-lwp.
 1.3 08-May-2004  kleink branches: 1.3.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.6; 1.2.26;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 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:05 +0000
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.6.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.6.1 26-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-26 16:25:20 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.50.1 06-Nov-2007  matt sync with HEAD
 1.4.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.4.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.38.1 03-Oct-2007  garbled Sync with HEAD
 1.4.30.1 09-Oct-2007  ad Sync with head.
 1.6.20.1 16-May-2008  yamt sync with head.
 1.6.18.1 18-May-2008  yamt sync with head.
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.38.1 18-Feb-2012  mrg merge to -current.
 1.7.34.1 17-Apr-2012  yamt sync with head
 1.8.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.5 28-Apr-2008  martin branches: 1.5.44;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.74; 1.4.76; 1.4.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 22-Sep-2001  simonb branches: 1.3.34;
*int_fast64_t should be "long", not "long long".
From Klaus Klein.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Add definitions for C99 fastest minimum-width integer types.
 1.1 14-Apr-2001  kleink branches: 1.1.2;
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.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:05 +0000
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.6.1 26-Apr-2001  nathanw file int_mwgwtypes.h was added on branch nathanw_sa on 2001-09-26 19:54:41 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.34.1 21-Jun-2006  yamt sync with head.
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.44.1 03-Dec-2017  jdolecek update from HEAD
 1.10 13-Aug-2014  matt Include <sys/common_int_types.h> if __UINTPTR_TYPE__ is defined.
 1.9 24-Dec-2005  perry branches: 1.9.122;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 25-May-2005  kleink branches: 1.7.2;
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.6 07-Aug-2003  agc branches: 1.6.6; 1.6.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 28-Apr-2001  kleink branches: 1.5.4; 1.5.24;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.4 12-Apr-2001  kleink Replace the 'unsigned __COMPILER_INT64__' construct with a new name,
__COMPILER_UINT64__, to be supplied - if such a case is made, it shouldn't
be assumed that the unsigned type-specifier may be applied to it.
 1.3 03-Jan-2001  takemura branches: 1.3.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.2 27-Jun-2000  kleink branches: 1.2.2;
Resolve some formatting nits; add __intptr_t and __uintptr_t.
 1.1 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.2.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.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.2.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 22:35:41 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5.4.2 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.5.4.1 28-Apr-2001  kleink file int_types.h was added on branch nathanw_sa on 2001-04-28 15:41:32 +0000
 1.6.14.1 28-May-2005  tron Pull up revision 1.7 (requested by klein in ticket #346):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.6.6.1 29-May-2005  riz Pull up revision 1.7 (requested by kleink in ticket #1555):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.9.122.1 03-Dec-2017  jdolecek update from HEAD
 1.85 16-Jul-2021  thorpej The Alpha AXP Architecture Reference Manual is explcit that the only
valid bits in the PSL are the IPL and USER bits, the latter of which
will always be clear when in the kernel, and that all other bits MBZ.
So, when reading the PSL to get the current IPL, don't bother masking
with ALPHA_PSL_IPL_MASK.
 1.84 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.83 10-Oct-2020  thorpej branches: 1.83.6;
Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.82 26-Sep-2020  thorpej Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.81 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.80 23-Sep-2020  thorpej Use a wrapper to acquire the kernel lock for non-MPSAFE interrupts,
rather than doing it in alpha_shared_intr_establish() directly.
 1.79 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.78 19-Sep-2020  thorpej Move softintr bits into <machine/intr.h> and define ALPHA_ALL_SOFTINTS
for locore.s
 1.77 17-Sep-2020  thorpej Reduce the __HAVE_FAST_SOFTINTS #ifdef perimeter.
 1.76 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.75 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.74 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.73 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.72 14-Jan-2017  christos fix types.
 1.71 19-May-2014  rmind branches: 1.71.4; 1.71.8;
Implement MI IPI interface with cross-call support.
 1.70 06-Feb-2012  matt branches: 1.70.6; 1.70.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.69 07-Jun-2011  matt branches: 1.69.2; 1.69.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.68 22-Jun-2010  rmind branches: 1.68.6;
Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight. Will be used for passive serialization.

OK ad@.
 1.67 26-Oct-2009  thorpej branches: 1.67.2; 1.67.4;
Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.66 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.65 24-Apr-2008  he branches: 1.65.2;
This file needs <machine/cpu.h> included, for the ALPHA_PSL_IPL_*
constants it uses.
 1.64 10-Mar-2008  ad branches: 1.64.2;
Finish moving alpha over to the MI atomic ops.
 1.63 04-Jan-2008  ad branches: 1.63.2; 1.63.6;
More header file cleanup.
 1.62 03-Dec-2007  ad branches: 1.62.6;
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.61 17-Oct-2007  garbled branches: 1.61.2;
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.60 18-May-2007  mhitch branches: 1.60.8; 1.60.10;
Fix alpha build after idlelwp merge. I don't know why machine/cpu.h was
added here, but it does not seem to be needed now, and was resulting in a
circular dependency when sys/sched.h was changed in the yamt-idlelpw branch.
 1.59 16-Feb-2007  ad branches: 1.59.6; 1.59.8; 1.59.12; 1.59.14;
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.58 09-Feb-2007  ad Merge newlock2 to head.
 1.57 12-Jan-2007  ad Define ipl_cookie_t._psl as uint8_t so that it can be packed into a
word with other seldomly written fields.
 1.56 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.55 16-Feb-2006  perry branches: 1.55.14; 1.55.16;
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.54 24-Dec-2005  perry branches: 1.54.2; 1.54.4; 1.54.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.53 11-Dec-2005  christos merge ktrace-lwp.
 1.52 03-Nov-2005  yamt - use sys/spl.h.
- add some IPL_ definitions.
 1.51 29-Oct-2005  yamt pull splraiseipl() from newlock branch.
 1.50 29-Mar-2005  thorpej branches: 1.50.2; 1.50.4;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.49 27-Jul-2001  thorpej branches: 1.49.2; 1.49.10; 1.49.22; 1.49.28; 1.49.30; 1.49.36;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.48 15-Jul-2001  thorpej - Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.47 28-Apr-2001  thorpej branches: 1.47.2;
Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.46 20-Apr-2001  thorpej Add splipi() to block interprocessor interrupts (which come in at IPL 5).
 1.45 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.44 15-Apr-2001  thorpej In splx(), don't call spl0() unless the ssir != 0.
 1.43 15-Apr-2001  thorpej Clean up soft interrupt related stuff a bit.
 1.42 14-Apr-2001  thorpej Change the softintr implementation to be a bit more cache friendly
(though, sigh, slightly more expensive at softintr_schedule() time).
 1.41 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.40 15-Jan-2001  thorpej branches: 1.40.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.39 14-Jan-2001  thorpej Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.38 14-Jan-2001  thorpej 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.37 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.36 20-Nov-2000  thorpej Move IPI processing into a separate function.
 1.35 18-Nov-2000  thorpej Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.34 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.33 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.32 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.31 13-Aug-2000  thorpej Add alpha_multicast_ipi().
 1.30 13-Jul-2000  thorpej Whitespace police.
 1.29 09-Jun-2000  cgd make spl0() and spllowersoftclock() return void. Also, move spl0()
prototype from param.h to intr.h. (there were some big XXXs in param.h
that said to do that, and intr.h is included by param.h, so...)
 1.28 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.27 04-Jun-2000  thorpej Un-__P'ify kernel prototypes.
 1.26 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.25 23-May-2000  thorpej branches: 1.25.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.24 19-Mar-2000  thorpej Point back to the alpha_shared_intr in the intrhand structure. This
allows platform-specific code to access the `intr_private' data via
the intrhand structure.
 1.23 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.22 29-Nov-1999  thorpej - Fix a botch in the IPI bitmasks (they were right-shifted by 1), and
add an IPI which causes the target CPU to perform AST processing when
it returns to userspace.
- Add a way to get/set a private pointer in the shared interrupt header.
 1.21 10-Aug-1999  thorpej branches: 1.21.2; 1.21.8;
Use atomic operations to manipulate the SSIR, and fix a problem introduced
with the spllowersoftclock() changes where more interrupts than necessary
were blocked while software interrupts were being processed.
 1.20 05-Aug-1999  thorpej Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

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

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.19 24-Feb-1999  thorpej Restructure the IPI code a little, allowing multiple IPIs to be sent at
once. Add a way to broadcast an IPI to all processors (except the sender,
obviously). Add an IPI for TLB shootdown.
 1.18 26-Sep-1998  thorpej Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP.

XXX HALT is not yet implemented, it's just a stub.
 1.17 25-Sep-1998  thorpej Minor style tweaks.
 1.16 21-Sep-1998  matt Add softserial to the alpha port. This significantly improved PPP
throughput on com ports.
 1.15 01-Aug-1998  thorpej Implement alpha_shared_intr_disestablish(). Simply removes the handler
fromthe list, allowing the caller to manipulate the sharing type,
if appropriate.
 1.14 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.13 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.12 07-Jul-1998  thorpej Define a macro to test if a shared interrupt should be disabled after
a stray has occurred.
 1.11 10-Nov-1997  mjacob Protect userland applications from the inline splraise function.
 1.10 07-Jul-1997  cgd branches: 1.10.6;
mark prototypes for static inline functions as possibly unused
(with __attribute__ ((unused))), to avoid generating warnings when
compiling without optimization but with the default warning flags.
 1.9 05-Jun-1997  cgd two more slight bogons
 1.8 05-Jun-1997  cgd actually, declare _splraise() as an inline function, because:
(1) it was using 'max', and some functions use a variable
of that name (*sigh*), and
(2) that makes it easier to be a bit trickier, and only call
swpipl if changing the IPL.
 1.7 05-Jun-1997  cgd parens around macro arg (this is an old one)
 1.6 05-Jun-1997  cgd make sure that splnet(), splbio(), splimp(), spltty(), splclock(),
splstatclock(), and splhigh() all _raise_ the IPL. (splhigh() is _not_
the highest possible IPL; mcheck is...)
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4 03-Dec-1996  cgd branches: 1.4.2;
kill siroff() and resturcture do_sir() to be cleaner and more correct.
 1.3 17-Nov-1996  cgd implement a (hack-ish) set of routines to do common chained-interrupt
handler management. It's nasty, but three slightly different copies of
the code is worse.
 1.2 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.1 12-Apr-1996  cgd the Alpha implementation of <machine/intr.h>
 1.4.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.6.1 11-Nov-1997  mellon Pull rev 1.11 up from trunk (mjacob)
 1.21.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.2.6 23-Apr-2001  bouyer Sync with HEAD.
 1.21.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.21.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.21.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.21.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.21.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.40.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.47.2.1 03-Aug-2001  lukem update to -current
 1.49.36.1 30-Mar-2005  tron Pull up revision 1.50 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.49.30.1 29-Apr-2005  kent sync with -current
 1.49.28.1 11-May-2005  riz Pull up revision 1.50 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.49.22.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.22.1 01-Apr-2005  skrll Sync with HEAD.
 1.49.10.2 11-Mar-2002  thorpej Add IPL_VM. (Other ports call this IPL_IMP, and that will be changed
in short order.)
 1.49.10.1 10-Mar-2002  thorpej Adjustments for new mutex routines:
* Make all the IPL_* constants meaningful within a single number domain.
* Use new SI_* constants to number the soft interrupt queues, rather than
IPL_SOFT*.
* Add splraiseipl() for use by kern_mutex.c. Usage is e.g.
splraiseipl(IPL_BIO).
 1.49.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.49.2.1 27-Jul-2001  thorpej file intr.h was added on branch nathanw_sa on 2001-07-27 00:25:20 +0000
 1.50.4.1 02-Nov-2005  yamt sync with head.
 1.50.2.7 17-Mar-2008  yamt sync with head.
 1.50.2.6 21-Jan-2008  yamt sync with head
 1.50.2.5 07-Dec-2007  yamt sync with head
 1.50.2.4 03-Sep-2007  yamt sync with head.
 1.50.2.3 26-Feb-2007  yamt sync with head.
 1.50.2.2 30-Dec-2006  yamt sync with head.
 1.50.2.1 21-Jun-2006  yamt sync with head.
 1.54.6.1 22-Apr-2006  simonb Sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.54.2.1 18-Feb-2006  yamt sync with head.
 1.55.16.3 21-Sep-2006  yamt rename splraiseipl argument to match with the rest of ports.
 1.55.16.2 18-Sep-2006  yamt correct a header.
 1.55.16.1 18-Sep-2006  yamt implement new api for alpha.
 1.55.14.2 01-Feb-2007  ad Header file cleanup.
 1.55.14.1 12-Jan-2007  ad Sync with head.
 1.59.14.1 22-May-2007  matt Update to HEAD.
 1.59.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.59.8.1 11-Jul-2007  mjf Sync with head.
 1.59.6.5 03-Dec-2007  ad Sync with HEAD.
 1.59.6.4 03-Dec-2007  ad Sync with HEAD.
 1.59.6.3 18-Oct-2007  ad More interrupt changes; collapse the symbolic levels down to the ones
that we actually need (none, soft, vm, sched, high) but retain aliases
like IPL_BIO for now.
 1.59.6.2 18-Oct-2007  ad Interrupt stuff for alpha (but no fast softints yet).
 1.59.6.1 27-May-2007  ad Sync with head.
 1.60.10.3 23-Mar-2008  matt sync with HEAD
 1.60.10.2 09-Jan-2008  matt sync with HEAD
 1.60.10.1 06-Nov-2007  matt sync with HEAD
 1.60.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.61.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.61.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.62.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.63.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.63.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.63.2.1 24-Mar-2008  keiichi sync with head.
 1.64.2.1 18-May-2008  yamt sync with head.
 1.65.2.3 11-Aug-2010  yamt sync with head.
 1.65.2.2 11-Mar-2010  yamt sync with head
 1.65.2.1 16-May-2008  yamt sync with head.
 1.67.4.2 12-Jun-2011  rmind sync with head
 1.67.4.1 03-Jul-2010  rmind sync with head
 1.67.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.68.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.69.6.1 18-Feb-2012  mrg merge to -current.
 1.69.2.1 17-Apr-2012  yamt sync with head
 1.70.20.1 10-Aug-2014  tls Rebase.
 1.70.6.2 03-Dec-2017  jdolecek update from HEAD
 1.70.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.71.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.71.4.1 05-Feb-2017  skrll Sync with HEAD
 1.83.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.21 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.20 21-Mar-2000  thorpej branches: 1.20.2;
Fix INTRCNT_DEC_550_IRQ_LEN. From Nathan Williams.
 1.19 04-Dec-1999  thorpej Actually, the 2100_A500 has 64 interrupts, not 16.
 1.18 29-Jun-1999  ross branches: 1.18.2; 1.18.8;
Minor Tsunami-related changes.
 1.17 19-Nov-1998  ross branches: 1.17.4; 1.17.6; 1.17.8;
Nuke the giant ugly-as-sin per-platform INTRNAMES masterpiece.
I just cannot add one more platform without getting sick.
Instead, we do just one table for all platforms. More-or-less,
it was only the A12 that even named it's individual interrupts anyway.

Also, prototype set_iointr() here. It's a slightly odd place, but 10*
better than the old place it was, and this file is included by exactly
the perfect set of .c files for set_iointr() visibility.
 1.16 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.15 26-Jun-1998  ross Add AlphaServer 1000 interrupts.
 1.14 24-Jun-1998  ross Add dec_1000a interrupts.
 1.13 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.12 29-Apr-1998  thorpej Add interrupt counter space for the DEC EB64+, and fix a misplaced
counter comment in the kn300 interrupt counters.
 1.11 15-Apr-1998  mjacob add Alpha 4100 support
 1.10 02-Mar-1998  ross Update interrupt name table for a12 crossbar.
 1.9 29-Jan-1998  ross branches: 1.9.2;
Define the A12 names.
 1.8 07-Apr-1997  cgd branches: 1.8.2;
clean up NetBSD RCS ID strings
 1.7 16-Nov-1996  cgd branches: 1.7.2;
add names and space for eb164 interrupt request counters
 1.6 05-Jun-1996  cgd avoid lots of upper-case letters in interrupt names. prettier that way.
 1.5 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.4 13-Apr-1996  cgd branches: 1.4.4;
capitalize IRQ names here, to match what's reported on boot
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.2 05-Jun-1996  cgd Pull up from trunk:
>avoid lots of upper-case letters in interrupt names. prettier that way.
 1.4.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.9.2.2 29-Jan-1998  ross Define the A12 names.
 1.9.2.1 29-Jan-1998  ross file intrcnt.h was added on branch bouyer-scsipi on 1998-01-29 22:26:25 +0000
 1.17.8.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.17.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.17.4.1 02-Jul-1999  perry pullup 1.17->1.18 (ross)
 1.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15 18-Oct-2016  jdolecek add isa_intr_establish_xname() to MD isa headers so that it can be used
by MI drivers
 1.14 06-Feb-2012  matt branches: 1.14.6; 1.14.24; 1.14.28;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.13 14-Jun-2011  matt branches: 1.13.2; 1.13.6;
struct device * -> device_t
 1.12 19-Aug-2009  dyoung branches: 1.12.10;
(Re-)define isa_detach_hook(), and define isa_dmadestroy(). Update
some isa_chipset_tag_t->ic_detach_hook() definitions.
 1.11 19-Aug-2009  dyoung isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t.
 1.10 19-Aug-2009  dyoung Define isa_dmadestroy and isa_detach_hook. Hook up a couple of
isa_detach_hook implementations.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 09-May-2003  fvdl branches: 1.8.104; 1.8.106; 1.8.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.7 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.6 01-Jun-2000  thorpej ISA DMA bounce buffer code, needed for a couple of SGMAP-less
systems, support for which will be hitting the tree soon.
 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 07-Feb-2000  thorpej branches: 1.4.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.3 19-Mar-1999  cgd branches: 1.3.8;
move isa/isa_machdep.h to include/isa_machdep.h. (can't do it via
repository copy because alpha already had an include/isa_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd these have moved elsewhere
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.108.2 19-Aug-2009  yamt sync with head.
 1.8.108.1 16-May-2008  yamt sync with head.
 1.8.106.1 18-May-2008  yamt sync with head.
 1.8.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.6.1 18-Feb-2012  mrg merge to -current.
 1.13.2.1 17-Apr-2012  yamt sync with head
 1.14.28.1 04-Nov-2016  pgoyette Sync with HEAD
 1.14.24.1 05-Dec-2016  skrll Sync with HEAD
 1.14.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 01-Jun-2000  cgd branches: 1.5.128; 1.5.130; 1.5.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.4 19-Mar-1999  cgd branches: 1.4.8; 1.4.16;
Moved from arch/alpha/isa/isapnp_machdep.h,v
 1.3 05-Sep-1998  christos Assign copyright to TNF.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 31-Jul-1998  thorpej branches: 1.1.2;
Machine-dependent ISA PnP goo for NetBSD/alpha.
 1.1.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.4.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 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.5.132.1 16-May-2008  yamt sync with head.
 1.5.130.1 18-May-2008  yamt sync with head.
 1.5.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 07-Jul-2004  drochner branches: 1.1.2;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 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 07-Jul-2004  skrll file joystick.h was added on branch ktrace-lwp on 2004-08-03 10:31:19 +0000
 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 11-Dec-2005  christos branches: 1.4.122; 1.4.142;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.142.1 22-Sep-2015  skrll Sync with HEAD
 1.4.122.1 03-Dec-2017  jdolecek update from HEAD
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 14-Feb-1998  cgd branches: 1.3.188; 1.3.192;
replace the single phys_ram_seg_t with a count. an array of segment
descriptors will be placed after this structure in the core file.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 01-Oct-1996  cgd branches: 1.1.2;
first cut at alpha machdep kernel coredump header
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.192.1 18-Feb-2012  mrg merge to -current.
 1.3.188.1 17-Apr-2012  yamt sync with head
 1.17 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.16 21-Apr-2014  matt branches: 1.16.26; 1.16.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.15 11-Apr-2013  christos branches: 1.15.4; 1.15.8;
add missing SSIZE_MIN
 1.14 28-Mar-2012  christos branches: 1.14.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.13 07-Jun-2010  tnozaki branches: 1.13.8; 1.13.12;
1. MB_LEN_MAX switch MD to MI.
2. unfortunately hppa's MB_LEN_MAX is defined incorrectly 6 instead of 32
so we have to add more setlocale(3) __RENAME func, __setlocale50.
3. move setlocale1.c and setlocale32.c to lib/libc/compat/locale/*
prepareing for next libc major crunk.
4. bump libc minor version.
 1.12 17-Oct-2007  garbled branches: 1.12.20; 1.12.40; 1.12.42;
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.11 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.10 11-Dec-2005  christos branches: 1.10.30; 1.10.38; 1.10.44; 1.10.48; 1.10.50;
merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 28-Apr-2003  bjh21 branches: 1.8.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.7 08-Aug-2000  tshiozak Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.6 07-Mar-2000  kleink branches: 1.6.2; 1.6.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.5 06-Aug-1998  kleink branches: 1.5.12;
_POSIX_SOURCE -> _POSIX_C_SOURCE
 1.4 09-Jan-1998  perry multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 12-Apr-1996  cgd branches: 1.2.2;
add XOPEN constants, clean up
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.12.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.4.1 09-Aug-2000  tshiozak pull up the following changes (approved by thorpej):
> cvs rdiff -r1.9 -r1.10 basesrc/include/locale.h
> cvs rdiff -r1.45 -r1.46 basesrc/include/stdlib.h
> cvs rdiff -r1.16 -r1.17 basesrc/lib/libc/locale/Makefile.inc
> cvs rdiff -r1.17 -r1.18 basesrc/lib/libc/locale/setlocale.c
> cvs rdiff -r0 -r1.2 basesrc/lib/libc/locale/setlocale_sb.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/alpha/include/limits.h
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/arm26/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/arm32/include/limits.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/limits.h
> cvs rdiff -r1.12 -r1.13 syssrc/sys/arch/m68k/include/limits.h
> cvs rdiff -r1.13 -r1.14 syssrc/sys/arch/mips/include/limits.h
> cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/pc532/include/limits.h
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/powerpc/include/limits.h
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/sh3/include/limits.h
> cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/sparc/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/sparc64/include/limits.h
> cvs rdiff -r1.9 -r1.10 syssrc/sys/arch/vax/include/limits.h
>
> Outline:
>
> Preparation for the future introduction of multibyte locale.
> - MB_LEN_MAX is increased to 32.
> - To ensure binary compatibility for old executables
> under multibyte locale, versioned setlocale is added.
> - __mb_len_cur definision is added in setlocale.c
> and enable it in stdlib.h .
> It is also important for multibyte locale stuffs,
> but I just forgot.
 1.6.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 03-Sep-2007  yamt sync with head.
 1.10.50.1 06-Nov-2007  matt sync with HEAD
 1.10.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.10.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.10.38.1 03-Oct-2007  garbled Sync with HEAD
 1.10.30.1 09-Oct-2007  ad Sync with head.
 1.12.42.1 03-Jul-2010  rmind sync with head
 1.12.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.12.20.1 11-Aug-2010  yamt sync with head.
 1.13.12.1 05-Apr-2012  mrg sync to latest -current.
 1.13.8.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.13.8.1 17-Apr-2012  yamt sync with head
 1.14.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 23-Jun-2013  tls resync from head
 1.15.8.1 10-Aug-2014  tls Rebase.
 1.15.4.1 18-May-2014  rmind sync with head
 1.16.28.1 10-Jun-2019  christos Sync with HEAD
 1.16.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.6 06-Aug-2014  joerg Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
 1.5 28-Apr-2008  martin branches: 1.5.44; 1.5.60;
Remove clause 3 and 4 from TNF licenses
 1.4 25-Jan-2006  christos branches: 1.4.72; 1.4.74; 1.4.76;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.3 31-Oct-2001  thorpej branches: 1.3.32; 1.3.44;
Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.2 08-Jun-2000  thorpej branches: 1.2.4; 1.2.6; 1.2.10;
And more ANSI'ification!
 1.1 10-Sep-1999  ross branches: 1.1.2; 1.1.10;
This is required by libsa/loadfile.c.
 1.1.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.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.2.10.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.3.44.1 01-Feb-2006  yamt sync with head.
 1.3.32.1 21-Jun-2006  yamt sync with head.
 1.4.76.1 16-May-2008  yamt sync with head.
 1.4.74.1 18-May-2008  yamt sync with head.
 1.4.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.60.1 10-Aug-2014  tls Rebase.
 1.5.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33 13-Feb-2022  riastradh alpha: __cpu_simple_lock audit.

Add missing "cc" and "memory" asm clobbers to the compiler can't
reorder memory access around these. The necessary memory barrier
instructions, mb, already appear in all the right places.
 1.32 12-Feb-2022  riastradh __cpu_simple_lock(9): Omit needless barriers in init.

It is, and always has been, the caller's responsibility to ensure the
lock is initialized before it can be used -- otherwise the memory
could hold garbage; it is nonsensical to even attempt locking
operations on it before initialization.

So there's no need to issue explicit barriers here. The barrier
seems to have been introduced in sys/arch/alpha/alpha/lock_machdep.c
rev. 1.1 (since moved to inline asm in alpha/include/lock.h) and then
copied & pasted into several other architectures.
 1.31 03-Apr-2021  thorpej Fix an IPI deadlock scenario that resulted in a TLB shootdown timeout
panic reported by John Klos on port-alpha:

- pmap_tlb_shootnow(): If we acquire a pmap's activation lock, we will
have raised the IPL on the current CPU to IPL_SCHED until we drop
the tlb_lock (due to how nested spin mutexes work). As such, when
we release the activation lock, forcibly lower our IPL back to IPL_VM
so that we can receive and process IPIs while waiting for other CPUs
to process the shootdowns.
- mutex_vector_enter(): Invoke SPINLOCK_SPIN_HOOK while spinning to acquire
a spin mutex. This is a nop on most platforms, but it's important on
the Alpha. Without this, IPIs (and thus TLB shootdowns) cannot be
processed if trying to acquire an IPL_SCHED spin mutex such as those
used by the scheduler.

...and while we're poking around in here:

- Rework the Alpha SPINLOCK_SPIN_HOOK to only check curcpu()->ci_ipis
if the current CPU's IPL is >= IPL_CLOCK (thus ensuring that preemption
is disabled and thus guaranteeing that curcpu() is stable). (Alpha does
not yet support kernel preemption, but this is now one less thing that
would need to be fixed.)
 1.30 29-Nov-2019  riastradh branches: 1.30.8; 1.30.10;
Nix mb_* on alpha.
 1.29 17-Sep-2017  christos branches: 1.29.4;
more const.
 1.28 25-Nov-2009  rmind branches: 1.28.22;
Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
 1.27 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.26 17-Oct-2007  garbled branches: 1.26.16; 1.26.18; 1.26.20;
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.25 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.24 11-Feb-2007  ad branches: 1.24.6; 1.24.14; 1.24.18; 1.24.22; 1.24.24;
inline -> __inline
 1.23 09-Feb-2007  ad Merge newlock2 to head.
 1.22 28-Dec-2005  perry branches: 1.22.20;
inline -> __inline
 1.21 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.20 11-Dec-2005  christos merge ktrace-lwp.
 1.19 26-Sep-2003  nathanw branches: 1.19.16;
Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.18 28-Jun-2003  he branches: 1.18.2;
#ifdef _KERNEL_OPT police.
 1.17 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.16 17-Dec-2001  thorpej Fix constraints in __asm statements (err, again). Kernels compiled
with GCC 2.95.3 work now.
 1.15 20-Apr-2001  thorpej branches: 1.15.2; 1.15.4;
SPINLOCK_INTERLOCK_RELEASE_HOOK should actually be
SPINLOCK_SPIN_HOOK, so that we actually check for
pending IPIs on the Alpha more than once. Also,
when we call alpha_ipi_process(), make sure to go
to splipi().
 1.14 16-Apr-2001  thorpej Oops, properly mark a memory operand as both an input and an
output as necessary.
 1.13 22-Nov-2000  thorpej branches: 1.13.2;
Add a debugging printf, commented out by default.
 1.12 20-Nov-2000  thorpej Ooops, do the last only if MULTIPROCESSOR.
 1.11 20-Nov-2000  thorpej On the Alpha, interprocessor interrupts come in at the same priority
as normal device interrupts. Because of this, we won't get IPIs while
servicing such interrupts. This can lead to the following deadlock
scenario as reported by Bill Sommerfeld:
- Process runs on cpu1, but has FP state on cpu0.
- Process executes FP-using insn, causing an FP trap, which causes
the kernel lock to be acquired.
- At roughly the same time, cpu0 receives a device interrupt, and attempts
to acquire the kernel lock, which blocks since cpu1 already has it.
- cpu1 sends cpu0 a SYNCH FPU IPI, and waits for cpu0 to release its
FP state.
- Since cpu0 cannot notice the IPI until it has processed the device
interrupt, which it cannot do because it cannot acquire the kernel
lock, we have deadlock.

Solve the problem by adding a spinlock interlock release hook which
checks for pending IPIs and processes them.

Idea from Bill Sommerfeld.
 1.10 14-Aug-2000  thorpej Remove an unnecessary MB in __cpu_simple_unlock(), per sections
5.3.3 and 5.3.4 of the Green Book, and a discussion w/ cgd@netbsd.org.
 1.9 14-Aug-2000  thorpej Issue a memory barrier before clearing a lock, as per section 5.5.3
of the Green Book and a discussion on tech-smp and port-alpha.
 1.8 08-Jun-2000  thorpej And more ANSI'ification!
 1.7 07-Jun-2000  simonb In __cpu_simple_lock_try(), use "return (v0 != 0);" instead of
"return (v0);" where v0 is an unsigned long and the function return
type is int. Stops lint warnings when this file is included.

Fix from Jason Thorpe.
 1.6 02-May-2000  thorpej branches: 1.6.2;
Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.
 1.5 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.4 03-Dec-1999  thorpej Rewrite the atomic locking primitives using in-line assembly.
 1.3 27-Jul-1999  thorpej branches: 1.3.2; 1.3.8;
Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.2 04-Nov-1998  chs branches: 1.2.8;
LOCKDEBUG enhancements for non-MP:
keep a list of locked locks.
use this to print where the lock was locked
when we either go to sleep with a lock held
or try to free a locked lock.
 1.1 24-Sep-1998  thorpej Machine-dependent spin lock operations for Alpha, included if MULTIPROCESSOR
is specified.
 1.2.8.1 02-Aug-1999  thorpej Update from trunk.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.3.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.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.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.15.4.1 20-Apr-2001  nathanw file lock.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.16.3 27-Oct-2007  yamt sync with head.
 1.19.16.2 26-Feb-2007  yamt sync with head.
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.22.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.24.24.1 06-Nov-2007  matt sync with HEAD
 1.24.22.1 02-Oct-2007  joerg Sync with HEAD.
 1.24.18.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.24.14.1 03-Oct-2007  garbled Sync with HEAD
 1.24.6.1 09-Oct-2007  ad Sync with head.
 1.26.20.2 11-Mar-2010  yamt sync with head
 1.26.20.1 16-May-2008  yamt sync with head.
 1.26.18.1 18-May-2008  yamt sync with head.
 1.26.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.22.1 03-Dec-2017  jdolecek update from HEAD
 1.29.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.30.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 07-Oct-2010  hans branches: 1.7.8; 1.7.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.6 11-Dec-2005  christos branches: 1.6.78; 1.6.98; 1.6.100;
merge ktrace-lwp.
 1.5 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.4 29-Sep-2002  wiz branches: 1.4.6;
"definitions" has lots of 'i's, but that's not reason to leave one out.
 1.3 25-Mar-2001  nathanw branches: 1.3.2; 1.3.4;
Verbose display of machine check errors on AS200/400 boxes.
 1.2 08-Jun-2000  thorpej branches: 1.2.4;
And more ANSI'ification!
 1.1 08-Jul-1998  mjacob branches: 1.1.14; 1.1.22;
common logout structure definitions, or a start thereof
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.14.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.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.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.3.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.1 25-Mar-2001  nathanw file logout.h was added on branch nathanw_sa on 2002-10-18 02:34:12 +0000
 1.3.2.1 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.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.100.1 05-Mar-2011  rmind sync with head
 1.6.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.6.78.1 09-Oct-2010  yamt sync with head
 1.7.12.1 18-Feb-2012  mrg merge to -current.
 1.7.8.1 17-Apr-2012  yamt sync with head
 1.2 04-Nov-2024  christos Undo previous lwp.h change.
 1.1 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 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:22 +0000
 1.4 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.8; 1.3.10;
Improve namespace test macros a bit.
 1.2 04-Jan-2000  kleink const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.1 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.3.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.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.3.6.1 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 22:35:41 +0000
 1.15 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.14 04-Nov-2024  christos Undo previous lwp.h change.
 1.13 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.12 18-May-2024  thorpej branches: 1.12.2;
Clean up the <sys/ucontext.h> <-> <machine/mcontext.h> interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
and use those constants to define the machine-dependent bits as well
as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
_UC_CLRSTACK are not defined by <machine/mcontext.h>.
 1.11 24-May-2021  thorpej Add _UC_SETSTACK / _UC_CLRSTACK handling. Fixes the t_sigaltstack test
on alpha.
 1.10 27-Dec-2019  kamil branches: 1.10.12; 1.10.14;
Harmonize the namespace of fast TLS base pointer getter functions

Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
 1.9 15-Feb-2018  kamil branches: 1.9.4;
Introduce _UC_MACHINE_FP() as a macro

_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.

Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.


For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).

For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:

./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)

Once ia64 will mature, this should be revisited.

A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.


For the remaining CPUs, reuse standard register as defined in appropriate ABI.

The direct users of this macro are LLVM and GCC with Sanitizers.

Proposed on tech-userlevel@.

Sponsored by <The NetBSD Foundation>
 1.8 12-Sep-2012  manu branches: 1.8.32;
setcontext() used to be incompatible with -lpthread since it affected
the TLS pointer, therefore wrecking the pthread environement.

Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
that controlled whether setcontext() would change the TLS pointer.
This change let libpthread override setcontext() with its own version
that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
-lpthread.

We also have the following required changes here:
- rename alpha's _UC_UNIQUE into _UC_TLSBASE
- add _UC_TLSBASE definition in header file for all ports
(powerpc, sh3, sparc and sparc64 lack the implementation for now)
- introduce a libc stub that can be overriden for setcontext()
- modify MD libcs swapcontext() implementations so that they use the
setcontext() libc stub instead of doing a plain system call.

While we are there:
- document various MD _UC_* flags in header file
- add libc and libpthread tests for swapcontext() behavior
(hopefully helpful to spot MD problems introduced with this change)

Future work:
- Deciding whether kernel support or _UC_TLSBASE should be added for
powerpc, sh3, sparc and sparc64 is left to portmasters
sparc64

Approved by core@
 1.7 25-Feb-2011  joerg branches: 1.7.4;
Be nicer to software that insists on -ansi and use __inline.
 1.6 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.5 28-Apr-2008  martin branches: 1.5.22; 1.5.28; 1.5.30;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78;
merge ktrace-lwp.
 1.3 08-Oct-2003  thorpej Add some accessor macros for the ucontext:
* _UC_MACHINE_PC() - access the program counter
* _UC_MACHINE_INTRV() - access the integer return value register
* _UC_MACHINE_SET_PC() - set the program counter (this requires
special handling on some platforms).
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 30-Aug-2001  nathanw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.6 14-Jan-2003  nathanw Add a MD flag, _UC_UNIQUE, that indicates that the "process-unique value"
has been stashed in the r31 (zero) slot.
 1.1.2.5 28-Dec-2001  nathanw Add a macro, _UC_MACHINE_SP(), to fetch the user stack pointer from
a ucontext_t.
 1.1.2.4 17-Dec-2001  nathanw A little whitespace cleanup.
 1.1.2.3 17-Dec-2001  nathanw Switch from my Tru64-inspired mcontext to Klaus's simpler one.
 1.1.2.2 25-Sep-2001  nathanw We don't need our own definition of mcontext_t; following Tru64, it's
identical to struct sigcontext, which is already defined in signal.h.
 1.1.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.30.1 05-Mar-2011  bouyer Sync with HEAD
 1.5.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.7.4.1 30-Oct-2012  yamt sync with head
 1.8.32.3 21-Mar-2018  martin Pull up the following, requested by kamil in ticket #552:

external/gpl3/gcc{.old}/dist/libsanitizer/asan/asan_linux.cc 1.4
sys/arch/aarch64/include/mcontext.h 1.2
sys/arch/alpha/include/mcontext.h 1.9
sys/arch/amd64/include/mcontext.h 1.19
sys/arch/arm/include/mcontext.h 1.19
sys/arch/hppa/include/mcontext.h 1.9
sys/arch/i386/include/mcontext.h 1.14
sys/arch/ia64/include/mcontext.h 1.6
sys/arch/m68k/include/mcontext.h 1.10
sys/arch/mips/include/mcontext.h 1.22
sys/arch/or1k/include/mcontext.h 1.2
sys/arch/powerpc/include/mcontext.h 1.18
sys/arch/riscv/include/mcontext.h 1.5
sys/arch/sh3/include/mcontext.h 1.11
sys/arch/sparc/include/mcontext.h 1.14-1.17
sys/arch/sparc64/include/mcontext.h 1.10
sys/arch/vax/include/mcontext.h 1.9
tests/lib/libc/sys/Makefile 1.50
tests/lib/libc/sys/t_ucontext.c 1.2-1.5
sys/arch/hppa/include/mcontext.h 1.10
sys/arch/ia64/include/mcontext.h 1.7

- Introduce _UC_MACHINE_FP(). _UC_MACHINE_FP() is a helper
macro to extract from mcontext a frame pointer.
- Add new tests in lib/libc/sys/t_ucontext:
* ucontext_sp (testing _UC_MACHINE_SP)
* ucontext_fp (testing _UC_MACHINE_FP)
* ucontext_pc (testing _UC_MACHINE_PC)
* ucontext_intrv (testing _UC_MACHINE_INTRV)

Add a dummy implementation of _UC_MACHINE_INTRV() for ia64.

Implement _UC_MACHINE_INTRV() for hppa.

Make the t_ucontext.c test more portable.

We now have _UC_MACHINE_FP.
 1.8.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.8.32.1 25-Feb-2018  snj Pull up following revision(s) (requested by kamil in ticket #552):
sys/arch/aarch64/include/mcontext.h: 1.2
sys/arch/alpha/include/mcontext.h: 1.9
sys/arch/amd64/include/mcontext.h: 1.19
sys/arch/arm/include/mcontext.h: 1.19
sys/arch/hppa/include/mcontext.h: 1.9
sys/arch/i386/include/mcontext.h: 1.14
sys/arch/ia64/include/mcontext.h: 1.6
sys/arch/m68k/include/mcontext.h: 1.10
sys/arch/mips/include/mcontext.h: 1.22
sys/arch/or1k/include/mcontext.h: 1.2
sys/arch/powerpc/include/mcontext.h: 1.18
sys/arch/riscv/include/mcontext.h: 1.5
sys/arch/sh3/include/mcontext.h: 1.11
sys/arch/sparc/include/mcontext.h: 1.14-1.17
sys/arch/sparc64/include/mcontext.h: 1.10
sys/arch/vax/include/mcontext.h: 1.9
tests/lib/libc/sys/Makefile: 1.50
tests/lib/libc/sys/t_ucontext.c: 1.2
Introduce _UC_MACHINE_FP() as a macro
_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.
Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.
For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).
For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:
./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)
Once ia64 will mature, this should be revisited.
A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.
For the remaining CPUs, reuse standard register as defined in appropriate ABI.
The direct users of this macro are LLVM and GCC with Sanitizers.
Proposed on tech-userlevel@.
Sponsored by <The NetBSD Foundation>
--
Improve _UC_MACHINE_FP() for SPARC/SPARC64
Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.
Algorithm:
uptr *stk_ptr;
# if defined (__arch64__)
stk_ptr = (uptr *) (*sp + 2047);
# else
stk_ptr = (uptr *) *sp;
# endif
*bp = stk_ptr[15];
Noted by <mrg>
--
Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.
--
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
--
Add new tests in lib/libc/sys/t_ucontext
New tests:
- ucontext_sp
- ucontext_fp
- ucontext_pc
- ucontext_intrv
They test respectively:
- _UC_MACHINE_SP
- _UC_MACHINE_FP
- _UC_MACHINE_PC
- _UC_MACHINE_INTRV
These tests attempt to access and print the values from ucontext, without
interpreting the values.
This is a follow up of the _UC_MACHINE_FP() introduction.
These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.
Sponsored by <The NetBSD Foundation>
 1.9.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.14.1 31-May-2021  cjep sync with head
 1.10.12.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.12.2.1 02-Aug-2025  perseant Sync with HEAD
 1.13 12-Jul-2023  riastradh 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.
 1.12 09-Jul-2023  riastradh machine/mutex.h: Sprinkle includes so this can be used by crash(8).

XXX pullup-10
 1.11 25-Aug-2021  thorpej branches: 1.11.4;
- In kern_mutex.c, if MUTEX_CAS() is not defined, define it in terms of
atomic_cas_ulong().
- For arm, ia64, m68k, mips, or1k, riscv, vax: don't define our own
MUTEX_CAS(), as they either use atomic_cas_ulong() or equivalent
(atomic_cas_uint() on m68k).
- For alpha and sparc64, don't define MUTEX_CAS() in terms of their own
_lock_cas(), which has its own memory barriers; the call sites in
kern_mutex.c already have the appropriate memory barrier calls. Thus,
alpha and sparc64 can use default definition.
- For sh3, don't define MUTEX_CAS() in terms of its own _lock_cas();
atomic_cas_ulong() is strong-aliased to _lock_cas(), therefore defining
our own MUTEX_CAS() is redundant.

Per thread:
https://mail-index.netbsd.org/tech-kern/2021/07/25/msg027562.html
 1.10 14-Jul-2021  thorpej Disable the mutex_spin_{enter,exit}() fast-path stubs while I investigate
some an odd IPL-related panic that seems to be related (that I can fairly
reliabily reproduce on an LCA45).
 1.9 12-Jul-2021  thorpej Optimized fast-paths for mutex_spin_enter() and mutex_spin_exit().
 1.8 23-Sep-2020  thorpej branches: 1.8.6;
Move the compile-time assert outside of the __MUTEX_PRIVATE guard.
 1.7 23-Sep-2020  thorpej Move the simple lock used for spin mutexes into the sub-structure that
contains the spin lock IPL field. This shrinks kmutex_t to sizeof(uintptr_t)
on Alpha.

This should have been done in rev 1.3 when the lock ID field was removed,
but better late than never, I guess.
 1.6 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.5 29-Nov-2019  riastradh Nix mb_* on alpha.
 1.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Nov-2007  yamt branches: 1.3.14; 1.3.16; 1.3.18;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.2 09-Feb-2007  ad branches: 1.2.4; 1.2.8; 1.2.14; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 11-Jan-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.3 01-Feb-2007  ad Header file cleanup.
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 11-Jan-2007  ad Checkpoint work in progress.
 1.2.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.2.26.1 09-Jan-2008  matt sync with HEAD
 1.2.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.2.14.1 18-Apr-2007  thorpej G/C _lock_cas().
 1.2.8.1 03-Dec-2007  ad Sync with HEAD.
 1.2.4.3 07-Dec-2007  yamt sync with head
 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:05:37 +0000
 1.3.18.1 16-May-2008  yamt sync with head.
 1.3.16.1 18-May-2008  yamt sync with head.
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.11.4.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.1 10-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.7 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.6 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.5 19-Mar-2002  thorpej Add comments describing the size of the mutex structure.
 1.1.2.4 17-Mar-2002  thorpej Don't need <machine/atomic.h>
 1.1.2.3 14-Mar-2002  thorpej Add a comment in some inline asm.
 1.1.2.2 11-Mar-2002  thorpej Fix two bugs pointed out by Bill Sommerfeld:
* MUTEX_RELEASE(): memory barrier goes *before* lock release.
* Fix race condition between mutex_exit() and MUTEX_SET_WAITERS().
 1.1.2.1 10-Mar-2002  thorpej Alpha support routines for kernel mutexes.
 1.2 02-Sep-1997  thorpej branches: 1.2.2; 1.2.4;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.1 06-Apr-1997  cgd branches: 1.1.2;
add <machine/options.h>, to allow 'defopt' option headers to be easily
included.
 1.1.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.2.4.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2.4.1 02-Sep-1997  thorpej file options.h was added on branch bouyer-scsipi on 1997-09-02 13:18:54 +0000
 1.2.2.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2.2.1 02-Sep-1997  thorpej file options.h was added on branch alpha-nwscons on 1997-09-02 13:18:54 +0000
 1.3 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.2 19-May-2002  nathanw branches: 1.2.148; 1.2.152;
Add missing common or OSF/1 PALcode instructions from the AARM: wtint,
clrfen, urti.
 1.1 06-Sep-1997  thorpej branches: 1.1.2; 1.1.32; 1.1.34; 1.1.46;
Split off PALcode functions into their own header file.
 1.1.46.1 30-May-2002  gehenna Catch up with -current.
 1.1.34.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.32.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.32.1 19-May-2002  nathanw Add missing common or OSF/1 PALcode instructions from the AARM: wtint,
clrfen, urti.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file pal.h was added on branch marc-pcmcia on 1997-09-06 17:59:50 +0000
 1.2.152.1 18-Feb-2012  mrg merge to -current.
 1.2.148.1 17-Apr-2012  yamt sync with head
 1.50 19-Jul-2021  christos Remove definitions for CACHE_LINE_SIZE and COHERENCY_UNIT which are the same
as the default.
 1.49 06-Jul-2021  thorpej - Define STACK_ALIGNBYTES to override the default and ensure that
stacks are 16-byte aligned, an assumption made by the compiler
and recommended by the Alpha Architecture Handbook.
- cpu_lwp_fork(): Ensure 16-byte stack alignment if the caller specified
one.

Addresses root casue of PR port-alpha/54307 and PR toolchain/56153.

Many thanks to rin@ for performing the root cause analysis and testing
changes.
 1.48 31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.47 10-Oct-2020  thorpej branches: 1.47.6;
G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.46 03-Sep-2020  thorpej Define COHERENCY_UNIT and CACHE_LINE_SIZE as 64, which is the primary cache
line size on EV6 / EV7. This is also the default MI fallback definition,
but now we're not relying on that value.
 1.45 07-Jan-2019  jdolecek move DEV_BSIZE, DEV_BSHIFT out of MD param.h, they are same on all ports

also move BLKDEV_IOSIZE, MAXPHYS, but allow override since some ports
have different value (powerpc uses NBPG for BLKDEV_IOSIZE, sun2/sun3
have lower MAXPHYS)
 1.44 20-Jan-2016  jklos branches: 1.44.16; 1.44.18;
Change base address to account for later Alpha models with later firmware
which require more space for SRM.
 1.43 14-Jan-2013  he branches: 1.43.14;
Copy the ALPHA_PGSHIFT value into the non-_KERNEL branch.
Fixes the build.
 1.42 07-Jan-2013  dsl Only include machine/cpu.h if _KERNEL is defined.
Fixes alpha userspace build (esp. pstat).
NFI why it worked before at all.
 1.41 10-Feb-2012  para branches: 1.41.6;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.40 24-Jan-2012  christos Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.39 20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.38 08-Feb-2011  rmind branches: 1.38.4; 1.38.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.37 08-Feb-2010  joerg branches: 1.37.2; 1.37.4; 1.37.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.36 28-Aug-2006  yamt branches: 1.36.60; 1.36.80;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.35 11-Dec-2005  christos branches: 1.35.4; 1.35.8;
merge ktrace-lwp.
 1.34 06-Apr-2004  simonb branches: 1.34.12;
Bump NMBCLUSTERS to something a little more modern - 2048 for the
normal case and 4096 for the "options GATEWAY" case.
 1.33 07-Aug-2003  agc branches: 1.33.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.32 26-Feb-2002  simonb branches: 1.32.16;
Purge CLSIZE, CLSIZELOG2 and MCLOFSET.
Be consistant in the way that MSIZE, MCLSHIFT, MCLBYTES and NMBCLUSTERS
are defined.
Remove old VM constants from cesfic port.
Bump MSIZE to 256 on mipsco (the only one that wasn't already 256).
 1.31 30-May-2001  mrg branches: 1.31.2; 1.31.4;
use _KERNEL_OPT
 1.30 09-Jun-2000  thorpej branches: 1.30.4;
Only include <machine/intr.h> if _KERNEL. Noted by enami tsugutomo.
 1.29 09-Jun-2000  cgd make spl0() and spllowersoftclock() return void. Also, move spl0()
prototype from param.h to intr.h. (there were some big XXXs in param.h
that said to do that, and intr.h is included by param.h, so...)
 1.28 08-Jun-2000  thorpej And more ANSI'ification!
 1.27 11-Feb-2000  thorpej branches: 1.27.2;
Update for the NKMEMPAGES changes.
 1.26 04-Dec-1999  ragge CL* discarding.
 1.25 19-Nov-1998  ross branches: 1.25.10; 1.25.16;
Stop including <machine/alpha_cpu.h>; we already export <machine/cpu.h>.
 1.24 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.23 29-Apr-1998  thorpej Pull in opt_gateway.h as appropriate.
 1.22 12-Mar-1998  thorpej Garbage-collect a bunch of constants that were inherited, but are no
longer necessary or make sense.
 1.21 10-Feb-1998  thorpej Bump KNMEMCLUSTERS slightly, and make it more obvious how to tune it
(lifted from i386 port).
 1.20 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.19 15-May-1997  mjacob branches: 1.19.4;
Allow MAXPHYS to be specified as a config file option.
 1.18 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.17 27-Feb-1997  jonathan Protect MCLSHIFT definition so users can customize MCLBYTES.
 1.16 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.15 13-Nov-1996  cgd branches: 1.15.2; 1.15.8;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.14 25-Oct-1996  cgd prototype alpha_XXX_dmamap(), the alpha DMA mapping hack.
 1.13 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.12 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.11 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.10 20-Dec-1995  cgd move DELAY's functionality into delay()
 1.9 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.8 13-Aug-1995  mycroft Add splsoftnet().
 1.7 03-Aug-1995  cgd bump NKMEMCLUSTERS up to 4M (increase of 4x)
 1.6 28-Jun-1995  cgd kill user-land DELAY macro, as suggested by gwr.
 1.5 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 24-Mar-1995  cgd remove support for double-mapping the user area/kernel stack
 1.2 18-Mar-1995  cgd don't be so quick to cast macro arguments to unsigned; if the
arguments are really off_t's (e.g. to btodb), then you can lose
information. This was the "> 4G file systems don't work" bug; physio
uses btodb, which was broken.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.15.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.15.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.19.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.16.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.16.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.25.10.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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.30.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.31.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.31.4.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-02-28 04:06:14 +0000
 1.31.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.32.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.16.1 03-Aug-2004  skrll Sync with HEAD
 1.33.2.1 14-Jul-2004  tron Pull up revision 1.34 (requested by mhitch in ticket #645):
Bump NMBCLUSTERS to something a little more modern - 2048 for the
normal case and 4096 for the "options GATEWAY" case.
 1.34.12.1 30-Dec-2006  yamt sync with head.
 1.35.8.1 03-Sep-2006  yamt sync with head.
 1.35.4.1 09-Sep-2006  rpaulo sync with head
 1.36.80.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.60.1 11-Mar-2010  yamt sync with head
 1.37.6.1 17-Feb-2011  bouyer Sync with HEAD
 1.37.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.2.1 05-Mar-2011  rmind sync with head
 1.38.8.1 18-Feb-2012  mrg merge to -current.
 1.38.4.2 23-Jan-2013  yamt sync with head
 1.38.4.1 17-Apr-2012  yamt sync with head
 1.41.6.2 03-Dec-2017  jdolecek update from HEAD
 1.41.6.1 25-Feb-2013  tls resync with head
 1.43.14.1 19-Mar-2016  skrll Sync with HEAD
 1.44.18.1 10-Jun-2019  christos Sync with HEAD
 1.44.16.1 18-Jan-2019  pgoyette Synch with HEAD
 1.47.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.47.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.22 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.21 06-Feb-2012  matt branches: 1.21.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 07-Jun-2011  matt branches: 1.20.2; 1.20.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.19 24-May-2011  rmind branches: 1.19.2;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.18 04-Jan-2008  ad branches: 1.18.32; 1.18.38;
More header file cleanup.
 1.17 17-Oct-2007  garbled branches: 1.17.2; 1.17.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.16 17-May-2007  yamt branches: 1.16.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.15 24-Dec-2005  perry branches: 1.15.26; 1.15.30; 1.15.32; 1.15.38;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 28-Jul-2005  thorpej - Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12 29-Jun-2003  fvdl branches: 1.12.2; 1.12.8; 1.12.16; 1.12.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 29-Jun-2003  martin #ifdef _KERNEL_OPT police
 1.10 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.9 30-Nov-2002  simonb Add multiple-inclusion protection.
 1.8 20-Apr-2001  thorpej branches: 1.8.4;
Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.7 15-Aug-2000  thorpej branches: 1.7.2;
Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.6 06-Apr-1997  cgd branches: 1.6.22;
clean up NetBSD RCS ID strings
 1.5 13-Nov-1996  cgd branches: 1.5.2;
update copyright dates
 1.4 07-Oct-1996  cgd change md_coredump struct to actually reflect the machine-dependent stuff
that's dumped. use it, rather than a hack, to export the info to user-land
(gdb).
 1.3 14-Jul-1996  cgd (1) Add machinery to make [fs]uswintr be a bit more careful when
determining if a fault was actually their fault. (Unfortunately, they're
not actually implemented now, anyway.)
(2) Minor cleanup.
 1.2 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.22.2 23-Apr-2001  bouyer Sync with HEAD.
 1.6.22.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.4.2 11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.1 20-Apr-2001  thorpej file pcb.h was added on branch nathanw_sa on 2002-12-11 05:51:58 +0000
 1.12.18.3 21-Jan-2008  yamt sync with head
 1.12.18.2 03-Sep-2007  yamt sync with head.
 1.12.18.1 21-Jun-2006  yamt sync with head.
 1.12.16.1 30-Jul-2005  tron Pull up revision 1.13 (requested by thorpej in ticket #629):
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12.8.1 29-Aug-2005  tron Pull up following revision(s) (requested by riz in ticket #5623):
sys/arch/alpha/alpha/machdep.c: revision 1.287
sys/arch/alpha/alpha/trap.c: revision 1.98
sys/arch/alpha/include/pcb.h: revision 1.13
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.38.1 22-May-2007  matt Update to HEAD.
 1.15.32.1 11-Jul-2007  mjf Sync with head.
 1.15.30.1 27-May-2007  ad Sync with head.
 1.15.26.1 20-Mar-2007  yamt adapt alpha.
 1.16.10.2 09-Jan-2008  matt sync with HEAD
 1.16.10.1 06-Nov-2007  matt sync with HEAD
 1.17.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.17.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.18.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.32.2 12-Jun-2011  rmind sync with head
 1.18.32.1 31-May-2011  rmind sync with head
 1.19.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.48.1 10-Jun-2019  christos Sync with HEAD
 1.25 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.24 04-Jul-2021  thorpej branches: 1.24.16;
Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.23 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.22 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.21 26-Sep-2020  thorpej branches: 1.21.6; 1.21.8;
Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.20 26-Sep-2020  thorpej Add support for CPU interrupt affinity for PCI interrupts:
- Keep a bitmap of eligible interrupt-handling CPUs in the pci_chipset_tag_t.
If this bitmap is 0, then we assume that all PCI interrupts should be
routed to the primary CPU.
- Add an optional PCI chipset callback for setting the CPU affinity of
an interrupt.
- When an establishing an interrupt handler, select the CPU that will
handle this irq using the following algorithm:
==> If the irq already has a CPU assignment, keep it.
==> Otherwise, find the CPU with the fewest registered handlers that
is eligible from both a hardware (based on the pci_chipset_tag_t)
and software (based on cpu_info::ci_schedstate.spc_flags) perspectives.
==> Fall back to the primary CPU failing all else.
 1.19 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.18 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.17 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.16 20-Jan-2014  tsutsui Check and set "is_console" property to PCI displays for framebuffer drivers.

Tested on DS15 with radeonfb(4) and XP1000 with vga(4)
by Naruaki Etomi in PR/48431.
 1.15 06-Feb-2012  matt branches: 1.15.6; 1.15.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 14-Jun-2011  matt branches: 1.14.2; 1.14.6;
struct device * -> device_t
 1.13 04-Apr-2011  dyoung branches: 1.13.2;
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.12 11-Dec-2005  christos branches: 1.12.100; 1.12.106;
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 (*pc_decompose_tag)() is no longer alpha specific. Move it as appropriate.
 1.8 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.7 08-Jun-2001  simonb branches: 1.7.2; 1.7.4;
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.6 28-Dec-2000  sommerfeld branches: 1.6.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.5 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 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.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
move pci/pci_machdep.h to include/pci_machdep.h. (can't do it via
repository copy because alpha already had an include/pci_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd this file is no longer used
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.7.4.1 08-Jun-2001  nathanw file pci_machdep.h was added on branch nathanw_sa on 2002-06-20 03:37:38 +0000
 1.7.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.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.100.1 21-Apr-2011  rmind sync with head
 1.13.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14.6.1 18-Feb-2012  mrg merge to -current.
 1.14.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.2.1 17-Apr-2012  yamt sync with head
 1.15.10.1 18-May-2014  rmind sync with head
 1.15.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.8.1 31-May-2021  cjep sync with head
 1.21.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.21.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.24.16.1 02-Aug-2025  perseant Sync with HEAD
 1.10 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 12-Aug-2011  dyoung branches: 1.9.2; 1.9.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.8 13-Jul-2011  dyoung #include <machine/bus_defs.h> instead of <machine/bus.h>.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 07-Jan-2001  thorpej branches: 1.6.126; 1.6.128; 1.6.130;
Make this C++ safe.
 1.5 19-Jun-2000  simonb branches: 1.5.2;
s/ouwl/outl/ in macro definition.
 1.4 08-Jun-2000  thorpej And more ANSI'ification!
 1.3 26-Feb-2000  thorpej branches: 1.3.2;
x86-style PIO ops for USERLAND ONLY! Requires -lalpha.
 1.2 23-Nov-1995  cgd branches: 1.2.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd Support for ISA programmed I/O functions.
 1.2.4.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 25-Jan-2001  jhawk Pull up revision 1.6 (requested by thorpej):
Make this file safe for inclusion in C++ programs.
 1.6.130.1 16-May-2008  yamt sync with head.
 1.6.128.1 18-May-2008  yamt sync with head.
 1.6.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 18-Feb-2012  mrg merge to -current.
 1.9.2.1 17-Apr-2012  yamt sync with head
 1.100 15-Jul-2025  andvar Fix various typos in comments.
 1.99 19-Jul-2022  riastradh branches: 1.99.10;
alpha: Fix missing includes in pmap.h.
 1.98 31-May-2021  thorpej Additional comment about the range (0-1025) that's needed for the PT page
reference count, and thus now many bits we need to scare up.
 1.97 31-May-2021  thorpej After a comment by joerg@, go back to using a dedicated field for the
PT page reference count, but add an XXX comment stating the desire to
find a safely-unused field in the vm_page structure when pages are in-
use as PT pages, so that we can save the 8 bytes per page needed for
this.
 1.96 30-May-2021  thorpej Implement pmap_remove_all().
 1.95 30-May-2021  thorpej When removing mappings, hang PV entries to be freed off of the
pmap_tlb_context structure, and free them back in bulk after we
release all of our locks (as we do with PT pages that are freed).
 1.94 30-May-2021  thorpej Keep track of a pmap's PV entries with a list hanging off the pmap.
 1.93 30-May-2021  thorpej Store the modified / referenced attribute bits in the lower 2 bits of
the PV entry list pointer in struct vm_page_md. This reduces the size
of that structure from 16 bytes to 8, and will go a fair way to making
up for increasing the size of struct pv_entry in a future commit.
 1.92 30-May-2021  thorpej Define a macro, VM_MDPAGE_PVS(), for fetching the first pv entry
for a page.
 1.91 30-May-2021  thorpej Pages that are in-use as page table pages should never be part of a
UVM loan transaction, so use the vm_page::loan_count field as the PT
page reference count.
 1.90 30-May-2021  thorpej Track the PT pages allocated to a pmap in the pmap itself.
 1.89 30-May-2021  thorpej Define a pmap_pagelist LIST_HEAD and use it where we used ad hoc LIST_HEADs
of vm_page structures. Define and use a generic routine to free such a list
back to UVM.

In pmap_remove_internal(), KASSERT that no PT pages are queued up to be
freed when removing mappings from the kernel pmap.
 1.88 29-May-2021  thorpej Move the pointer to the pmap's lev1map out of the shared pmap structure
and into each CPU's pmap_percpu area. This pointer is constant for the
life of the pmap, and moving it gives us an additional 8 bytes in the
shared pmap structure.

Because the kernel pmap does not have per-CPU data, all places where we
need the kernel pmap's lev1map now just reference kernel_lev1map directly.
 1.87 29-May-2021  thorpej Rather than tracking "needs I-sync on return to userspace" in a bitmap,
track it with a separate field in the pmap_percpu. Not only does this
reduce cache line contention ever so slightly, it also frees up a field
in the shared portion of the pmap structure.
 1.86 29-May-2021  thorpej Rename pmap_asn_info to pmap_percpu, and pmap::pm_asni to pmap::pm_percpu.
No functional change.
 1.85 24-May-2021  thorpej pmap_tlb_shootdown_all_user() can be called in the PV scenario as well
as the forward scenario, for example if a pmap_page_protect() to remove
all mappings results in the freeing of a PT page. It therefore needs
to do the same reference counting dance as pmap_tlb_shootdown_pv().

Also fix a use-after-free error in pmap_page_protect().

Add / tweak some assertions, and shrink the pmap::pm_count field from
long to unsigned int (which gave me a spare unsigned int field for
debugging purposes).

PR port-alpha/56201.
 1.84 03-Sep-2020  thorpej branches: 1.84.6; 1.84.8;
Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.83 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.82 23-Jul-2020  skrll unifdef -U_LKM
 1.81 14-Mar-2020  ad pmap_remove_all(): Return a boolean value to indicate the behaviour. If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.
 1.80 19-May-2018  thorpej branches: 1.80.2;
Implement PMAP_DIRECT / pmap_direct_process() in support of experimental
UBC optimizations.
 1.79 01-Jan-2014  matt branches: 1.79.28;
Fix PMAP_SIZEOF() to deal with that the pmap has 0 pmap_asn_info now.
Addresses PR/48488.
 1.78 04-Nov-2013  christos convert to flex array
 1.77 06-Feb-2012  matt branches: 1.77.6; 1.77.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.76 14-Nov-2010  uebayasi branches: 1.76.8; 1.76.12;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.75 26-Oct-2009  thorpej branches: 1.75.2; 1.75.4;
Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.74 15-Mar-2009  cegger ansify function definitions
 1.73 09-Dec-2008  pooka branches: 1.73.2;
In case of no _KERNEL_OPT, always define _PMAP_MAY_USE_PROM_CONSOLE
 1.72 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.71 28-Apr-2008  martin branches: 1.71.6; 1.71.8;
Remove clause 3 and 4 from TNF licenses
 1.70 10-Mar-2008  ad branches: 1.70.2; 1.70.4;
Finish moving alpha over to the MI atomic ops.
 1.69 02-Jan-2008  ad branches: 1.69.2; 1.69.6;
Merge vmlocking2 to head.
 1.68 21-Feb-2007  thorpej branches: 1.68.10; 1.68.22; 1.68.28; 1.68.30; 1.68.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.67 02-Apr-2006  thorpej branches: 1.67.14;
Static'ify.
 1.66 16-Feb-2006  perry branches: 1.66.2; 1.66.4; 1.66.6;
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.65 24-Dec-2005  perry branches: 1.65.2; 1.65.4; 1.65.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.64 11-Dec-2005  christos merge ktrace-lwp.
 1.63 24-Aug-2003  chs branches: 1.63.16;
add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.62 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.61 02-Aug-2003  matt Make this compile with gcc3. Change kernel_pmap_store to array of struct
pmap instead of array u_long. A bit of space is wasted but it supresses
the -Wcast-align warning.
 1.60 09-Apr-2003  nathanw branches: 1.60.2;
POOL_VTOPHYS: Cast argument to ALPHA_K0SEG_TO_PHYS() to vaddr_t to
prevent gcc complaining about bitwise operations on pointers.
 1.59 09-Apr-2003  thorpej Add the ability for pool caches to cache the physical address of
objects. Clients of the pool_cache API must consistently use
the "paddr" variants or not, otherwise behavior is undefined.

Enable this on Alpha, ARM, MIPS, and x86. Other platforms must
define POOL_VTOPHYS() in the appropriate manner in order to enable
the feature.

Part 1 of a series of simple patches contributed by Wasabi Systems
to improve network performance.
 1.58 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.57 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.56 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.55 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.54 10-Sep-2001  chris 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.53 15-Jul-2001  thorpej branches: 1.53.2; 1.53.4;
Defer sending shootdown IPIs a bit longer. Reduces traffic a fair
bit more.
 1.52 15-Jul-2001  thorpej - Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.51 30-May-2001  mrg branches: 1.51.2;
use _KERNEL_OPT
 1.50 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.49 01-May-2001  thorpej Delete the pmap_copy() calls.
 1.48 01-May-2001  thorpej Use a single linked list for PV entries. This saves 1MB of space
on my 1G RAM AlphaServer.
 1.47 01-May-2001  thorpej 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.46 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.45 29-Apr-2001  thorpej Add glue for page zero'ing in the idle loop.
 1.44 24-Apr-2001  thorpej Delete a couple of statistics that are not really worth keeping.
 1.43 24-Apr-2001  thorpej Gather ASN info into a single structure, and place a variable-length
array of those structures at the end of the pmap structure. We compute
the size of the pmap structure based on the maximum CPU ID for a
particular machine. This gives us better cache behavior and better
memory footprint for the ASN info.
 1.42 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.41 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.40 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.39 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.38 22-Nov-2000  thorpej branches: 1.38.2;
Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.37 19-Nov-2000  thorpej Implement pmap_growkernel().
 1.36 26-Aug-2000  thorpej Snapshot of TLB shootdown bugfixes.
 1.35 08-Jun-2000  thorpej And more ANSI'ification!
 1.34 23-May-2000  thorpej branches: 1.34.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.33 01-Mar-2000  thorpej Infrastructure for lazy istream sync in the pmap module:
- Add a bitmask for the CPUs which need an isync before this pmap returns
to userspace on that CPU.
- Define PMAP_USERRET(), a utility macro for userret() to use to process
the deferred isync, and call it as appropriate in userret().
 1.32 28-Nov-1999  thorpej - Use alpha_atomic_{add,sub}_q() to update the pmap statistics. We now no
longer need to lock the kernel pmap in pmap_kenter_pa() and pmap_kremove().
- Since locking the kernel pmap in interrupt context is no longer required,
don't go to splimp() when locking the kernel pmap.
- Implement a new pmap_remove() function, not yet enabled by default. It
is structured like pmap_protect, and should be *much* faster. This was
actually written quite some time ago, but never committed because it
didn't work properly. Given the recent bugfix to pmap_protect(), "duh,
of course it didn't work properly before...". It seems to work fine now
(have done several builds and run the UVM regression tests using the new
code), but it is currently run-time optional so that some performance
measurements can be easily run against the old and new code.
 1.31 24-May-1999  thorpej branches: 1.31.2; 1.31.8;
The kernel pmap can be accessed (and locked!) while in an interrupt
context, so we must block interrupts which may cause memory allocation
before asserting the kernel pmap's lock. Put this all in PMAP_LOCK()
and PMAP_UNLOCK() macros to make it easier.
 1.30 23-May-1999  thorpej Make the list of all pmaps LRU-ordered, and update a comment regarding
locking.
 1.29 23-May-1999  thorpej Save ourselves some work in some pv list traversal functions; keep a pointer
to the PTE that maps the page in the pv_entry so that we don't have to
compute it from the pmap/va.
 1.28 21-May-1999  thorpej Use the pool allocator for pv_entry structures. Set a (patchable/config'able)
low water mark on the pool, so we have some chance of crawling along in
extreme memory shortages.
 1.27 15-Apr-1999  thorpej DEC_KN300 no longer uses PROM console.
 1.26 24-Feb-1999  thorpej branches: 1.26.2;
First-cut at multiprocessor TLB shootdown. This simple implementation can
probably be improved somewhat, but an attempt to be efficient has been
made.

Note: TLB shootdowns are NOT YET ENABLED.
 1.25 04-Feb-1999  thorpej Define a macro which has human readable strings corresponding to PGU_*
constants.
 1.24 22-Sep-1998  thorpej Add some support for multiple processors to the pmap module. Still left
to do: TLB shootdown code, but that will be much easier to write once
the code to spin up the additional CPUs is working.
 1.23 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.22 24-Jul-1998  thorpej Provide PMAP_{,UN}MAP_POOLPAGE().
 1.21 11-Jun-1998  thorpej Define a macro to test PG_EXEC.
 1.20 20-May-1998  thorpej Add fine-grained locking, using a locking protocol modeled after the i386
UVM pmap's locking protocol, written by Chuck Cranor. Not all of the
support for multiple processors is here yet, but the kernel does run
under moderate loads with LOCKDEBUG (all locking operations are no-ops
unless LOCKDEBUG is turned on).

This is by no means complete... there are still some possible snares
to take a look at.
 1.19 19-May-1998  thorpej Make PT page reference counting more generic so it can be used for other
special use page types.
 1.18 19-May-1998  thorpej The Alpha architecture has a variable page size; don't hardwire the
number of PV entries per page at compile time.
 1.17 19-May-1998  thorpej Make the page attribute manifest constant names have similar form to
page usage manifest constant names.
 1.16 19-May-1998  thorpej Keep track of page usage inside the pmap (pvent, l{1,2,3}pt page, "normal").
 1.15 27-Apr-1998  thorpej Increase the efficiency of pmap_l{2,3}pte() somewhat, by allowing the
caller to pass an optional 3rd argument, which is the previous level
PTE corresponding the virtual address. If this argument is non-NULL,
the table walk otherwise necessary will be bypassed.
 1.14 15-Apr-1998  mjacob oops- add missing include
 1.13 15-Apr-1998  mjacob add Alpha 4100 support
 1.12 26-Mar-1998  thorpej if NEW_SCC_DRIVER, 3000/300 and 3000/500 aren't PROM console candidates.
 1.11 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.10 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.9 20-Aug-1996  cgd branches: 1.9.2;
OLD_PMAP -> NEW_PMAP
 1.8 09-Jul-1996  cgd temporarily move new pmap code into a seperate header, so changes to
one version won't spam people compiling with the option to get the other.
 1.7 02-Jul-1996  cgd minor cleanups to fit into the NetBSD source tree better (e.g. remove
RCS Log messages). Haven't even tried to compile it yet.
 1.6 02-Jul-1996  cgd pull in the Mach3 alpha pmap, as a base for the new pmap module. Modified
from the mach3 versions only as much as necessary to allow the old
NetBSD/Alpha pmap code to compile. THESE WILL NOT WORK AS-IS, and at
minimum will require code to implement reference- and modified-bit
emulation.
 1.5 02-Jul-1996  cgd if OLD_PMAP defined, pull in <machine/pmap.old.h> and ignore the other
contents of this file.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.26.2.1 16-Apr-1999  thorpej branches: 1.26.2.1.2;
Pull up 1.26 -> 1.27.
 1.26.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.31.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.31.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.31.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.31.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.34.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.38.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.51.2.3 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.51.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.51.2.1 03-Aug-2001  lukem update to -current
 1.53.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.53.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.53.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.53.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.53.2.1 15-Jul-2001  nathanw file pmap.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.16.4 17-Mar-2008  yamt sync with head.
 1.63.16.3 21-Jan-2008  yamt sync with head
 1.63.16.2 26-Feb-2007  yamt sync with head.
 1.63.16.1 21-Jun-2006  yamt sync with head.
 1.65.6.1 22-Apr-2006  simonb Sync with head.
 1.65.4.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 18-Feb-2006  yamt sync with head.
 1.66.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.66.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.66.2.1 11-Apr-2006  yamt sync with head
 1.67.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.68.34.1 02-Jan-2008  bouyer Sync with HEAD
 1.68.30.1 30-Dec-2007  ad Locking changes for alpha.
 1.68.28.1 18-Feb-2008  mjf Sync with HEAD.
 1.68.22.2 23-Mar-2008  matt sync with HEAD
 1.68.22.1 09-Jan-2008  matt sync with HEAD
 1.68.10.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.69.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.69.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.69.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.69.2.1 24-Mar-2008  keiichi sync with head.
 1.70.4.3 11-Mar-2010  yamt sync with head
 1.70.4.2 04-May-2009  yamt sync with head.
 1.70.4.1 16-May-2008  yamt sync with head.
 1.70.2.1 18-May-2008  yamt sync with head.
 1.71.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.71.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.71.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.73.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.75.4.1 05-Mar-2011  rmind sync with head
 1.75.2.2 15-Nov-2010  uebayasi Sync with HEAD.
 1.75.2.1 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.76.12.1 18-Feb-2012  mrg merge to -current.
 1.76.8.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.76.8.1 17-Apr-2012  yamt sync with head
 1.77.10.1 18-May-2014  rmind sync with head
 1.77.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.28.1 21-May-2018  pgoyette Sync with HEAD
 1.80.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.84.8.1 31-May-2021  cjep sync with head
 1.84.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.99.10.1 02-Aug-2025  perseant Sync with HEAD
 1.9 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.8 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.7 14-Oct-1997  mjacob Remove __VM_PMAP_HACK.
 1.6 02-Sep-1997  thorpej Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
 1.5 16-May-1997  gwr branches: 1.5.4;
Add #define __VM_PMAP_HACK as a temporary measure.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 20-Aug-1996  cgd branches: 1.3.2;
add cached dirbase PFN, protos for pmap_{,de}activate()
 1.2 10-Jul-1996  cgd it compiles, but DEFINITELY does not run
 1.1 09-Jul-1996  cgd temporarily move new pmap code into a seperate header, so changes to
one version won't spam people compiling with the option to get the other.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.2 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.32 22-Mar-1998  thorpej Replace PMAP_ASNGEN_INVALID with PMAP_ASN_RESERVED.
 1.31 18-Mar-1998  thorpej Add ASN housekeeping and a CPU mask to the pmap.
 1.30 18-Mar-1998  thorpej Move the "are we active" macros out of the header file.
 1.29 18-Mar-1998  thorpej Pass the max ASN from the HWRPB to pmap_boostrap().
 1.28 18-Mar-1998  thorpej Add a macro to test if PG_ASM (Address Space Match) is set in a PTE.
 1.27 17-Mar-1998  thorpej Add a software PTE bit that indicates that a va -> pa mapping was entered
in the physical->virtual list.
 1.26 12-Mar-1998  thorpej Garbage-collect this a bit.
 1.25 12-Mar-1998  thorpej Massive cleanup and partial rewrite of the NetBSD/alpha pmap module.

Major change is that page table page management has been completely
rewritten. Page tables are now accessed via K0SEG (no more KVA space
wasted on user page tables), and a much larger user address space is
supported.

Many thanks to Chris Demetriou and Ross Harvey for helpful insight and
debugging assistance.
 1.24 07-Mar-1998  thorpej Export a pointer to the Virtual Page Table.
 1.23 06-Mar-1998  thorpej pmap_ste() -> pmap_l2pte(), pmap_pte() -> pmap_l3pte()
 1.22 06-Mar-1998  thorpej Move pmap_pte*() macros into the header file, nuke pmap_ste_v(), add
pmap_lev1pte().
 1.21 01-Mar-1998  ross Remove the A12 from the rogue's gallery of the promcons-addicted.
 1.20 27-Feb-1998  thorpej Revamp pv_table management:
- Make pv_table an array of struct pv_head's, which contain LIST_HEADs
for the pv_entry's, as well as page attributes (mod, ref, ptpage).
- Use <sys/queue.h> to manipulate pv_entry lists.
- Fix several obvious bugs in pmap_collect_pv().
- Use K0SEG to access pv_page's.
 1.19 27-Feb-1998  thorpej Step 1 of the Grand Alpha Pmap Rototill:
- Clean up pmap_bootstrap() some, and make a slight change to how the
PROM mappings are saved.
- Give each pmap its own level 1 page table, rather than sharing a global
level 1 page table. This will eventually allow for Very Large user
address spaces.
- Keep a list of all pmaps, so that when kernel level 2 page tables are
allocated, all level 1 tables may be updated.
- Add a couple of functions for allocating and freeing page table pages.
- Add a few comments about ASN allocation.
 1.18 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.17 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.16 09-Jan-1998  thorpej If MACHINE_NEW_NONCONTIG is defined, activate the pmap_steal_memory()
interface.
 1.15 09-Jan-1998  thorpej Get rid of some old cruft.
 1.14 09-Jan-1998  thorpej Gather pv_table and pmap_attributes things togther, and macro'ize
access to them a little better.

Also, improve the performance of pmap_is_{referenced,modified}() and
pmap_clear_{reference,modify}() somewhat.
 1.13 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.12 17-Nov-1997  ross Put in Jason's recommended fix for the null-curproc-in-pmap.old.c problem.
 1.11 03-Sep-1997  thorpej branches: 1.11.4;
From hp300 pmap: use mycroft's pv_entry allocator (from i386 port).
 1.10 03-Sep-1997  thorpej Update from hp300 pmap: define an active_user_pmap() macro and use it.
 1.9 02-Sep-1997  thorpej branches: 1.9.2;
PMAP_{,DE}ACTIVATE() are no longer exported from the Utah-derived pmap.
 1.8 02-Sep-1997  thorpej - Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
- Garbage-collect pmap->pm_stchanged; it's not really used for anything.
 1.7 06-Apr-1997  cgd branches: 1.7.2;
clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 09-Jul-1996  cgd redefine lots of things in terms of definitions in alpha_cpu.h
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.9.2.2 02-Sep-1997  thorpej PMAP_{,DE}ACTIVATE() are no longer exported from the Utah-derived pmap.
 1.9.2.1 02-Sep-1997  thorpej file pmap.old.h was added on branch bouyer-scsipi on 1997-09-02 23:52:56 +0000
 1.11.4.1 17-Nov-1997  thorpej Sync w/ trunk (ross).
 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:31:33 +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:18:51 +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 01:02:38 +0000
 1.23 22-Jul-2021  thorpej Use __BITS() to define MDLWP_FP_C.
 1.22 16-May-2014  matt branches: 1.22.44;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.21 06-Feb-2012  matt branches: 1.21.6; 1.21.10; 1.21.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 07-Jun-2011  matt branches: 1.20.2; 1.20.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.19 14-Jan-2011  rmind branches: 1.19.6;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.18 21-Nov-2009  rmind branches: 1.18.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.17 09-Feb-2007  ad branches: 1.17.48;
Merge newlock2 to head.
 1.16 24-Dec-2005  perry branches: 1.16.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.15 11-Dec-2005  christos merge ktrace-lwp.
 1.14 21-Sep-2003  skd branches: 1.14.16;
Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.13 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.12 17-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11 14-Jul-2001  thorpej branches: 1.11.2;
Cosmetic change.
 1.10 26-Apr-2001  ross branches: 1.10.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.9 19-Jan-2001  thorpej branches: 1.9.2;
Make ASTs per-process.
 1.8 14-Dec-2000  mycroft Do the previous with a forwarding declaration of struct proc instead.
 1.7 14-Dec-2000  mycroft Wrap mdproc in #ifdef _KERNEL.
 1.6 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.5 10-Aug-1999  thorpej branches: 1.5.2;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.4 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 24-Mar-1995  cgd branches: 1.2.4;
remove support for double-mapping the user area/kernel stack
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.5.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.5.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.5.2.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.1 03-Aug-2001  lukem update to -current
 1.11.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.11.2.1 14-Jul-2001  nathanw file proc.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.16.2 26-Feb-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.17.48.1 11-Mar-2010  yamt sync with head
 1.18.4.2 12-Jun-2011  rmind sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.20.1 10-Aug-2014  tls Rebase.
 1.21.10.1 18-May-2014  rmind sync with head
 1.21.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.44.1 01-Aug-2021  thorpej Sync with HEAD.
 1.11 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 05-Sep-2000  thorpej branches: 1.10.164; 1.10.168;
Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.9 06-Apr-1997  cgd branches: 1.9.22;
clean up NetBSD RCS ID strings
 1.8 19-Dec-1996  cgd __asm rather than asm, to make lint happy without -g
 1.7 13-Nov-1996  cgd branches: 1.7.2;
update copyright dates
 1.6 15-Sep-1996  cgd save and restore registers symmetrically. don't forget to restore PV (t12).
 1.5 21-Aug-1996  cgd PSL_IPL_HIGH -> ALPHA_PSL_IPL_HIGH
 1.4 09-Jul-1996  cgd profile_swpipl() -> _alpha_pal_swpipl()
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 24-Jan-1997  cgd sync with trunk
 1.9.22.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.168.1 18-Feb-2012  mrg merge to -current.
 1.10.164.1 17-Apr-2012  yamt sync with head
 1.17 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.16 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.15 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.14 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.13 24-May-2011  rmind branches: 1.13.4; 1.13.8;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.12 08-Jun-2000  thorpej branches: 1.12.154; 1.12.160;
And more ANSI'ification!
 1.11 15-Oct-1998  ross branches: 1.11.12; 1.11.20;
1. STANDALONE -> _STANDALONE
2. Key raw prom interfaces defes on ENABLEPROM
3. Define the prom "ioctl" magtape functions.
 1.10 06-Oct-1998  thorpej Split hwrpb_restart_setup(), putting the code that initializes the vtpb
and primary hwpcb into hwrpb_primary_init(). Call the latter before
performing autoconfiguration().
 1.9 24-Sep-1998  thorpej Make prom_enter() and prom_leave() public.
 1.8 25-May-1998  thorpej Add "SCSIID" and "SCSIFAST" environment variables present on the
DEC 3000 systems.
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
update copyright dates
 1.5 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 15-Oct-1996  cgd define and call a new function, hwrbp_restart_setup(). It's called after
autoconfiguration to clear the RPB's per-cpu-slot BIP flag and to set up the
RPB's restart function pointers, etc.
 1.3 26-Sep-1996  cgd add support for the prom 'write' operation.
 1.2 23-Apr-1996  cgd prom_halt doesn't return; give it a noreturn attribute
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.12.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.160.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.154.1 31-May-2011  rmind sync with head
 1.13.8.1 18-Feb-2012  mrg merge to -current.
 1.13.4.1 17-Apr-2012  yamt sync with head
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 09-Jul-1996  cgd branches: 1.6.2;
Everything which would be defined here is defined in
alpha_cpu.h, and this file is no longer necessary for the
Alpha. However, some machine-independent code (e.g.
/sys/compat/common/kern_exit_43.c) still wants a file with
this name to be around.
 1.5 23-Apr-1996  cgd pal_halt doesn't return; give it a noreturn attribute.
Mark assembly that uses 'mb' as clobbering memory (pthreads does, and
it can't hurt).
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd rename MB to wbflush, make it inline
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.31 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.30 28-Apr-2008  martin branches: 1.30.34; 1.30.38;
Remove clause 3 and 4 from TNF licenses
 1.29 11-Dec-2005  christos branches: 1.29.74; 1.29.76; 1.29.78;
merge ktrace-lwp.
 1.28 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.27 14-Oct-2002  chs branches: 1.27.6;
eliminate PT_ENTRY_NULL in favor of plain old NULL.
 1.26 09-Apr-1999  thorpej branches: 1.26.14;
Fix a bug in TBI optimization uncovered by the "access_type" changes. Thanks
to Bernd Ernesti for providing crash dumps to Charles Hannum who tracked
it down.
 1.25 14-Aug-1998  thorpej branches: 1.25.6;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.24 01-Aug-1998  thorpej Remove some lint.
 1.23 08-Jul-1998  thorpej Define a macro that returns the mask of PALcode PTE bits that we care
about when determining if a TBI is necessary (i.e. the PALcode bits minus
the FOx bits, since we always track those).
 1.22 11-Jun-1998  thorpej Define a software PTE bit to track VM_PROT_EXEC.
 1.21 19-May-1998  thorpej Argh, finish renaming Lev1map to kernel_lev1map.
 1.20 25-Mar-1998  thorpej Keep a few things that reference kernel variables out of the namespace.
Add a check to see if libkvm is using this file.
 1.19 17-Mar-1998  thorpej Add a software PTE bit that indicates that a va -> pa mapping was entered
in the physical->virtual list.
 1.18 12-Mar-1998  thorpej Move PTE-related constants here, and make them not depend on a hard-coded
page size (i.e. use the one initialized from the HWRPB at boot time).

Do a bit of cleanup while here, rendering old inherited constants obsolete.
 1.17 12-Mar-1998  thorpej Nuke ALPHA_STSIZE and ALPHA_MAX_PTSIZE. Add macros to compute and operate
on segments mapped by L1 and L2 PTEs.
 1.16 09-Mar-1998  thorpej Define VPT_INDEX(), which computes the index into the Virtual Page Table
of the PTE that maps the specified virtual address.

Thanks to Chris Demetriou and Ross Harvey for clarifying the VPT.
 1.15 07-Mar-1998  thorpej Clean up a comment.
 1.14 07-Mar-1998  thorpej Clean this up a bit.
 1.13 07-Mar-1998  thorpej Nuke kvtopte() and ptetokv().
 1.12 07-Mar-1998  thorpej Nuke the vatopa() macro.
 1.11 02-Mar-1998  thorpej Rename a few macros to better describe what they are:
- kvtol1pte() -> l1pte_index()
- vatoste() -> l2pte_index()
- vatopte() -> l3pte_index()
 1.10 02-Sep-1997  thorpej branches: 1.10.2;
Garbage-collect loadustp(); the functionality has moved to pmap.old.c
 1.9 07-Apr-1997  cgd branches: 1.9.2;
clean up NetBSD RCS ID strings
 1.8 13-Nov-1996  cgd branches: 1.8.2;
update copyright dates
 1.7 01-Oct-1996  cgd move kvtol1pte outside of _KERNEL
 1.6 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.5 09-Jul-1996  cgd redefine lots of things in terms of definitions in alpha_cpu.h
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.8.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.10.2.2 02-Sep-1997  thorpej Garbage-collect loadustp(); the functionality has moved to pmap.old.c
 1.10.2.1 02-Sep-1997  thorpej file pte.h was added on branch bouyer-scsipi on 1997-09-02 19:07:23 +0000
 1.25.6.1 09-Apr-1999  thorpej branches: 1.25.6.1.2;
Pull up 1.25 -> 1.26; fix TBI optimization bug.
 1.25.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.26.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.27.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.6.1 03-Aug-2004  skrll Sync with HEAD
 1.29.78.1 16-May-2008  yamt sync with head.
 1.29.76.1 18-May-2008  yamt sync with head.
 1.29.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.30.38.1 18-Feb-2012  mrg merge to -current.
 1.30.34.1 17-Apr-2012  yamt sync with head
 1.11 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.10 18-Jun-2019  kamil Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).
 1.9 12-Apr-2017  kamil branches: 1.9.12;
Add new macro PTRACE_BREAKPOINT_ASM in <sys/ptrace.h> MD part

This macro ships with a MD-specific assembly instruction triggering
a software breakpoint.

Missing instruction for powerpc targets.

This code is used in ATF tests (lib/libc/sys/t_ptrace_wait).

Original patch by Nick Hudson, thanks!
 1.8 25-Sep-2015  christos branches: 1.8.2; 1.8.4;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.7 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.6 25-Jan-2008  skrll branches: 1.6.54; 1.6.74;
Define PT_MACHDEP_STRINGS
 1.5 11-Dec-2005  christos branches: 1.5.50; 1.5.56;
merge ktrace-lwp.
 1.4 21-Sep-2003  skd branches: 1.4.16;
Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.3 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 04-Feb-2008  yamt sync with head.
 1.5.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.50.1 23-Mar-2008  matt sync with HEAD
 1.6.74.3 28-Aug-2017  skrll Sync with HEAD
 1.6.74.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.74.1 22-Sep-2015  skrll Sync with HEAD
 1.6.54.1 03-Dec-2017  jdolecek update from HEAD
 1.8.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.8.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.9.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.12.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 08-Jun-2000  thorpej branches: 1.4.166; 1.4.170;
And more ANSI'ification!
 1.3 06-Apr-1997  cgd branches: 1.3.22; 1.3.30;
clean up NetBSD RCS ID strings
 1.2 28-Mar-1995  jtc branches: 1.2.4;
KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.30.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.22.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.170.1 18-Feb-2012  mrg merge to -current.
 1.4.166.1 17-Apr-2012  yamt sync with head
 1.2 05-Feb-2003  nakayama Replace machine/rnd.h with more appropriate name to share it
with cycle counter based microtime in kern/kern_microtime.c.
 1.1 08-Jun-2000  thorpej branches: 1.1.4; 1.1.6;
Add cpu_counter() for rnd(4), using the rpcc insn.
 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 08-Jun-2000  bouyer file rnd.h was added on branch thorpej_scsipi on 2000-11-20 22:35:41 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 08-Jun-2000  minoura file rnd.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:33 +0000
 1.45 31-Mar-2024  thorpej In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true. This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.
 1.44 03-Oct-2020  thorpej Add a comment describing the rpb::rpb_vptb field.
 1.43 08-Apr-2019  thorpej Add some additional CPU and system types.
 1.42 06-Feb-2012  matt branches: 1.42.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.41 25-Jul-2002  simonb branches: 1.41.146; 1.41.150;
Use "#define<tab>".
 1.40 25-Jul-2002  he Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.39 03-May-2001  thorpej branches: 1.39.2; 1.39.4; 1.39.16; 1.39.18;
Add systype for "Titan" systems (systype 38).
 1.38 06-Jul-2000  thorpej branches: 1.38.2;
Oops, g/c some stuff from previous.
 1.37 06-Jul-2000  thorpej Define some more CTB formats.
 1.36 03-Jul-2000  thorpej The `rpb_phys_address_size' field is really 2 32-bit fields,
`rpb_phys_address_size' and `rpb_extended_va_size', per Brown Book.
 1.35 03-Jun-2000  thorpej branches: 1.35.2;
Add EV57 and EV67 processor variants.
cvs: ----------------------------------------------------------------------
 1.34 31-May-2000  thorpej Add a few systypes.
 1.33 29-Mar-2000  simonb branches: 1.33.2;
Extern declaration of cputype.
 1.32 29-Jun-1999  ross branches: 1.32.2;
Minor Tsunami-related changes.
 1.31 14-Apr-1999  thorpej Slight braino in previous.
 1.30 14-Apr-1999  thorpej Add macros to decode the `turboslot' member of the Console Terminal Block.
 1.29 17-Mar-1999  drochner branches: 1.29.2;
add ST_DEC_6600, clean up some comments
 1.28 19-Nov-1998  ross "extern struct rpb *hwrpb" belongs here (duhhh)
 1.27 22-Sep-1998  thorpej Define the inter-console communication buffer portion of the per-cpu
info structure.
 1.26 14-Aug-1998  thorpej Change the "vm_offset_t"s to "u_long"s for now; eventually, we can make
them vaddr_t and paddr_t, as appropriate (after scouring the RPB docs
to know which are phys and virt addresses).
 1.25 26-Jun-1998  ross Note ST_DEC_1000 as PCI/EISA.
 1.24 24-Jun-1998  ross Identify ST_DEC_1000A as PCI/EISA.

New macros:

LOCATE_PCS(struct rpb *hwrpb, int cpu_number)
PCS_PROC_MAJORTYPE(struct pcs *)
PCS_PROC_MINORTYPE(struct pcs *)

Define LOCATE_PCS() to map (hwrpb, cpu_number) -> Per-Cpu-Slot structure.

Replace the PCS_PROC_{MAJOR,MINOR}{,SHIFT} stuff with macros that simply
return the major and minor cpu type codes.
 1.23 05-Jun-1998  thorpej Add system variation for Miata 1.5.
 1.22 03-Jun-1998  thorpej Define a bunch more system variations.
 1.21 29-Apr-1998  thorpej Define the DEC 550 Personal Workstation (Miata) systype.
 1.20 15-Apr-1998  mjacob add Alpha 4100 support
 1.19 20-Mar-1998  thorpej Add a few more systypes.
 1.18 02-Mar-1998  ross Second part of cdev_decl() migration. Declare cputype variable.
Add config info for a12 switch driver and console driver.
 1.17 13-Feb-1998  thorpej Define the structure of the HWRPB's Dynamic System Recognition area.
 1.16 12-Feb-1998  cgd rename struct rob's "rpb" element to "rpb_phys" for clarity. also,
change its type from a pointer to a never-defined structure to a
u_int64_t.
 1.15 29-Jan-1998  ross Correct a number of apparent errors in a few reboot paramemter block fields.
 1.14 12-Jan-1998  thorpej Add "non-volatile" memory cluster usage bit.
 1.13 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.12 06-Apr-1997  cgd branches: 1.12.4; 1.12.6;
clean up NetBSD RCS ID strings
 1.11 13-Nov-1996  cgd branches: 1.11.2;
clean up cpu type descriptions, in line with rev. 3 of the AARM
 1.10 13-Nov-1996  cgd update copyright dates
 1.9 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.8 11-Nov-1996  cgd add system type numbers up to 28, add the EV56 processor type number.
 1.7 29-Apr-1996  cgd fix definition of the "Primary Eligible" RPB PCS processor variation field.
 1.6 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5 28-Jun-1995  cgd update to make current state of knowledge
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 24-Mar-1995  cgd fill in sysnames for the 300 family
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.11.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.11.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.6.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.12.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.2.2 02-Jul-1999  perry pullup 1.31->1.32 (ross)
 1.29.2.1 16-Apr-1999  thorpej branches: 1.29.2.1.2; 1.29.2.1.4;
Pull up 1.29 -> 1.31. (Console Terminal Block `turboslot' definitions.)
 1.29.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.29.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.29.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 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.33.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.35.2.3 06-Jul-2000  thorpej G/c part of previous.
 1.35.2.2 06-Jul-2000  thorpej Pull up rev. 1.37:
Define some more CTB formats.
 1.35.2.1 03-Jul-2000  thorpej Pull up rev. 1.36:
The `rpb_phys_address_size' field is really 2 32-bit fields,
`rpb_phys_address_size' and `rpb_extended_va_size', per Brown Book.
 1.38.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.39.18.1 29-Jul-2002  lukem Pull up revision 1.40 (requested by he in ticket #552):
Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.39.16.1 30-Aug-2002  gehenna catch up with -current.
 1.39.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.39.4.1 03-May-2001  nathanw file rpb.h was added on branch nathanw_sa on 2002-08-01 02:41:03 +0000
 1.39.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.41.150.1 18-Feb-2012  mrg merge to -current.
 1.41.146.1 17-Apr-2012  yamt sync with head
 1.42.48.1 10-Jun-2019  christos Sync with HEAD
 1.6 11-Jul-2021  thorpej Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().
 1.5 29-Nov-2019  riastradh branches: 1.5.12;
Largely eliminate the MD rwlock.h header file.

This was full of definitions that have been obsolete for over a
decade. The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
 1.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Nov-2007  yamt branches: 1.3.14; 1.3.16; 1.3.18;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.2 09-Feb-2007  ad branches: 1.2.4; 1.2.8; 1.2.14; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 29-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 29-Dec-2006  ad Checkpoint work in progress.
 1.2.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.2.26.1 09-Jan-2008  matt sync with HEAD
 1.2.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.2.14.1 18-Apr-2007  thorpej G/C _lock_cas().
 1.2.8.1 03-Dec-2007  ad Sync with HEAD.
 1.2.4.3 07-Dec-2007  yamt sync with head
 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:05:38 +0000
 1.3.18.1 16-May-2008  yamt sync with head.
 1.3.16.1 18-May-2008  yamt sync with head.
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.1 14-Mar-2002  thorpej branches: 1.1.2;
file rwlock_impl.h was initially added on branch newlock.
 1.1.2.5 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.4 17-Mar-2002  thorpej Change RWLOCK_ACQUIRE() and RWLOCK_RELEASE() to evaluate to true
or false depending on the success of the "compare and swap" operation.

This makes them a lot easier to implement on IA32.
 1.1.2.3 17-Mar-2002  thorpej Note two more rwlock primitives MD code must provide, for use in
direct-handoff, and provide those additional primitives on the Alpha.
 1.1.2.2 17-Mar-2002  thorpej Fix a couple of brain-o's in the rwlock primitives.
 1.1.2.1 14-Mar-2002  thorpej Alpha rwlock primitives implementation.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 14-Sep-1998  thorpej branches: 1.3.186; 1.3.190;
Need 83 longs for a jmp_buf now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.190.1 18-Feb-2012  mrg merge to -current.
 1.3.186.1 17-Apr-2012  yamt sync with head
 1.3 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.2 06-Apr-1997  cgd branches: 1.2.22;
clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
preliminary SFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap,
cursor, etc.) support.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.22.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 17-Oct-2014  uebayasi Fix build of RAWHIDE kernel.
 1.1 27-Dec-2000  sommerfeld branches: 1.1.2; 1.1.176;
Let COMPAT_LINUX build with DEBUG
 1.1.176.1 03-Dec-2017  jdolecek update from HEAD
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 27-Dec-2000  bouyer file sigdebug.h was added on branch thorpej_scsipi on 2001-01-05 17:33:46 +0000
 1.19 29-Oct-2021  thorpej Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.
 1.18 26-Oct-2021  christos Merge all MD __sigaction14_sigtramp.c copies into one:
- sparc and sparc64 were not using version 0 sigcontext when there were
no arguments in the signal version. This was probably a bug.
- vax is using +1 the version numbers of the other archs.
- Only hppa was defining __LIBC12_SOURCE__ so it was getting a working
sigcontext before. all the other ports that supported sigcontext had
the compat code disabled.
[pointed out by thorpej, thanks!]
If we want to remove sigcontext support from userland at least now there
is less work to do so.
 1.17 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.16 06-Feb-2012  matt branches: 1.16.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.15 19-Nov-2008  ad branches: 1.15.16; 1.15.20;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.14 11-Dec-2005  christos branches: 1.14.74; 1.14.78; 1.14.84; 1.14.86;
merge ktrace-lwp.
 1.13 20-Jan-2005  drochner expose struct sigcontext* just as much as necessary
 1.12 10-May-2004  drochner branches: 1.12.4;
SIGTRAMP_VALID() should not pollute the user namespace
 1.11 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.10 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.9 18-Oct-2003  christos define SIGTRAMP_VALID()
 1.8 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.7 28-Apr-2003  bjh21 branches: 1.7.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.6 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5 13-Sep-1998  thorpej branches: 1.5.24;
Make signal delivery work again.
 1.4 25-May-1998  kleink If any of _ANSI_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE are defined, don't
provide any identifiers other than sig_atomic_t.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 16-Feb-1995  cgd branches: 1.2.4;
update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.24.1 16-Jan-2003  thorpej * Include <sys/sigtypes.h> rather than <sys/signal.h> in <sys/ucontext.h>.
* Define _UCONTEXT_TO_SIGCONTEXT() and _SIGCONTEXT_TO_UCONTEXT()
macros for converting a ucontext -> sigcontext and back again.
These macros in turn use machine-dependent macros _MCONTEXT_TO_SIGCONTEXT()
and _SIGCONTEXT_TO_MCONTEXT() provided by <machine/signal.h>.

The conversion process is not 100% accurate, but should be close enough.

Also note that the mcontext conversion may not be enough for all platforms
(m68k is a good example of this). These macros should be used only if
you really know what you're doing.
 1.7.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.14.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.78.1 04-May-2009  yamt sync with head.
 1.14.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.20.1 18-Feb-2012  mrg merge to -current.
 1.15.16.1 17-Apr-2012  yamt sync with head
 1.16.48.1 10-Jun-2019  christos Sync with HEAD
 1.20 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.19 07-Jul-2011  mrg port to GCC 4.5.
 1.18 11-Dec-2005  christos merge ktrace-lwp.
 1.17 11-Jan-2005  he In the __lint__ version of va_arg(), apply the cast the user specified.
Fixes build problem; vfprintf.c from libc fails to lint otherwise.
 1.16 02-Jan-2005  christos Try one more time to pacify lint.
 1.15 02-Jan-2005  christos Simplify the lint case by providing simple versions of the va_ macros,
instead of defining the buildin macros used to construct them.
 1.14 31-Dec-2004  christos Define builtin va start differently for lint, so that it does not produce
a warning.
 1.13 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.12 28-Apr-2003  bjh21 branches: 1.12.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.11 10-May-2000  thorpej Make stdarg/varargs work with GCC 2.96.
 1.10 03-Feb-2000  kleink Add a C99-style va_copy macro.
 1.9 03-May-1999  christos branches: 1.9.2;
Define __builtin_*() for lint
 1.8 27-Jul-1998  mycroft branches: 1.8.10;
Delint.
 1.7 06-Apr-1997  cgd branches: 1.7.8;
clean up NetBSD RCS ID strings
 1.6 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.5 22-Dec-1996  cgd if __lint__ is defined, #define __builtin_saveregs() and
__builtin_classify_type() into harmless values, so that lint doesn't
get confused, think they're real functions, and that they're being
invoked in the wrong ways.
 1.4 09-Oct-1996  cgd branches: 1.4.2;
change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.3 26-Dec-1995  mycroft Stylistic changes.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.7.8.1 01-Feb-1999  cgd pull up rev 1.8 from trunk (PR#6862). (mycroft)
 1.8.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.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.4 17-Jan-2005  skrll Sync with HEAD.
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.19 12-Aug-2011  dyoung branches: 1.19.2; 1.19.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.18 02-Aug-2011  uebayasi Define struct alpha_pci_conf_readwrite_args only once; fix build.
 1.17 28-Jul-2011  dyoung Put libalpha back.
 1.16 17-Jul-2011  dyoung Oops, add back struct alpha_pci_conf_readwrite_args.
 1.15 17-Jul-2011  dyoung Don't #include <machine/bus_defs.h> from this header unless _KERNEL
is #defined. While this header is installed in the alpha userland,
however, <machine/bus_defs.h> is not.

Don't declare any of the alpha_bus_ or alpha_pci_ symbols unless _KERNEL
is #defined. I cannot find anything but libarch in the base system
that uses the symbols. Anything using alpha_pci_ symbols ought to use
pci(3), instead. Up next: don't use those symbols in libarch.
 1.14 13-Jul-2011  dyoung #include <machine/bus_defs.h> instead of <machine/bus.h>.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 04-Mar-2007  christos branches: 1.12.40; 1.12.42; 1.12.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 11-Sep-2003  kleink branches: 1.10.16;
__{BEGIN,END}_DECLS-wrap prototypes.
 1.9 14-Jan-2002  thorpej branches: 1.9.16;
Add sysarch calls to read and write the full fp_c.
 1.8 26-Apr-2001  ross branches: 1.8.2; 1.8.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.7 20-Apr-2001  ross Nonfunctional change split out from pending functional commit.
 1.6 30-Jun-2000  simonb branches: 1.6.2;
Pass the abst to alpha_pci_mem_unmap() so that the real size of the
mapped area can be unmapped.
 1.5 08-Jun-2000  thorpej branches: 1.5.2;
And more ANSI'ification!
 1.4 26-Feb-2000  thorpej branches: 1.4.2;
- Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.3 30-Apr-1999  ross branches: 1.3.2; 1.3.8;
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.2 09-Jul-1996  cgd this file should not exist, for now
 1.1 12-Apr-1996  cgd alpha sysarch header. right now, only defines (inline) alpha_rpcc()
 1.3.8.2 23-Apr-2001  bouyer Sync with HEAD.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.2 30-Apr-1999  ross * New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.3.2.1 30-Apr-1999  ross file sysarch.h was added on branch netbsd-1-4 on 1999-04-30 00:58:33 +0000
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 03-Jul-2000  thorpej Pull up rev. 1.6:
Pass the abst to alpha_pci_mem_unmap() so that the real size of the
mapped area can be unmapped.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.4.1 26-Apr-2001  nathanw file sysarch.h was added on branch nathanw_sa on 2002-02-28 04:06:15 +0000
 1.8.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.9.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.44.1 16-May-2008  yamt sync with head.
 1.12.42.1 18-May-2008  yamt sync with head.
 1.12.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 18-Feb-2012  mrg merge to -current.
 1.19.2.1 17-Apr-2012  yamt sync with head
 1.9 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.8 20-Jul-2022  thorpej branches: 1.8.10;
In the Alpha tc_syncbus(), we need to issue a MB because WMB does not
order reads with respect to writes. Remove now-redundant tc_wmb()
calls before tc_syncbus().

NFC on MIPS other than removing a redundant wbflush() (tc_wmb() followed
by tc_syncbus()).
 1.7 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.6 04-Nov-2013  christos branches: 1.6.6;
make volatile variable as __USED()
 1.5 06-Feb-2012  matt branches: 1.5.6; 1.5.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 01-Jun-2000  cgd branches: 1.4.166; 1.4.170;
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;
move tc/tc_machdep.h to include/tc_machdep.h. (can't do it via
repository copy because alpha already had an include/tc_machdep.h in
the attic.)
 1.2 17-May-1996  cgd moved to ../tc
 1.1 20-Dec-1995  cgd portability definitions for machine-independent TC configuration code.
 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.170.1 18-Feb-2012  mrg merge to -current.
 1.4.166.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.4.166.1 17-Apr-2012  yamt sync with head
 1.5.10.1 18-May-2014  rmind sync with head
 1.5.6.2 03-Dec-2017  jdolecek update from HEAD
 1.5.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.6.1 28-Aug-2017  skrll Sync with HEAD
 1.8.10.1 02-Aug-2025  perseant Sync with HEAD
 1.3 26-Apr-1998  drochner Oops, forgot to delete. It's in dev/pci now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
TGA reg defns, moved here from ../pci for X. doesn't really belong here
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.61 23-Jan-2021  christos Document via __HAVE_BUS_SPACE_8 platforms that implement bus_space_*_8
 1.60 25-Sep-2020  thorpej branches: 1.60.2;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.59 19-Sep-2020  thorpej Enable __HAVE_FAST_SOFTINTS and garbage-collect the #ifdefs.
 1.58 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.57 04-Sep-2020  thorpej Put the MI cpu_data at the beginning of cpu_info so that it is
cache line aligned.
 1.56 30-Apr-2020  skrll G/C __HAVE_AST_PERPROC
 1.55 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.54 24-Jan-2016  christos branches: 1.54.18;
use __paddr_t since this is a userland API.
 1.53 23-Jan-2016  christos expose the kernel types for standalone code.
 1.52 23-Jan-2016  christos Hide {p,v}{addr,size}_t and register_t (and a couple more types that
are machine-specific) from userland unless _KERNEL/_KMEMUSER and a
new _KERNTYPES variables is defined. The _KERNTYPES should be fixed
for many subsystems that should not be using it (rump)...
 1.51 28-Aug-2015  pooka Convert to __cpu_simple_lock_nv_t. Somehow missed alpha in the earlier
commit. Thanks to uebs for pointing it out.
 1.50 08-Jan-2015  riastradh Introduce membar_datadep_consumer.

Discussed briefly on tech-kern without objection:

https://mail-index.netbsd.org/tech-kern/2014/11/20/msg018054.html
https://mail-index.netbsd.org/tech-kern/2015/01/07/msg018326.html
 1.49 25-Jan-2012  matt branches: 1.49.6; 1.49.22; 1.49.24;
Enable direct-mapped uareas for alpha.
 1.48 13-Jul-2011  dyoung branches: 1.48.2; 1.48.6;
Switch alpha to new-style <sys/bus.h>.

While I'm here, get rid of outdated __HAVE_DEVICE_REGISTER.
 1.47 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.46 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.45 31-Mar-2011  skrll branches: 1.45.2;
Enable TLS for alpha - a 2nd class^Wtier system in pookaBSD^WNetBSD

alpha_reloc.c diff from joerg on port-alpha.
 1.44 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.43 07-Jul-2010  chs branches: 1.43.2; 1.43.4;
implement cpu_lwp_setprivate() on several platforms.
 1.42 11-Dec-2009  matt branches: 1.42.2; 1.42.4;
Add PRIx{P,V}{ADDR,SIZE}, PRIu{P,V}SIZE, and PRIxREGISTER{,32,64} for all
(except where they will be added via merge). These should be used to print
{p,v}{addr,size}_t and register*_t as appropriate.
 1.41 20-Aug-2009  matt Add print format specifiers for {p,v}{addr,size}_t and register_t,
PRTx{P,V}{ADDR,SIZE} and PRTxREGISTER, respectively.
 1.40 20-Jan-2008  joerg branches: 1.40.10;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.39 29-Nov-2007  ad branches: 1.39.6;
__HAVE_ATOMIC64_OPS
 1.38 17-Oct-2007  garbled branches: 1.38.2;
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.37 21-Jul-2007  tsutsui branches: 1.37.4; 1.37.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.36 14-Jul-2007  ad branches: 1.36.2; 1.36.4;
Generic soft interrupts are mandatory.
 1.35 03-Sep-2006  bjh21 branches: 1.35.12; 1.35.18; 1.35.20;
Nothing in the kernel now tests __HAVE_NWSCONS, so stop defining it everywhere.
 1.34 24-Dec-2005  perry branches: 1.34.4; 1.34.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.33 11-Dec-2005  christos merge ktrace-lwp.
 1.32 18-Jan-2004  martin branches: 1.32.16;
Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.31 26-Sep-2003  nathanw Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.30 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.29 28-Apr-2003  bjh21 branches: 1.29.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.28 08-Jan-2003  thorpej Use the MI setrunqueue()/remrunqueue().
 1.27 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.26 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.25 18-Sep-2002  thorpej Add support for restartable atomic sequences. Rearragne the tail
of cpu_switch() slightly so we can reenable interrupts a little
earlier.
 1.24 03-May-2002  thorpej Revert revision 1.23.
 1.23 03-May-2002  eeh Provide _LP64 definition if we are generating LP64 binaries.
 1.22 28-Feb-2002  simonb Use "#define<tab>".
 1.21 28-Apr-2001  kleink branches: 1.21.2; 1.21.4;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.20 19-Jan-2001  thorpej branches: 1.20.2;
Make ASTs per-process.
 1.19 14-Jan-2001  thorpej Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.18 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.17 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.16 08-Jun-2000  thorpej Add cpu_counter() for rnd(4), using the rpcc insn.
 1.15 23-May-2000  thorpej branches: 1.15.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.14 05-Feb-2000  cgd clean up (group, sort) __HAVE_* defines
 1.13 01-Feb-2000  danw #define __HAVE_DEVICE_REGISTER on ports that have it, and check for
that, rather than a list of architecture defines, in config_attach
 1.12 14-Aug-1998  thorpej branches: 1.12.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.10 14-Jun-1998  kleink branches: 1.10.2;
GC the unused `physadr' type, which was not able to hold a complete physical
address on 2 architectures anyhow. Also, move the definition of the `label_t'
type inside _KERNEL protection, since it is specific to the in-kernel
setjmp()/longjmp() implementations.
 1.9 15-Apr-1998  drochner tell drivers that this port knows about the mi wscons stuff
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 07-Dec-1996  cgd kill __BROKEN_INDIRECT_CONFIG
 1.6 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.5 01-Oct-1996  cgd branches: 1.5.2;
kill __BDEVSW_DUMP_OLD_TYPE
 1.4 06-Jul-1995  cgd add <sys/cdefs.h> inclusions. namsspace-protect physadr, label_t
def'ns against _POSIX_SOURCE and _ANSI_SOURCE.
 1.3 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.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.2 07-Dec-1996  cgd sync with changes in trunk.
 1.5.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.10.2.2 12-Aug-1998  eeh Protect XOPEN and POSIX code from vm_offset_t, paddr_t, vaddr_t, vm_size_t, psize_t, and vsize_t.
 1.10.2.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.12.12.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.12.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.12.12.4 05-Jan-2001  bouyer Sync with HEAD
 1.12.12.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.12.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.12.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.4.5 08-Jan-2003  thorpej Sync with HEAD.
 1.21.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.21.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.21.4.1 28-Apr-2001  nathanw file types.h was added on branch nathanw_sa on 2002-04-01 07:38:51 +0000
 1.21.2.3 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.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.16.5 21-Jan-2008  yamt sync with head
 1.32.16.4 07-Dec-2007  yamt sync with head
 1.32.16.3 03-Sep-2007  yamt sync with head.
 1.32.16.2 30-Dec-2006  yamt sync with head.
 1.32.16.1 21-Jun-2006  yamt sync with head.
 1.34.8.1 14-Sep-2006  yamt sync with head.
 1.34.4.1 09-Sep-2006  rpaulo sync with head
 1.35.20.1 03-Oct-2007  garbled Sync with HEAD
 1.35.18.1 18-Apr-2007  thorpej - G/C the unused __HAVE_ATOMIC_OPERATIONS define.
- Set __HAVE_ATOMIC64_OPS to indicate 64-bit atomic op support.
 1.35.12.3 03-Dec-2007  ad Sync with HEAD.
 1.35.12.2 20-Aug-2007  ad Sync with HEAD.
 1.35.12.1 15-Jul-2007  ad Sync with head.
 1.36.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.36.2.1 07-Aug-2007  matt Sync with HEAD.
 1.37.6.3 23-Mar-2008  matt sync with HEAD
 1.37.6.2 09-Jan-2008  matt sync with HEAD
 1.37.6.1 06-Nov-2007  matt sync with HEAD
 1.37.4.1 03-Dec-2007  joerg Sync with HEAD.
 1.38.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.38.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.39.6.1 23-Jan-2008  bouyer Sync with HEAD.
 1.40.10.3 11-Aug-2010  yamt sync with head.
 1.40.10.2 11-Mar-2010  yamt sync with head
 1.40.10.1 16-Sep-2009  yamt sync with head
 1.42.4.4 12-Jun-2011  rmind sync with head
 1.42.4.3 21-Apr-2011  rmind sync with head
 1.42.4.2 05-Mar-2011  rmind sync with head
 1.42.4.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.42.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.43.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.43.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.45.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.6.1 18-Feb-2012  mrg merge to -current.
 1.48.2.1 17-Apr-2012  yamt sync with head
 1.49.24.3 19-Mar-2016  skrll Sync with HEAD
 1.49.24.2 22-Sep-2015  skrll Sync with HEAD
 1.49.24.1 06-Apr-2015  skrll Sync with HEAD
 1.49.22.1 18-Mar-2015  snj Pull up following revision(s) (requested by riastradh in ticket #600):
common/lib/libc/arch/alpha/atomic/membar_ops.S: revision 1.7
lib/libc/atomic/membar_ops.3: revision 1.4
sys/arch/alpha/include/types.h: revision 1.50
sys/sys/atomic.h: revision 1.13
Introduce membar_datadep_consumer.
Discussed briefly on tech-kern without objection:
https://mail-index.netbsd.org/tech-kern/2014/11/20/msg018054.html
https://mail-index.netbsd.org/tech-kern/2015/01/07/msg018326.html
 1.49.6.1 03-Dec-2017  jdolecek update from HEAD
 1.54.18.1 10-Jun-2019  christos Sync with HEAD
 1.60.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11 01-May-2021  thorpej Make sure preemption is disabled around PMAP_USERRET(); it uses
per-cpu information.

XXX mi_userret() also internally disables preemption. Should restructure
these to remove redundancies.
 1.10 06-Feb-2012  matt branches: 1.10.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 15-Dec-2010  matt branches: 1.9.8; 1.9.12;
rework <uvm/uvm_extern.h> includes.
 1.8 28-Apr-2008  martin branches: 1.8.22;
Remove clause 3 and 4 from TNF licenses
 1.7 05-Nov-2007  ad branches: 1.7.16; 1.7.18; 1.7.20;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.6 16-Feb-2006  perry branches: 1.6.24; 1.6.42; 1.6.44; 1.6.48;
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.5 24-Dec-2005  perry branches: 1.5.2; 1.5.4; 1.5.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 31-Oct-2003  cl branches: 1.3.16;
Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 03-Jan-2001  thorpej branches: 1.1.2; 1.1.4;
ANSI'ify, and inline userret().
 1.1.4.4 26-Sep-2002  nathanw Change "if (l->l_flag & L_SA_UPCALL)" to "while (l->l_flag & L_SA_UPCALL)"
in userret() functions or equivalent, to permit delivery of multiple upcalls
in a single kernel entry.

XXX It's getting crowded in here. Collapsing posting signals, upcalls, and
XXX kernel-exit handling into one mechanism would be nice.
 1.1.4.3 17-Dec-2001  nathanw Call sa_upcall_userret() instead of cpu_upcall().
 1.1.4.2 17-Nov-2001  nathanw Check and obey user-return exit hook (replaces test for P_WEXIT).
 1.1.4.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 03-Jan-2001  bouyer file userret.h was added on branch thorpej_scsipi on 2001-01-05 17:33:46 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 15-Nov-2007  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.5.2.1 18-Feb-2006  yamt sync with head.
 1.6.48.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.44.1 06-Nov-2007  matt sync with HEAD
 1.6.42.1 06-Nov-2007  joerg Sync with HEAD.
 1.6.24.1 03-Dec-2007  ad Sync with HEAD.
 1.7.20.1 16-May-2008  yamt sync with head.
 1.7.18.1 18-May-2008  yamt sync with head.
 1.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.22.1 05-Mar-2011  rmind sync with head
 1.9.12.1 18-Feb-2012  mrg merge to -current.
 1.9.8.1 17-Apr-2012  yamt sync with head
 1.10.64.1 13-May-2021  thorpej Sync with HEAD.
 1.12 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.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 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.9 12-May-2000  thorpej branches: 1.9.28;
Only use __builtin_va_alist_t if using GCC 2.96 or later. Fixes
pkg/10080, from Matthias Scheler.
 1.8 10-May-2000  thorpej Make stdarg/varargs work with GCC 2.96.
 1.7 06-Apr-1997  cgd branches: 1.7.22;
clean up NetBSD RCS ID strings
 1.6 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.5 09-Oct-1996  cgd branches: 1.5.2;
change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.4 26-Dec-1995  mycroft Make the type of __builtin_va_list a long.
 1.3 26-Dec-1995  mycroft Stylistic changes.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.22.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.9.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.28.1 03-Aug-2004  skrll Sync with HEAD
 1.40 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.39 29-Aug-2020  thorpej Bump UBC_WINSHIFT to 16 (64KB), and UBC_NWINS to 4096 (256MB total).
Alpha has plenty of KVA to use for this.
 1.38 10-Dec-2012  chs enable __USE_TOPDOWN_VM.
 1.37 10-Sep-2012  martin branches: 1.37.2;
Make this file idempotent
 1.36 08-Feb-2011  rmind branches: 1.36.4;
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.35 14-Nov-2010  uebayasi branches: 1.35.2; 1.35.4;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.34 06-Nov-2010  uebayasi Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.33 06-Mar-2009  joerg branches: 1.33.2; 1.33.4;
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.32 10-Mar-2008  ad branches: 1.32.4; 1.32.12; 1.32.18;
Use atomics to maintain the number of special page references. Should fix
locking problems including in revision 1.232.
 1.31 21-Feb-2008  ad branches: 1.31.2;
Use a hash of locks, instead of one per vm_page.
 1.30 02-Jan-2008  ad branches: 1.30.2;
Merge vmlocking2 to head.
 1.29 11-Dec-2005  christos branches: 1.29.50; 1.29.56; 1.29.60; 1.29.64;
merge ktrace-lwp.
 1.28 22-Mar-2004  matt branches: 1.28.16;
Change default data size to 256MB.
(A native NetBSD build will no longer with a limit of 128MB).
 1.27 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.26 08-Apr-2003  thorpej branches: 1.26.2;
Make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK compile time constants; we only
support 8K page models at the moment anyway.
 1.25 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.24 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.23 01-May-2001  thorpej branches: 1.23.2; 1.23.4;
Use a single linked list for PV entries. This saves 1MB of space
on my 1G RAM AlphaServer.
 1.22 01-May-2001  thorpej 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.21 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.20 18-Apr-2001  thorpej Remove an un-true comment regarding the location of the u-area.
 1.19 19-Nov-2000  thorpej branches: 1.19.2;
Make VM_MAX_KERNEL_ADDRESS end on a page boundary.
 1.18 22-May-2000  thorpej Remove the adjustment of VM_PHYS_SIZE for `large memory machines'. The
only adjustment that was really necessary was for VM_KMEM_SIZE, and that
is no longer necessary because there is now generic auto-sizing for
kmem_map.
 1.17 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.16 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.15 04-Dec-1999  ragge CL* discarding.
 1.14 26-Mar-1999  thorpej branches: 1.14.4; 1.14.8; 1.14.14;
Don't bother allocating mb_map on these systems. Mbuf clusters are
allocated from a pool, and the MIPS and Alpha use KSEG to map pool
pages. So, mb_map wasn't actually being used. Saves around 4MB of
kernel virtual address space in a typical configuration.

Garbage-collect the related VM_MBUF_SIZE constant.
 1.13 16-Jan-1999  chuck MNN is now the only option possible
 1.12 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.10 12-Mar-1998  thorpej Increase the maximum userspace address to 4TB. Leave the stack at 8G
for now, but make a note that we might want to move it down to 4G later.
 1.9 27-Feb-1998  thorpej Revamp pv_table management:
- Make pv_table an array of struct pv_head's, which contain LIST_HEADs
for the pv_entry's, as well as page attributes (mod, ref, ptpage).
- Use <sys/queue.h> to manipulate pv_entry lists.
- Fix several obvious bugs in pmap_collect_pv().
- Use K0SEG to access pv_page's.
 1.8 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.7 10-Feb-1998  thorpej Make it easier to keep the scaled VM_*_SIZE values in sync w/ the
constants.
 1.6 23-Sep-1997  mjacob A minor barely acceptable hack to handle having a kernel boot on a system
with large amounts of memory and not spew. This doesn't really replace
fixing this problem better later, but it works for now. Basically, if memory
is greater than 128MB, start upping the sizes of some maps.
 1.5 12-Jun-1997  mrg branches: 1.5.4;
bring mrg-vm-swap2 onto mainilne.
 1.4 06-Apr-1997  cgd branches: 1.4.2;
clean up NetBSD RCS ID strings
 1.3 09-Jul-1996  cgd branches: 1.3.2; 1.3.6;
delete cruft, clean up constants
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.6.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.3.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.5.4.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.8.3 21-Apr-2001  bouyer Sync with HEAD
 1.14.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.14.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.14.4.1 04-Jul-1999  chs add UBC parameters.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.4.3 11-Dec-2002  thorpej Sync with HEAD.
 1.23.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.4.1 01-May-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.16.3 17-Mar-2008  yamt sync with head.
 1.28.16.2 27-Feb-2008  yamt sync with head.
 1.28.16.1 21-Jan-2008  yamt sync with head
 1.29.64.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.60.1 30-Dec-2007  ad Locking changes for alpha.
 1.29.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.29.50.2 23-Mar-2008  matt sync with HEAD
 1.29.50.1 09-Jan-2008  matt sync with HEAD
 1.30.2.1 24-Mar-2008  keiichi sync with head.
 1.31.2.2 03-Apr-2008  mjf Sync with HEAD.
 1.31.2.1 21-Feb-2008  mjf file vmparam.h was added on branch mjf-devfs2 on 2008-04-03 12:42:10 +0000
 1.32.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.4.1 04-May-2009  yamt sync with head.
 1.33.4.1 05-Mar-2011  rmind sync with head
 1.33.2.3 15-Nov-2010  uebayasi Sync with HEAD.
 1.33.2.2 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.33.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.35.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.35.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.36.4.1 30-Oct-2012  yamt sync with head
 1.37.2.1 25-Feb-2013  tls resync with head
 1.6 28-Aug-2006  he Use the common <dev/sun/vuid_event.h> header file instead of maintaining
separate copies in port-specific directories. Add duplicate include
protection. Makes the alpha and atari ports build usr.bin/kdump/ again.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8;
merge ktrace-lwp.
 1.4 25-Apr-2004  fair branches: 1.4.12;
protect against multiple includes because the make procedures for
kdump, ktruss, etc., aren't smart enough to spot this as a duplicate
from both include/{alpha,machine}/vuid_event.h
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 30-Dec-2006  yamt sync with head.
 1.5.8.1 03-Sep-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.76; 1.2.78;
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:31:19 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 16-Apr-1999  ross Really say goodbye to old wscons.
 1.2 06-Apr-1997  cgd branches: 1.2.16;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
header which defines 'workstation console glue' ioctls
 1.1.2.4 01-Jun-1997  cgd fix copyright; this file is entirely rewritten (by me), and shares no
source with the existing wsconsio.h.
 1.1.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.2 31-Jan-1997  cgd clean up some comments, add display mode swtich ioctls
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.16.1 16-Apr-1999  perry unneeded -- from old wscons. removal on branch requested by ross
 1.9 29-Mar-2008  tsutsui Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.8 07-Nov-2007  ad branches: 1.8.14;
Merge tty changes from the vmlocking branch.
 1.7 11-Dec-2005  christos branches: 1.7.30; 1.7.48; 1.7.50; 1.7.54; 1.7.56;
merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 08-Dec-2000  nisimura branches: 1.5.24;
A forgotten commit that should be done at the time when zs_ioasic.c was
changed.
 1.4 09-Sep-2000  nisimura u_char -> u_int for function argument and return of Zilog register
manipulation helper functions; no loss, no gain, for Alpha processor.
 1.3 08-Jun-2000  thorpej And more ANSI'ification!
 1.2 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.1 24-Mar-1998  thorpej branches: 1.1.14; 1.1.22;
Initial mostly-working ioasic attachment for the MI 8530 SCC driver. It is
enough to use as a console on my DEC 3000/400 (connected to a VT-520
terminal).

XXX The MI SCC driver needs serious changes to handle platforms which
have muliple SCC attachments (e.g. the Alpha port, which has an ioasic
attachment for TurboChannel systems and a gbus attachment for TurboLaser
systems).

XXX The MI SCC driver also needs changes to deal with the wacky (to put
it mildly) way the chips are wired up on the ioasic (on both TC Alphas
and DECstations). These are going to come along later.
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.14.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.14.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.1.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.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 15-Nov-2007  yamt sync with head.
 1.7.56.1 19-Nov-2007  mjf Sync with HEAD.
 1.7.54.1 13-Nov-2007  bouyer Sync with HEAD
 1.7.50.1 08-Nov-2007  matt sync with -HEAD
 1.7.48.1 11-Nov-2007  joerg Sync with HEAD.
 1.7.30.3 03-Dec-2007  ad Sync with HEAD.
 1.7.30.2 03-Dec-2007  ad Sync with HEAD.
 1.7.30.1 18-Oct-2007  ad Interrupt stuff for alpha (but no fast softints yet).
 1.8.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.11 15-Jan-1998  thorpej No longer needed; we use the MI IDE driver now.
 1.10 12-Jan-1998  thorpej Adjust for config changes.
 1.9 08-Oct-1997  thorpej branches: 1.9.2;
Implement DIOCGDEFLABEL.
 1.8 19-Jul-1997  cgd branches: 1.8.2;
sync with dev/isa/wd.c rev. 1.162:
>date: 1997/07/18 00:26:22; author: fvdl; state: Exp; lines: +10 -10
>Work around possible race condition with 2 drives on one controller
>in wd_get_parms. PR 3773, from Onno van der Linden (onno@simplex.nl)
S: ----------------------------------------------------------------------
 1.7 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.6 24-Jun-1997  thorpej foosize()'s return value is in DEV_BSIZE units; adjust the size obtained
from the disklabel accordingly.
 1.5 18-Jun-1997  pk Remove spurious line left over in previous commit.
Also, use parentheses like in <dev/isa/wd.c>
 1.4 18-Jun-1997  pk wdsize(): only call wdopen()/wdclose() if not already open, per the
current `openmask'.
 1.3 21-Apr-1997  cgd branches: 1.3.2;
minimal changes to make hacked wd driver work under a different name.
It is configured (in config files) as 'awdc'/'awd', but shows up as
'wdc'/'wd', so that a minimal amount of code had to be modified to make
the name change work. This is only intended to be temporary, anyway.
 1.2 21-Apr-1997  cgd Convert to use bus_space_* macros. The resulting code isn't quite correct,
but works on the alpha (since there's currently no floppy drive support).
 1.1 21-Apr-1997  cgd copy ISA wd driver from /sys/dev/isa/wd.c. This rev is unmodified.
This is temporary, until /sys/dev/isa/wd.c is properly bus_space_*-ified.
 1.3.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.3.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.1 21-Apr-1997  cgd file awd.c was added on branch alpha-nwscons on 1997-06-01 04:12:45 +0000
 1.8.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 10-May-1998  mycroft Pull up patch from mycroft.
 1.11 07-Apr-2000  thorpej Use dev/isa/fd.c.
 1.10 24-Mar-2000  thorpej Fallout from callout.
 1.9 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.8 07-Feb-2000  thorpej 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.7 07-Feb-2000  thorpej Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle. Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
 1.6 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.5 24-Mar-1999  mrg branches: 1.5.8; 1.5.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.4 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.3 22-Feb-1999  mycroft Use DMAMODE_DEMAND. Tested on an AS200.
 1.2 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.1 18-Feb-1999  thorpej Floppy driver for NetBSD/alpha, copied from i386 port, and munged to take
out the i386'isms (i.e. no NVRAM read for default floppy type; floppies
just default to 1.44MB).
 1.5.14.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.5.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3 07-Apr-2000  thorpej Use dev/isa/fd.c.
 1.2 07-Feb-2000  thorpej 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.1 18-Feb-1999  thorpej branches: 1.1.8;
Floppy driver for NetBSD/alpha, copied from i386 port, and munged to take
out the i386'isms (i.e. no NVRAM read for default floppy type; floppies
just default to 1.44MB).
 1.1.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.22 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.21 06-Feb-2012  matt branches: 1.21.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 06-Jun-2011  matt branches: 1.20.2; 1.20.6;
CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
 1.19 15-Dec-2010  matt branches: 1.19.6;
rework <uvm/uvm_extern.h> includes.
 1.18 14-Mar-2009  dsl branches: 1.18.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.17 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15 02-Oct-2002  thorpej branches: 1.15.112; 1.15.120; 1.15.126;
Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 29-Jun-2000  mrg branches: 1.13.2; 1.13.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 07-Aug-1998  drochner branches: 1.12.12;
implemt a simple "beep" device to access the ISA speaker
 1.11 28-May-1998  drochner pull in new PC display headers
 1.10 15-Apr-1998  drochner Adapt ISA console selection ti new mi drivers.
(was broken anyway, a "++" was missing somewhere)
 1.9 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.8 07-Apr-1997  cgd branches: 1.8.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.6 06-Apr-1997  cgd fix bogon in comment (s/PCI/ISA/)
 1.5 23-Nov-1996  cgd branches: 1.5.2;
update for new names for ISA VGA console match and attach functions
 1.4 19-Nov-1996  cgd implement isa_display_console(), to be used when console is an ISA display dev
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.12.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.13.4.1 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.13.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.15.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.112.1 04-May-2009  yamt sync with head.
 1.18.4.2 12-Jun-2011  rmind sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.64.1 13-May-2021  thorpej Sync with HEAD.
 1.10 19-Mar-1999  cgd move isa/isa_machdep.h to include/isa_machdep.h. (can't do it via
repository copy because alpha already had an include/isa_machdep.h in
the attic.)
 1.9 07-Aug-1998  drochner implemt a simple "beep" device to access the ISA speaker
 1.8 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.7 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.6 23-May-1998  matt Add isa_intr_alloc macro (for PCMCIA).
 1.5 15-Apr-1998  drochner Adapt ISA console selection ti new mi drivers.
(was broken anyway, a "++" was missing somewhere)
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 19-Nov-1996  cgd branches: 1.3.2;
add an isa_display_console() function, to be used when console is an ISA dev
 1.2 12-Apr-1996  cgd define all of the appropriate functions, as indirections through
a function switch.
 1.1 12-Apr-1996  cgd (incomplete) machine-dependent ISA definitions.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.17 22-Jan-2022  skrll Ensure bus_dmatag_subregion is called with an inclusive max_addr
everywhere.
 1.16 17-Dec-2021  skrll Correct copypaste comment grammar.
 1.15 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.14 18-Nov-2020  thorpej branches: 1.14.4;
malloc(9) -> kmem(9)
 1.13 29-Feb-2016  christos branches: 1.13.30;
PR/50854: David Binderman: Remove redundant code.
 1.12 06-Feb-2012  matt branches: 1.12.6; 1.12.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt rework <uvm/uvm_extern.h> includes.
 1.9 14-Mar-2009  dsl branches: 1.9.4;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.8 28-Apr-2008  martin branches: 1.8.8; 1.8.14;
Remove clause 3 and 4 from TNF licenses
 1.7 04-Mar-2007  yamt branches: 1.7.40; 1.7.42; 1.7.44;
fix fallout from caddr_t changes.
 1.6 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 05-May-2003  fvdl branches: 1.5.18; 1.5.56;
Move definition of ISA_DMA_BOUNCE_THRESHOLD to dev/isa/isareg.h.
 1.4 26-Apr-2002  thorpej Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.3 29-Jun-2000  mrg branches: 1.3.2; 1.3.4; 1.3.6;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 01-Jun-2000  thorpej branches: 1.2.2; 1.2.4;
Forgot __KERNEL_RCSID().
 1.1 01-Jun-2000  thorpej ISA DMA bounce buffer code, needed for a couple of SGMAP-less
systems, support for which will be hitting the tree soon.
 1.2.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.4.1 01-Jun-2000  minoura file isadma_bounce.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:37 +0000
 1.2.2.1 27-Apr-2002  he Pull up revision 1.4 (requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.3.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.3.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.3.2.1 29-Jun-2000  bouyer file isadma_bounce.c was added on branch thorpej_scsipi on 2000-11-20 19:56:57 +0000
 1.5.56.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.18.1 03-Sep-2007  yamt sync with head.
 1.7.44.2 04-May-2009  yamt sync with head.
 1.7.44.1 16-May-2008  yamt sync with head.
 1.7.42.1 18-May-2008  yamt sync with head.
 1.7.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.4.1 05-Mar-2011  rmind sync with head
 1.11.6.1 18-Feb-2012  mrg merge to -current.
 1.11.2.1 17-Apr-2012  yamt sync with head
 1.12.24.1 19-Mar-2016  skrll Sync with HEAD
 1.12.6.1 03-Dec-2017  jdolecek update from HEAD
 1.13.30.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.14.4.1 13-May-2021  thorpej Sync with HEAD.
 1.8 19-Jul-2000  thorpej This file is obsolsete.
 1.7 02-Sep-1997  thorpej branches: 1.7.18; 1.7.28;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 07-Apr-1997  cgd branches: 1.6.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 13-Oct-1996  christos branches: 1.4.2;
backout previous kprintf change
 1.3 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 12-Apr-1996  cgd add CMU copyright notice
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.28.1 19-Jul-2000  thorpej Update from trunk:
This file is obsolete.
 1.7.18.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.9 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.8 01-Jul-2011  dyoung branches: 1.8.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.3 05-Sep-1998  christos branches: 1.3.46;
Assign copyright to TNF.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 31-Jul-1998  thorpej branches: 1.1.2;
Machine-dependent ISA PnP goo for NetBSD/alpha.
 1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.2.1 31-Jul-1998  eeh file isapnp_machdep.c was added on branch eeh-paddr_t on 1998-08-08 03:06:35 +0000
 1.3.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.46.1 03-Aug-2004  skrll Sync with HEAD
 1.5.78.2 04-May-2009  yamt sync with head.
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 19-Mar-1999  cgd Moved to arch/alpha/include/isapnp_machdep.h,v
 1.3 05-Sep-1998  christos Assign copyright to TNF.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 31-Jul-1998  thorpej branches: 1.1.2;
Machine-dependent ISA PnP goo for NetBSD/alpha.
 1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.2.1 31-Jul-1998  eeh file isapnp_machdep.h was added on branch eeh-paddr_t on 1998-08-08 03:06:35 +0000
 1.22 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.21 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.20 01-Jul-2011  dyoung branches: 1.20.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.19 29-Mar-2008  tsutsui Don't forget to initialize sc_dev.
 1.18 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.17 17-Oct-2007  garbled branches: 1.17.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.16 21-Jul-2007  tsutsui branches: 1.16.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.15 11-Dec-2005  christos branches: 1.15.30; 1.15.38; 1.15.42; 1.15.44;
merge ktrace-lwp.
 1.14 14-Sep-2004  drochner branches: 1.14.12;
adapt to ISA "unknown address" namespace separation
 1.13 02-Oct-2002  thorpej branches: 1.13.6;
Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.10 02-Sep-1997  thorpej branches: 1.10.30; 1.10.32;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.9 22-Jul-1997  jonathan branches: 1.9.2;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.8 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.6 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.5 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.4 23-Nov-1996  cgd branches: 1.4.2;
clean up match: check args more carefully, make sure I/O space can be mapped
 1.3 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.2 17-Apr-1996  cgd fix copyrights
 1.1 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.4.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.4.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.4.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.9.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.32.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.10.32.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.30.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.30.2 28-Feb-2002  nathanw Catch up to -current.
 1.10.30.1 11-Jan-2002  nathanw More catchup.
 1.13.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.14.12.1 03-Sep-2007  yamt sync with head.
 1.15.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.15.42.1 07-Aug-2007  matt Sync with HEAD.
 1.15.38.1 03-Oct-2007  garbled Sync with HEAD
 1.15.30.1 20-Aug-2007  ad Sync with HEAD.
 1.16.6.1 06-Nov-2007  matt sync with HEAD
 1.17.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.70.1 13-May-2021  thorpej Sync with HEAD.
 1.24 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.23 15-Apr-1998  thorpej Don't use the ISA `delay port', since it no longer exists.
 1.22 18-Jan-1998  drochner adapt to changed <dev/ic/i8042reg.h>
 1.21 12-Jan-1998  thorpej Adjust for config changes.
 1.20 25-Sep-1997  thorpej Enter DDB on cntl-alt-esc (a'la i386).
 1.19 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18 07-Apr-1997  cgd branches: 1.18.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.16 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.15 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.14 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.13 25-Nov-1996  cgd branches: 1.13.2;
Add a primitive driver for the PC-ish Programmable Peripheral Interface
and PC-ish keyboard controller. (Actually, on alphas, the built-in PPI
(in the SIO) appears to be a lobotomized version of the original, but
i'd not call that a bad thing.) This driver should eventually handle all
speaker tone requests and keyboard commands, but for now it just maps
the relevant ports and passes them on to the keyboard and mouse drivers,
which are now its children (rather than children of ISA).
 1.12 19-Nov-1996  cgd catch up with wscons frame buffer attachment, mmap, and ioctl
interface changes.
 1.11 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.10 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 05-May-1996  thorpej Don't attempt to map the `delay port' (0x84). It's mapped and exported
by the ISA bus attach code.
 1.6 23-Apr-1996  cgd Changes from Trevor Mendez <tmendez@bbn.com> to make this compile
with NWSCONS == 0.
 1.5 12-Apr-1996  cgd update for bus.h, add support for X, and provide use of the bell.
 1.4 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.3 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 03-Aug-1995  cgd pc keyboard driver, largely snarfed from i386. should be MI, but
until the i386 is capable of using a 'split' version, no point.
 1.13.2.6 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.5 01-Feb-1997  cgd Add (gross) hacks to allow proper early attachment of console keyboard.
The pckbd driver is getting nastier and nastier. "It needs cleaned."
 1.13.2.4 31-Jan-1997  cgd fix type/value reporting
 1.13.2.3 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.13.2.2 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.13.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.18.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 03-Aug-1995  cgd branches: 1.1.4;
pc keyboard driver, largely snarfed from i386. should be MI, but
until the i386 is capable of using a 'split' version, no point.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.9 15-Apr-1998  mjacob delay handle was removed
 1.8 12-Jan-1998  thorpej Adjust for config changes.
 1.7 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 07-Apr-1997  cgd branches: 1.6.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.3 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.2 25-Nov-1996  cgd branches: 1.2.2;
hide a bogosity by not printing a message when pms not attached
 1.1 25-Nov-1996  cgd Add a primitive driver for the PC-ish Programmable Peripheral Interface
and PC-ish keyboard controller. (Actually, on alphas, the built-in PPI
(in the SIO) appears to be a lobotomized version of the original, but
i'd not call that a bad thing.) This driver should eventually handle all
speaker tone requests and keyboard commands, but for now it just maps
the relevant ports and passes them on to the keyboard and mouse drivers,
which are now its children (rather than children of ISA).
 1.2.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.2.3 01-Feb-1997  cgd Add (gross) hacks to allow proper early attachment of console keyboard.
The pckbd driver is getting nastier and nastier. "It needs cleaned."
 1.2.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.2.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.6.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.3 15-Apr-1998  thorpej Don't need "delaybah" in the attach args anymore.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 25-Nov-1996  cgd branches: 1.1.2;
Add a primitive driver for the PC-ish Programmable Peripheral Interface
and PC-ish keyboard controller. (Actually, on alphas, the built-in PPI
(in the SIO) appears to be a lobotomized version of the original, but
i'd not call that a bad thing.) This driver should eventually handle all
speaker tone requests and keyboard commands, but for now it just maps
the relevant ports and passes them on to the keyboard and mouse drivers,
which are now its children (rather than children of ISA).
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 01-Feb-1997  cgd Add (gross) hacks to allow proper early attachment of console keyboard.
The pckbd driver is getting nastier and nastier. "It needs cleaned."
 1.13 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.12 12-Jan-1998  thorpej Adjust for config changes.
 1.11 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.10 07-Apr-1997  cgd branches: 1.10.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.9 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.8 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.7 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.6 25-Nov-1996  cgd branches: 1.6.2;
Add a primitive driver for the PC-ish Programmable Peripheral Interface
and PC-ish keyboard controller. (Actually, on alphas, the built-in PPI
(in the SIO) appears to be a lobotomized version of the original, but
i'd not call that a bad thing.) This driver should eventually handle all
speaker tone requests and keyboard commands, but for now it just maps
the relevant ports and passes them on to the keyboard and mouse drivers,
which are now its children (rather than children of ISA).
 1.5 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 12-Apr-1996  cgd support for PS/2-style mice
 1.6.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.6.2.2 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.6.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.10.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
speaker (PIT AUX port) definitions
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
PC timer definitions
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.8 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 07-Apr-1997  cgd branches: 1.7.4; 1.7.6;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.6 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.5 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.4 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.3 23-Nov-1996  cgd branches: 1.3.2;
move probe and setup code into common functions. always probe (i.e.
even if PCI and the IDs are right), just for sanity, before declaring
success. Split the single 0x3b0 -> 0x3df allocation into three seperate
ones: 0x3b0 -> 0x3bc (leaving the 4 ports available for lpt),
0x3c0 -> 0x3cf, and 0x3d0 -> 0x3df. The former chunk has to be split
off if the lpt can exist there, and it's sort-of pretty to have each
group (based on second hex digit) have its own handle.
 1.2 20-Nov-1996  cgd try mapping the I/O space (as well as the memory space) in the probe routine.
 1.1 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.3.2.5 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.3.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.3 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.3.2.2 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.3.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.7.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.7.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 23-Nov-1996  cgd branches: 1.2.2;
move probe and setup code into common functions. always probe (i.e.
even if PCI and the IDs are right), just for sanity, before declaring
success. Split the single 0x3b0 -> 0x3df allocation into three seperate
ones: 0x3b0 -> 0x3bc (leaving the 4 ports available for lpt),
0x3c0 -> 0x3cf, and 0x3d0 -> 0x3df. The former chunk has to be split
off if the lpt can exist there, and it's sort-of pretty to have each
group (based on second hex digit) have its own handle.
 1.1 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.19 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.18 25-Sep-2020  thorpej branches: 1.18.6;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.17 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.16 19-Sep-2020  tsutsui Possible fix for hangup on Jensen mentioned in PR/36628.

According to comments in Linux drivers/tty/serial/8250/8250.h,
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/serial/8250/8250.h?h=v5.8#n242
the driver has to set OUT1 and OUT2 lines for "some ALPHA"
otherwise "the machine locks up with endless interrupts."
Note OUT2 (MCR_IENABLE) is set in MI com_attach_subr()
so we have to set OUT1 (MCR_DSR) in the MD attachment.

The information was notified from Miod Vallat.
 1.15 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.14 21-Mar-2014  christos branches: 1.14.28; 1.14.30;
gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.13 01-Jul-2011  dyoung branches: 1.13.2; 1.13.12; 1.13.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.12 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.11 21-Nov-2009  rmind branches: 1.11.10;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 14-Mar-2008  cube branches: 1.9.2; 1.9.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.8 29-Feb-2008  dyoung Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

Add a generic suspend routine. Suspend and resume com@isa.

Protect against dereferencing a NULL softc in comioctl().

Destroy both a mutex and a callout in com_detach().

Cosmetic: use aprint_*_dev(). Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.7 03-Dec-2007  ad branches: 1.7.10; 1.7.14;
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.6 13-Jul-2006  gdamore branches: 1.6.14; 1.6.32; 1.6.34; 1.6.40;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.5 02-Oct-2002  thorpej branches: 1.5.22; 1.5.36; 1.5.40; 1.5.48;
Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2 27-Jul-2001  thorpej branches: 1.2.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.8;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.8.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.1.8.1 03-Aug-2001  lukem update to -current
 1.1.4.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.4.1 12-Jul-2000  bouyer file com_jensenio.c was added on branch thorpej_scsipi on 2000-11-20 19:56:57 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file com_jensenio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:11 +0000
 1.2.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1 27-Jul-2001  nathanw file com_jensenio.c was added on branch nathanw_sa on 2002-10-18 02:34:15 +0000
 1.5.48.4 17-Jun-2006  gdamore Undo the undo. Restore COM_INIT_REGS.
 1.5.48.3 17-Jun-2006  gdamore Undo most of the work I did, but leave in the change to use a common
com_cleanup().
 1.5.48.2 16-Jun-2006  gdamore Convert MD specific cleanups to com_cleanup.
 1.5.48.1 15-Jun-2006  gdamore Alpha com(4) ports.
 1.5.40.1 11-Aug-2006  yamt sync with head
 1.5.36.1 09-Sep-2006  rpaulo sync with head
 1.5.22.3 17-Mar-2008  yamt sync with head.
 1.5.22.2 07-Dec-2007  yamt sync with head
 1.5.22.1 30-Dec-2006  yamt sync with head.
 1.6.40.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.34.2 23-Mar-2008  matt sync with HEAD
 1.6.34.1 09-Jan-2008  matt sync with HEAD
 1.6.32.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.14.1 03-Dec-2007  ad Sync with HEAD.
 1.7.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.10.1 24-Mar-2008  keiichi sync with head.
 1.9.4.2 11-Mar-2010  yamt sync with head
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.11.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.16.1 18-May-2014  rmind sync with head
 1.13.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.30.1 10-Jun-2019  christos Sync with HEAD
 1.14.28.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.18.6.1 13-May-2021  thorpej Sync with HEAD.
 1.25 19-Oct-2025  thorpej Use {,e}isabus_attach().
 1.24 21-Feb-2025  thorpej Fix a paste-o introduced in rev 1.22 that prevented ISA bus instances from
attaching.
 1.23 04-Dec-2023  thorpej branches: 1.23.2;
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.22 07-Aug-2021  thorpej branches: 1.22.6;
Merge thorpej-cfargs2.
 1.21 07-May-2021  thorpej branches: 1.21.6;
Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.20 24-Apr-2021  thorpej branches: 1.20.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.19 19-Aug-2009  dyoung branches: 1.19.78;
isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t.
 1.18 19-Aug-2009  dyoung Define isa_dmadestroy and isa_detach_hook. Hook up a couple of
isa_detach_hook implementations.
 1.17 09-Jul-2008  joerg - Statify
- Split device/softc.
 1.16 28-Apr-2008  martin branches: 1.16.2; 1.16.4; 1.16.6;
Remove clause 3 and 4 from TNF licenses
 1.15 17-Oct-2007  garbled branches: 1.15.16; 1.15.18; 1.15.20;
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.14 22-Jul-2007  tsutsui branches: 1.14.6;
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
 1.13 11-Dec-2005  christos branches: 1.13.24; 1.13.30; 1.13.38; 1.13.40; 1.13.42; 1.13.44;
merge ktrace-lwp.
 1.12 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.11 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.10 14-Sep-2004  drochner branches: 1.10.12;
include "locators.h" explicitely (don't rely on isavar.h doing so)
 1.9 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.8 01-Jan-2003  thorpej branches: 1.8.2;
Use aprint_normal() for cfprint routines.
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.4 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.3 27-Jul-2001  thorpej branches: 1.3.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.2 14-Aug-2000  thorpej branches: 1.2.2; 1.2.6;
Add support for EISA configuration space on the Jensen (it's
mapped differently than on other EISA sysetms).
 1.1 12-Jul-2000  thorpej branches: 1.1.2;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.3 14-Aug-2000  thorpej Pullup rev. 1.2:
Add support for EISA configuration space on the Jensen (it's
mapped differently than on other EISA sysetms).
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:11 +0000
 1.2.6.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.2.6.1 03-Aug-2001  lukem update to -current
 1.2.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.2.2.1 14-Aug-2000  bouyer file jensenio.c was added on branch thorpej_scsipi on 2000-11-20 19:57:00 +0000
 1.3.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.3.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.1 27-Jul-2001  nathanw file jensenio.c was added on branch nathanw_sa on 2002-10-18 02:34:15 +0000
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Sep-2004  skrll Sync with HEAD
 1.10.12.2 03-Sep-2007  yamt sync with head.
 1.10.12.1 21-Jun-2006  yamt sync with head.
 1.13.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.13.42.1 07-Aug-2007  matt Sync with HEAD.
 1.13.40.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.13.38.1 03-Oct-2007  garbled Sync with HEAD
 1.13.30.1 20-Aug-2007  ad Sync with HEAD.
 1.13.24.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.14.6.1 06-Nov-2007  matt sync with HEAD
 1.15.20.3 19-Aug-2009  yamt sync with head.
 1.15.20.2 04-May-2009  yamt sync with head.
 1.15.20.1 16-May-2008  yamt sync with head.
 1.15.18.1 18-May-2008  yamt sync with head.
 1.15.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1 19-Oct-2008  haad Sync with HEAD.
 1.16.4.1 18-Jul-2008  simonb Sync with head.
 1.16.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.78.2 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.19.78.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.20.2.1 13-May-2021  thorpej Sync with HEAD.
 1.21.6.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.22.6.1 22-Feb-2025  martin Pull up following revision(s) (requested by thorpej in ticket #1065):

sys/arch/alpha/jensenio/jensenio.c: revision 1.24

Fix a paste-o introduced in rev 1.22 that prevented ISA bus instances from attaching.
 1.23.2.1 02-Aug-2025  perseant Sync with HEAD
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 06-Feb-2012  matt branches: 1.5.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 25-Sep-2011  chs branches: 1.4.2; 1.4.6;
change inline to static inline to appease gcc 4.5.
 1.3 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.130; 1.1.132; 1.1.134;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.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.4.1 12-Jul-2000  bouyer file jensenio_bus_intio.c was added on branch thorpej_scsipi on 2000-11-20 19:57:00 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio_bus_intio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:11 +0000
 1.4.6.1 18-Feb-2012  mrg merge to -current.
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.5.64.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.4 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.3 01-Jul-2011  dyoung branches: 1.3.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.130; 1.1.132; 1.1.134;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.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.4.1 12-Jul-2000  bouyer file jensenio_bus_io.c was added on branch thorpej_scsipi on 2000-11-20 19:57:01 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio_bus_io.c was added on branch netbsd-1-5 on 2000-07-12 20:59:12 +0000
 1.3.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.4 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.3 01-Jul-2011  dyoung branches: 1.3.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.130; 1.1.132; 1.1.134;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.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.4.1 12-Jul-2000  bouyer file jensenio_bus_mem.c was added on branch thorpej_scsipi on 2000-11-20 19:57:01 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio_bus_mem.c was added on branch netbsd-1-5 on 2000-07-12 20:59:12 +0000
 1.3.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.10 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.9 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.8 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.7 14-Oct-2020  thorpej branches: 1.7.6;
Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.6 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.5 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 01-Jul-2011  dyoung branches: 1.4.2; 1.4.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.3 02-Feb-2010  skrll Typo in comment.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.130; 1.1.132; 1.1.134;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.134.2 11-Mar-2010  yamt sync with head
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.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.4.1 12-Jul-2000  bouyer file jensenio_dma.c was added on branch thorpej_scsipi on 2000-11-20 19:57:01 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio_dma.c was added on branch netbsd-1-5 on 2000-07-12 20:59:12 +0000
 1.4.6.1 18-Feb-2012  mrg merge to -current.
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.7.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.7.6.1 13-May-2021  thorpej Sync with HEAD.
 1.18 15-Jul-2021  thorpej - Use defined constants for PIC registers, not magic numbers (XXX except
for the ELCR register; need a new header file).
- In jensenio_specific_eoi(), actually issue a specific EOI (the code
was erroneously issuing a non-specific EOI).
- In jensenio_pic_init(), ensure all IRQs are initialized to EDGE trigger.
 1.17 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.16 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.15 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.14 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.13 25-Sep-2020  thorpej branches: 1.13.6;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.12 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.11 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.10 06-Feb-2012  matt branches: 1.10.6; 1.10.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 28-Apr-2008  martin branches: 1.9.34; 1.9.38;
Remove clause 3 and 4 from TNF licenses
 1.8 03-Dec-2007  ad branches: 1.8.14; 1.8.16; 1.8.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.7 17-Oct-2007  garbled branches: 1.7.2;
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.6 27-Jul-2007  tsutsui branches: 1.6.4; 1.6.6;
Check a correct value on a sanity check in jensenio_eisa_intr_map().

Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.5 24-Dec-2005  perry branches: 1.5.24; 1.5.30; 1.5.38; 1.5.40; 1.5.42; 1.5.44;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 27-Sep-2002  provos branches: 1.4.22;
remove trailing \n in panic(). approved perry.
 1.3 27-Jul-2001  thorpej branches: 1.3.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.2 14-Aug-2000  thorpej branches: 1.2.2; 1.2.6;
Clean this up a little bit, and issue a Specific EOI after
dispatching an EISA interrupt.
 1.1 12-Jul-2000  thorpej branches: 1.1.2;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.3 14-Aug-2000  thorpej Pull up rev. 1.2:
Clean this up a little bit, and issue a Specific EOI after
dispatching an EISA interrupt.
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenio_intr.c was added on branch netbsd-1-5 on 2000-07-12 20:59:13 +0000
 1.2.6.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.2.6.1 03-Aug-2001  lukem update to -current
 1.2.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.2.2.1 14-Aug-2000  bouyer file jensenio_intr.c was added on branch thorpej_scsipi on 2000-11-20 19:57:02 +0000
 1.3.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.1 27-Jul-2001  nathanw file jensenio_intr.c was added on branch nathanw_sa on 2002-10-18 02:34:15 +0000
 1.4.22.3 07-Dec-2007  yamt sync with head
 1.4.22.2 03-Sep-2007  yamt sync with head.
 1.4.22.1 21-Jun-2006  yamt sync with head.
 1.5.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.42.1 07-Aug-2007  matt Sync with HEAD.
 1.5.40.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.5.38.1 03-Oct-2007  garbled Sync with HEAD
 1.5.30.2 03-Dec-2007  ad Sync with HEAD.
 1.5.30.1 20-Aug-2007  ad Sync with HEAD.
 1.5.24.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.6.6.2 09-Jan-2008  matt sync with HEAD
 1.6.6.1 06-Nov-2007  matt sync with HEAD
 1.6.4.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.8.18.1 16-May-2008  yamt sync with head.
 1.8.16.1 18-May-2008  yamt sync with head.
 1.8.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.38.1 18-Feb-2012  mrg merge to -current.
 1.9.34.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.9.34.1 17-Apr-2012  yamt sync with head
 1.10.10.1 18-May-2014  rmind sync with head
 1.10.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.13.6.1 13-May-2021  thorpej Sync with HEAD.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 28-Apr-2008  martin branches: 1.3.34; 1.3.38;
Remove clause 3 and 4 from TNF licenses
 1.2 24-Dec-2005  perry branches: 1.2.74; 1.2.76; 1.2.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.44;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.44.1 21-Jun-2006  yamt sync with head.
 1.1.4.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.4.1 12-Jul-2000  bouyer file jensenioreg.h was added on branch thorpej_scsipi on 2000-11-20 19:57:02 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jensenioreg.h was added on branch netbsd-1-5 on 2000-07-12 20:59:13 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.38.1 18-Feb-2012  mrg merge to -current.
 1.3.34.1 17-Apr-2012  yamt sync with head
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.5 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.74; 1.3.76; 1.3.78;
merge ktrace-lwp.
 1.2 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.28;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.28.1 03-Sep-2004  skrll Sync with HEAD
 1.1.4.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.4.1 12-Jul-2000  bouyer file jenseniovar.h was added on branch thorpej_scsipi on 2000-11-20 19:57:02 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file jenseniovar.h was added on branch netbsd-1-5 on 2000-07-12 20:59:14 +0000
 1.3.78.1 16-May-2008  yamt sync with head.
 1.3.76.1 18-May-2008  yamt sync with head.
 1.3.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.14 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.13 29-Mar-2014  christos branches: 1.13.46;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.12 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.12; 1.11.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 07-Mar-2008  cube branches: 1.8.2; 1.8.4;
Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
 1.7 17-Oct-2007  garbled branches: 1.7.12; 1.7.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 19-Jul-2007  tsutsui branches: 1.6.6;
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.

Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
 1.5 02-Oct-2002  thorpej branches: 1.5.22; 1.5.58; 1.5.64; 1.5.72; 1.5.74; 1.5.76; 1.5.78;
Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2 27-Jul-2001  thorpej branches: 1.2.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.8;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.8.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.1.8.1 03-Aug-2001  lukem update to -current
 1.1.4.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.4.1 12-Jul-2000  bouyer file lpt_jensenio.c was added on branch thorpej_scsipi on 2000-11-20 19:57:03 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file lpt_jensenio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:14 +0000
 1.2.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1 27-Jul-2001  nathanw file lpt_jensenio.c was added on branch nathanw_sa on 2002-10-18 02:34:16 +0000
 1.5.78.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.76.1 07-Aug-2007  matt Sync with HEAD.
 1.5.74.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.5.72.1 03-Oct-2007  garbled Sync with HEAD
 1.5.64.1 20-Aug-2007  ad Sync with HEAD.
 1.5.58.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.5.22.2 17-Mar-2008  yamt sync with head.
 1.5.22.1 03-Sep-2007  yamt sync with head.
 1.6.6.2 23-Mar-2008  matt sync with HEAD
 1.6.6.1 06-Nov-2007  matt sync with HEAD
 1.7.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.7.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.12.1 24-Mar-2008  keiichi sync with head.
 1.8.4.2 11-Mar-2010  yamt sync with head
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.11.16.1 18-May-2014  rmind sync with head
 1.11.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.46.1 13-May-2021  thorpej Sync with HEAD.
 1.12 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.11 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.10 01-Jul-2011  dyoung branches: 1.10.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 29-Mar-2008  tsutsui branches: 1.8.2; 1.8.4;
Don't forget to initialize sc_dev.
 1.7 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.6 17-Oct-2007  garbled branches: 1.6.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.5 21-Jul-2007  tsutsui branches: 1.5.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.4 02-Oct-2002  thorpej branches: 1.4.22; 1.4.64; 1.4.72; 1.4.76; 1.4.78;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.8.1 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.1.6.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.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.4.1 12-Jul-2000  bouyer file mcclock_jensenio.c was added on branch thorpej_scsipi on 2000-11-20 19:57:03 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file mcclock_jensenio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:15 +0000
 1.4.78.1 15-Aug-2007  skrll Sync with HEAD.
 1.4.76.1 07-Aug-2007  matt Sync with HEAD.
 1.4.72.1 03-Oct-2007  garbled Sync with HEAD
 1.4.64.1 20-Aug-2007  ad Sync with HEAD.
 1.4.22.1 03-Sep-2007  yamt sync with head.
 1.5.6.1 06-Nov-2007  matt sync with HEAD
 1.6.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.10.70.1 13-May-2021  thorpej Sync with HEAD.
 1.16 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.15 18-Nov-2020  thorpej branches: 1.15.4;
malloc(9) -> kmem(9)
 1.14 25-Sep-2020  thorpej branches: 1.14.2;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.13 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.12 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.11 06-Feb-2012  matt branches: 1.11.6; 1.11.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 28-Apr-2008  martin branches: 1.10.34; 1.10.38;
Remove clause 3 and 4 from TNF licenses
 1.9 15-Mar-2008  cube branches: 1.9.2; 1.9.4;
Split device_t and softc for pckbc(4) and its attachments.
 1.8 05-Jan-2008  ad branches: 1.8.2; 1.8.6;
Fix includes.
 1.7 03-Dec-2007  ad branches: 1.7.6;
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.6 02-Oct-2002  thorpej branches: 1.6.22; 1.6.64; 1.6.82; 1.6.84; 1.6.90;
Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.3 27-Jul-2001  thorpej branches: 1.3.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.2 12-Jul-2001  thorpej bzero -> memset
 1.1 12-Jul-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.8;
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.8.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.1.8.1 03-Aug-2001  lukem update to -current
 1.1.4.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.4.1 12-Jul-2000  bouyer file pckbc_jensenio.c was added on branch thorpej_scsipi on 2000-11-20 19:57:03 +0000
 1.1.2.2 12-Jul-2000  thorpej Update from trunk:
Code to support the DEC 2000/300 (DECpc AXP 150, a.k.a. "Jensen")
systems. Thanks to Gyenes Istvan for the rounds of testing.
 1.1.2.1 12-Jul-2000  thorpej file pckbc_jensenio.c was added on branch netbsd-1-5 on 2000-07-12 20:59:15 +0000
 1.3.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.1 27-Jul-2001  nathanw file pckbc_jensenio.c was added on branch nathanw_sa on 2002-10-18 02:34:16 +0000
 1.6.90.2 18-Feb-2008  mjf Sync with HEAD.
 1.6.90.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.84.2 23-Mar-2008  matt sync with HEAD
 1.6.84.1 09-Jan-2008  matt sync with HEAD
 1.6.82.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.64.1 03-Dec-2007  ad Sync with HEAD.
 1.6.22.3 17-Mar-2008  yamt sync with head.
 1.6.22.2 21-Jan-2008  yamt sync with head
 1.6.22.1 07-Dec-2007  yamt sync with head
 1.7.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.8.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.8.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.2.1 24-Mar-2008  keiichi sync with head.
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.10.38.1 18-Feb-2012  mrg merge to -current.
 1.10.34.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.10.34.1 17-Apr-2012  yamt sync with head
 1.11.10.1 18-May-2014  rmind sync with head
 1.11.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.15.4.1 13-May-2021  thorpej Sync with HEAD.
 1.26 19-Jun-2023  msaitoh Fix typo. unknwon -> unknown
 1.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 04-Jul-2021  thorpej branches: 1.24.2;
Remove unnecessary #include <sys/malloc.h>
 1.23 24-Apr-2021  thorpej branches: 1.23.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.22 06-Feb-2012  matt branches: 1.22.62;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.21 25-Sep-2011  chs branches: 1.21.2; 1.21.6;
avoid array overrun, noticed by gcc 4.5.
 1.20 09-Jul-2008  joerg - device/softc split
- ANSIfy
 1.19 04-Mar-2007  christos branches: 1.19.40; 1.19.44; 1.19.46; 1.19.48; 1.19.50;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 11-Dec-2005  christos branches: 1.18.26;
merge ktrace-lwp.
 1.17 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.16 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.15 02-Jun-2005  drochner branches: 1.15.2;
add more "const"
 1.14 13-Sep-2004  drochner autoconf cleanup: turn xxxsubmatch() functions into the locator
passing variants
 1.13 01-Jan-2003  thorpej branches: 1.13.2;
Use aprint_normal() for cfprint routines.
 1.12 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.9 26-Sep-2002  thorpej Const poison.
 1.8 02-May-2001  thorpej branches: 1.8.2; 1.8.4;
Determine the size of the B-Cache earier, and initialize the
number of page colors accordingly.
 1.7 16-Nov-1999  mjacob branches: 1.7.6;
Add in a step to actually probe for MCPCIAs. This allows us to run on
4100s that only have two of four possible MCPCIAs.
 1.6 15-Apr-1999  thorpej branches: 1.6.2; 1.6.8;
- Add a comment explaining why we probe for MCPCIAs in the shuffled
MID order.
- Export the shuffled MID order; other files now need it.
- Don't derive the GID from the unit number of the mcbus. A user could
render his kernel non-bootable by using a different unit number in the
kernel config file. We (and the hardware) only support one MCBUS, so
simply use instance 0. Note that this will need to be adjusted if there
are even any multiple-MCBUS systems.
 1.5 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.4 08-Jul-1998  mjacob branches: 1.4.8;
attempt to catch some stuff for ev5 module info
 1.3 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.2 15-Apr-1998  mjacob redo misleading comment (thanks, soren)
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.4.8.2 16-Dec-1999  he Pull up revision 1.7 (requested by mjacob):
Force probing of MCPCIAs such that if they are not there we can
still boot. Not all Alpha 4100 / Rawhide systems have the full
four MCPCIAs.
 1.4.8.1 16-Apr-1999  thorpej branches: 1.4.8.1.2;
Pull up 1.5 -> 1.6.
 1.4.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 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.7.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.3 03-Jan-2003  thorpej Sync with HEAD.
 1.8.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.1 02-May-2001  nathanw file mcbus.c was added on branch nathanw_sa on 2002-10-18 02:34:17 +0000
 1.8.2.1 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.13.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.18.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.50.1 19-Oct-2008  haad Sync with HEAD.
 1.19.48.1 18-Jul-2008  simonb Sync with head.
 1.19.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.44.1 04-May-2009  yamt sync with head.
 1.19.40.1 28-Sep-2008  mjf Sync with HEAD.
 1.21.6.1 18-Feb-2012  mrg merge to -current.
 1.21.2.1 17-Apr-2012  yamt sync with head
 1.22.62.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.22.62.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.23.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.24.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.3 16-Nov-1999  mjacob Add in a define for a MCPCIA bridge register that would be suitable for
probing for with badaddr(9).
 1.2 15-Apr-1998  mjacob branches: 1.2.8; 1.2.14; 1.2.20;
redo misleading comment (thanks, soren)
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.2.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.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.2.8.1 16-Dec-1999  he Pull up revision 1.3 (requested by mjacob):
Force probing of MCPCIAs such that if they are not there we can
still boot. Not all Alpha 4100 / Rawhide systems have the full
four MCPCIAs.
 1.7 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 11-Dec-2005  christos branches: 1.6.112; 1.6.116;
merge ktrace-lwp.
 1.5 13-Sep-2004  drochner autoconf cleanup: turn xxxsubmatch() functions into the locator
passing variants
 1.4 26-Sep-2002  thorpej branches: 1.4.6;
Const poison.
 1.3 15-Apr-1999  thorpej branches: 1.3.14; 1.3.16;
- Add a comment explaining why we probe for MCPCIAs in the shuffled
MID order.
- Export the shuffled MID order; other files now need it.
- Don't derive the GID from the unit number of the mcbus. A user could
render his kernel non-bootable by using a different unit number in the
kernel config file. We (and the hardware) only support one MCBUS, so
simply use instance 0. Note that this will need to be adjusted if there
are even any multiple-MCBUS systems.
 1.2 15-Apr-1998  mjacob branches: 1.2.8;
redo misleading comment (thanks, soren)
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.2.8.1 16-Apr-1999  thorpej branches: 1.2.8.1.2;
Pull up 1.2 -> 1.3.
 1.2.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.16.1 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.3.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.6.116.1 18-Feb-2012  mrg merge to -current.
 1.6.112.1 17-Apr-2012  yamt sync with head
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 09-Jul-2008  joerg branches: 1.5.98;
device/softc split
aprint conversion
 1.4 02-Oct-2002  thorpej branches: 1.4.108; 1.4.112; 1.4.114; 1.4.116; 1.4.118;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 15-Apr-1998  mjacob branches: 1.2.26; 1.2.28;
redo misleading comment (thanks, soren)
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.2.28.1 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.2.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.118.1 19-Oct-2008  haad Sync with HEAD.
 1.4.116.1 18-Jul-2008  simonb Sync with head.
 1.4.114.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.112.1 04-May-2009  yamt sync with head.
 1.4.108.1 28-Sep-2008  mjf Sync with HEAD.
 1.5.98.1 01-Aug-2021  thorpej Sync with HEAD.
 1.25 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.24 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.23 17-May-2011  dyoung branches: 1.23.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.22 15-Dec-2010  matt branches: 1.22.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.21 14-Mar-2009  dsl branches: 1.21.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.18 17-Oct-2007  garbled branches: 1.18.20; 1.18.28; 1.18.34;
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.17 21-Jul-2007  tsutsui branches: 1.17.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.16 11-Dec-2005  christos branches: 1.16.30; 1.16.38; 1.16.42; 1.16.44;
merge ktrace-lwp.
 1.15 30-Aug-2004  drochner branches: 1.15.12;
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.14 15-Jun-2003  fvdl branches: 1.14.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.13 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.12 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.9 12-Jul-2001  thorpej branches: 1.9.2; 1.9.14;
bzero -> memset
 1.8 29-Jun-2000  mrg branches: 1.8.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 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 04-Nov-1999  thorpej branches: 1.5.2;
Allow rd/line, rd/mult, and wr/inval.
 1.4 14-May-1998  thorpej branches: 1.4.14; 1.4.16; 1.4.20;
Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.3 02-Mar-1998  ross Fix attachment message.
 1.2 02-Mar-1998  ross Clean up attachment code and prototypes.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.4.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.16.1 14-Nov-1999  fvdl Sync with -current.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.4.3 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.8.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.1 03-Aug-2001  lukem update to -current
 1.9.14.1 30-May-2002  gehenna Catch up with -current.
 1.9.2.4 03-Jan-2003  thorpej Sync with HEAD.
 1.9.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.9.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.9.2.1 12-Jul-2001  nathanw file a12c.c was added on branch nathanw_sa on 2002-06-20 03:37:39 +0000
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Sep-2004  skrll Sync with HEAD
 1.15.12.1 03-Sep-2007  yamt sync with head.
 1.16.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.16.42.1 07-Aug-2007  matt Sync with HEAD.
 1.16.38.1 03-Oct-2007  garbled Sync with HEAD
 1.16.30.1 20-Aug-2007  ad Sync with HEAD.
 1.17.6.1 06-Nov-2007  matt sync with HEAD
 1.18.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.18.20.1 04-May-2009  yamt sync with head.
 1.21.4.2 31-May-2011  rmind sync with head
 1.21.4.1 05-Mar-2011  rmind sync with head
 1.22.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.23.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.7 14-Mar-2009  dsl branches: 1.7.10;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 17-Apr-2000  drochner branches: 1.5.134; 1.5.142; 1.5.148;
implement bus_space_vaddr()
 1.4 12-Mar-1999  perry branches: 1.4.8;
ovbcopy->memmove
 1.3 23-Sep-1998  ross Track changes elsewhere in the PCI interface.
 1.2 02-Mar-1998  ross Use the more consistent register field names & add ctags(1) keys.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 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.5.148.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.142.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.134.1 04-May-2009  yamt sync with head.
 1.7.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.7 15-Dec-2010  matt branches: 1.7.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 14-Mar-2009  dsl branches: 1.6.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.5 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 28-Apr-2008  martin branches: 1.4.8; 1.4.14;
Remove clause 3 and 4 from TNF licenses
 1.3 29-Jun-2000  mrg branches: 1.3.126; 1.3.128; 1.3.130;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 02-Mar-1998  ross branches: 1.2.14;
Use the more consistent register field names & add ctags(1) keys.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.2.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.3.130.2 04-May-2009  yamt sync with head.
 1.3.130.1 16-May-2008  yamt sync with head.
 1.3.128.1 18-May-2008  yamt sync with head.
 1.3.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.7.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.8 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.7 15-Dec-2010  matt branches: 1.7.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 14-Mar-2009  dsl branches: 1.6.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 29-Jun-2000  mrg branches: 1.3.130; 1.3.138; 1.3.144;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 02-Mar-1998  ross branches: 1.2.14;
Use the more consistent register field names & add ctags(1) keys.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.2.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.3.144.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.138.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.130.1 04-May-2009  yamt sync with head.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.7.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.2 02-Mar-1998  ross branches: 1.2.186;
Support attachment of xb and a12dc, define most of the remaining
core logic register fields.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.2.186.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.6 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.5 14-Mar-2009  dsl branches: 1.5.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 11-Dec-2005  christos branches: 1.4.78; 1.4.86; 1.4.92;
merge ktrace-lwp.
 1.3 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.2 02-Mar-1998  ross branches: 1.2.48;
Support attachment of xb and a12dc, define most of the remaining
core logic register fields.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.2.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.48.1 03-Aug-2004  skrll Sync with HEAD
 1.4.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.78.1 04-May-2009  yamt sync with head.
 1.5.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.4 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.1 16-Sep-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.8; 1.1.24;
Add AGP support (oops, forgot to commit this file with the last batch).
 1.1.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.24.1 03-Aug-2004  skrll Sync with HEAD
 1.1.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.8.1 16-Sep-2001  thorpej file agp_machdep.c was added on branch kqueue on 2002-01-10 19:37:06 +0000
 1.1.4.2 01-Oct-2001  fvdl Catch up with -current.
 1.1.4.1 16-Sep-2001  fvdl file agp_machdep.c was added on branch thorpej-devvp on 2001-10-01 12:37:04 +0000
 1.1.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.2.1 16-Sep-2001  nathanw file agp_machdep.c was added on branch nathanw_sa on 2001-09-21 22:34:58 +0000
 1.60 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.59 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.58 04-Jul-2021  thorpej branches: 1.58.2;
Remove unnecessary #include <sys/malloc.h>
 1.57 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.56 18-Jun-2021  thorpej Sprinkle some static.
 1.55 24-Apr-2021  thorpej branches: 1.55.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.54 06-Feb-2012  matt branches: 1.54.62;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.53 14-Jun-2011  matt branches: 1.53.2; 1.53.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.52 17-May-2011  dyoung branches: 1.52.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.51 15-Dec-2010  matt branches: 1.51.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.50 15-Apr-2010  jakllsch Share some attention with apecs(4).
- Convert to CFATTACH_DECL_NEW().
- Sprinkle static on functions.
- Recycle now-empty-and/or-unused softc structures.
 1.49 14-Mar-2009  dsl branches: 1.49.2; 1.49.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.48 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.47 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.46 28-Apr-2008  martin branches: 1.46.8; 1.46.14;
Remove clause 3 and 4 from TNF licenses
 1.45 11-Dec-2005  christos branches: 1.45.74; 1.45.76; 1.45.78;
merge ktrace-lwp.
 1.44 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.43 15-Jun-2003  fvdl branches: 1.43.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.42 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.41 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.40 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.39 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.38 29-Jun-2000  mrg branches: 1.38.2; 1.38.4; 1.38.16;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.37 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.36 04-Nov-1999  thorpej Allow rd/line, rd/mult, and wr/inval.
 1.35 10-Apr-1999  cgd branches: 1.35.2; 1.35.4; 1.35.8;
be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.34 26-Jun-1998  ross branches: 1.34.10;
New platforms: Mikasa and Mikasa/Pinnacle, aka Pinkasa.

Like the 1000A, the AlphaServer 1000 has a daughtercard assembly that
integrates the CPU and core logic, so these can be ev4/apecs or ev5/cia.
New systype, and, sigh, another way of doing interrupts and another
mystery icu.

Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
all the calls. Duhh.
 1.33 24-Jun-1998  ross Call pci_1000a_pickintr() like on other platforms, but for 1000a expand
the iot, memt, and pc in the call so that pci_1000a_pickintr() (and the
other routines in that module) do not need to be aware of the core logic
type just to pass down memory and I/O space tags or to call the decompose
function.
 1.32 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.31 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.30 29-Apr-1998  thorpej Add support for the DEC EB64+.
 1.29 17-Jan-1998  thorpej Don't assume that we'll be using direct-mapped DMA for PCI.
 1.28 12-Jan-1998  thorpej Adjust for config changes.
 1.27 02-Sep-1997  thorpej Pull in DEC_2100_A50 and DEC_EB64PLUS options.
 1.26 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.25 02-Sep-1997  thorpej Fix oversight in a previous commit.
 1.24 02-Sep-1997  thorpej branches: 1.24.2;
- Garbage-collect all DMA-related initialization, calling a separate
*_dma_init() function instead.
- Pass the appropriate bus dma tag to children.
 1.23 02-Sep-1997  thorpej branches: 1.23.2;
Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.22 10-Apr-1997  cgd branches: 1.22.2;
pass memory- and i/o-enabled flags down via the PCI bus and device attach
arguments, so that a device can tell if its memory and I/O spaces are
enabled. The flags are cleared, depending on the contents of devices CSR
registers, in the machine-independent PCI bus code.
 1.21 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.20 07-Apr-1997  cgd include machine/options.h
 1.19 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.18 06-Apr-1997  cgd clean up some #ifdefs
 1.17 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.16 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.15 25-Nov-1996  cgd branches: 1.15.2;
update for new extent management code. Most importantly, we can't call
the chipset space init functions multiple times, since that would clobber
extent allocations made between the two calls. Also, deal with the
fact that the APECS and LCA no longer shared common chipset functions.
 1.14 11-Nov-1996  cgd clean up some spacing in switch statements
 1.13 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.9 11-Jul-1996  cgd some cleanup for -Wall
 1.8 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.7 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.6 12-Apr-1996  cgd update for new ISA/EISA/PCI and 'bus' interfaces.
 1.5 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.2 03-Aug-1995  cgd move some of the most important configuration code into a seperate
function, so that it can be called from early bus config code.
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.15.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.15.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.15.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.22.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.23.2.2 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.23.2.1 02-Sep-1997  thorpej file apecs.c was added on branch thorpej-bus-dma on 1997-09-02 12:40:19 +0000
 1.24.2.2 02-Sep-1997  thorpej - Garbage-collect all DMA-related initialization, calling a separate
*_dma_init() function instead.
- Pass the appropriate bus dma tag to children.
 1.24.2.1 02-Sep-1997  thorpej file apecs.c was added on branch bouyer-scsipi on 1997-09-02 12:51:21 +0000
 1.34.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.35.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.35.4.1 14-Nov-1999  fvdl Sync with -current.
 1.35.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.38.16.1 30-May-2002  gehenna Catch up with -current.
 1.38.4.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.38.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.38.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.38.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.43.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.43.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.43.2.1 03-Sep-2004  skrll Sync with HEAD
 1.45.78.3 11-Aug-2010  yamt sync with head.
 1.45.78.2 04-May-2009  yamt sync with head.
 1.45.78.1 16-May-2008  yamt sync with head.
 1.45.76.1 18-May-2008  yamt sync with head.
 1.45.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.46.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.46.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.49.4.3 31-May-2011  rmind sync with head
 1.49.4.2 05-Mar-2011  rmind sync with head
 1.49.4.1 30-May-2010  rmind sync with head
 1.49.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.52.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.53.6.1 18-Feb-2012  mrg merge to -current.
 1.53.2.1 17-Apr-2012  yamt sync with head
 1.54.62.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.55.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.58.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 01-Jul-2011  dyoung branches: 1.11.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 29-Jun-2000  mrg branches: 1.9.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 02-Sep-1997  thorpej branches: 1.8.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.6 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.5 10-Apr-1997  cgd branches: 1.5.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.4 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd include machine/options.h
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 25-Nov-1996  cgd branches: 1.1.2;
split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.18.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.9.152.1 05-Mar-2011  rmind sync with head
 1.11.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 01-Jul-2011  dyoung branches: 1.11.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 29-Jun-2000  mrg branches: 1.9.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 02-Sep-1997  thorpej branches: 1.8.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.6 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.5 10-Apr-1997  cgd branches: 1.5.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.4 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd include machine/options.h
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 25-Nov-1996  cgd branches: 1.1.2;
split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.18.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.9.152.1 05-Mar-2011  rmind sync with head
 1.11.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.25 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.24 05-May-2021  thorpej Moar static.
 1.23 11-Oct-2020  thorpej branches: 1.23.6;
Add some bus_dma instrumentation.
 1.22 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.21 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 01-Jul-2011  dyoung branches: 1.20.2; 1.20.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.19 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.18 14-Mar-2009  dsl branches: 1.18.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 19-Jul-2001  thorpej branches: 1.15.2; 1.15.124; 1.15.126; 1.15.128;
APECS has a 256 byte DMA prefetch threshold.
 1.14 03-Jan-2001  thorpej branches: 1.14.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.13 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 14-Aug-1998  thorpej branches: 1.12.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.10 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.9 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.8 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.7 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.6 17-Jan-1998  thorpej Initialize s/g DMA registers in the same order as the CIA chipset's:
(1) window base
(2) window mask
(3) translation base
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Update for "minptalign" argument to alpha_sgmap_init().
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 23-May-1997  thorpej branches: 1.1.2;
file apecs_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.4 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.1.2.3 05-Jun-1997  thorpej When invalidating the SGMAP TLB, do a memory barrier synch before writing
the TBIA register, as well as after.
 1.1.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.1.2.1 23-May-1997  thorpej Add chipset-specific DMA functions. For all of these chipsets, we have
one 1G direct-mapped DMA window at 1G and one 8M SGMAP-mapped DMA window
at 8M.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file apecs_dma.c was added on branch alpha-nwscons on 1997-06-07 04:43:08 +0000
 1.12.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.12.12.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.4.1 03-Aug-2001  lukem update to -current
 1.15.128.2 04-May-2009  yamt sync with head.
 1.15.128.1 16-May-2008  yamt sync with head.
 1.15.126.1 18-May-2008  yamt sync with head.
 1.15.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.2.2 19-Jul-2001  thorpej APECS has a 256 byte DMA prefetch threshold.
 1.15.2.1 19-Jul-2001  thorpej file apecs_dma.c was added on branch nathanw_sa on 2001-07-19 18:39:30 +0000
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.23.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.23.6.1 13-May-2021  thorpej Sync with HEAD.
 1.5 12-Apr-1996  cgd implement APECS and LCA 'bus' functions, and share them between the
two chipsets, since they're the same.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.2 03-Aug-1995  cgd MB -> wbflush
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.6 25-Nov-1996  cgd split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.5 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.3 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement APECS and LCA 'bus' functions, and share them between the
two chipsets, since they're the same.
 1.2.4.1 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.7 25-Nov-1996  cgd split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.6 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.4 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.3 10-Jun-1996  cgd update for new memory window handling in pcs_bus_mem_common.c.
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement APECS and LCA 'bus' functions, and share them between the
two chipsets, since they're the same.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 10-Jun-1996  cgd pull up from trunk:
>update for new memory window handling in pcs_bus_mem_common.c.
 1.28 25-Jun-2021  thorpej Use the default implementations of attach_hook(), bus_maxdevs(),
make_tag(), and decompose_tag().
 1.27 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.26 02-Oct-2015  msaitoh branches: 1.26.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.25 06-Feb-2012  matt branches: 1.25.6; 1.25.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.24 14-Jun-2011  matt branches: 1.24.2; 1.24.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.23 15-Dec-2010  matt branches: 1.23.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.22 14-Mar-2009  dsl branches: 1.22.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.21 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.20 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.19 15-May-2002  thorpej branches: 1.19.116; 1.19.124; 1.19.130;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.18 29-Jun-2000  mrg branches: 1.18.2; 1.18.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.17 29-Jun-1999  ross branches: 1.17.2;
* sprintf -> snprintf
* add a few alpha_mb() ops as called for by folklore and rumour
 1.16 02-Sep-1997  thorpej branches: 1.16.14;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.15 19-Jul-1997  cgd branches: 1.15.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.14 31-May-1997  cgd Adjust gcc -Wuninitialized warning initializers (or add them) so that
compliation without DEBUG and/or DIAGNOSTIC happens without errors.
Note that all such initializations in the Alpha port are marked with "XXX
gcc -Wuninitialized". As far as I'm concerned, the one or two times
-Wuninitialized has saved me from problems are worth the (very minor) cost
involved with the initializations, esp. if it's noted why the
initializations are done. This was prompted by PR#3690, from Ted Lemon.
 1.13 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.12 07-Apr-1997  cgd include machine/options.h
 1.11 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.10 13-Nov-1996  cgd branches: 1.10.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 12-Apr-1996  cgd update for new ISA/EISA/PCI and 'bus' interfaces.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.2 03-Aug-1995  cgd i/o mapping, kill some trash, map cacheable mem in dense PCI mem space
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.10.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.14.1 01-Jul-1999  thorpej Sync w/ -current.
 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.18.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.19.130.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.124.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.116.1 04-May-2009  yamt sync with head.
 1.22.4.1 05-Mar-2011  rmind sync with head
 1.23.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.24.6.1 18-Feb-2012  mrg merge to -current.
 1.24.2.1 17-Apr-2012  yamt sync with head
 1.25.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.25.6.1 03-Dec-2017  jdolecek update from HEAD
 1.26.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.26.34.1 13-May-2021  thorpej Sync with HEAD.
 1.8 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 06-Jun-1997  thorpej branches: 1.7.196; 1.7.200;
Pull thorpej-bus-dma branch into mainline.
 1.6 03-Jun-1997  cgd make REGVAL macros use volatile pointers
 1.5 07-Apr-1997  cgd branches: 1.5.2;
clean up NetBSD RCS ID strings
 1.4 09-Jul-1996  cgd branches: 1.4.2;
clean and update for new defintions, prototypes, etc.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.4.2.3 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.4.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.5.2.1 23-May-1997  thorpej Add DMA-related registers and constants.
 1.7.200.1 18-Feb-2012  mrg merge to -current.
 1.7.196.1 17-Apr-2012  yamt sync with head
 1.12 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.11 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 15-Apr-2010  jakllsch branches: 1.10.8; 1.10.12;
Share some attention with apecs(4).
- Convert to CFATTACH_DECL_NEW().
- Sprinkle static on functions.
- Recycle now-empty-and/or-unused softc structures.
 1.9 14-Mar-2009  dsl branches: 1.9.2; 1.9.4;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.8 02-Sep-1997  thorpej branches: 1.8.158; 1.8.166; 1.8.172;
Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.7 06-Jun-1997  thorpej branches: 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 07-Apr-1997  cgd branches: 1.6.2;
clean up NetBSD RCS ID strings
 1.5 25-Nov-1996  cgd branches: 1.5.2;
update for new extent management code, and for apecs/lca space access fn split
 1.4 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for new ISA/EISA/PCI and 'bus' interfaces.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.6.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.6.2.1 23-May-1997  thorpej Add DMA-related structures.
 1.7.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.172.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.166.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.158.2 11-Aug-2010  yamt sync with head.
 1.8.158.1 04-May-2009  yamt sync with head.
 1.9.4.1 30-May-2010  rmind sync with head
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.12.1 18-Feb-2012  mrg merge to -current.
 1.10.8.1 17-Apr-2012  yamt sync with head
 1.6 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4 12-Apr-1996  cgd branches: 1.4.2;
clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd add indirect register definitions.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd Brooktree bt485 register definitions. should be MI, but didn't want
to shove my names down others' throats (yet).
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.81 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.80 22-May-2022  andvar fix various small typos, mainly in comments.
 1.79 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.78 04-Jul-2021  thorpej branches: 1.78.2;
Remove unnecessary #include <sys/malloc.h>
 1.77 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.76 18-Jun-2021  thorpej Sprinkle some static.
 1.75 24-Apr-2021  thorpej branches: 1.75.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.74 11-Oct-2015  martin branches: 1.74.32;
Felix Deichmann in PR port-alpha/50326: cosmetic patch for Pyxis attach
message.
 1.73 06-Feb-2012  matt branches: 1.73.6; 1.73.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.72 14-Jun-2011  matt branches: 1.72.2; 1.72.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.71 17-May-2011  dyoung branches: 1.71.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.70 15-Dec-2010  matt branches: 1.70.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.69 14-Mar-2009  dsl branches: 1.69.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.68 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.67 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.66 16-Dec-2008  christos branches: 1.66.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.65 28-Apr-2008  martin branches: 1.65.8;
Remove clause 3 and 4 from TNF licenses
 1.64 11-Dec-2005  christos branches: 1.64.26; 1.64.74; 1.64.76; 1.64.78;
merge ktrace-lwp.
 1.63 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.62 15-Jun-2003  fvdl branches: 1.62.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.61 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.60 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.59 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.58 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.57 26-Apr-2001  ross branches: 1.57.2; 1.57.4; 1.57.16;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.56 29-Jun-2000  mrg branches: 1.56.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.55 03-Apr-2000  thorpej Use the new cpu_amask variable rather than calling alpha_implver() and
alpha_amask() ourselves.
 1.54 19-Mar-2000  thorpej Put the code that enables/disables Pyxis interrupt lines in
cia_pyxis_intr_enable().
 1.53 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.52 09-Feb-2000  thorpej Don't force BWX on Pyxis by default; it's just not reliable enough.
 1.51 06-Feb-2000  thorpej If we have a Pyxis with the DMA page crossing bug, don't allow coalescing
of adjacent DMA segments.

XXX This is still not perfect... but making it perfect will probably
require additions to the bus_dma interface and the ISA autoconfiguration
interface.
 1.50 01-Feb-2000  thorpej Always use BWX for bus access on Pyxis chips.
 1.49 04-Nov-1999  thorpej Don't do rd/line, rd/mult, or wr/inval on the buggy Miata 1's.
 1.48 04-Nov-1999  thorpej Tell the PCI layer that Memory Read Line, Memory Read Multiple, and
Memory Write and Invalidate are okay PCI commands to use.
 1.47 10-Apr-1999  cgd branches: 1.47.2; 1.47.8; 1.47.10; 1.47.14;
be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.46 29-Jul-1998  thorpej Split up using BWX for PCI config and bus access. Default to using BWX for
the former, but not the latter. Hopefully, this will address some problems
people have been experiencing w/ some devices on Pyxis systems when BWX
is used for bus access. (If it's not used for PCI config access, we can
get fatal machine checks while probing behind PCI-PCI bridges!!)
 1.45 26-Jun-1998  ross New platforms: Mikasa and Mikasa/Pinnacle, aka Pinkasa.

Like the 1000A, the AlphaServer 1000 has a daughtercard assembly that
integrates the CPU and core logic, so these can be ev4/apecs or ev5/cia.
New systype, and, sigh, another way of doing interrupts and another
mystery icu.

Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
all the calls. Duhh.
 1.44 24-Jun-1998  ross Call pci_1000a_pickintr() like on other platforms, but for 1000a expand
the iot, memt, and pc in the call so that pci_1000a_pickintr() (and the
other routines in that module) do not need to be aware of the core logic
type just to pass down memory and I/O space tags or to call the decompose
function.
 1.43 06-Jun-1998  thorpej - Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
- Display Pyxis revision properly.
 1.42 05-Jun-1998  thorpej - Egads! There are Pyxis "Pass 1" chips that do not have the DMA bug!
Use the check recommended by the Digital Workstation engineers; look
for Miata 1 systems (i.e. with Intel SIO). From Andrew Gallatin.
- Update copyright (Pyxis and BWX).
 1.41 05-Jun-1998  thorpej On Pass 1 Pyxis, disable PCI Read Prefetching, and warn the user about
the DMA bug that exists on this Pyxis revision.
 1.40 05-Jun-1998  thorpej oops, read CNFG on all Pyxis revs.
 1.39 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.38 04-Jun-1998  thorpej For whatever reason, the firmware seems to enable PCI loopback mode if it
also enables BWX. Make sure it's enabled if we have an old, buggy firmware
rev.
 1.37 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.36 03-Jun-1998  thorpej Ok, now we _REALLY_ have Pyxis recognition correct. There are two systypes
that can have Pyxis: EB164 (AlphaPC164LX and AlphaPC164SX) and DEC_550 (Miata),
and these systypes/variations _always_ have Pyxis.
 1.35 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.34 12-May-1998  thorpej Use flags instead of a bunch of booleans. Add a "use bwx" flag.
 1.33 11-May-1998  thorpej Rework ALCOR/ALCOR2/Pyxis recognition Yet Again. (Actually, just the
way it's displayed, and mask off the revision once we've determined
which chip we're talking to.)
 1.32 28-Apr-1998  thorpej Try (again) to get the chip number right for Alcor and Pyxis, using the
following (iffy) hueristic:

CIA revision 1 -> 21171
CIA revision 2 -> 21172
CIA revision > 2 -> 21174
 1.31 12-Feb-1998  thorpej We can't count on the CIA revision register telling us if we're a 21171
or 21172, so make the chip/revsion output a little more sane.
 1.30 17-Jan-1998  thorpej Don't assume that we'll be using direct-mapped DMA for PCI.
 1.29 12-Jan-1998  thorpej Adjust for config changes.
 1.28 27-Oct-1997  thorpej Clean up printing of chipset revision/capabilities.
 1.27 17-Sep-1997  thorpej branches: 1.27.2;
If the CIA revision is >= 2, read the CIA configuration register, and
remember its contents. Print out a bit of information about the chip,
including whether or not it supports the EV56 BWX instructions.
 1.26 02-Sep-1997  thorpej cia_bus_ -> cia_swiz_bus_
 1.25 02-Sep-1997  thorpej Pull in DEC_EB164 and DEC_KN20AA options.
 1.24 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.23 02-Sep-1997  thorpej Fix oversight in a previous commit.
 1.22 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.21 06-Jun-1997  thorpej branches: 1.21.4; 1.21.6;
Pull thorpej-bus-dma branch into mainline.
 1.20 10-Apr-1997  cgd branches: 1.20.2;
pass memory- and i/o-enabled flags down via the PCI bus and device attach
arguments, so that a device can tell if its memory and I/O spaces are
enabled. The flags are cleared, depending on the contents of devices CSR
registers, in the machine-independent PCI bus code.
 1.19 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.18 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.17 06-Apr-1997  cgd clean up some #ifdefs
 1.16 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.15 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.14 25-Nov-1996  cgd branches: 1.14.2;
update for new extent management code. Most importantly, we can't call
the chipset space init functions multiple times, since that would clobber
extent allocations made between the two calls.
 1.13 11-Nov-1996  cgd preliminary support for the EB164. The EB164 is more or less a 'normal'
21164 + 21172 box, with Yet Another Way of doing interrupts. The
interrupt mapping and handling code hasn't been written yet, and none
of this code has been tested. (Checkpoint of work in progress.)
 1.12 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.8 11-Jul-1996  cgd some cleanup for -Wall
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 10-Jun-1996  cgd read value of HAE_MEM and HAE_IO, so that the bus_* functions can
do window recognition correctly.
 1.5 13-Apr-1996  cgd branches: 1.5.4;
update for new ISA/EISA/PCI/'bus' interfaces. Untested
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd partially update for new ISA/EISA/PCI and 'bus' interfaces. not yet
complete, or tested.
 1.2 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.4.1 10-Jun-1996  cgd pull up from trunk:
>read value of HAE_MEM and HAE_IO, so that the bus_* functions can
>do window recognition correctly.
 1.14.2.5 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.14.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.14.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.14.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.20.2.1 23-May-1997  thorpej - Garbage-collect all DMA-related initialization, calling a separate
*_dma_init() function instead.
- Pass the appropriate bus dma tag to children.
 1.21.6.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.21.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.2.1 27-Oct-1997  thorpej Pull up from trunk: Clean up printing of chipset revision/capabilities.
 1.47.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.47.10.1 14-Nov-1999  fvdl Sync with -current.
 1.47.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.47.2.3 07-Feb-2000  he Apply patch (requested by thorpej):
Fix a small oversight in the Miata DMA fix pullups.
 1.47.2.2 06-Feb-2000  he Pull up revision 1.51 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.47.2.1 10-Apr-1999  he file cia.c was added on branch netbsd-1-4 on 2000-02-06 17:29:37 +0000
 1.56.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.57.16.1 30-May-2002  gehenna Catch up with -current.
 1.57.4.4 03-Jan-2003  thorpej Sync with HEAD.
 1.57.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.57.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.57.4.1 26-Apr-2001  nathanw file cia.c was added on branch nathanw_sa on 2002-06-20 03:37:40 +0000
 1.57.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.57.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.62.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.62.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.62.2.1 03-Sep-2004  skrll Sync with HEAD
 1.64.78.2 04-May-2009  yamt sync with head.
 1.64.78.1 16-May-2008  yamt sync with head.
 1.64.76.1 18-May-2008  yamt sync with head.
 1.64.74.2 17-Jan-2009  mjf Sync with HEAD.
 1.64.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.64.26.2 25-Mar-2007  yamt revert rev.1.64.26.1, which was committed mistakenly. pointed by Pavel Cahyna.
 1.64.26.1 24-Mar-2007  yamt initialize ci->ci_schedstate.spc_mutex of APs.
(sched_rqinit is called before APs are attached.)
 1.65.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.65.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.66.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.69.4.2 31-May-2011  rmind sync with head
 1.69.4.1 05-Mar-2011  rmind sync with head
 1.70.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.71.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.72.6.1 18-Feb-2012  mrg merge to -current.
 1.72.2.1 17-Apr-2012  yamt sync with head
 1.73.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.73.6.1 03-Dec-2017  jdolecek update from HEAD
 1.74.32.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.75.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.78.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.11 12-Aug-1997  cgd cia_bus_* -> cia_swiz_bus_*
 1.10 10-Apr-1997  cgd branches: 1.10.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.9 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.8 07-Apr-1997  cgd include machine/options.h
 1.7 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 25-Nov-1996  cgd branches: 1.6.2;
reimplement, so that it works with the new extent mapping code.
 1.5 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.4 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.3 10-Jun-1996  cgd update for changed definitions in ciareg.h
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement 'bus' functions for the CIA chipset.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 10-Jun-1996  cgd pull up from trunk:
>update for changed definitions in ciareg.h.
 1.6.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12 12-Aug-1997  cgd cia_bus_* -> cia_swiz_bus_*
 1.11 10-Apr-1997  cgd branches: 1.11.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.10 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.9 07-Apr-1997  cgd include machine/options.h
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 25-Nov-1996  cgd branches: 1.7.2;
reimplement, so that it works with the new extent mapping code.
 1.6 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.4 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.3 10-Jun-1996  cgd update for changed definitions in ciareg.h
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement 'bus' functions for the CIA chipset.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 10-Jun-1996  cgd pull up from trunk:
>update for changed definitions in ciareg.h.
 1.7.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 01-Jul-2011  dyoung branches: 1.5.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.4 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.3 29-Jun-2000  mrg branches: 1.3.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 02-Dec-1999  thorpej CIA core logic with BWX enabled appears on both EV56 and PCA56. We
require at least EV56 for the assembler to emit BWX opcodes, so set
the arch to "ev56".
 1.1 04-Jun-1998  thorpej branches: 1.1.14; 1.1.20;
Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.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.3.152.1 05-Mar-2011  rmind sync with head
 1.5.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 01-Jul-2011  dyoung branches: 1.5.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.4 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.3 29-Jun-2000  mrg branches: 1.3.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 02-Dec-1999  thorpej CIA core logic with BWX enabled appears on both EV56 and PCA56. We
require at least EV56 for the assembler to emit BWX opcodes, so set
the arch to "ev56".
 1.1 04-Jun-1998  thorpej branches: 1.1.14; 1.1.20;
Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.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.3.152.1 05-Mar-2011  rmind sync with head
 1.5.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.38 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.37 19-Jul-2021  thorpej For CIA/Pyxis and Tsunami/Typhoon/Titan, save the firmware's idea of
the DMA window configuration, and restore it at shutdown time. Make
sure that all assumptions we've made on the firmware's configuration
of DMA windows is correct.
 1.36 18-Jul-2021  thorpej Oops, pass the correct bus_dma_tag_t to the "hi" sgmap init function.
 1.35 17-Jul-2021  thorpej Back in rev 1.21, mhitch@ fixed an issue with his 1.5GB RAM PWS 500au
by using a fall-back to the ISA DMA window if DMA was out of range for
the 1G @ 1G PCI DMA window. Alas, the ISA DMA window is pretty small
(8M @ 8M), and it's possible to starve it with PCI devices that might
have, for example, large control data structures there.

So, instead, if the system has more than 1G of RAM, use Window 3
(previously unused) as a SGMAP window 1G @ 3G, and set that as the
fall-back if the direct-mapped window fails.
 1.34 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.33 18-Jun-2021  thorpej Wrap a couple of long lines.
 1.32 05-May-2021  thorpej Moar static.
 1.31 11-Oct-2020  thorpej branches: 1.31.6;
Add some bus_dma instrumentation.
 1.30 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.29 04-Nov-2013  christos mark variables used
 1.28 06-Feb-2012  matt branches: 1.28.6; 1.28.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.27 01-Jul-2011  dyoung branches: 1.27.2; 1.27.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.26 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.25 18-Mar-2009  cegger branches: 1.25.4;
Ansify function definitions w/o arguments. Generated with sed.
 1.24 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.23 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.22 28-Apr-2008  martin branches: 1.22.8; 1.22.14;
Remove clause 3 and 4 from TNF licenses
 1.21 14-Mar-2007  mhitch branches: 1.21.36; 1.21.38; 1.21.40;
Contrary to the comment in cia_dma_get_tag(), there are machines with cia
that have over 1.0G. Allow direct dma requests to fall back to SGMAPs.
my PWS 500au with 1.5G of memory now works with dma operations.
 1.20 11-Dec-2005  christos branches: 1.20.24; 1.20.26; 1.20.30; 1.20.32;
merge ktrace-lwp.
 1.19 04-Dec-2003  keihan branches: 1.19.14; 1.19.16;
netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.18 19-Jul-2001  thorpej branches: 1.18.2; 1.18.22;
ALCOR/ALCOR2/PYXIS have a 256-byte DMA prefetch threshold.
 1.17 03-Jan-2001  thorpej branches: 1.17.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.16 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.15 06-Feb-2000  thorpej If we have a Pyxis with the DMA page crossing bug, don't allow coalescing
of adjacent DMA segments.

XXX This is still not perfect... but making it perfect will probably
require additions to the bus_dma interface and the ISA autoconfiguration
interface.
 1.14 25-Jan-2000  thorpej Fix a fatal typo in a Pyxis SGMAP TLB bug workaround. Noticed by
Jeff Roberson <nomad@nop.aliensystems.com>.
 1.13 14-Aug-1998  thorpej branches: 1.13.6; 1.13.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.12 23-Jun-1998  thorpej Duuuh! Align the SGMAP page tables to 32K, not 32M.
 1.11 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.10 04-Jun-1998  thorpej Deal with a hardware bug in Pass 1 and Pass 2 Pyxis chips. Basically,
the scatter/gather TLB cannot be invalidated on these chips. So, to
work around this, we configure the otherwise unsed DMA Window 2 as a
2M SGMAP window at 128M, point all of its page table entries at the
DMA spill page, and, when the TLB is to be invalidated, put the PCI bus
into loopback mode, and create a target hit on Window 2 every 64k for
the number of TLB entries (plus a few ... it seems to not work unless
we read a few extra times), forcing out old TLB entries to make room for
the new, dummy target hits.
 1.9 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.8 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.7 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.6 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Fix initialization of DMA window 0:
- Make sure the page table is aligned to at least 32k.
- Don't consider the MEMCS signal when checking for a window hit.
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 23-May-1997  thorpej branches: 1.1.2;
file cia_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.4 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.1.2.3 05-Jun-1997  thorpej When invalidating the SGMAP TLB, do a memory barrier synch before writing
the TBIA register, as well as after.
 1.1.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.1.2.1 23-May-1997  thorpej Add chipset-specific DMA functions. For all of these chipsets, we have
one 1G direct-mapped DMA window at 1G and one 8M SGMAP-mapped DMA window
at 8M.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file cia_dma.c was added on branch alpha-nwscons on 1997-06-07 04:43:14 +0000
 1.13.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.13.12.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.13.6.2 06-Feb-2000  he Pull up revision 1.15 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.13.6.1 31-Jan-2000  he Pull up revision 1.14 (requested by thorpej):
Fix a fatal typo in a Pyxis SGMAP TLB bug workaround.
 1.17.4.1 03-Aug-2001  lukem update to -current
 1.18.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.22.1 03-Aug-2004  skrll Sync with HEAD
 1.18.2.2 19-Jul-2001  thorpej ALCOR/ALCOR2/PYXIS have a 256-byte DMA prefetch threshold.
 1.18.2.1 19-Jul-2001  thorpej file cia_dma.c was added on branch nathanw_sa on 2001-07-19 18:42:43 +0000
 1.19.16.1 03-Sep-2007  yamt sync with head.
 1.19.14.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by mhitch in ticket #1686):
sys/arch/alpha/pci/cia_dma.c: revision 1.21
Contrary to the comment in cia_dma_get_tag(), there are machines with cia
that have over 1.0G. Allow direct dma requests to fall back to SGMAPs.
my PWS 500au with 1.5G of memory now works with dma operations.
 1.20.32.1 11-Jul-2007  mjf Sync with head.
 1.20.30.1 10-Apr-2007  ad Sync with head.
 1.20.26.1 24-Mar-2007  yamt sync with head.
 1.20.24.1 26-Mar-2007  jdc Pull up revision 1.21 (requested by mhitch in ticket #520).

Contrary to the comment in cia_dma_get_tag(), there are machines with cia
that have over 1.0G. Allow direct dma requests to fall back to SGMAPs.
my PWS 500au with 1.5G of memory now works with dma operations.
 1.21.40.2 04-May-2009  yamt sync with head.
 1.21.40.1 16-May-2008  yamt sync with head.
 1.21.38.1 18-May-2008  yamt sync with head.
 1.21.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.4.1 05-Mar-2011  rmind sync with head
 1.27.6.1 18-Feb-2012  mrg merge to -current.
 1.27.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.2.1 17-Apr-2012  yamt sync with head
 1.28.10.1 18-May-2014  rmind sync with head
 1.28.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.31.6.1 13-May-2021  thorpej Sync with HEAD.
 1.2 12-Apr-1996  cgd implement 'bus' functions for the CIA chipset.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.36 11-Sep-2021  andvar sysinst/partitions.h: fix typos comments, also fix same typos in other files.
 1.35 25-Jun-2021  thorpej Use the default implementations of attach_hook(), bus_maxdevs(),
make_tag(), and decompose_tag().
 1.34 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.33 02-Oct-2015  msaitoh branches: 1.33.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.32 06-Feb-2012  matt branches: 1.32.6; 1.32.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.31 14-Jun-2011  matt branches: 1.31.2; 1.31.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.30 15-Dec-2010  matt branches: 1.30.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.29 14-Mar-2009  dsl branches: 1.29.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.28 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.27 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.26 15-May-2002  thorpej branches: 1.26.116; 1.26.124; 1.26.130;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.25 29-Jun-2000  mrg branches: 1.25.2; 1.25.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.24 29-Jun-1999  ross branches: 1.24.2;
* sprintf -> snprintf
* add a few alpha_mb() ops as called for by folklore and rumour
 1.23 29-Jul-1998  thorpej branches: 1.23.10;
Split up using BWX for PCI config and bus access. Default to using BWX for
the former, but not the latter. Hopefully, this will address some problems
people have been experiencing w/ some devices on Pyxis systems when BWX
is used for bus access. (If it's not used for PCI config access, we can
get fatal machine checks while probing behind PCI-PCI bridges!!)
 1.22 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.21 12-May-1998  thorpej Gah, typo.
 1.20 12-May-1998  thorpej Oops, and the writes, too.
 1.19 12-May-1998  thorpej Clean up the code that puts the PCI controller into config mode 1; no
functional difference.
 1.18 14-Oct-1997  cjs Make compile without DIAGNOSTIC set.
 1.17 15-Sep-1997  thorpej In addition to MAS_ABT, check TAR_ABT when doing configuration space
reads. This is necessary because of newer AlphaStation firmware doing
the Wrong Thing with target aborts behind PCI-PCI bridges, much like they
do the Wrong Thing with master aborts. Reported by Matthias Drochner.
 1.16 15-Sep-1997  thorpej Make sure to clear MAS_ABT if we received one.
 1.15 15-Sep-1997  thorpej branches: 1.15.2;
Use the symbolic name for "received master abort".
 1.14 13-Sep-1997  thorpej Apparently, new AlphaStation 500/600 firmware has the same problem with
PCI master aborts as eb164 firmware, so use the same workaround mechanism
on all system types (clear error register's master abort bit, and check
it after accessing configuration space), not just eb164's.

This also fixes a bug on eb164's - when making the Alpha port compile
again, I made an error that caused this to not be used on eb164 systems,
either. Thanks to Matt Jacob for pointing out this goof.
 1.13 02-Sep-1997  thorpej Apply a change made to other PCI chipsets:
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.12 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.11 07-Apr-1997  cgd branches: 1.11.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.10 07-Apr-1997  cgd include machine/options.h
 1.9 07-Apr-1997  cgd clean up eb164 #ifdefs
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 23-Nov-1996  cgd branches: 1.7.2;
deal with the fact that apparently-common revisions of EB164 firmware
don't machine check when a PCI Master Abort is signalled. This can
happen, for instance, when configuration space for a device that isn't
present is examined. When this is detected, act like we normally would
when machine checks are posted while examining nonexistant devices.
 1.6 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 12-Apr-1996  cgd Replace with completely new version derived from APECS code. No serious
bugs to fix (that i know of), just doing it that way was easiest.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.7.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.7.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.7.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.2.5 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.15.2.2 15-Sep-1997  thorpej Use the symbolic name for "received master abort".
 1.15.2.1 15-Sep-1997  thorpej file cia_pci.c was added on branch bouyer-scsipi on 1997-09-15 22:35:55 +0000
 1.23.10.1 01-Jul-1999  thorpej Sync w/ -current.
 1.24.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.26.130.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.124.1 28-Apr-2009  skrll Sync with HEAD.
 1.26.116.1 04-May-2009  yamt sync with head.
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.30.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.31.6.1 18-Feb-2012  mrg merge to -current.
 1.31.2.1 17-Apr-2012  yamt sync with head
 1.32.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.32.6.1 03-Dec-2017  jdolecek update from HEAD
 1.33.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.33.34.1 13-May-2021  thorpej Sync with HEAD.
 1.19 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.18 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.17 01-Jul-2011  dyoung branches: 1.17.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.15 29-Jun-2000  mrg branches: 1.15.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.14 02-Sep-1997  thorpej branches: 1.14.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.13 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.12 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.11 12-Aug-1997  cgd branches: 1.11.2; 1.11.4;
cia_bus_* -> cia_swiz_bus_*
 1.10 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.9 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.8 07-Apr-1997  cgd include machine/options.h
 1.7 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 25-Nov-1996  cgd branches: 1.6.2;
reimplement, so that it works with the new extent mapping code.
 1.5 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.4 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.3 10-Jun-1996  cgd update for changed definitions in ciareg.h
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement 'bus' functions for the CIA chipset.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 10-Jun-1996  cgd pull up from trunk:
>update for changed definitions in ciareg.h.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.4.3 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.2 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 12-Aug-1997  thorpej file cia_swiz_bus_io.c was added on branch marc-pcmcia on 1997-08-23 07:07:04 +0000
 1.11.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.11.2.1 12-Aug-1997  cgd file cia_swiz_bus_io.c was added on branch alpha-nwscons on 1997-08-12 05:56:00 +0000
 1.14.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.152.1 05-Mar-2011  rmind sync with head
 1.17.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.20 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.19 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.18 01-Jul-2011  dyoung branches: 1.18.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.17 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.16 29-Jun-2000  mrg branches: 1.16.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.15 02-Sep-1997  thorpej branches: 1.15.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.14 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.13 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.12 12-Aug-1997  cgd branches: 1.12.2; 1.12.4;
cia_bus_* -> cia_swiz_bus_*
 1.11 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.10 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.9 07-Apr-1997  cgd include machine/options.h
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 25-Nov-1996  cgd branches: 1.7.2;
reimplement, so that it works with the new extent mapping code.
 1.6 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 27-Aug-1996  cgd include <sys/systm.h> for printf prototype
 1.4 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.3 10-Jun-1996  cgd update for changed definitions in ciareg.h
 1.2 12-Apr-1996  cgd branches: 1.2.4;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd implement 'bus' functions for the CIA chipset.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 10-Jun-1996  cgd pull up from trunk:
>update for changed definitions in ciareg.h.
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.4.3 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.4.2 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.4.1 12-Aug-1997  thorpej file cia_swiz_bus_mem.c was added on branch marc-pcmcia on 1997-08-23 07:07:05 +0000
 1.12.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.12.2.1 12-Aug-1997  cgd file cia_swiz_bus_mem.c was added on branch alpha-nwscons on 1997-08-12 05:56:03 +0000
 1.15.18.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.16.152.1 05-Mar-2011  rmind sync with head
 1.18.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.23 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 06-Jun-1998  thorpej branches: 1.22.188; 1.22.192;
Define a REGVAL64() for some Pyxis registers.
 1.21 05-Jun-1998  thorpej What was called CNFG in ALCOR and ALCOR2 is actually called PYXIS_CTRL1
in Pyxis. Add a comment to this fact.
 1.20 05-Jun-1998  thorpej Define the Pyxis-specific bits in the CIA_CSR_REV register (ID mask, and
the ID for the 21174).
 1.19 05-Jun-1998  thorpej Define the Pyxis interrupt request register.
 1.18 04-Jun-1998  thorpej CIA and Pyxis have 8 scatter/gather TLB entries.
 1.17 04-Jun-1998  thorpej Define the CIA control register.
 1.16 03-Jun-1998  thorpej Define the ALT_MEM big in the CIA revision register.
 1.15 12-May-1998  thorpej Clean up the code that puts the PCI controller into config mode 1; no
functional difference.
 1.14 29-Apr-1998  thorpej Define Pyxis Interrupt Mask and General Purpose Output registers.
 1.13 27-Oct-1997  thorpej Clean up printing of chipset revision/capabilities.
 1.12 17-Sep-1997  thorpej branches: 1.12.2;
Define the BWX-capable regions of the CIA chipset's address space (mem,
i/o, pci config space mode 0, pci config space mode 1) and the CIA
REV and CNFG CSRs.
 1.11 15-Sep-1997  thorpej Define bits in the CIA_ERR register.
 1.10 06-Jun-1997  thorpej branches: 1.10.4; 1.10.6;
Pull thorpej-bus-dma branch into mainline.
 1.9 03-Jun-1997  cgd make REGVAL macros use volatile pointers
 1.8 07-Apr-1997  cgd branches: 1.8.2;
clean up NetBSD RCS ID strings
 1.7 23-Nov-1996  cgd branches: 1.7.2;
fix HAE_MEM_REG3_START definition (shift was incorrect). Add CIA_CSR_CIA_ERR
register definition. (should define bits in CIA_CSR_CIA_ERR, but haven't
done that yet.)
 1.6 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.4 13-Jun-1996  cgd clean up copyright notices
 1.3 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.2 09-Jun-1996  cgd add definitions used to figure out how PCI/EISA/ISA memory regions are
mapped.
 1.1 23-Nov-1995  cgd branches: 1.1.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.4.3 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.1.4.2 13-Jun-1996  cgd pull up from trunk:
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.1.4.1 09-Jun-1996  cgd pull up from trunk:
>add definitions used to figure out how PCI/EISA/ISA memory regions are
>mapped.
 1.7.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.7.2.3 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.7.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.2.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.8.2.1 23-May-1997  thorpej Add DMA-related registers and constants.
 1.10.6.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.10.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.1 27-Oct-1997  thorpej Pull up from trunk: Clean up printing of chipset revision/capabilities.
 1.22.192.1 18-Feb-2012  mrg merge to -current.
 1.22.188.1 17-Apr-2012  yamt sync with head
 1.23 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.22 19-Jul-2021  thorpej For CIA/Pyxis and Tsunami/Typhoon/Titan, save the firmware's idea of
the DMA window configuration, and restore it at shutdown time. Make
sure that all assumptions we've made on the firmware's configuration
of DMA windows is correct.
 1.21 17-Jul-2021  thorpej Back in rev 1.21, mhitch@ fixed an issue with his 1.5GB RAM PWS 500au
by using a fall-back to the ISA DMA window if DMA was out of range for
the 1G @ 1G PCI DMA window. Alas, the ISA DMA window is pretty small
(8M @ 8M), and it's possible to starve it with PCI devices that might
have, for example, large control data structures there.

So, instead, if the system has more than 1G of RAM, use Window 3
(previously unused) as a SGMAP window 1G @ 3G, and set that as the
fall-back if the direct-mapped window fails.
 1.20 06-Feb-2012  matt branches: 1.20.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.19 14-Jun-2011  matt branches: 1.19.2; 1.19.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.18 14-Mar-2009  dsl branches: 1.18.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.17 19-Mar-2000  thorpej branches: 1.17.134; 1.17.142; 1.17.148;
Put the code that enables/disables Pyxis interrupt lines in
cia_pyxis_intr_enable().
 1.16 04-Nov-1999  thorpej Don't do rd/line, rd/mult, or wr/inval on the buggy Miata 1's.
 1.15 29-Jul-1998  thorpej branches: 1.15.8; 1.15.14; 1.15.16; 1.15.20;
Split up using BWX for PCI config and bus access. Default to using BWX for
the former, but not the latter. Hopefully, this will address some problems
people have been experiencing w/ some devices on Pyxis systems when BWX
is used for bus access. (If it's not used for PCI config access, we can
get fatal machine checks while probing behind PCI-PCI bridges!!)
 1.14 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.13 12-May-1998  thorpej Use flags instead of a bunch of booleans. Add a "use bwx" flag.
 1.12 11-May-1998  thorpej Rework ALCOR/ALCOR2/Pyxis recognition Yet Again. (Actually, just the
way it's displayed, and mask off the revision once we've determined
which chip we're talking to.)
 1.11 17-Sep-1997  thorpej If the CIA revision is >= 2, read the CIA configuration register, and
remember its contents. Print out a bit of information about the chip,
including whether or not it supports the EV56 BWX instructions.
 1.10 02-Sep-1997  thorpej cia_bus_ -> cia_swiz_bus_
 1.9 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.8 06-Jun-1997  thorpej branches: 1.8.4; 1.8.6;
Pull thorpej-bus-dma branch into mainline.
 1.7 07-Apr-1997  cgd branches: 1.7.2;
clean up NetBSD RCS ID strings
 1.6 25-Nov-1996  cgd branches: 1.6.2;
update for new extent management code
 1.5 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.4 10-Jun-1996  cgd store HAE_MEM and HAE_IO register contents in the cia configuration
structure, and add prototypes for the bus_{mem,io}_init() functions.
 1.3 12-Apr-1996  cgd branches: 1.3.4;
clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd partially update for new ISA/EISA/PCI and 'bus' interfaces. not yet
complete, or tested.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.4.1 10-Jun-1996  cgd pull up from trunk:
>store HAE_MEM and HAE_IO register contents in the cia configuration
>structure, and add prototypes for the bus_{mem,io}_init() functions.
 1.6.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.6.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.3 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.7.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.7.2.1 23-May-1997  thorpej Add DMA-related structures.
 1.8.6.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.8.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.16.1 14-Nov-1999  fvdl Sync with -current.
 1.15.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.15.8.1 07-Feb-2000  he Apply patch (requested by thorpej):
Fix a small oversight in the Miata DMA fix pullups.
 1.17.148.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.142.1 28-Apr-2009  skrll Sync with HEAD.
 1.17.134.1 04-May-2009  yamt sync with head.
 1.18.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.19.6.1 18-Feb-2012  mrg merge to -current.
 1.19.2.1 17-Apr-2012  yamt sync with head
 1.20.64.1 01-Aug-2021  thorpej Sync with HEAD.
 1.43 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.42 19-Jun-2021  thorpej branches: 1.42.2;
Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.41 19-Jun-2021  thorpej Remove the "first" argument from pci_kn8ae_pickintr(), instead using
a real once control in that function. Removes a needless divergence from
other "pickintr" routines.
 1.40 24-Apr-2021  thorpej branches: 1.40.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.39 25-Sep-2020  thorpej branches: 1.39.4;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.38 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.37 14-Jun-2011  matt branches: 1.37.2; 1.37.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.36 17-May-2011  dyoung branches: 1.36.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.35 15-Dec-2010  matt branches: 1.35.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.34 14-Mar-2009  dsl branches: 1.34.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.33 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.32 04-Mar-2007  christos branches: 1.32.44; 1.32.52; 1.32.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 11-Dec-2005  christos branches: 1.31.26;
merge ktrace-lwp.
 1.30 04-Nov-2004  ragge branches: 1.30.12;
Make match() fail if this is not a DWLPX (i.e a DWLMA).
XXX - DWL* type should be checked in kftxx.c.
This avoids a panic if the device is not a DWLPX.
 1.29 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.28 15-Jun-2003  fvdl branches: 1.28.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.27 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.26 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.25 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.24 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.23 27-Jul-2001  thorpej branches: 1.23.2; 1.23.14;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.22 29-Jun-2000  mrg branches: 1.22.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.21 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.20 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.19 04-Nov-1999  thorpej branches: 1.19.2;
Allow rd/line, rd/mult, and wr/inval.
 1.18 12-Feb-1999  thorpej branches: 1.18.8; 1.18.10; 1.18.14;
Fix printf format problems on Alpha.
 1.17 06-Jun-1998  thorpej Remove some debugging code no longer relevant now that we have DMA
window chaining.
 1.16 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.15 26-Mar-1998  thorpej Remove references to pmap.old.h - It should have just been pmap.h, but
that isn't necessary, either, since <vm/vm.h> is already included.
 1.14 23-Mar-1998  mjacob Do a more complete job of figuring out what kind of DWLP? we have- figure
out how much s/g ram is available. Can't really use the 128K entry S/G
ram yet- but I'll fix that later. More importantly, add in a dwlpx_iointr
handler that will try and figure out what the DWLPX error is and at
least print out what is happening- I actually found it useful in S/G
entry debugging as it could tell me that I had some bad S/G entries.
 1.13 12-Jan-1998  thorpej Adjust for config changes.
 1.12 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.11 02-Sep-1997  thorpej Fix oversight in a previous commit.
 1.10 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.9 16-Aug-1997  mjacob It helps streaming performance substantially to enable bursts and more up hose
packets. It's not clear whether latency will be affected much. It could be.
However, for the time being, getting full rates out of HIPPI or SCSI are what
interests us at NASA, so we'll hew to this bias.
 1.8 08-Jun-1997  thorpej branches: 1.8.4;
Add code to decode the PCIA_RESENT register. Display information on
the PCIA revision, and whether or not the STD I/O EISA bridge is
present. Decode, but don't bother displaying, the power consumption
information for each PCI slot.
 1.7 08-Jun-1997  thorpej Don't print the hose number here; that's done in kftprint().
 1.6 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.5 10-Apr-1997  cgd branches: 1.5.2; 1.5.4;
pass memory- and i/o-enabled flags down via the PCI bus and device attach
arguments, so that a device can tell if its memory and I/O spaces are
enabled. The flags are cleared, depending on the contents of devices CSR
registers, in the machine-independent PCI bus code.
 1.4 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.5.4.4 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.5.4.3 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.5.4.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.1 10-Apr-1997  cgd file dwlpx.c was added on branch alpha-nwscons on 1997-06-01 04:13:11 +0000
 1.5.2.1 23-May-1997  thorpej - Garbage-collect all DMA-related initialization, calling a separate
*_dma_init() function instead.
- Pass the appropriate bus dma tag to children.
 1.8.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.10.1 14-Nov-1999  fvdl Sync with -current.
 1.18.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.19.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.22.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.4.1 03-Aug-2001  lukem update to -current
 1.23.14.1 30-May-2002  gehenna Catch up with -current.
 1.23.2.4 03-Jan-2003  thorpej Sync with HEAD.
 1.23.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.23.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.23.2.1 27-Jul-2001  nathanw file dwlpx.c was added on branch nathanw_sa on 2002-06-20 03:37:40 +0000
 1.28.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Sep-2004  skrll Sync with HEAD
 1.30.12.1 03-Sep-2007  yamt sync with head.
 1.31.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.44.1 04-May-2009  yamt sync with head.
 1.34.4.2 31-May-2011  rmind sync with head
 1.34.4.1 05-Mar-2011  rmind sync with head
 1.35.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.37.6.1 18-Feb-2012  mrg merge to -current.
 1.37.2.1 17-Apr-2012  yamt sync with head
 1.39.4.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.40.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.42.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.16 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.15 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.14 01-Jul-2011  dyoung branches: 1.14.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.13 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.12 29-Jun-2000  mrg branches: 1.12.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 02-Sep-1997  thorpej branches: 1.11.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.10 02-Sep-1997  thorpej Garbage-collect.
 1.9 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.8 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.7 11-Apr-1997  cgd branches: 1.7.2; 1.7.6;
provide a way for chipsets which can have multiple instances to force
a seperate chipset structure to be allocated for each.
 1.6 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.5 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.4 07-Apr-1997  cgd include machine/options.h
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.7.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 11-Apr-1997  cgd file dwlpx_bus_io.c was added on branch alpha-nwscons on 1997-06-01 04:13:12 +0000
 1.11.18.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.152.1 05-Mar-2011  rmind sync with head
 1.14.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.16 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.15 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.14 01-Jul-2011  dyoung branches: 1.14.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.13 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.12 29-Jun-2000  mrg branches: 1.12.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 02-Sep-1997  thorpej branches: 1.11.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.10 02-Sep-1997  thorpej Garbage-collect.
 1.9 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.8 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.7 11-Apr-1997  cgd branches: 1.7.2; 1.7.6;
provide a way for chipsets which can have multiple instances to force
a seperate chipset structure to be allocated for each.
 1.6 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.5 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.4 07-Apr-1997  cgd include machine/options.h
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.7.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 11-Apr-1997  cgd file dwlpx_bus_mem.c was added on branch alpha-nwscons on 1997-06-01 04:13:13 +0000
 1.11.18.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.152.1 05-Mar-2011  rmind sync with head
 1.14.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.30 19-Jun-2021  thorpej No need to include pci_kn8ae.h here.
 1.29 05-May-2021  thorpej Moar static.
 1.28 18-Nov-2020  thorpej branches: 1.28.4;
malloc(9) -> kmem(9)
 1.27 11-Oct-2020  thorpej branches: 1.27.2;
Add some bus_dma instrumentation.
 1.26 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.25 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.24 21-Mar-2014  christos branches: 1.24.30;
gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.23 06-Feb-2012  matt branches: 1.23.6; 1.23.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 01-Jul-2011  dyoung branches: 1.22.2; 1.22.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.21 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.20 15-Dec-2010  matt branches: 1.20.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.19 14-Mar-2009  dsl branches: 1.19.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.18 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.17 28-Apr-2008  martin branches: 1.17.8; 1.17.14;
Remove clause 3 and 4 from TNF licenses
 1.16 19-Jul-2001  thorpej branches: 1.16.2; 1.16.124; 1.16.126; 1.16.128;
DWLPx has a 256-byte DMA prefetch threshold.
 1.15 03-Jan-2001  thorpej branches: 1.15.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.14 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 06-Apr-1999  pk branches: 1.13.2;
Fix garbled words in copyright statement.
 1.12 01-Sep-1998  thorpej branches: 1.12.6;
Nuke an unused variable.
 1.11 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.10 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.9 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.8 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.7 23-Mar-1998  mjacob Redo it slightly so that S/G now appears to work a bit better. This
version has 2GB direct map starting at 2GB, and either 256MB or 1GB
S/G starting at 1MB. I've done *some* testing on this, but I'm not
quite happy with it yet.
 1.6 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Update for "minptalign" argument to alpha_sgmap_init().
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 23-May-1997  thorpej branches: 1.1.2;
file dwlpx_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.4 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.1.2.3 05-Jun-1997  thorpej Oops, convert page table address (phys) to a K0SEG address that the CPU
can use. Rearrange slightly to make it less easy to screw this up.
 1.1.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
- Add support for sgmap-mapped DMA on the DWLPx.
 1.1.2.1 23-May-1997  thorpej Add chipset-specific DMA functions. For all of these chipsets, we have
one 1G direct-mapped DMA window at 1G and one 8M SGMAP-mapped DMA window
at 8M.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file dwlpx_dma.c was added on branch alpha-nwscons on 1997-06-07 04:43:21 +0000
 1.12.6.1 07-Apr-1999  pk branches: 1.12.6.1.2;
Pull up from trunk: copyright text warts.
 1.12.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.4.1 03-Aug-2001  lukem update to -current
 1.16.128.2 04-May-2009  yamt sync with head.
 1.16.128.1 16-May-2008  yamt sync with head.
 1.16.126.1 18-May-2008  yamt sync with head.
 1.16.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.2.2 19-Jul-2001  thorpej DWLPx has a 256-byte DMA prefetch threshold.
 1.16.2.1 19-Jul-2001  thorpej file dwlpx_dma.c was added on branch nathanw_sa on 2001-07-19 18:59:42 +0000
 1.17.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.20.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.6.1 18-Feb-2012  mrg merge to -current.
 1.22.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.2.1 17-Apr-2012  yamt sync with head
 1.23.10.1 18-May-2014  rmind sync with head
 1.23.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.27.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.28.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.28.4.1 13-May-2021  thorpej Sync with HEAD.
 1.21 25-Jun-2021  thorpej Use the default implementation of attach_hook().
 1.20 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.19 02-Oct-2015  msaitoh branches: 1.19.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.18 06-Feb-2012  matt branches: 1.18.6; 1.18.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.17 14-Jun-2011  matt branches: 1.17.2; 1.17.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.16 15-Dec-2010  matt branches: 1.16.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.15 14-Mar-2009  dsl branches: 1.15.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.14 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.13 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.12 04-Mar-2007  christos branches: 1.12.44; 1.12.52; 1.12.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 27-Sep-2002  provos branches: 1.11.22; 1.11.60;
remove trailing \n in panic(). approved perry.
 1.10 29-Jun-2000  mrg branches: 1.10.2; 1.10.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 15-Apr-1998  mjacob branches: 1.9.14;
oops on byte enables for TurboLaser systems
 1.8 02-Sep-1997  thorpej branches: 1.8.4;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 16-Aug-1997  mjacob a minor bit of cleanup
 1.6 07-Apr-1997  cgd branches: 1.6.2; 1.6.6;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 15-Mar-1997  cgd patch from Matt Jacob to enable secondary PCI bus support
 1.3 13-Mar-1997  cgd fix from Matt Jacob: configuration accesses need PCI Byte enables just
like sparse memory accesses do.
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.6.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.6.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.1 07-Apr-1997  cgd file dwlpx_pci.c was added on branch alpha-nwscons on 1997-06-01 04:13:14 +0000
 1.8.4.1 04-Nov-1998  cgd pull up rev 1.9 from trunk (mjacob)
 1.9.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.10.4.1 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.10.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.11.60.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.22.1 03-Sep-2007  yamt sync with head.
 1.12.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.44.1 04-May-2009  yamt sync with head.
 1.15.4.1 05-Mar-2011  rmind sync with head
 1.16.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.18.6.1 03-Dec-2017  jdolecek update from HEAD
 1.19.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.19.34.1 13-May-2021  thorpej Sync with HEAD.
 1.11 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 17-May-2006  drochner branches: 1.10.100; 1.10.104;
Define some fixed bus addresses as "Unsigned Long" instead of
"Long Long" -- gcc4 propagates the "long long" along the way and
complains about mismatches to "long".
This is the same on alpha, but the conflict is unnecessary, so avoid it.
 1.9 21-Mar-1998  mjacob branches: 1.9.64; 1.9.78; 1.9.80; 1.9.82; 1.9.86;
add some error defintions
 1.8 16-Aug-1997  mjacob Add some PCIA_CTL defines.
 1.7 08-Jun-1997  thorpej branches: 1.7.4;
Add bit definitions for the PCIA_PRESENT register.
 1.6 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.5 03-Jun-1997  cgd make REGVAL macros use volatile pointers
 1.4 16-Apr-1997  mjacob branches: 1.4.2; 1.4.4;
clarify a comment slightly.
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.4.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.4.4.1 03-Jun-1997  thorpej Add a bunch of DMA-related constants and bits, etc.
 1.4.2.5 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.4.2.3 06-Jun-1997  cgd sync nwscons with trunk
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 16-Apr-1997  cgd file dwlpxreg.h was added on branch alpha-nwscons on 1997-06-01 04:13:15 +0000
 1.7.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.86.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.82.1 24-May-2006  yamt sync with head.
 1.9.80.1 01-Jun-2006  kardel Sync with head.
 1.9.78.1 09-Sep-2006  rpaulo sync with head
 1.9.64.1 21-Jun-2006  yamt sync with head.
 1.10.104.1 18-Feb-2012  mrg merge to -current.
 1.10.100.1 17-Apr-2012  yamt sync with head
 1.12 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.11 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 14-Jun-2011  matt branches: 1.10.2; 1.10.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.9 14-Mar-2009  dsl branches: 1.9.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.8 27-Jul-2001  thorpej branches: 1.8.2; 1.8.128; 1.8.136; 1.8.142;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.7 15-Apr-1998  mjacob branches: 1.7.28;
removal of unneeded define
 1.6 23-Mar-1998  mjacob Prepare for handling multisized S/G maps. Specify dwlpx_iointr function.
 1.5 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.4 06-Jun-1997  thorpej branches: 1.4.4;
Pull thorpej-bus-dma branch into mainline.
 1.3 07-Apr-1997  cgd branches: 1.3.2; 1.3.4;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.4.3 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.3.4.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.4.1 07-Apr-1997  cgd file dwlpxvar.h was added on branch alpha-nwscons on 1997-06-01 04:13:16 +0000
 1.3.2.3 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.3.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.3.2.1 23-May-1997  thorpej Add DMA-related structures.
 1.4.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.28.1 03-Aug-2001  lukem update to -current
 1.8.142.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.136.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.128.1 04-May-2009  yamt sync with head.
 1.8.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.8.2.1 27-Jul-2001  thorpej file dwlpxvar.h was added on branch nathanw_sa on 2001-07-27 00:25:21 +0000
 1.9.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.6 24-Sep-1998  ross Move if_ade* from alpha/pci/ to alpha/a12/
 1.5 23-Sep-1998  ross Update for vm_offset_t, vaddr_t sweep.
 1.4 31-Aug-1998  cgd kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)
 1.3 05-Jul-1998  jonathan defopt NS, NSIP.
 1.2 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.1 31-Jan-1998  ross Add the A12 fast ethernet controller, an if_de.c hacked (prior to
bus_dma's appearance in the tree) to support sram bounce buffers.
When a busified if_de.c appears, this module can join awd.c at the
end of that long walk on a short pier.
 1.3 24-Sep-1998  ross Move if_ade* from alpha/pci/ to alpha/a12/
 1.2 23-Sep-1998  ross Update for vm_offset_t, vaddr_t sweep.
 1.1 31-Jan-1998  ross Add the A12 fast ethernet controller, an if_de.c hacked (prior to
bus_dma's appearance in the tree) to support sram bounce buffers.
When a busified if_de.c appears, this module can join awd.c at the
end of that long walk on a short pier.
 1.22 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.21 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.20 04-Jul-2021  thorpej branches: 1.20.2;
Remove unnecessary #include <sys/malloc.h>
 1.19 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.18 18-Jun-2021  thorpej Sprinkle some static.
 1.17 24-Apr-2021  thorpej branches: 1.17.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.16 14-Jun-2011  matt branches: 1.16.68;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.15 17-May-2011  dyoung branches: 1.15.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.14 28-Apr-2008  martin branches: 1.14.22; 1.14.28;
Remove clause 3 and 4 from TNF licenses
 1.13 11-Dec-2005  christos branches: 1.13.74; 1.13.76; 1.13.78;
merge ktrace-lwp.
 1.12 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.11 15-Jun-2003  fvdl branches: 1.11.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.10 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.6 06-Oct-2001  thorpej branches: 1.6.10;
Don't forget to fill in the DMA tag when attaching the AGP
controller.
 1.5 15-Sep-2001  thorpej Oops, don't need to fill in pcibus_attach_args twice.
 1.4 15-Sep-2001  thorpej Attach "agp" to the AMD-751 PCI host controller (Alpha UP1000/UP1100).
 1.3 29-Nov-2000  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Do the additional PCI memory initialization after configuring DMA.
 1.2 26-Jun-2000  thorpej branches: 1.2.2;
Do the previously slightly differently, to avoid confusing the internal
space extent maps. Pointed out by msaitoh@netbsd.org. (Someone should
send me an EV6 machine!)
 1.1 01-Jun-2000  thorpej branches: 1.1.2; 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongate.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:38 +0000
 1.1.2.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.2.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.2.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.2.2.1 26-Jun-2000  bouyer file irongate.c was added on branch thorpej_scsipi on 2000-11-20 19:57:08 +0000
 1.3.6.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.3.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.3 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.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.5 03-Jan-2003  thorpej Sync with HEAD.
 1.3.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.2 22-Oct-2001  nathanw Catch up to -current.
 1.3.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.6.10.1 30-May-2002  gehenna Catch up with -current.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Sep-2004  skrll Sync with HEAD
 1.13.78.1 16-May-2008  yamt sync with head.
 1.13.76.1 18-May-2008  yamt sync with head.
 1.13.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.22.1 31-May-2011  rmind sync with head
 1.15.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.16.68.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.17.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.20.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.9 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.8 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.7 01-Jul-2011  dyoung branches: 1.7.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.6 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.5 28-Apr-2008  martin branches: 1.5.22;
Remove clause 3 and 4 from TNF licenses
 1.4 29-Jun-2000  mrg branches: 1.4.2; 1.4.128; 1.4.130; 1.4.132;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 26-Jun-2000  thorpej Garbage-collect CHIP_PHYSADDR().
 1.2 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.1 01-Jun-2000  thorpej branches: 1.1.2; 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongate_bus_io.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:38 +0000
 1.1.2.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 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.4.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.4.2.1 29-Jun-2000  bouyer file irongate_bus_io.c was added on branch thorpej_scsipi on 2000-11-20 19:57:09 +0000
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.7.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 06-Feb-2012  matt branches: 1.11.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 01-Jul-2011  dyoung branches: 1.10.2; 1.10.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.9 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.8 28-Apr-2008  martin branches: 1.8.22;
Remove clause 3 and 4 from TNF licenses
 1.7 17-Apr-2001  thorpej branches: 1.7.4; 1.7.126; 1.7.128; 1.7.130;
- Get rid of the prot bits in the mem_clusters[] array when
reserving RAM in the bus_mem extent map. Problem pointed
out by Artur Grabowski.
- Work around a slightly annoying bit of behavior exhibited by
the UP1000 firmware. The UP1000 firmware reports the space
consumed by the "ISA hole" in the same MDDT entry as two
chunks of RAM (on either side of the hole) used by the PALcode,
all as one "reserved for PALcode" chunk. We must take this
into account when reserving RAM in the bus_mem extent map.
 1.6 29-Nov-2000  thorpej branches: 1.6.2;
Do the additional PCI memory initialization after configuring DMA.
 1.5 29-Nov-2000  thorpej The AMD 751 doesn't have DMA windows, so allocate the RAM out of the
PCI memory extent map. Bad things will happen if we try to assign
a device where RAM is mapped into PCI space.
 1.4 29-Jun-2000  mrg branches: 1.4.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 26-Jun-2000  thorpej Garbage-collect CHIP_PHYSADDR().
 1.2 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.1 01-Jun-2000  thorpej branches: 1.1.2; 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongate_bus_mem.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:38 +0000
 1.1.2.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.4.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.4.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.4.2.1 29-Jun-2000  bouyer file irongate_bus_mem.c was added on branch thorpej_scsipi on 2000-11-20 19:57:09 +0000
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.130.1 16-May-2008  yamt sync with head.
 1.7.128.1 18-May-2008  yamt sync with head.
 1.7.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.4.2 17-Apr-2001  thorpej - Get rid of the prot bits in the mem_clusters[] array when
reserving RAM in the bus_mem extent map. Problem pointed
out by Artur Grabowski.
- Work around a slightly annoying bit of behavior exhibited by
the UP1000 firmware. The UP1000 firmware reports the space
consumed by the "ISA hole" in the same MDDT entry as two
chunks of RAM (on either side of the hole) used by the PALcode,
all as one "reserved for PALcode" chunk. We must take this
into account when reserving RAM in the bus_mem extent map.
 1.7.4.1 17-Apr-2001  thorpej file irongate_bus_mem.c was added on branch nathanw_sa on 2001-04-17 21:52:01 +0000
 1.8.22.1 05-Mar-2011  rmind sync with head
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.64.1 01-Aug-2021  thorpej Sync with HEAD.
 1.10 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.9 05-May-2021  thorpej Moar static.
 1.8 14-Oct-2020  thorpej branches: 1.8.6;
Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.7 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.6 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.5 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.4 28-Apr-2008  martin branches: 1.4.22;
Remove clause 3 and 4 from TNF licenses
 1.3 29-Jun-2000  mrg branches: 1.3.2; 1.3.128; 1.3.130; 1.3.132;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 11-Jun-2000  thorpej branches: 1.2.4;
G/c some unneeded prototypes (functions don't exist).
 1.1 01-Jun-2000  thorpej Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.2.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.4.1 11-Jun-2000  minoura file irongate_dma.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:39 +0000
 1.3.132.1 16-May-2008  yamt sync with head.
 1.3.130.1 18-May-2008  yamt sync with head.
 1.3.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.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.3.2.1 29-Jun-2000  bouyer file irongate_dma.c was added on branch thorpej_scsipi on 2000-11-20 19:57:09 +0000
 1.4.22.1 05-Mar-2011  rmind sync with head
 1.8.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.8.6.1 13-May-2021  thorpej Sync with HEAD.
 1.13 03-Apr-2024  thorpej Add a missing barrier in irongate_conf_read0().
 1.12 25-Jun-2021  thorpej branches: 1.12.10;
Use the default implementations of attach_hook(), bus_maxdevs(),
make_tag(), and decompose_tag().
 1.11 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.10 02-Oct-2015  msaitoh branches: 1.10.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.9 06-Feb-2012  matt branches: 1.9.6; 1.9.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 14-Jun-2011  matt branches: 1.8.2; 1.8.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.7 15-Dec-2010  matt branches: 1.7.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 14-Mar-2009  dsl branches: 1.6.4;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.14;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.74; 1.4.76; 1.4.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 15-Sep-2001  thorpej branches: 1.3.34;
Only filter out the PCI_ID_REG in irongate_conf_read().
 1.2 29-Jun-2000  mrg branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 01-Jun-2000  thorpej branches: 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongate_pci.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:39 +0000
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.2.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.2.2.1 29-Jun-2000  bouyer file irongate_pci.c was added on branch thorpej_scsipi on 2000-11-20 19:57:09 +0000
 1.3.34.1 21-Jun-2006  yamt sync with head.
 1.4.78.2 04-May-2009  yamt sync with head.
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.7.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.6.1 18-Feb-2012  mrg merge to -current.
 1.8.2.1 17-Apr-2012  yamt sync with head
 1.9.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.6.1 03-Dec-2017  jdolecek update from HEAD
 1.10.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.10.34.1 13-May-2021  thorpej Sync with HEAD.
 1.12.10.1 16-Apr-2024  martin Pull up following revision(s) (requested by thorpej in ticket #652):

sys/arch/alpha/pci/irongate_pci.c: revision 1.13

Add a missing barrier in irongate_conf_read0().
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 26-Jun-2000  thorpej branches: 1.2.2; 1.2.128; 1.2.130; 1.2.132;
Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.1 01-Jun-2000  thorpej branches: 1.1.2; 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongatereg.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:39 +0000
 1.1.2.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.2.132.1 16-May-2008  yamt sync with head.
 1.2.130.1 18-May-2008  yamt sync with head.
 1.2.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.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.2.2.1 26-Jun-2000  bouyer file irongatereg.h was added on branch thorpej_scsipi on 2000-11-20 19:57:10 +0000
 1.8 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.7 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.6 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 14-Jun-2011  matt branches: 1.5.2; 1.5.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.4 28-Apr-2008  martin branches: 1.4.32;
Remove clause 3 and 4 from TNF licenses
 1.3 29-Nov-2000  thorpej branches: 1.3.126; 1.3.128; 1.3.130;
Do the additional PCI memory initialization after configuring DMA.
 1.2 18-Nov-2000  thorpej branches: 1.2.2;
Duh, don't need SGMAP-related includes on this chipset.
 1.1 01-Jun-2000  thorpej branches: 1.1.4;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file irongatevar.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:39 +0000
 1.2.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.2.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.2.2.1 18-Nov-2000  bouyer file irongatevar.h was added on branch thorpej_scsipi on 2000-11-20 19:57:10 +0000
 1.3.130.1 16-May-2008  yamt sync with head.
 1.3.128.1 18-May-2008  yamt sync with head.
 1.3.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.5.6.1 18-Feb-2012  mrg merge to -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.58 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.57 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.56 16-Jul-2021  thorpej branches: 1.56.2;
On LCA45 systems, look at the memory controller's Bcache configuration
to initialize uvmexp.ncolors rather than hard-coding a value per model
(some models can have more than one configuration).
 1.55 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.54 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.53 18-Jun-2021  thorpej Sprinkle some static.
 1.52 24-Apr-2021  thorpej branches: 1.52.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.51 06-Feb-2012  matt branches: 1.51.62;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.50 14-Jun-2011  matt branches: 1.50.2; 1.50.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.49 17-May-2011  dyoung branches: 1.49.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.48 15-Dec-2010  matt branches: 1.48.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.47 14-Mar-2009  dsl branches: 1.47.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.46 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.45 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.44 28-Apr-2008  martin branches: 1.44.8; 1.44.14;
Remove clause 3 and 4 from TNF licenses
 1.43 11-Dec-2005  christos branches: 1.43.74; 1.43.76; 1.43.78;
merge ktrace-lwp.
 1.42 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.41 15-Jun-2003  fvdl branches: 1.41.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.40 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.39 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.38 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.37 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.36 29-Jun-2000  mrg branches: 1.36.2; 1.36.4; 1.36.16;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.35 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.34 04-Nov-1999  thorpej Allow rd/line, rd/mult, and wr/inval.
 1.33 10-Apr-1999  cgd branches: 1.33.2; 1.33.4; 1.33.8;
be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.32 27-Jun-1998  thorpej branches: 1.32.10;
Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.31 27-Jun-1998  thorpej Oops, forgot option header.
 1.30 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.29 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.28 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.27 17-Jan-1998  thorpej Don't assume that we'll be using direct-mapped DMA for PCI.
 1.26 12-Jan-1998  thorpej Adjust for config changes.
 1.25 02-Sep-1997  thorpej Fix a typo.
 1.24 02-Sep-1997  thorpej Pull in DEC_AXPPCI_33 option.
 1.23 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.22 02-Sep-1997  thorpej Fix oversight in a previous commit.
 1.21 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.20 06-Jun-1997  thorpej branches: 1.20.4;
Pull thorpej-bus-dma branch into mainline.
 1.19 10-Apr-1997  cgd branches: 1.19.2;
pass memory- and i/o-enabled flags down via the PCI bus and device attach
arguments, so that a device can tell if its memory and I/O spaces are
enabled. The flags are cleared, depending on the contents of devices CSR
registers, in the machine-independent PCI bus code.
 1.18 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.16 06-Apr-1997  cgd clean up some #ifdefs
 1.15 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.14 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.13 25-Nov-1996  cgd branches: 1.13.2;
update for new extent management code. Most importantly, we can't call
the chipset space init functions multiple times, since that would clobber
extent allocations made between the two calls. Also, deal with the
fact that the APECS and LCA no longer shared common chipset functions.
 1.12 11-Nov-1996  cgd clean up some spacing in switch statements
 1.11 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.7 11-Jul-1996  cgd some cleanup for -Wall
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 23-Apr-1996  cgd Corrections from hardware manual, from Trevor Mendez <tmendez@bbn.com>.
Adds comments and sets IOC_CONF correctly (it's write-only!).
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd partially update for new ISA/EISA/PCI and 'bus' interfaces. not yet
complete, or tested.
 1.2 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.13.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.13.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.13.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.19.2.1 23-May-1997  thorpej - Garbage-collect all DMA-related initialization, calling a separate
*_dma_init() function instead.
- Pass the appropriate bus dma tag to children.
 1.20.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.33.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.33.4.1 14-Nov-1999  fvdl Sync with -current.
 1.33.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.16.1 30-May-2002  gehenna Catch up with -current.
 1.36.4.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.36.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.36.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.36.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.36.2.1 20-Jun-2002  nathanw Catch up to -current.
 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-Sep-2004  skrll Sync with HEAD
 1.43.78.2 04-May-2009  yamt sync with head.
 1.43.78.1 16-May-2008  yamt sync with head.
 1.43.76.1 18-May-2008  yamt sync with head.
 1.43.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.44.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.44.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.47.4.2 31-May-2011  rmind sync with head
 1.47.4.1 05-Mar-2011  rmind sync with head
 1.48.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.49.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.50.6.1 18-Feb-2012  mrg merge to -current.
 1.50.2.1 17-Apr-2012  yamt sync with head
 1.51.62.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.52.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.56.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 01-Jul-2011  dyoung branches: 1.11.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 29-Jun-2000  mrg branches: 1.9.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 02-Sep-1997  thorpej branches: 1.8.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.6 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.5 10-Apr-1997  cgd branches: 1.5.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.4 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd include machine/options.h
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 25-Nov-1996  cgd branches: 1.1.2;
split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.18.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.9.152.1 05-Mar-2011  rmind sync with head
 1.11.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 01-Jul-2011  dyoung branches: 1.11.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 29-Jun-2000  mrg branches: 1.9.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.8 02-Sep-1997  thorpej branches: 1.8.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 02-Sep-1997  thorpej Use more complete #include directives when pulling in the chipdep
functions.
 1.6 02-Sep-1997  thorpej Adjust for new names for the PCI i/o and mem swizzle-style access
function files.
 1.5 10-Apr-1997  cgd branches: 1.5.4;
move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.4 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd include machine/options.h
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 25-Nov-1996  cgd branches: 1.1.2;
split the APECS and LCA bus memory and I/O functions. Most of them still do
the same things, but the extent maps have to be managed differently,
since the two chipsets provide different memory and I/O region mapping
possibilities.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.18.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.9.152.1 05-Mar-2011  rmind sync with head
 1.11.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.28 01-Aug-2023  andvar fix various typos in comments.
 1.27 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.26 05-May-2021  thorpej Moar static.
 1.25 11-Oct-2020  thorpej branches: 1.25.6;
Add some bus_dma instrumentation.
 1.24 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.23 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 01-Jul-2011  dyoung branches: 1.22.2; 1.22.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.21 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.20 14-Mar-2009  dsl branches: 1.20.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.18 28-Apr-2008  martin branches: 1.18.8; 1.18.14;
Remove clause 3 and 4 from TNF licenses
 1.17 11-Dec-2005  christos branches: 1.17.74; 1.17.76; 1.17.78;
merge ktrace-lwp.
 1.16 02-Jul-2004  mycroft Actually initialize the direct-mapped DMA window, which is clearly not set up
by the firmware on my Multia. Now PCI devices like the builtin tlp actually
work.
 1.15 19-Jul-2001  thorpej branches: 1.15.2; 1.15.22; 1.15.24;
The LCA isn't supposed to have a DMA prefetch threshold, but experience
has shown is that if we don't allocate a spill page, we get a machine
check. So, initialize the threshold to 256 bytes.
 1.14 03-Jan-2001  thorpej branches: 1.14.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.13 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 14-Aug-1998  thorpej branches: 1.12.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.10 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.9 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.8 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.7 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.6 17-Jan-1998  thorpej Initialize s/g DMA registers in the same order as the CIA chipset's:
(1) window base
(2) window mask
(3) translation base
 1.5 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.4 17-Jan-1998  thorpej Update for "minptalign" argument to alpha_sgmap_init().
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 23-May-1997  thorpej branches: 1.1.2;
file lca_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.4 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.1.2.3 05-Jun-1997  thorpej When invalidating the SGMAP TLB, do a memory barrier synch before writing
the TBIA register, as well as after.
 1.1.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.1.2.1 23-May-1997  thorpej Add chipset-specific DMA functions. For all of these chipsets, we have
one 1G direct-mapped DMA window at 1G and one 8M SGMAP-mapped DMA window
at 8M.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file lca_dma.c was added on branch alpha-nwscons on 1997-06-07 04:43:28 +0000
 1.12.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.12.12.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.4.1 03-Aug-2001  lukem update to -current
 1.15.24.1 02-Jul-2004  he Pull up revision 1.16 (requested by mycroft in ticket #582):
Actually initialize the direct-mapped DMA window, which is
clearly not set up by the firmware on the Multia. Now
devices like the built-in tlp actually work.
 1.15.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.22.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.2 19-Jul-2001  thorpej The LCA isn't supposed to have a DMA prefetch threshold, but experience
has shown is that if we don't allocate a spill page, we get a machine
check. So, initialize the threshold to 256 bytes.
 1.15.2.1 19-Jul-2001  thorpej file lca_dma.c was added on branch nathanw_sa on 2001-07-19 18:47:39 +0000
 1.17.78.2 04-May-2009  yamt sync with head.
 1.17.78.1 16-May-2008  yamt sync with head.
 1.17.76.1 18-May-2008  yamt sync with head.
 1.17.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.20.4.1 05-Mar-2011  rmind sync with head
 1.22.6.1 18-Feb-2012  mrg merge to -current.
 1.22.2.1 17-Apr-2012  yamt sync with head
 1.25.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.25.6.1 13-May-2021  thorpej Sync with HEAD.
 1.2 12-Apr-1996  cgd implement APECS and LCA 'bus' functions, and share them between the
two chipsets, since they're the same.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.24 25-Jun-2021  thorpej - Use the default implementations of attach_hook(), make_tag(), and
decompose_tag().
- In lca_bus_maxdevs(), only allow devices 0-15 on bus #0.
- Re-factor some duplicated code into lca_make_type0addr().
 1.23 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.22 02-Oct-2015  msaitoh branches: 1.22.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.21 06-Feb-2012  matt branches: 1.21.6; 1.21.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 14-Jun-2011  matt branches: 1.20.2; 1.20.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.19 15-Dec-2010  matt branches: 1.19.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.18 14-Mar-2009  dsl branches: 1.18.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.17 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15 15-May-2002  thorpej branches: 1.15.116; 1.15.124; 1.15.130;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.14 29-Jun-2000  mrg branches: 1.14.2; 1.14.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 02-Sep-1997  thorpej branches: 1.13.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.12 19-Jul-1997  cgd branches: 1.12.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.11 31-May-1997  cgd Adjust gcc -Wuninitialized warning initializers (or add them) so that
compliation without DEBUG and/or DIAGNOSTIC happens without errors.
Note that all such initializations in the Alpha port are marked with "XXX
gcc -Wuninitialized". As far as I'm concerned, the one or two times
-Wuninitialized has saved me from problems are worth the (very minor) cost
involved with the initializations, esp. if it's noted why the
initializations are done. This was prompted by PR#3690, from Ted Lemon.
 1.10 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.9 07-Apr-1997  cgd include machine/options.h
 1.8 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 13-Nov-1996  cgd branches: 1.7.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.6 13-Oct-1996  christos backout previous kprintf change
 1.5 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.3 23-Apr-1996  cgd Corrections from hardware manual, from Trevor Mendez <tmendez@bbn.com>.
Adds comments and sets IOC_CONF correctly (it's write-only!).
 1.2 12-Apr-1996  cgd "Do over." Throw the old file away, replace it with a version hacked
from the current apecs_pci.c. This new version hopefully works for
the same sets of devices that that previous one did, and hopefully
will work for multi-function devices and for secondary PCI busses as
well. (looking at the code, there was no way the old one could have!)
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.7.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.18.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.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.15.130.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.124.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.116.1 04-May-2009  yamt sync with head.
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.21.6.1 03-Dec-2017  jdolecek update from HEAD
 1.22.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.22.34.1 13-May-2021  thorpej Sync with HEAD.
 1.10 16-Jul-2021  thorpej Define the memory controller registers, and contents for the Cache
register.
 1.9 06-Feb-2012  matt branches: 1.9.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 05-Sep-1997  thorpej branches: 1.8.192; 1.8.196;
Define Status 0 and Status 1 registers.
 1.7 06-Jun-1997  thorpej branches: 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 03-Jun-1997  cgd make REGVAL macros use volatile pointers
 1.5 07-Apr-1997  cgd branches: 1.5.2;
clean up NetBSD RCS ID strings
 1.4 23-Nov-1996  cgd branches: 1.4.2;
add definitions for LCA_IOC_HAE contents. Add a REGVAL64 macro, like
REGVAL but good for 64-bit chipset registers.
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 23-Apr-1996  cgd Changes from Trevor Mendez <tmendez@bbn.com> to add definitions of a
couple of registers useful for debugging.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.2.3 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.4.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.2 06-Jun-1997  thorpej Update thorpej-bus-dma branch from trunk.
 1.5.2.1 23-May-1997  thorpej Add DMA-related registers and constants.
 1.7.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.196.1 18-Feb-2012  mrg merge to -current.
 1.8.192.1 17-Apr-2012  yamt sync with head
 1.9.64.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.12 16-Jul-2021  thorpej On LCA45 systems, look at the memory controller's Bcache configuration
to initialize uvmexp.ncolors rather than hard-coding a value per model
(some models can have more than one configuration).
 1.11 06-Feb-2012  matt branches: 1.11.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 14-Jun-2011  matt branches: 1.10.2; 1.10.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.9 14-Mar-2009  dsl branches: 1.9.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.8 02-Sep-1997  thorpej branches: 1.8.158; 1.8.166; 1.8.172;
Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.7 06-Jun-1997  thorpej branches: 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 07-Apr-1997  cgd branches: 1.6.2;
clean up NetBSD RCS ID strings
 1.5 25-Nov-1996  cgd branches: 1.5.2;
update for new extent management code, and for apecs/lca space access fn split
 1.4 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd partially update for new ISA/EISA/PCI and 'bus' interfaces. not yet
complete, or tested.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 06-Jun-1997  thorpej Update for pci_pte*_sgmap -> pci_sgmap_pte* change.
 1.6.2.2 03-Jun-1997  thorpej - Adopt to new common sgmap code.
- Fix several bugs, and reduce housekeeping overhead.
 1.6.2.1 23-May-1997  thorpej Add DMA-related structures.
 1.7.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.172.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.166.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.158.1 04-May-2009  yamt sync with head.
 1.9.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.64.1 01-Aug-2021  thorpej Sync with HEAD.
 1.36 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.35 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.34 19-Jun-2021  thorpej branches: 1.34.2;
Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.33 19-Jun-2021  thorpej Remove the "first" argument from pci_kn300_pickintr(). It's redundant with
information we already have, and is a needless divergence from other
"pickintr" routines.
 1.32 18-Jun-2021  thorpej Sprinkle some static.
 1.31 24-Apr-2021  thorpej branches: 1.31.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.30 18-Nov-2020  thorpej branches: 1.30.2;
malloc(9) -> kmem(9)
 1.29 06-Feb-2012  matt branches: 1.29.28; 1.29.38; 1.29.60;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.28 14-Jun-2011  matt branches: 1.28.2; 1.28.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.27 17-May-2011  dyoung branches: 1.27.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.26 18-Mar-2009  cegger branches: 1.26.4; 1.26.6;
Ansify function definitions w/o arguments. Generated with sed.
 1.25 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.24 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.23 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.22 12-Jun-2008  dogcow branches: 1.22.4; 1.22.10;
per cube's suggestion,
mcpcia_cd.cd_devs[i] -> device_lookup_private(&mcpcia_cd, i)
 1.21 28-Apr-2008  martin branches: 1.21.2; 1.21.4;
Remove clause 3 and 4 from TNF licenses
 1.20 04-Mar-2007  christos branches: 1.20.40; 1.20.42; 1.20.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 11-Dec-2005  christos branches: 1.19.26;
merge ktrace-lwp.
 1.18 30-Aug-2004  drochner branches: 1.18.12;
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.17 15-Jun-2003  fvdl branches: 1.17.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.16 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.15 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.12 02-May-2001  thorpej branches: 1.12.2; 1.12.4; 1.12.16;
Determine the size of the B-Cache earier, and initialize the
number of page colors accordingly.
 1.11 25-Jun-2000  thorpej branches: 1.11.2;
G/c unused include.
 1.10 25-Jun-2000  thorpej Implement mcpcia_bus_get_window().
 1.9 05-Jun-2000  thorpej branches: 1.9.2;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.8 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.7 16-Nov-1999  mjacob branches: 1.7.2;
Make sure a MCPCIA exists before trying to initialize it. Also make
sure a MCPCIA softc exists before trying to do post-config cleanup
on it.
 1.6 04-Nov-1999  thorpej Allow rd/line, rd/mult, and wr/inval.
 1.5 15-Apr-1999  thorpej branches: 1.5.2; 1.5.4; 1.5.8;
Add support for a single statically-allocated MCPCIA configuration structure,
which holds state of the MCPCIA to which the console is attached.

- All MCPCIA info is now stored in the mcpcia_config structure; the
mcpcia_softc only contains a struct device and a pointer to one of these.
- If attaching the console MCPCIA, use the static configuration, else allocate
the substructure.
- Rename mcpcia_init() to mcpcia_init0(), and make it take a "mallocsafe"
argument.
- Implement a new mcpcia_init(), which looks for the MCPCIA which has the
EISA bridge attached. Initialize this MCPCIA as the console MCPCIA (the
console on the Rawhide is only allowed on this MCPCIA; firmware rule).
- Eliminate the kludgy linked listed of mcpcia_softcs. Just use mcpcia_cd
to find all configured instances.

Separate bug fix: Actually clear the MCPCIA error mask after probing for
PCI (and ISA) devices, don't just clear it twice in mcpcia_init0().

Some other slight cleanup.
 1.4 08-Jul-1998  mjacob branches: 1.4.8;
minor tweak, and example of how to do error insertion
 1.3 06-Jun-1998  thorpej Don't call *_dma_init() twice; there's no need to. Just do it in *attach().
 1.2 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.4.8.2 16-Dec-1999  he Pull up revision 1.7 (requested by mjacob):
Force probing of MCPCIAs such that if they are not there we can
still boot. Not all Alpha 4100 / Rawhide systems have the full
four MCPCIAs.
 1.4.8.1 16-Apr-1999  thorpej branches: 1.4.8.1.2;
Pull up 1.4 -> 1.5.
 1.4.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.4.1 14-Nov-1999  fvdl Sync with -current.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.16.1 30-May-2002  gehenna Catch up with -current.
 1.12.4.4 03-Jan-2003  thorpej Sync with HEAD.
 1.12.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.12.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.12.4.1 02-May-2001  nathanw file mcpcia.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.12.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.12.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Sep-2004  skrll Sync with HEAD
 1.18.12.1 03-Sep-2007  yamt sync with head.
 1.19.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.44.2 04-May-2009  yamt sync with head.
 1.20.44.1 16-May-2008  yamt sync with head.
 1.20.42.2 17-Jun-2008  yamt sync with head.
 1.20.42.1 18-May-2008  yamt sync with head.
 1.20.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.20.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.4.1 18-Jun-2008  simonb Sync with head.
 1.21.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.22.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.26.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.4.1 31-May-2011  rmind sync with head
 1.27.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.28.6.1 18-Feb-2012  mrg merge to -current.
 1.28.2.1 17-Apr-2012  yamt sync with head
 1.29.60.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.29.38.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.29.28.2 20-Jul-2016  pgoyette Redo previous. Rather than separately extracting the device_t, we can
rely on sc->sc_dev when we need to call device_release().
 1.29.28.1 19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.30.2.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.31.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.34.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 01-Jul-2011  dyoung branches: 1.5.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.4 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.3 29-Jun-2000  mrg branches: 1.3.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 15-Apr-1999  thorpej branches: 1.2.2;
CHIP_EX_MALLOC_SAFE() now must pay attention in class.
 1.1 15-Apr-1998  mjacob branches: 1.1.8;
add Alpha 4100 support
 1.1.8.1 16-Apr-1999  thorpej branches: 1.1.8.1.2;
Pull up 1.1 -> 1.2.
 1.1.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.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.3.152.1 05-Mar-2011  rmind sync with head
 1.5.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.5 01-Jul-2011  dyoung branches: 1.5.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.4 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.3 29-Jun-2000  mrg branches: 1.3.152;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 15-Apr-1999  thorpej branches: 1.2.2;
CHIP_EX_MALLOC_SAFE() now must pay attention in class.
 1.1 15-Apr-1998  mjacob branches: 1.1.8;
add Alpha 4100 support
 1.1.8.1 16-Apr-1999  thorpej branches: 1.1.8.1.2;
Pull up 1.1 -> 1.2.
 1.1.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.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.3.152.1 05-Mar-2011  rmind sync with head
 1.5.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.26 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.25 19-Jun-2021  thorpej No need to include pci_kn300.h here.
 1.24 05-May-2021  thorpej Moar static.
 1.23 11-Oct-2020  thorpej branches: 1.23.6;
Add some bus_dma instrumentation.
 1.22 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.21 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 01-Jul-2011  dyoung branches: 1.20.2; 1.20.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.19 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.18 14-Mar-2009  dsl branches: 1.18.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 19-Jul-2001  thorpej branches: 1.15.2; 1.15.124; 1.15.126; 1.15.128;
MCPCIA has a 256 byte DMA prefetch threshold.
 1.14 03-Jan-2001  thorpej branches: 1.14.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.13 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 15-Apr-1999  thorpej branches: 1.12.2;
Fix a silly bug present since rev 1.1; the direct-mapped window is
supposed to be Window 1, but a cut'n'paste error made it stomp over
Window 0, thus breaking ISA DMA. Fix this. (Confirmed to work with
floppy driver.)

While I'm here, do something I've been meaning to do for a while: change
Window 1 from a 1G at 2G to a 2G at 2G direct-mapped window, and add
a Window 2 of 1G at 1G SGMAP-mapped. Chain Window 2 to Window 1, and
use it as a fall-back for PCI DMA if the system has more than 2G of RAM.
 1.11 15-Apr-1999  thorpej Adjust for new register access arguments, and make one slight cosmetic
change.
 1.10 06-Apr-1999  pk Fix garbled words in copyright statement.
 1.9 12-Feb-1999  thorpej branches: 1.9.2;
Fix printf format problems on Alpha.
 1.8 01-Sep-1998  thorpej Nuke an unused variable.
 1.7 15-Aug-1998  thorpej Normalize the copyright notice on this file.
 1.6 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.5 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.4 21-May-1998  thorpej Correct a small, but fatal, typo.
 1.3 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.2 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.9.2.2 16-Apr-1999  thorpej branches: 1.9.2.2.2;
Pull up 1.10 -> 1.12.
 1.9.2.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.9.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.4.1 03-Aug-2001  lukem update to -current
 1.15.128.2 04-May-2009  yamt sync with head.
 1.15.128.1 16-May-2008  yamt sync with head.
 1.15.126.1 18-May-2008  yamt sync with head.
 1.15.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.2.2 19-Jul-2001  thorpej MCPCIA has a 256 byte DMA prefetch threshold.
 1.15.2.1 19-Jul-2001  thorpej file mcpcia_dma.c was added on branch nathanw_sa on 2001-07-19 18:55:41 +0000
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.23.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.23.6.1 13-May-2021  thorpej Sync with HEAD.
 1.14 25-Jun-2021  thorpej Use the default implementation of attach_hook().
 1.13 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.12 02-Oct-2015  msaitoh branches: 1.12.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.11 06-Feb-2012  matt branches: 1.11.6; 1.11.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 14-Jun-2011  matt branches: 1.10.2; 1.10.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.9 15-Dec-2010  matt branches: 1.9.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.8 14-Mar-2009  dsl branches: 1.8.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 04-Mar-2007  christos branches: 1.5.44; 1.5.52; 1.5.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 29-Jun-2000  mrg branches: 1.4.40; 1.4.78;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 05-May-1998  mjacob branches: 1.3.14;
remove the unneccessary alpha_mbs and slight cleanup
 1.2 30-Apr-1998  mjacob do some mbs before a config read/write
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 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.78.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.40.1 03-Sep-2007  yamt sync with head.
 1.5.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.44.1 04-May-2009  yamt sync with head.
 1.8.4.1 05-Mar-2011  rmind sync with head
 1.9.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.11.6.1 03-Dec-2017  jdolecek update from HEAD
 1.12.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.12.34.1 13-May-2021  thorpej Sync with HEAD.
 1.9 02-Jun-2024  andvar fix various typos in word `interrupt', mainly in comments.
 1.8 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 17-May-2006  drochner branches: 1.7.100; 1.7.104;
Define some fixed bus addresses as "Unsigned Long" instead of
"Long Long" -- gcc4 propagates the "long long" along the way and
complains about mismatches to "long".
This is the same on alpha, but the conflict is unnecessary, so avoid it.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.12;
merge ktrace-lwp.
 1.5 13-Feb-2004  wiz branches: 1.5.16;
Uppercase CPU, plural is CPUs.
 1.4 26-Sep-2003  wiz Definition, not defintion. From miod@openbsd.
 1.3 15-Apr-1999  thorpej branches: 1.3.36;
Add support for a single statically-allocated MCPCIA configuration structure,
which holds state of the MCPCIA to which the console is attached.

- All MCPCIA info is now stored in the mcpcia_config structure; the
mcpcia_softc only contains a struct device and a pointer to one of these.
- If attaching the console MCPCIA, use the static configuration, else allocate
the substructure.
- Rename mcpcia_init() to mcpcia_init0(), and make it take a "mallocsafe"
argument.
- Implement a new mcpcia_init(), which looks for the MCPCIA which has the
EISA bridge attached. Initialize this MCPCIA as the console MCPCIA (the
console on the Rawhide is only allowed on this MCPCIA; firmware rule).
- Eliminate the kludgy linked listed of mcpcia_softcs. Just use mcpcia_cd
to find all configured instances.

Separate bug fix: Actually clear the MCPCIA error mask after probing for
PCI (and ISA) devices, don't just clear it twice in mcpcia_init0().

Some other slight cleanup.
 1.2 08-Jul-1998  mjacob branches: 1.2.8;
add some error handling definitions
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.2.8.1 16-Apr-1999  thorpej branches: 1.2.8.1.2;
Pull up 1.2 -> 1.3.
 1.2.8.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.36.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.8.1 24-May-2006  yamt sync with head.
 1.6.6.1 01-Jun-2006  kardel Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.104.1 18-Feb-2012  mrg merge to -current.
 1.7.100.1 17-Apr-2012  yamt sync with head
 1.7 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.6 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.5 14-Mar-2009  dsl branches: 1.5.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 16-Apr-1999  thorpej branches: 1.4.142; 1.4.150; 1.4.156;
Add SGMAP stuff for Window 2, and rename Window 0's SGMAP stuff to indicate
its use.
 1.3 15-Apr-1999  thorpej Add support for a single statically-allocated MCPCIA configuration structure,
which holds state of the MCPCIA to which the console is attached.

- All MCPCIA info is now stored in the mcpcia_config structure; the
mcpcia_softc only contains a struct device and a pointer to one of these.
- If attaching the console MCPCIA, use the static configuration, else allocate
the substructure.
- Rename mcpcia_init() to mcpcia_init0(), and make it take a "mallocsafe"
argument.
- Implement a new mcpcia_init(), which looks for the MCPCIA which has the
EISA bridge attached. Initialize this MCPCIA as the console MCPCIA (the
console on the Rawhide is only allowed on this MCPCIA; firmware rule).
- Eliminate the kludgy linked listed of mcpcia_softcs. Just use mcpcia_cd
to find all configured instances.

Separate bug fix: Actually clear the MCPCIA error mask after probing for
PCI (and ISA) devices, don't just clear it twice in mcpcia_init0().

Some other slight cleanup.
 1.2 17-Feb-1999  mjacob branches: 1.2.2;
Gronk. DWLPX comment in a MCPCIA file.
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.2.2.1 16-Apr-1999  thorpej branches: 1.2.2.1.2;
Pull up 1.2 -> 1.4.
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.156.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.150.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.142.1 04-May-2009  yamt sync with head.
 1.5.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.31 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.30 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.29 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.28 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.27 22-Sep-2020  thorpej branches: 1.27.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.26 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.25 18-Dec-2013  skrll Silence gcc 4.8
 1.24 06-Feb-2012  matt branches: 1.24.6; 1.24.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.23 04-Apr-2011  dyoung branches: 1.23.4; 1.23.8;
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.22 15-Dec-2010  matt branches: 1.22.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.21 14-Mar-2009  dsl branches: 1.21.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.18 28-Apr-2008  martin branches: 1.18.8; 1.18.14;
Remove clause 3 and 4 from TNF licenses
 1.17 03-Dec-2007  ad branches: 1.17.14; 1.17.16; 1.17.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.16 11-Dec-2005  christos branches: 1.16.30; 1.16.48; 1.16.50; 1.16.56;
merge ktrace-lwp.
 1.15 29-Mar-2005  thorpej branches: 1.15.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.14 27-Sep-2002  provos branches: 1.14.6; 1.14.12; 1.14.14; 1.14.20;
remove trailing \n in panic(). approved perry.
 1.13 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.12 27-Jul-2001  thorpej branches: 1.12.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.11 28-Dec-2000  sommerfeld branches: 1.11.4;
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.10 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.8 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.7 15-Dec-1999  thorpej branches: 1.7.2;
Key off NSIO and NPCEB for (E)ISA interrupt support.

XXX Can probably nuke the SIO test; don't all of the Mikasa-class systems
XXX have EISA?
 1.6 29-Jun-1999  ross branches: 1.6.2; 1.6.8;
* sprintf -> snprintf
* add a few alpha_mb() ops as called for by folklore and rumour
 1.5 12-Feb-1999  thorpej branches: 1.5.4;
Fix printf format problems on Alpha.
 1.4 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.3 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.2 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.1 26-Jun-1998  ross New platforms: Mikasa and Mikasa/Pinnacle, aka Pinkasa.

Like the 1000A, the AlphaServer 1000 has a daughtercard assembly that
integrates the CPU and core logic, so these can be ev4/apecs or ev5/cia.
New systype, and, sigh, another way of doing interrupts and another
mystery icu.

Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
all the calls. Duhh.
 1.5.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.2 05-Jan-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.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.4.3 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.11.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.4.1 03-Aug-2001  lukem update to -current
 1.12.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.12.2.1 27-Jul-2001  nathanw file pci_1000.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.14.20.1 30-Mar-2005  tron Pull up revision 1.15 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.14.14.1 29-Apr-2005  kent sync with -current
 1.14.12.1 11-May-2005  riz Pull up revision 1.15 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.14.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.15.2.1 07-Dec-2007  yamt sync with head
 1.16.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.50.1 09-Jan-2008  matt sync with HEAD
 1.16.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.30.1 03-Dec-2007  ad Sync with HEAD.
 1.17.18.2 04-May-2009  yamt sync with head.
 1.17.18.1 16-May-2008  yamt sync with head.
 1.17.16.1 18-May-2008  yamt sync with head.
 1.17.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.4.2 21-Apr-2011  rmind sync with head
 1.21.4.1 05-Mar-2011  rmind sync with head
 1.22.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.23.8.1 18-Feb-2012  mrg merge to -current.
 1.23.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.23.4.1 17-Apr-2012  yamt sync with head
 1.24.10.1 18-May-2014  rmind sync with head
 1.24.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.3 14-Mar-2009  dsl branches: 1.3.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.14;
Remove clause 3 and 4 from TNF licenses
 1.1 26-Jun-1998  ross branches: 1.1.150; 1.1.152; 1.1.154;
New platforms: Mikasa and Mikasa/Pinnacle, aka Pinkasa.

Like the 1000A, the AlphaServer 1000 has a daughtercard assembly that
integrates the CPU and core logic, so these can be ev4/apecs or ev5/cia.
New systype, and, sigh, another way of doing interrupts and another
mystery icu.

Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
all the calls. Duhh.
 1.1.154.2 04-May-2009  yamt sync with head.
 1.1.154.1 16-May-2008  yamt sync with head.
 1.1.152.1 18-May-2008  yamt sync with head.
 1.1.150.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.33 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.32 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.31 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.30 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.29 22-Sep-2020  thorpej branches: 1.29.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.28 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.27 18-Dec-2013  skrll Silence gcc 4.8
 1.26 06-Feb-2012  matt branches: 1.26.6; 1.26.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.25 04-Apr-2011  dyoung branches: 1.25.4; 1.25.8;
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.24 15-Dec-2010  matt branches: 1.24.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.23 14-Mar-2009  dsl branches: 1.23.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.22 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.21 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.20 28-Apr-2008  martin branches: 1.20.8; 1.20.14;
Remove clause 3 and 4 from TNF licenses
 1.19 03-Dec-2007  ad branches: 1.19.14; 1.19.16; 1.19.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.18 11-Dec-2005  christos branches: 1.18.30; 1.18.48; 1.18.50; 1.18.56;
merge ktrace-lwp.
 1.17 29-Mar-2005  thorpej branches: 1.17.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.16 27-Sep-2002  provos branches: 1.16.6; 1.16.12; 1.16.14; 1.16.20;
remove trailing \n in panic(). approved perry.
 1.15 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.14 27-Jul-2001  thorpej branches: 1.14.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.13 28-Dec-2000  sommerfeld branches: 1.13.4;
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.12 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.10 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.9 15-Dec-1999  thorpej branches: 1.9.2;
Key off NSIO and NPCEB for (E)ISA interrupt support.

XXX Can probably nuke the SIO test; don't all of the Noritake-class systems
XXX have EISA?
 1.8 29-Jun-1999  ross branches: 1.8.2; 1.8.8;
* sprintf -> snprintf
* add a few alpha_mb() ops as called for by folklore and rumour
 1.7 12-Feb-1999  thorpej branches: 1.7.4;
Fix printf format problems on Alpha.
 1.6 19-Nov-1998  ross Fix interrupt map for baseboard bridge.
 1.5 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.4 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.3 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.2 26-Jun-1998  ross Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
the calls. Duhh.

Also, remove the initial XXX mystery_icu debugging code.
 1.1 24-Jun-1998  ross New platforms: Noritake, Pintake, and Corelle. Sometimes these are ev4/apecs,
sometimes they are ev5/cia.
 1.7.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.2 05-Jan-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.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.4.3 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.13.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.4.1 03-Aug-2001  lukem update to -current
 1.14.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.14.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.14.2.1 27-Jul-2001  nathanw file pci_1000a.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.16.20.1 30-Mar-2005  tron Pull up revision 1.17 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.16.14.1 29-Apr-2005  kent sync with -current
 1.16.12.1 11-May-2005  riz Pull up revision 1.17 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.16.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.17.2.1 07-Dec-2007  yamt sync with head
 1.18.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.18.50.1 09-Jan-2008  matt sync with HEAD
 1.18.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.30.1 03-Dec-2007  ad Sync with HEAD.
 1.19.18.2 04-May-2009  yamt sync with head.
 1.19.18.1 16-May-2008  yamt sync with head.
 1.19.16.1 18-May-2008  yamt sync with head.
 1.19.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.4.2 21-Apr-2011  rmind sync with head
 1.23.4.1 05-Mar-2011  rmind sync with head
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.8.1 18-Feb-2012  mrg merge to -current.
 1.25.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.25.4.1 17-Apr-2012  yamt sync with head
 1.26.10.1 18-May-2014  rmind sync with head
 1.26.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.4 14-Mar-2009  dsl branches: 1.4.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 26-Jun-1998  ross branches: 1.2.150; 1.2.152; 1.2.154;
Kill off some EVCNT_COUNTERS calls, since [A] it has to be rewritten anyway
before it can be useful, and [B] #ifdefs do not belong at every call site,
a common API should be defined and the implementations conditionalized, not
the calls. Duhh.

Also, remove the initial XXX mystery_icu debugging code.
 1.1 24-Jun-1998  ross New platforms: Noritake, Pintake, and Corelle. Sometimes these are ev4/apecs,
sometimes they are ev5/cia.
 1.2.154.2 04-May-2009  yamt sync with head.
 1.2.154.1 16-May-2008  yamt sync with head.
 1.2.152.1 18-May-2008  yamt sync with head.
 1.2.150.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.44 25-Jun-2021  thorpej Reduce code duplication among platforms that use the i82378 SIO to
route PCI interrupts to the ISA PIC by refactoring it into a new
sio_pirq_intr_map() function.
 1.43 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.42 22-Sep-2020  thorpej branches: 1.42.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.41 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.40 06-Feb-2012  matt branches: 1.40.6; 1.40.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.39 01-Jul-2011  dyoung branches: 1.39.2; 1.39.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.38 04-Apr-2011  dyoung 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.37 15-Dec-2010  matt branches: 1.37.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.36 16-Mar-2009  dsl branches: 1.36.4;
ANSIfy functions with function-pointer arguments
 1.35 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.34 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.33 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.32 27-Sep-2002  provos branches: 1.32.112; 1.32.120; 1.32.126;
remove trailing \n in panic(). approved perry.
 1.31 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.30 27-Jul-2001  thorpej branches: 1.30.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.29 28-Dec-2000  sommerfeld branches: 1.29.4;
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.28 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.27 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.26 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.25 19-Nov-1998  ross branches: 1.25.10; 1.25.18;
#include <machine/intrcnt.h>
 1.24 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.23 24-Apr-1998  mjacob fix minor typo
 1.22 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.21 16-Apr-1998  thorpej Make function names in printfs and panics consistent.
 1.20 16-Apr-1998  thorpej Fix a whitespace botch.
 1.19 14-Apr-1998  thorpej Pass the pci_chipset_tag_t to sio_intr_setup(). XXX This code should be
rearranged so that other non-PCI-but-in-all-other-ways-ISA-PIC-like
devices can share code.
 1.18 02-Sep-1997  thorpej Adjust for changes to bus space tag initialization.
 1.17 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.16 19-Jul-1997  cgd branches: 1.16.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.15 31-May-1997  cgd Adjust gcc -Wuninitialized warning initializers (or add them) so that
compliation without DEBUG and/or DIAGNOSTIC happens without errors.
Note that all such initializations in the Alpha port are marked with "XXX
gcc -Wuninitialized". As far as I'm concerned, the one or two times
-Wuninitialized has saved me from problems are worth the (very minor) cost
involved with the initializations, esp. if it's noted why the
initializations are done. This was prompted by PR#3690, from Ted Lemon.
 1.14 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.13 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.12 13-Nov-1996  cgd branches: 1.12.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.11 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 14-Jul-1996  cgd (1) Include more headers to bring necessary prototypes into scope.
 1.7 23-Apr-1996  cgd clean up some, and use new sioreg.h
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 12-Apr-1996  cgd update for new PCI, etc., interfaces
 1.4 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.12.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.12.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.18.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.10.2 05-Jan-2001  bouyer Sync with HEAD
 1.25.10.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.29.4.3 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.29.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.29.4.1 03-Aug-2001  lukem update to -current
 1.30.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.30.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.30.2.1 27-Jul-2001  nathanw file pci_2100_a50.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.32.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.112.1 04-May-2009  yamt sync with head.
 1.36.4.2 21-Apr-2011  rmind sync with head
 1.36.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.6.1 18-Feb-2012  mrg merge to -current.
 1.39.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.2.1 17-Apr-2012  yamt sync with head
 1.40.10.1 18-May-2014  rmind sync with head
 1.40.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.5 14-Mar-2009  dsl branches: 1.5.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 07-Apr-1997  cgd branches: 1.4.162; 1.4.170; 1.4.176;
clean up NetBSD RCS ID strings
 1.3 12-Apr-1996  cgd branches: 1.3.2;
clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for new PCI, etc., interfaces
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.176.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.170.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.162.1 04-May-2009  yamt sync with head.
 1.5.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.18 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.17 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.16 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.15 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.14 25-Sep-2020  thorpej branches: 1.14.6;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.13 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.12 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.11 06-Feb-2012  matt branches: 1.11.6; 1.11.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 04-Apr-2011  dyoung branches: 1.10.4; 1.10.8;
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.9 28-Apr-2008  martin branches: 1.9.22; 1.9.28;
Remove clause 3 and 4 from TNF licenses
 1.8 03-Dec-2007  ad branches: 1.8.14; 1.8.16; 1.8.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.7 11-Dec-2005  christos branches: 1.7.30; 1.7.48; 1.7.50; 1.7.56;
merge ktrace-lwp.
 1.6 29-Mar-2005  thorpej branches: 1.6.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.5 27-Sep-2002  provos branches: 1.5.6; 1.5.12; 1.5.14; 1.5.20;
remove trailing \n in panic(). approved perry.
 1.4 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.3 27-Jul-2001  thorpej branches: 1.3.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.2 28-Dec-2000  sommerfeld branches: 1.2.2; 1.2.6;
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.1 21-Dec-2000  thorpej Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.2.6.3 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.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 03-Aug-2001  lukem update to -current
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 28-Dec-2000  bouyer file pci_2100_a500.c was added on branch thorpej_scsipi on 2001-01-05 17:33:47 +0000
 1.3.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.1 27-Jul-2001  nathanw file pci_2100_a500.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.5.20.1 30-Mar-2005  tron Pull up revision 1.6 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.5.14.1 29-Apr-2005  kent sync with -current
 1.5.12.1 11-May-2005  riz Pull up revision 1.6 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.5.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.6.2.1 07-Dec-2007  yamt sync with head
 1.7.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.50.1 09-Jan-2008  matt sync with HEAD
 1.7.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.30.1 03-Dec-2007  ad Sync with HEAD.
 1.8.18.1 16-May-2008  yamt sync with head.
 1.8.16.1 18-May-2008  yamt sync with head.
 1.8.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.22.1 21-Apr-2011  rmind sync with head
 1.10.8.1 18-Feb-2012  mrg merge to -current.
 1.10.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.10.4.1 17-Apr-2012  yamt sync with head
 1.11.10.1 18-May-2014  rmind sync with head
 1.11.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.2 28-Apr-2008  martin branches: 1.2.104;
Remove clause 3 and 4 from TNF licenses
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.128; 1.1.130; 1.1.132;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file pci_2100_a500.h was added on branch thorpej_scsipi on 2001-01-05 17:33:47 +0000
 1.2.104.1 01-Aug-2021  thorpej Sync with HEAD.
 1.42 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.41 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.40 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.39 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.38 22-Sep-2020  thorpej branches: 1.38.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.37 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.36 06-Feb-2012  matt branches: 1.36.6; 1.36.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.35 14-Jun-2011  matt branches: 1.35.2; 1.35.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.34 04-Apr-2011  dyoung branches: 1.34.2;
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.33 15-Dec-2010  matt branches: 1.33.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.32 16-Mar-2009  dsl branches: 1.32.4;
ANSIfy functions with function-pointer arguments
 1.31 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.30 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.29 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.28 28-Apr-2008  martin branches: 1.28.8; 1.28.14;
Remove clause 3 and 4 from TNF licenses
 1.27 03-Dec-2007  ad branches: 1.27.14; 1.27.16; 1.27.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.26 11-Dec-2005  christos branches: 1.26.30; 1.26.48; 1.26.50; 1.26.56;
merge ktrace-lwp.
 1.25 29-Mar-2005  thorpej branches: 1.25.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.24 27-Sep-2002  provos branches: 1.24.6; 1.24.12; 1.24.14; 1.24.20;
remove trailing \n in panic(). approved perry.
 1.23 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.22 27-Jul-2001  thorpej branches: 1.22.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.21 27-Mar-2001  ross branches: 1.21.2;
On alternate Tuesdays, SRM uses a different method of identifying
PCI interrupts routed to the ISA ICU.
 1.20 25-Mar-2001  ross Don't panic until DEFCON 1.
 1.19 28-Dec-2000  sommerfeld branches: 1.19.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.18 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.17 06-Jun-2000  thorpej branches: 1.17.2;
Report which compatibility IRQ the PCI IDE gets.
 1.16 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.15 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.14 19-Mar-2000  thorpej branches: 1.14.2;
Add support for mapping the OHCI USB controller interrupt (which is wired toan ISA IRQ because it's in the same package as the PCI-ISA bridge).
 1.13 12-Feb-1999  thorpej branches: 1.13.8;
Fix printf format problems on Alpha.
 1.12 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.11 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.10 07-Jul-1998  thorpej The Pyxis core logic in the Miata seems to have problems with stray interrupts.
Do what Digital UNIX (formerly DEC OSF/1) does; just ignore strays.
 1.9 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.8 06-Jun-1998  thorpej Only disable an interrupt line after MAXSTRAYs if there is no handler
attached; we get stray interrupts on PCI devices sometimes, for some
unknown reason. (Similar problem exists on the 164SX, which also has
a Pyxis.)
 1.7 06-Jun-1998  thorpej Use REGVAL64() to frob the Pyxis interrupt mask register.
 1.6 05-Jun-1998  thorpej Oops, turn off some debugging printfs.
 1.5 05-Jun-1998  thorpej Miata 1 has an Intel SIO at bus 0 device 7 and a CMD PCI IDE at bus 0
device 4. Miata 1.5 and Miata 2 have a Cypress at device 7 and PCI IDE
at functions 1 and 2 of the Cypress (like the PC164SX). These on-board
PCI IDE controllers are wired to compatibility mode, so don't bother
trying to map the interrupt.
 1.4 05-Jun-1998  thorpej Actually, I did use a few of them on this file (I wasn't clear enough
in my mail to Ross, I guess...)
 1.3 05-Jun-1998  ross Revert...Jason didn't use Andrew's diffs.
 1.2 05-Jun-1998  ross Tweak the copyrights a little bit. pci_550.h gets a TNF copyright, not
CMU, and pci_550.c keeps TNF but gets "Andrew Gallatin and Jason R. Thorpe".
 1.1 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.13.8.3 27-Mar-2001  bouyer Sync with HEAD.
 1.13.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.13.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.14.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.2.1 04-Apr-2001  he Pull up revisions 1.20-1.21 (requested by ross):
Fix a Miata panic-on-boot due to an unusual SRM irq routing.
 1.19.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.21.2.3 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.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 03-Aug-2001  lukem update to -current
 1.22.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.22.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.22.2.1 27-Jul-2001  nathanw file pci_550.c was added on branch nathanw_sa on 2002-06-20 03:37:43 +0000
 1.24.20.1 30-Mar-2005  tron Pull up revision 1.25 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.24.14.1 29-Apr-2005  kent sync with -current
 1.24.12.1 11-May-2005  riz Pull up revision 1.25 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.24.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.25.2.1 07-Dec-2007  yamt sync with head
 1.26.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.26.50.1 09-Jan-2008  matt sync with HEAD
 1.26.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.26.30.1 03-Dec-2007  ad Sync with HEAD.
 1.27.18.2 04-May-2009  yamt sync with head.
 1.27.18.1 16-May-2008  yamt sync with head.
 1.27.16.1 18-May-2008  yamt sync with head.
 1.27.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.4.2 21-Apr-2011  rmind sync with head
 1.32.4.1 05-Mar-2011  rmind sync with head
 1.33.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.35.6.1 18-Feb-2012  mrg merge to -current.
 1.35.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.2.1 17-Apr-2012  yamt sync with head
 1.36.10.1 18-May-2014  rmind sync with head
 1.36.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.5 14-Mar-2009  dsl branches: 1.5.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 05-Jun-2000  thorpej branches: 1.4.132; 1.4.140; 1.4.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.3 05-Jun-1998  ross branches: 1.3.14; 1.3.22;
Revert...Jason didn't use Andrew's diffs.
 1.2 05-Jun-1998  ross Tweak the copyrights a little bit. pci_550.h gets a TNF copyright, not
CMU, and pci_550.c keeps TNF but gets "Andrew Gallatin and Jason R. Thorpe".
 1.1 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.3.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 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.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.132.1 04-May-2009  yamt sync with head.
 1.5.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.33 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.32 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.31 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.30 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.29 26-Sep-2020  thorpej branches: 1.29.6;
Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.28 26-Sep-2020  thorpej Support CPU interrupt affinity on Tsunami systems.
 1.27 23-Sep-2020  thorpej Define a constant for the SIO IRQ line, and keep a shadow copy of
the interrupt enables.
 1.26 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.25 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.24 06-Feb-2012  matt branches: 1.24.6; 1.24.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.23 01-Jul-2011  dyoung branches: 1.23.2; 1.23.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.22 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.21 04-Apr-2011  dyoung branches: 1.21.2;
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.20 15-Dec-2010  matt branches: 1.20.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.19 16-Mar-2009  dsl branches: 1.19.4;
ANSIfy functions with function-pointer arguments
 1.18 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.17 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15 03-Dec-2007  ad branches: 1.15.18; 1.15.26; 1.15.32;
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.14 16-Feb-2006  mhitch branches: 1.14.24; 1.14.42; 1.14.44; 1.14.50;
Bad Jason! Fix interrupt event counter attach typo. Only the last interrupt
was getting an event counter, and none of the dec_6600 interrupts were
getting counted.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 02-Jun-2005  drochner branches: 1.12.2;
add more "const"
 1.11 29-Mar-2005  thorpej - Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.10 27-Sep-2002  provos branches: 1.10.6; 1.10.12; 1.10.14; 1.10.20;
remove trailing \n in panic(). approved perry.
 1.9 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.8 27-Jul-2001  thorpej branches: 1.8.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.7 28-Dec-2000  sommerfeld branches: 1.7.4;
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 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 06-Jun-2000  thorpej Report which compatibility IRQ the PCI IDE gets.
 1.4 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.3 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.2 19-Mar-2000  thorpej branches: 1.2.2;
Add support for mapping the OHCI USB controller interrupt (which is wired toan ISA IRQ because it's in the same package as the PCI-ISA bridge).
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.6.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file pci_6600.c was added on branch netbsd-1-4 on 1999-06-29 06:46:47 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file pci_6600.c was added on branch chs-ubc2 on 1999-07-01 23:00:57 +0000
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.4.3 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.7.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1 03-Aug-2001  lukem update to -current
 1.8.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.8.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.1 27-Jul-2001  nathanw file pci_6600.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.10.20.2 20-Feb-2006  tron Pull up following revision(s) (requested by mhitch in ticket #1175):
sys/arch/alpha/pci/pci_6600.c: revision 1.14
Bad Jason! Fix interrupt event counter attach typo. Only the last interrupt
was getting an event counter, and none of the dec_6600 interrupts were
getting counted.
 1.10.20.1 30-Mar-2005  tron Pull up revision 1.11 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.10.14.1 29-Apr-2005  kent sync with -current
 1.10.12.2 26-Feb-2006  riz Pull up following revision(s) (requested by mhitch in ticket #10320):
sys/arch/alpha/pci/pci_6600.c: revision 1.14
Bad Jason! Fix interrupt event counter attach typo. Only the last interrupt
was getting an event counter, and none of the dec_6600 interrupts were
getting counted.
 1.10.12.1 11-May-2005  riz Pull up revision 1.11 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.10.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.12.2.2 07-Dec-2007  yamt sync with head
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.44.1 09-Jan-2008  matt sync with HEAD
 1.14.42.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.24.1 03-Dec-2007  ad Sync with HEAD.
 1.15.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.18.1 04-May-2009  yamt sync with head.
 1.19.4.2 21-Apr-2011  rmind sync with head
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.20.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.21.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.23.6.1 18-Feb-2012  mrg merge to -current.
 1.23.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.2.1 17-Apr-2012  yamt sync with head
 1.24.10.1 18-May-2014  rmind sync with head
 1.24.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.2 14-Mar-2009  dsl branches: 1.2.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.148; 1.1.156; 1.1.162;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.162.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.156.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.148.1 04-May-2009  yamt sync with head.
 1.1.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file pci_6600.h was added on branch netbsd-1-4 on 1999-06-29 06:46:47 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file pci_6600.h was added on branch chs-ubc2 on 1999-07-01 23:00:57 +0000
 1.2.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.13 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.12 15-Dec-2010  matt branches: 1.12.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.11 16-Mar-2009  dsl branches: 1.11.4;
ANSIfy functions with function-pointer arguments
 1.10 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.9 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.8 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.7 29-Jun-2000  mrg branches: 1.7.130; 1.7.138; 1.7.144;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.5 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 24-Apr-1998  mjacob branches: 1.4.14; 1.4.22;
fix minor typo
 1.3 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.2 02-Mar-1998  ross Rewrite of interrupt dispatch logic. Add ctags(1) keys for *a12*.h files.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.4.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.144.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.138.1 28-Apr-2009  skrll Sync with HEAD.
 1.7.130.1 04-May-2009  yamt sync with head.
 1.11.4.1 05-Mar-2011  rmind sync with head
 1.12.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.5 17-Jun-2011  matt Remove Avalon A12 support.
ok ross@
 1.4 14-Mar-2009  dsl branches: 1.4.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 05-Jun-2000  thorpej branches: 1.3.132; 1.3.140; 1.3.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.2 02-Mar-1998  ross branches: 1.2.14; 1.2.22;
Rewrite of interrupt dispatch logic. Add ctags(1) keys for *a12*.h files.
 1.1 29-Jan-1998  ross Add basic platform support for NetBSD on the Avalon A12. I'm running this
CVS commit on one right now...
 1.2.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.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.3.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.132.1 04-May-2009  yamt sync with head.
 1.4.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20 25-Jun-2021  thorpej Remove pointless warning.
 1.19 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.18 22-Sep-2020  thorpej branches: 1.18.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.17 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.16 06-Feb-2012  matt branches: 1.16.6; 1.16.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.15 04-Apr-2011  dyoung branches: 1.15.4; 1.15.8;
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.14 15-Dec-2010  matt branches: 1.14.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.13 16-Mar-2009  dsl branches: 1.13.4;
ANSIfy functions with function-pointer arguments
 1.12 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.11 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.10 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.9 28-Apr-2008  martin branches: 1.9.8; 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 15-May-2002  thorpej branches: 1.8.112; 1.8.114; 1.8.116;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.7 27-Jul-2001  thorpej branches: 1.7.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.6 28-Dec-2000  sommerfeld branches: 1.6.4;
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.5 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.3 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.2 19-Nov-1998  ross branches: 1.2.10; 1.2.18;
#include <machine/intrcnt.h>
 1.1 26-Jun-1998  thorpej Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.2.18.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.10.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.10.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.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.7.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.7.2.1 27-Jul-2001  nathanw file pci_alphabook1.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.8.116.2 04-May-2009  yamt sync with head.
 1.8.116.1 16-May-2008  yamt sync with head.
 1.8.114.1 18-May-2008  yamt sync with head.
 1.8.112.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.4.2 21-Apr-2011  rmind sync with head
 1.13.4.1 05-Mar-2011  rmind sync with head
 1.14.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.8.1 18-Feb-2012  mrg merge to -current.
 1.15.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.15.4.1 17-Apr-2012  yamt sync with head
 1.16.10.1 18-May-2014  rmind sync with head
 1.16.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.2 14-Mar-2009  dsl branches: 1.2.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.1 26-Jun-1998  thorpej branches: 1.1.154; 1.1.162; 1.1.168;
Very preliminary support for the Tadpole/DEC AlphaBook. These are basically
AXPpci33 machines + power management and a Cirrus PCI-PCMCIA controller.

There is currently no support for the power management facilities, and
the PCI-PCMCIA controller driver needs some work, but this should boot
and run from disk.
 1.1.168.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.162.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.154.1 04-May-2009  yamt sync with head.
 1.2.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.41 25-Jun-2021  thorpej Reduce code duplication among platforms that use the i82378 SIO to
route PCI interrupts to the ISA PIC by refactoring it into a new
sio_pirq_intr_map() function.
 1.40 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.39 22-Sep-2020  thorpej branches: 1.39.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.38 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.37 06-Feb-2012  matt branches: 1.37.6; 1.37.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.36 01-Jul-2011  dyoung branches: 1.36.2; 1.36.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.35 04-Apr-2011  dyoung 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.34 15-Dec-2010  matt branches: 1.34.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.33 16-Mar-2009  dsl branches: 1.33.4;
ANSIfy functions with function-pointer arguments
 1.32 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.31 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.30 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.29 27-Sep-2002  provos branches: 1.29.112; 1.29.120; 1.29.126;
remove trailing \n in panic(). approved perry.
 1.28 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.27 27-Jul-2001  thorpej branches: 1.27.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.26 28-Dec-2000  sommerfeld branches: 1.26.4;
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.25 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.24 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.23 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.22 19-Nov-1998  ross branches: 1.22.10; 1.22.18;
#include <machine/intrcnt.h>
 1.21 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.20 24-Apr-1998  mjacob fix minor typo
 1.19 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.18 16-Apr-1998  thorpej Make function names in printfs and panics consistent.
 1.17 14-Apr-1998  thorpej Pass the pci_chipset_tag_t to sio_intr_setup(). XXX This code should be
rearranged so that other non-PCI-but-in-all-other-ways-ISA-PIC-like
devices can share code.
 1.16 02-Sep-1997  thorpej Adjust for changes to bus space tag initialization.
 1.15 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.14 19-Jul-1997  cgd branches: 1.14.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.13 31-May-1997  cgd Adjust gcc -Wuninitialized warning initializers (or add them) so that
compliation without DEBUG and/or DIAGNOSTIC happens without errors.
Note that all such initializations in the Alpha port are marked with "XXX
gcc -Wuninitialized". As far as I'm concerned, the one or two times
-Wuninitialized has saved me from problems are worth the (very minor) cost
involved with the initializations, esp. if it's noted why the
initializations are done. This was prompted by PR#3690, from Ted Lemon.
 1.12 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.11 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.10 13-Nov-1996  cgd branches: 1.10.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.9 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 14-Jul-1996  cgd (1) Include more headers to bring necessary prototypes into scope.
 1.5 23-Apr-1996  cgd hanges from Trevor Mendez <tmendez@bbn.com> to use new sioreg.h
header. Also, I moved the LCA_SIO_DEVICE definition higher up in the
file.
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd update for new PCI code, etc. As yet, untested.
 1.2 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.10.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.18.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.22.10.2 05-Jan-2001  bouyer Sync with HEAD
 1.22.10.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.26.4.3 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.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.4.1 03-Aug-2001  lukem update to -current
 1.27.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.27.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.27.2.1 27-Jul-2001  nathanw file pci_axppci_33.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.29.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.112.1 04-May-2009  yamt sync with head.
 1.33.4.2 21-Apr-2011  rmind sync with head
 1.33.4.1 05-Mar-2011  rmind sync with head
 1.34.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.6.1 18-Feb-2012  mrg merge to -current.
 1.36.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.2.1 17-Apr-2012  yamt sync with head
 1.37.10.1 18-May-2014  rmind sync with head
 1.37.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.39.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.5 14-Mar-2009  dsl branches: 1.5.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 07-Apr-1997  cgd branches: 1.4.162; 1.4.170; 1.4.176;
clean up NetBSD RCS ID strings
 1.3 12-Apr-1996  cgd branches: 1.3.2;
clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for new PCI code, etc. As yet, untested.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.176.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.170.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.162.1 04-May-2009  yamt sync with head.
 1.5.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.1 09-Mar-2025  thorpej branches: 1.1.4;
Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 09-Mar-2025  perseant file pci_bootdev.c was added on branch perseant-exfatfs on 2025-08-02 05:55:23 +0000
 1.24 06-Dec-2023  thorpej bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.
 1.23 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.22 05-May-2021  thorpej Moar static.
 1.21 06-Feb-2012  matt branches: 1.21.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.19 25-Sep-2011  chs branches: 1.19.2; 1.19.6;
change inline to static inline to appease gcc 4.5.
 1.18 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.17 28-Apr-2008  martin branches: 1.17.8; 1.17.14;
Remove clause 3 and 4 from TNF licenses
 1.16 04-Mar-2007  christos branches: 1.16.40; 1.16.42; 1.16.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 11-Dec-2005  christos branches: 1.15.26;
merge ktrace-lwp.
 1.14 14-Jul-2003  lukem branches: 1.14.16;
add __KERNEL_RCSID() (using 1, for #included .c files)
 1.13 04-Sep-2001  thorpej branches: 1.13.20;
Typos, pointed out by Luke Mewburn (gee, I guess I built a kernel
other than GENERIC).
 1.12 04-Sep-2001  thorpej Implement bus_space_mmap().
 1.11 26-Jun-2000  thorpej branches: 1.11.2; 1.11.4;
Do the previously slightly differently, to avoid confusing the internal
space extent maps. Pointed out by msaitoh@netbsd.org. (Someone should
send me an EV6 machine!)
 1.10 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.9 17-Apr-2000  drochner branches: 1.9.4;
implement bus_space_vaddr()
 1.8 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.7 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.6 02-Dec-1999  thorpej Pull in the BWX inlines. We expect the arch to be set appropriately for
the assembler before these files are pulled in by the chip-sepecific files.
 1.5 30-Aug-1998  cgd branches: 1.5.12; 1.5.18;
use current bus_space interface names for barrier ops
 1.4 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.3 07-Jun-1998  thorpej branches: 1.3.2;
Oops, don't forget to fill in *addrp.
 1.2 06-Jun-1998  thorpej Implement bus_space_{alloc,free}() for BWX bus space.
 1.1 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.3.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.5.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.12.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.9.4.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.11.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.13.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.20.1 03-Aug-2004  skrll Sync with HEAD
 1.14.16.1 03-Sep-2007  yamt sync with head.
 1.15.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.44.2 04-May-2009  yamt sync with head.
 1.16.44.1 16-May-2008  yamt sync with head.
 1.16.42.1 18-May-2008  yamt sync with head.
 1.16.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.6.1 18-Feb-2012  mrg merge to -current.
 1.19.2.1 17-Apr-2012  yamt sync with head
 1.21.64.1 13-May-2021  thorpej Sync with HEAD.
 1.30 06-Dec-2023  thorpej bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.
 1.29 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.28 05-May-2021  thorpej Moar static.
 1.27 15-Jan-2014  tsutsui branches: 1.27.46;
Revert previous. PR/48431 claims ALPHA_PHYS_TO_K0SEG() is necessary.

Actually CHIP_MEM_SYS_START(v) seems a physical address per *_mem_map()
function, but I don't think mmap() function should return K0SEG address
(it should return PA cookie IIUC) so I guess there is something wrong
in Titan's bus space functions. I'll investigate them later.
 1.26 13-Jan-2014  tsutsui bus_space_mmap(9) function should return alpha_btop(PA), not alpha_btop(VA).

Pointed out in PR port-alpha/48431 from nullnilaki.
 1.25 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.24 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.23 25-Sep-2011  chs branches: 1.23.2; 1.23.6;
change inline to static inline to appease gcc 4.5.
 1.22 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.21 28-Apr-2008  martin branches: 1.21.8; 1.21.14;
Remove clause 3 and 4 from TNF licenses
 1.20 04-Mar-2007  christos branches: 1.20.40; 1.20.42; 1.20.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 11-Dec-2005  christos branches: 1.19.26;
merge ktrace-lwp.
 1.18 14-Jul-2003  lukem branches: 1.18.16;
add __KERNEL_RCSID() (using 1, for #included .c files)
 1.17 16-Sep-2001  thorpej branches: 1.17.18;
BWX-addressable space is aways linear, so always allow BUS_SPACE_MAP_LINEAR
requests to succeed (and ignore BUS_SPACE_MAP_PREFETCHABLE, since it makes
no difference in BWX-addressable space).
 1.16 04-Sep-2001  thorpej branches: 1.16.2;
Typos, pointed out by Luke Mewburn (gee, I guess I built a kernel
other than GENERIC).
 1.15 04-Sep-2001  thorpej Implement bus_space_mmap().
 1.14 29-Nov-2000  thorpej branches: 1.14.2; 1.14.4;
Revert previous -- we'll do it differently.
 1.13 29-Nov-2000  thorpej Increase the number of static extent descriptors from 8 to 16,
and add a means for calling a chip-specific init hook.
 1.12 26-Jun-2000  thorpej Do the previously slightly differently, to avoid confusing the internal
space extent maps. Pointed out by msaitoh@netbsd.org. (Someone should
send me an EV6 machine!)
 1.11 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.10 17-Apr-2000  drochner branches: 1.10.4;
implement bus_space_vaddr()
 1.9 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.8 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.7 06-Feb-2000  thorpej Changed cacheable -> prefetchable. [sync w/ swiz]
 1.6 02-Dec-1999  thorpej Pull in the BWX inlines. We expect the arch to be set appropriately for
the assembler before these files are pulled in by the chip-sepecific files.
 1.5 30-Aug-1998  cgd branches: 1.5.12; 1.5.18;
use current bus_space interface names for barrier ops
 1.4 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.3 07-Jun-1998  thorpej branches: 1.3.2;
Oops, don't forget to fill in *addrp.
 1.2 06-Jun-1998  thorpej Implement bus_space_{alloc,free}() for BWX bus space.
 1.1 04-Jun-1998  thorpej Add support for using BWX for PCI config space and PCI i/o and mem space
on the ALCOR2 and Pyxis. BWX is enabled iff:
- It hasn't been disabled by the user (patch `cia_use_bwx' or build cia.o
with the option "CIA_USE_BWX=0"),
- it's enabled in CIA_CSR_CNFG,
- we are running on an EV5-family processor,
- BWX is in the processor's capabilities mask.
 1.3.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.5.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.12.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.4.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.14.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.14.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.16.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.18.1 03-Aug-2004  skrll Sync with HEAD
 1.18.16.1 03-Sep-2007  yamt sync with head.
 1.19.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.44.2 04-May-2009  yamt sync with head.
 1.20.44.1 16-May-2008  yamt sync with head.
 1.20.42.1 18-May-2008  yamt sync with head.
 1.20.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.6.1 18-Feb-2012  mrg merge to -current.
 1.23.2.1 17-Apr-2012  yamt sync with head
 1.27.46.1 13-May-2021  thorpej Sync with HEAD.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.2 03-Aug-1995  cgd need i/o map function pointer
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.1 09-Mar-2025  thorpej branches: 1.1.4;
Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 09-Mar-2025  perseant file pci_consinit.c was added on branch perseant-exfatfs on 2025-08-02 05:55:23 +0000
 1.1 23-May-1997  thorpej branches: 1.1.2;
file pci_dma_sgmap.h was initially added on branch thorpej-bus-dma.
 1.1.2.2 03-Jun-1997  thorpej Garbage-collect; these files are no longer needed.
 1.1.2.1 23-May-1997  thorpej Add code to manage SGMAP-mapped DMA windows. These routines create
the SGMAPs, and load/unload the page tables with DMA transactions.
 1.1 23-May-1997  thorpej branches: 1.1.2;
file pci_dma_sgmap_common.c was initially added on branch thorpej-bus-dma.
 1.1.2.2 03-Jun-1997  thorpej Garbage-collect; these files are no longer needed.
 1.1.2.1 23-May-1997  thorpej Add code to manage SGMAP-mapped DMA windows. These routines create
the SGMAPs, and load/unload the page tables with DMA transactions.
 1.50 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.49 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.48 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.47 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.46 22-Sep-2020  thorpej branches: 1.46.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.45 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.44 06-Feb-2012  matt branches: 1.44.6; 1.44.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.43 14-Jun-2011  matt branches: 1.43.2; 1.43.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.42 04-Apr-2011  dyoung branches: 1.42.2;
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.41 15-Dec-2010  matt branches: 1.41.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.40 16-Mar-2009  dsl branches: 1.40.4;
ANSIfy functions with function-pointer arguments
 1.39 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.38 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 28-Apr-2008  martin branches: 1.36.8; 1.36.14;
Remove clause 3 and 4 from TNF licenses
 1.35 03-Dec-2007  ad branches: 1.35.14; 1.35.16; 1.35.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.34 11-Dec-2005  christos branches: 1.34.30; 1.34.48; 1.34.50; 1.34.56;
merge ktrace-lwp.
 1.33 29-Mar-2005  thorpej branches: 1.33.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.32 27-Sep-2002  provos branches: 1.32.6; 1.32.12; 1.32.14; 1.32.20;
remove trailing \n in panic(). approved perry.
 1.31 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.30 27-Jul-2001  thorpej branches: 1.30.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.29 28-Dec-2000  sommerfeld branches: 1.29.4;
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.28 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.27 06-Jun-2000  thorpej Report which compatibility IRQ the PCI IDE gets.
 1.26 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.25 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.24 12-Feb-1999  thorpej branches: 1.24.8; 1.24.16;
Fix printf format problems on Alpha.
 1.23 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.22 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.21 07-Jul-1998  thorpej Fix typi.
 1.20 07-Jul-1998  thorpej The Pyxis core logic in the 164SX and 164LX seems to have problems with
stray interrupts. Do what Digital UNIX (formerly DEC OSF/1) does; just
ignore strays.
 1.19 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.18 05-Jun-1998  thorpej Don't attempt to map the PCI IDE interrupt at bus 0 device 11 on the
AlphaPC 164 and AlphaPC 164LX - these are wired to compatibility mode.
 1.17 24-May-1998  matt Only disable stray interrupts if there is no interrupt handler attached
 1.16 11-May-1998  thorpej Rework PCI interrupt mapping on the EB164 systype. Rather than computing
interrupt routing directly, use the interrupt routing information provided
in the PCI "line" register. The previous scheme did not work properly on
AlphaPC 164SXs. Also, be silent about the fact that 0/8/x does not
have its interrupt mapped; this is to be expected on the 164SX (this is
the Cypress PCI-ISA bridge, which has IDE wired to compat mode on functions
1 and 2; the 164SX does _not_ have PCI IDE on device 11 like other AlphaPCs).
 1.15 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.14 18-Apr-1998  thorpej First cut at PCI IDE compat interrupt support for the EB164 systype.
PCI IDE is found on the AlphaPC 164SX's Cypress PCI-ISA bridge.
 1.13 16-Apr-1998  thorpej Make function names in printfs and panics consistent.
 1.12 16-Apr-1998  thorpej Allow device 8 (the SIO) to have its interrupt mapped; there might be
a PCI IDE controller on one of the PCI-ISA bridge's functions (e.g.
AlphaPC 164SX).
 1.11 14-Apr-1998  thorpej Pass the pci_chipset_tag_t to sio_intr_setup(). XXX This code should be
rearranged so that other non-PCI-but-in-all-other-ways-ISA-PIC-like
devices can share code.
 1.10 02-Sep-1997  thorpej Adjust for changes to bus space tag initialization.
 1.9 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.8 19-Jul-1997  cgd branches: 1.8.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.7 31-May-1997  cgd Adjust gcc -Wuninitialized warning initializers (or add them) so that
compliation without DEBUG and/or DIAGNOSTIC happens without errors.
Note that all such initializations in the Alpha port are marked with "XXX
gcc -Wuninitialized". As far as I'm concerned, the one or two times
-Wuninitialized has saved me from problems are worth the (very minor) cost
involved with the initializations, esp. if it's noted why the
initializations are done. This was prompted by PR#3690, from Ted Lemon.
 1.6 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 25-Nov-1996  cgd branches: 1.4.2;
make eb164 interrupts actually work.
 1.3 17-Nov-1996  cgd implement interrupt enable/disable and mapping as described in
the Digital Semiconductor AlphaPC 164 Motherboard Technical Reference
Manual. This may not work, but it's the best i can do with the
documentation I have.
 1.2 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.1 11-Nov-1996  cgd preliminary support for the EB164. The EB164 is more or less a 'normal'
21164 + 21172 box, with Yet Another Way of doing interrupts. The
interrupt mapping and handling code hasn't been written yet, and none
of this code has been tested. (Checkpoint of work in progress.)
 1.4.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.24.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.24.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.29.4.3 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.29.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.29.4.1 03-Aug-2001  lukem update to -current
 1.30.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.30.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.30.2.1 27-Jul-2001  nathanw file pci_eb164.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.32.20.1 30-Mar-2005  tron Pull up revision 1.33 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.32.14.1 29-Apr-2005  kent sync with -current
 1.32.12.1 11-May-2005  riz Pull up revision 1.33 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.32.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.33.2.1 07-Dec-2007  yamt sync with head
 1.34.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.34.50.1 09-Jan-2008  matt sync with HEAD
 1.34.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.30.1 03-Dec-2007  ad Sync with HEAD.
 1.35.18.2 04-May-2009  yamt sync with head.
 1.35.18.1 16-May-2008  yamt sync with head.
 1.35.16.1 18-May-2008  yamt sync with head.
 1.35.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.40.4.2 21-Apr-2011  rmind sync with head
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.43.6.1 18-Feb-2012  mrg merge to -current.
 1.43.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.43.2.1 17-Apr-2012  yamt sync with head
 1.44.10.1 18-May-2014  rmind sync with head
 1.44.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.4 14-Mar-2009  dsl branches: 1.4.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 05-Jun-2000  thorpej branches: 1.3.132; 1.3.140; 1.3.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.2 07-Apr-1997  cgd branches: 1.2.22; 1.2.30;
clean up NetBSD RCS ID strings
 1.1 11-Nov-1996  cgd branches: 1.1.2;
preliminary support for the EB164. The EB164 is more or less a 'normal'
21164 + 21172 box, with Yet Another Way of doing interrupts. The
interrupt mapping and handling code hasn't been written yet, and none
of this code has been tested. (Checkpoint of work in progress.)
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.30.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.22.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.3.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.132.1 04-May-2009  yamt sync with head.
 1.4.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.6 23-Jan-2002  ross Tweak boilerplate to kill assembler warning (netbsd pr alpha/15119)
 1.5 02-Sep-1997  thorpej branches: 1.5.30; 1.5.32;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.4 08-Apr-1997  cgd branches: 1.4.4;
include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.3 07-Apr-1997  cgd clean up options.h inclusion slightly
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.1 25-Nov-1996  cgd branches: 1.1.2;
make eb164 interrupts actually work.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.32.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.30.1 28-Feb-2002  nathanw Catch up to -current.
 1.29 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.28 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.27 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.26 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.25 22-Sep-2020  thorpej branches: 1.25.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.24 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.23 06-Feb-2012  matt branches: 1.23.6; 1.23.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 04-Apr-2011  dyoung branches: 1.22.4; 1.22.8;
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.21 15-Dec-2010  matt branches: 1.21.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.20 16-Mar-2009  dsl branches: 1.20.4;
ANSIfy functions with function-pointer arguments
 1.19 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 03-Dec-2007  ad branches: 1.15.14; 1.15.16; 1.15.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.14 11-Dec-2005  christos branches: 1.14.30; 1.14.48; 1.14.50; 1.14.56;
merge ktrace-lwp.
 1.13 29-Mar-2005  thorpej branches: 1.13.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.12 27-Sep-2002  provos branches: 1.12.6; 1.12.12; 1.12.14; 1.12.20;
remove trailing \n in panic(). approved perry.
 1.11 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.10 27-Jul-2001  thorpej branches: 1.10.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.9 28-Dec-2000  sommerfeld branches: 1.9.4;
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.8 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 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 12-Feb-1999  thorpej branches: 1.5.8; 1.5.16;
Fix printf format problems on Alpha.
 1.4 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.3 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.2 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.1 29-Apr-1998  thorpej Add support for the DEC EB64+.
 1.5.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.8.2 05-Jan-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.9.4.3 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.9.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.4.1 03-Aug-2001  lukem update to -current
 1.10.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.10.2.1 27-Jul-2001  nathanw file pci_eb64plus.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.12.20.1 30-Mar-2005  tron Pull up revision 1.13 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.12.14.1 29-Apr-2005  kent sync with -current
 1.12.12.1 11-May-2005  riz Pull up revision 1.13 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.12.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.13.2.1 07-Dec-2007  yamt sync with head
 1.14.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.50.1 09-Jan-2008  matt sync with HEAD
 1.14.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.30.1 03-Dec-2007  ad Sync with HEAD.
 1.15.18.2 04-May-2009  yamt sync with head.
 1.15.18.1 16-May-2008  yamt sync with head.
 1.15.16.1 18-May-2008  yamt sync with head.
 1.15.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.20.4.2 21-Apr-2011  rmind sync with head
 1.20.4.1 05-Mar-2011  rmind sync with head
 1.21.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.22.8.1 18-Feb-2012  mrg merge to -current.
 1.22.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.22.4.1 17-Apr-2012  yamt sync with head
 1.23.10.1 18-May-2014  rmind sync with head
 1.23.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.3 14-Mar-2009  dsl branches: 1.3.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.2 05-Jun-2000  thorpej branches: 1.2.132; 1.2.140; 1.2.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.1 29-Apr-1998  thorpej branches: 1.1.14; 1.1.22;
Add support for the DEC EB64+.
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.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.2.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.132.1 04-May-2009  yamt sync with head.
 1.3.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 14-Sep-2004  drochner fix wrong asm .end names which caused assembler warnings,
from Nicolas Joly per PR port-alpha/26945
 1.2 02-Sep-1997  thorpej branches: 1.2.52;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.1 10-Apr-1997  cgd branches: 1.1.2; 1.1.6;
add eb64+ support, enabled with options DEC_EB64PLUS
 1.1.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 10-Apr-1997  cgd file pci_eb64plus_intr.s was added on branch alpha-nwscons on 1997-06-01 04:13:32 +0000
 1.2.52.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.52.1 18-Sep-2004  skrll Sync with HEAD.
 1.29 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.28 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.27 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.26 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.25 22-Sep-2020  thorpej branches: 1.25.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.24 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.23 06-Feb-2012  matt branches: 1.23.6; 1.23.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 04-Apr-2011  dyoung branches: 1.22.4; 1.22.8;
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.21 15-Dec-2010  matt branches: 1.21.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.20 16-Mar-2009  dsl branches: 1.20.4;
ANSIfy functions with function-pointer arguments
 1.19 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 03-Dec-2007  ad branches: 1.15.14; 1.15.16; 1.15.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.14 11-Dec-2005  christos branches: 1.14.30; 1.14.48; 1.14.50; 1.14.56;
merge ktrace-lwp.
 1.13 29-Mar-2005  thorpej branches: 1.13.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.12 27-Sep-2002  provos branches: 1.12.6; 1.12.12; 1.12.14; 1.12.20;
remove trailing \n in panic(). approved perry.
 1.11 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.10 27-Jul-2001  thorpej branches: 1.10.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.9 28-Dec-2000  sommerfeld branches: 1.9.4;
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.8 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 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 12-Feb-1999  thorpej branches: 1.5.8; 1.5.16;
Fix printf format problems on Alpha.
 1.4 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.3 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.2 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.1 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.5.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.8.2 05-Jan-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.9.4.3 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.9.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.4.1 03-Aug-2001  lukem update to -current
 1.10.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.10.2.1 27-Jul-2001  nathanw file pci_eb66.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.12.20.1 30-Mar-2005  tron Pull up revision 1.13 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.12.14.1 29-Apr-2005  kent sync with -current
 1.12.12.1 11-May-2005  riz Pull up revision 1.13 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.12.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.13.2.1 07-Dec-2007  yamt sync with head
 1.14.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.50.1 09-Jan-2008  matt sync with HEAD
 1.14.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.30.1 03-Dec-2007  ad Sync with HEAD.
 1.15.18.2 04-May-2009  yamt sync with head.
 1.15.18.1 16-May-2008  yamt sync with head.
 1.15.16.1 18-May-2008  yamt sync with head.
 1.15.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.20.4.2 21-Apr-2011  rmind sync with head
 1.20.4.1 05-Mar-2011  rmind sync with head
 1.21.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.22.8.1 18-Feb-2012  mrg merge to -current.
 1.22.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.22.4.1 17-Apr-2012  yamt sync with head
 1.23.10.1 18-May-2014  rmind sync with head
 1.23.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.2 14-Mar-2009  dsl branches: 1.2.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.1 27-Jun-1998  thorpej branches: 1.1.154; 1.1.162; 1.1.168;
Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.1.168.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.162.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.154.1 04-May-2009  yamt sync with head.
 1.2.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Sep-2004  drochner fix wrong asm .end names which caused assembler warnings,
from Nicolas Joly per PR port-alpha/26945
 1.1 27-Jun-1998  thorpej branches: 1.1.48;
Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.1.48.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.1 18-Sep-2004  skrll Sync with HEAD.
 1.59 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.58 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.57 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.56 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.55 22-Sep-2020  thorpej branches: 1.55.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.54 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.53 06-Feb-2012  matt branches: 1.53.6; 1.53.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.52 04-Apr-2011  dyoung branches: 1.52.4; 1.52.8;
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.51 15-Dec-2010  matt branches: 1.51.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.50 14-Mar-2009  dsl branches: 1.50.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.49 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.48 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.47 03-Dec-2007  ad branches: 1.47.18; 1.47.26; 1.47.32;
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.46 11-Dec-2005  christos branches: 1.46.30; 1.46.48; 1.46.50; 1.46.56;
merge ktrace-lwp.
 1.45 29-Mar-2005  thorpej branches: 1.45.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.44 27-Sep-2002  provos branches: 1.44.6; 1.44.12; 1.44.14; 1.44.20;
remove trailing \n in panic(). approved perry.
 1.43 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.42 27-Jul-2001  thorpej branches: 1.42.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.41 28-Dec-2000  sommerfeld branches: 1.41.4;
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.40 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.39 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.38 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.37 15-Dec-1999  thorpej branches: 1.37.2;
Key off NSIO and NPCEB for (E)ISA interrupt support.

XXX Can probably nuke the SIO test; don't all of the ALCOR-class systems
XXX have EISA?
 1.36 12-Feb-1999  thorpej branches: 1.36.8; 1.36.14;
Fix printf format problems on Alpha.
 1.35 31-Oct-1998  mjacob If NSIO not defined, compile errors.
 1.34 01-Aug-1998  thorpej Implement pci_intr_disestablish().
 1.33 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.32 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.31 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.30 24-Apr-1998  mjacob fix minor typo
 1.29 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.28 16-Apr-1998  thorpej Make function names in printfs and panics consistent.
 1.27 14-Apr-1998  thorpej Pass the pci_chipset_tag_t to sio_intr_setup(). XXX This code should be
rearranged so that other non-PCI-but-in-all-other-ways-ISA-PIC-like
devices can share code.
 1.26 02-Sep-1997  thorpej Adjust for changes to bus space tag initialization.
 1.25 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.24 19-Jul-1997  cgd branches: 1.24.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.23 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.22 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.21 17-Nov-1996  cgd branches: 1.21.2;
use the new common chained-interrupt support code.
 1.20 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.19 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.18 13-Oct-1996  christos backout previous kprintf change
 1.17 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.16 19-Aug-1996  cgd check in the code used to build the kernel that Andrew Gallatin used to
figure out the correct IRQ for the ethernet on the AlphaStation 500.
That code is enabled via KN20AA_BOGUS_IRQ_FROB (but hopefully won't be
needed any time soon, and won't link w/o slight changes to other code).
Basically, when establishing an interrupt that we don't know what to
do with, prompt the user for what interrupt line to enable. If you
get stray interrupts when you try to use the device (but not before),
then you've got the right line.
 1.15 19-Aug-1996  cgd fix typo in comment
 1.14 19-Aug-1996  cgd 21040 ethernet chip on AlphaStation 500 lives in slot 6 (a slot not
found on the AlphaStation 600), and interrupts on interrupt line 13.
Thanks to Andrew Gallatin for booting a test kernel 32 times (trying
each interrupt line, looking for the right one) to find this.
 1.13 15-Aug-1996  cgd clean up stray interrupt handling a bit.
 1.12 14-Aug-1996  cgd oops; fix bogon in last.
 1.11 14-Aug-1996  cgd say 'stray kn20aa irq' rather than 'stray PCI irq'; former is more correct.
 1.10 14-Aug-1996  cgd fix inadvertent reordering of switch which cases by slot number but
is ordered by interrupt number.
 1.9 07-Aug-1996  cgd fix bogus returns from dec_kn20aa_intr_map(), and slightly simplify interrupt
mapping code. (instead of using a "slot" and multiplying by 4 and adding the
pin number later to get the IRQ, just use base IRQ value and add the pin
number.)
 1.8 07-Aug-1996  cgd fix a typo, add a function kn20aa_disable_intr() to disable a given
kn20aa interrupt line.
 1.7 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
(2) Include more headers to bring necessary prototypes into scope.
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 13-Jun-1996  cgd clean up copyright notices
 1.4 05-Jun-1996  cgd avoid lots of upper-case letters in interrupt names. prettier that way.
 1.3 13-Apr-1996  cgd branches: 1.3.4;
update for new ISA/EISA/PCI/'bus' interfaces. Untested
 1.2 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.4.3 26-Aug-1996  cgd pull up from trunk: minor cleanups and support for handling
AlphaStation 500's built-in 21040 ethernet's interrupt.
 1.3.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.3.4.1 05-Jun-1996  cgd Pull up from trunk:
>avoid lots of upper-case letters in interrupt names. prettier that way.
 1.21.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.21.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.24.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.36.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.36.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.37.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.41.4.3 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.41.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.41.4.1 03-Aug-2001  lukem update to -current
 1.42.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.42.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.42.2.1 27-Jul-2001  nathanw file pci_kn20aa.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.44.20.1 30-Mar-2005  tron Pull up revision 1.45 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.44.14.1 29-Apr-2005  kent sync with -current
 1.44.12.1 11-May-2005  riz Pull up revision 1.45 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.44.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.45.2.1 07-Dec-2007  yamt sync with head
 1.46.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.46.50.1 09-Jan-2008  matt sync with HEAD
 1.46.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.46.30.1 03-Dec-2007  ad Sync with HEAD.
 1.47.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.47.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.47.18.1 04-May-2009  yamt sync with head.
 1.50.4.2 21-Apr-2011  rmind sync with head
 1.50.4.1 05-Mar-2011  rmind sync with head
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.52.8.1 18-Feb-2012  mrg merge to -current.
 1.52.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.52.4.1 17-Apr-2012  yamt sync with head
 1.53.10.1 18-May-2014  rmind sync with head
 1.53.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.5 14-Mar-2009  dsl branches: 1.5.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 05-Jun-2000  thorpej branches: 1.4.132; 1.4.140; 1.4.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.3 07-Apr-1997  cgd branches: 1.3.22; 1.3.30;
clean up NetBSD RCS ID strings
 1.2 13-Apr-1996  cgd branches: 1.2.2;
update for new ISA/EISA/PCI/'bus' interfaces. Untested
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.30.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.22.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.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.132.1 04-May-2009  yamt sync with head.
 1.5.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.43 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.42 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.41 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.40 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.39 19-Jun-2021  thorpej Remove the "first" argument from pci_kn300_pickintr(). It's redundant with
information we already have, and is a needless divergence from other
"pickintr" routines.
 1.38 25-Sep-2020  thorpej branches: 1.38.6;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.37 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.36 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.35 06-Feb-2012  matt branches: 1.35.6; 1.35.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.34 04-Apr-2011  dyoung branches: 1.34.4; 1.34.8;
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.33 15-Dec-2010  matt branches: 1.33.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.32 14-Mar-2009  dsl branches: 1.32.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.31 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.30 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.29 03-Dec-2007  ad branches: 1.29.18; 1.29.26; 1.29.32;
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.28 11-Dec-2005  christos branches: 1.28.30; 1.28.48; 1.28.50; 1.28.56;
merge ktrace-lwp.
 1.27 29-Mar-2005  thorpej branches: 1.27.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.26 06-Jul-2004  mhitch branches: 1.26.4; 1.26.10;
Ooops - buspin is what should be used.
 1.25 06-Jul-2004  mhitch When calculating the mcpcia irq, include bus pin to account for devices
behind a PCI-PCI bridge. Fixes PR#25831 (and the duplicate PR#26031).
Verified by Chuck Silvers.
 1.24 15-May-2002  thorpej branches: 1.24.10; 1.24.12;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.23 27-Jul-2001  thorpej branches: 1.23.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.22 28-Dec-2000  sommerfeld branches: 1.22.4;
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.21 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.20 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.19 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.18 10-Feb-2000  mjacob branches: 1.18.2;
Reset maxstray count if we get a good interrupt for a level.
 1.17 10-Feb-2000  mjacob Guard against trying to disable an interrupt where we'd dereference a
bad pointer.
 1.16 15-Dec-1999  thorpej Key off NSIO and NPCEB for (E)ISA interrupt support.

XXX Can probably nuke the SIO test; don't all of the Rawhide-class systems
XXX have EISA?
 1.15 15-Dec-1999  thorpej Use alpha_shared_intr_{get,set}_private().
 1.14 15-Dec-1999  thorpej Fix a botch in stray interrupt reporting; report the kn300 IRQ, not the
interrupt enable bit on the MCPCIA the interrupt is mapped to.
 1.13 04-Dec-1999  mjacob Fixes PR#8836. Some changes made by somebody else were a tad incomplete so
configuring w/o SIO broke compilation. I forget why, but there was at one
point (and may still be) a dependency between SIO and EISA. This change
just makes things compile sensibly again. It may make no sense to build
a kernel w/o sio in this case. I can't test this conveniently because I
haven't got a 4100 with a video card in it at the moment.
 1.12 16-Apr-1999  thorpej branches: 1.12.2; 1.12.8;
Clean up the Rawhide interrupt code some more:
- Actually display the kn300 irq, not the MCPCIA irq, in the interrupt
string. Also, don't bother displaying device/pin on strays, since
it doesn't play will with shared interrupts that would happen due to
a PCI-PCI bridge.
- Shave a few more cycles out of the interrupt dispatch routine.
 1.11 15-Apr-1999  thorpej - Change the "savunit[]" and "savirqs[]" arrays to ints, rather than chars.
The access is more efficient this way (and this was done in the interrupt
dispatch code, so some cycles are actually shaved), and gcc gets annoyed
when chars are used as array subscripts.
- Adjust for the fixed Rawhide console initialization.
- When mapping a PCI interrupt, don't always map device 1 to IRQ 16. Device
1 is only the internal 53c810 on MID 5, and is an invalid device number
on any other MID.
- Adjust for change mcpcia_config/mcpcia_softc structures.
- Nuke the kludgy linked list of mcpcia_softc structures. Instead, just
use savunit[v] to index into mcpcia_cd.cd_devs[] to find the MCPCIA
which has the stray interrupt.
- Some other minor cosmetic cleanup.
 1.10 12-Feb-1999  thorpej branches: 1.10.2;
Fix printf format problems on Alpha.
 1.9 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.8 07-Jul-1998  thorpej Use ALPHA_SHARED_INTR_DISABLE() to test if a shared interrupt should
be disabled after a stray.
 1.7 05-May-1998  mjacob make it impossible to compile w/o SIO (you cannot have a console otherwise
 1.6 30-Apr-1998  mjacob pretty much redo interrupt code- now handles shared interrupts and solves the buspin int problem
 1.5 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.4 24-Apr-1998  mjacob fix minor typo
 1.3 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.2 15-Apr-1998  mjacob Hmmm- how did that happen- I missed a merge
 1.1 15-Apr-1998  mjacob add Alpha 4100 support
 1.10.2.1 16-Apr-1999  thorpej branches: 1.10.2.1.2;
Pull up 1.10 -> 1.12.
 1.10.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.22.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.4.1 03-Aug-2001  lukem update to -current
 1.23.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.23.2.1 27-Jul-2001  nathanw file pci_kn300.c was added on branch nathanw_sa on 2002-06-20 03:37:44 +0000
 1.24.12.2 09-Jul-2004  tron branches: 1.24.12.2.2;
Pull up revision 1.26 (requested by mhitch in ticket #622):
Ooops - buspin is what should be used.
 1.24.12.1 09-Jul-2004  tron Pull up revision 1.25 (requested by mhitch in ticket #623):
When calculating the mcpcia irq, include bus pin to account for devices
behind a PCI-PCI bridge. Fixes PR#25831 (and the duplicate PR#26031).
Verified by Chuck Silvers.
 1.24.12.2.2.1 11-May-2005  riz Pull up revision 1.27 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.24.10.4 01-Apr-2005  skrll Sync with HEAD.
 1.24.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.10.1 03-Aug-2004  skrll Sync with HEAD
 1.26.10.1 30-Mar-2005  tron Pull up revision 1.27 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.27.2.1 07-Dec-2007  yamt sync with head
 1.28.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.28.50.1 09-Jan-2008  matt sync with HEAD
 1.28.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.28.30.1 03-Dec-2007  ad Sync with HEAD.
 1.29.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.18.1 04-May-2009  yamt sync with head.
 1.32.4.2 21-Apr-2011  rmind sync with head
 1.32.4.1 05-Mar-2011  rmind sync with head
 1.33.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.8.1 18-Feb-2012  mrg merge to -current.
 1.34.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.34.4.1 17-Apr-2012  yamt sync with head
 1.35.10.1 18-May-2014  rmind sync with head
 1.35.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.4 19-Jun-2021  thorpej Remove the "first" argument from pci_kn300_pickintr(). It's redundant with
information we already have, and is a needless divergence from other
"pickintr" routines.
 1.3 14-Mar-2009  dsl branches: 1.3.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.2 05-Jun-2000  thorpej branches: 1.2.132; 1.2.140; 1.2.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.1 15-Apr-1998  mjacob branches: 1.1.14; 1.1.22;
add Alpha 4100 support
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.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.2.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.132.1 04-May-2009  yamt sync with head.
 1.3.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.34 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.33 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.32 19-Jun-2021  thorpej Remove the "first" argument from pci_kn8ae_pickintr(), instead using
a real once control in that function. Removes a needless divergence from
other "pickintr" routines.
 1.31 25-Sep-2020  thorpej branches: 1.31.6;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.30 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.29 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.28 04-Nov-2013  christos mark variables used
 1.27 06-Feb-2012  matt branches: 1.27.6; 1.27.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.26 04-Apr-2011  dyoung branches: 1.26.4; 1.26.8;
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.25 15-Dec-2010  matt branches: 1.25.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.24 14-Mar-2009  dsl branches: 1.24.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.23 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.22 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.21 15-May-2002  thorpej branches: 1.21.116; 1.21.124; 1.21.130;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.20 13-Aug-2001  mjacob branches: 1.20.2;
Fixed the one minor buglet that kept 8200s from working
(SCB_VECTOIDX(vec) - SCB_IOVECBASE] -> SCB_VECTOIDX(vec - SCB_IOVECBASE))

Sigh. This is all very good work- this new interrupt stuff. Yet like the
last time my good friend Jason 'simplified' things, we lost information.
It used to be you could tell which specific slot an interrupt was frame
based upon the vector. Now you can't because they're allocated dynamically.
Oh well- it's not all that important.
 1.19 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.18 28-Dec-2000  sommerfeld branches: 1.18.4;
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.17 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.16 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.15 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.14 12-Feb-1999  thorpej branches: 1.14.8; 1.14.16;
Fix printf format problems on Alpha.
 1.13 25-Apr-1998  thorpej Fix some whitespace lossage.
 1.12 24-Apr-1998  mjacob fix minor typo
 1.11 18-Apr-1998  thorpej Initialize the PCI IDE compat interrupt PCI method to NULL; PCI IDE
compat interrupts are not currently supported on these platforms.
 1.10 16-Apr-1998  thorpej Make function names in printfs and panics consistent.
 1.9 15-Apr-1998  mjacob spurious interrupt notification and finally adding vmstat -i support
 1.8 23-Mar-1998  mjacob Slightly restructure interrupt handling to accomodate the addition
of a dwlpx_iointr vector.
 1.7 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 19-Jul-1997  cgd branches: 1.6.2;
don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.5 24-Jun-1997  mjacob Turn of 'unclaimed interrupt' messages- we know about them already- we can't
really fix this as yet.
 1.4 07-Apr-1997  cgd branches: 1.4.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 07-Apr-1997  cgd file pci_kn8ae.c was added on branch alpha-nwscons on 1997-06-01 04:13:35 +0000
 1.6.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.14.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.14.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.18.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.4.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.18.4.1 03-Aug-2001  lukem update to -current
 1.20.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.20.2.1 13-Aug-2001  nathanw file pci_kn8ae.c was added on branch nathanw_sa on 2002-06-20 03:37:45 +0000
 1.21.130.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.124.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.116.1 04-May-2009  yamt sync with head.
 1.24.4.2 21-Apr-2011  rmind sync with head
 1.24.4.1 05-Mar-2011  rmind sync with head
 1.25.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.8.1 18-Feb-2012  mrg merge to -current.
 1.26.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.26.4.1 17-Apr-2012  yamt sync with head
 1.27.10.1 18-May-2014  rmind sync with head
 1.27.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.6 19-Jun-2021  thorpej Remove the "first" argument from pci_kn8ae_pickintr(), instead using
a real once control in that function. Removes a needless divergence from
other "pickintr" routines.
 1.5 14-Mar-2009  dsl branches: 1.5.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 05-Jun-2000  thorpej branches: 1.4.132; 1.4.140; 1.4.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.3 07-Apr-1997  cgd branches: 1.3.2; 1.3.24; 1.3.32;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.32.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.24.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.3.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.1 07-Apr-1997  cgd file pci_kn8ae.h was added on branch alpha-nwscons on 1997-06-01 04:13:36 +0000
 1.4.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.132.1 04-May-2009  yamt sync with head.
 1.5.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.34 04-Oct-2025  thorpej Use device_{get,set}prop_bool() for "is_console".
 1.33 16-Sep-2021  andvar fix various typos, mainly in comments.
 1.32 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.31 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.30 25-Jun-2021  thorpej Make the following PCI chipset functions optional:
- attach_hook()
- bus_maxdevs()
- make_tag()
- decompose_tag()
...and provide a default implementation for each.
 1.29 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.28 26-Sep-2020  thorpej branches: 1.28.6;
Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.27 26-Sep-2020  thorpej Add support for CPU interrupt affinity for PCI interrupts:
- Keep a bitmap of eligible interrupt-handling CPUs in the pci_chipset_tag_t.
If this bitmap is 0, then we assume that all PCI interrupts should be
routed to the primary CPU.
- Add an optional PCI chipset callback for setting the CPU affinity of
an interrupt.
- When an establishing an interrupt handler, select the CPU that will
handle this irq using the following algorithm:
==> If the irq already has a CPU assignment, keep it.
==> Otherwise, find the CPU with the fewest registered handlers that
is eligible from both a hardware (based on the pci_chipset_tag_t)
and software (based on cpu_info::ci_schedstate.spc_flags) perspectives.
==> Fall back to the primary CPU failing all else.
 1.26 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.25 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.24 09-Aug-2019  rin Fix build without vga at pci.
 1.23 17-Oct-2014  uebayasi branches: 1.23.20;
PCI controller doesn't rely on (depend on) AGP bus, but provide it. If one
specific architecture is known to have some specific AGP implementation, such
suggestion must be done in the "selection" part, not the "definition" part.

This is also an indirect (across bus attachment), circular dependency.
 1.22 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.21 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.20 20-Jan-2014  tsutsui Check and set "is_console" property to PCI displays for framebuffer drivers.

Tested on DS15 with radeonfb(4) and XP1000 with vga(4)
by Naruaki Etomi in PR/48431.
 1.19 06-Feb-2012  matt branches: 1.19.6; 1.19.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.18 15-Dec-2010  matt branches: 1.18.8; 1.18.12;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.17 14-Mar-2009  dsl branches: 1.17.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.16 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15 16-Jul-2001  elric branches: 1.15.2; 1.15.128; 1.15.136; 1.15.142;
So, the PowerStorm 4d20 a.k.a. 32bit TGA2 w/ IBM RGB561 RAMDAC was causing
the kernel to panic since it is recognised as a TGA and the TGA driver
doesn't [yet] know what to do with it.

This patch fixes that by:
o making tgamatch() try to actually figure out what kind
of TGA card is there, rather than simply relying on the
vendor/product ids.
o creating a tga_cnmatch() so that the console code in
arch/alpha/pci/pci_machdep.c can cause the same to occur.
o breaking up some of tga_getdevconfig() into a few different
functions to re-use code that would have been duplicated.
o changed arch/alpha/pci/pci_machdep.c so that it calls out
to tga_cnmatch() if DEVICE_IS_TGA() matches before it decides
to attach the console as a TGA.

Addresses PR: port-alpha/12923
 1.14 29-Jun-2000  mrg branches: 1.14.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 28-May-1998  drochner branches: 1.13.14;
pull in new PC display headers
 1.12 15-Apr-1998  drochner Adapt PCI console selection to new mi drivers.
 1.11 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.10 07-Apr-1997  cgd branches: 1.10.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.9 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.8 08-Mar-1997  cgd fix problem compiling if neither PCI VGA nor TGA frame buffers were
configured. Pointed out by Matt Jacob.
 1.7 19-Nov-1996  cgd branches: 1.7.2; 1.7.8;
update for VGA-related changes
 1.6 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.5 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.4 12-Apr-1996  cgd update for new PCI, etc., interfaces.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd i/o map function dispatch, console picker function
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.7.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.10.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.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.14.4.1 03-Aug-2001  lukem update to -current
 1.15.142.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.136.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.128.1 04-May-2009  yamt sync with head.
 1.15.2.2 16-Jul-2001  elric So, the PowerStorm 4d20 a.k.a. 32bit TGA2 w/ IBM RGB561 RAMDAC was causing
the kernel to panic since it is recognised as a TGA and the TGA driver
doesn't [yet] know what to do with it.

This patch fixes that by:
o making tgamatch() try to actually figure out what kind
of TGA card is there, rather than simply relying on the
vendor/product ids.
o creating a tga_cnmatch() so that the console code in
arch/alpha/pci/pci_machdep.c can cause the same to occur.
o breaking up some of tga_getdevconfig() into a few different
functions to re-use code that would have been duplicated.
o changed arch/alpha/pci/pci_machdep.c so that it calls out
to tga_cnmatch() if DEVICE_IS_TGA() matches before it decides
to attach the console as a TGA.

Addresses PR: port-alpha/12923
 1.15.2.1 16-Jul-2001  elric file pci_machdep.c was added on branch nathanw_sa on 2001-07-16 00:55:18 +0000
 1.17.4.1 05-Mar-2011  rmind sync with head
 1.18.12.1 18-Feb-2012  mrg merge to -current.
 1.18.8.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.18.8.1 17-Apr-2012  yamt sync with head
 1.19.10.1 18-May-2014  rmind sync with head
 1.19.6.2 03-Dec-2017  jdolecek update from HEAD
 1.19.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.28.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.10 19-Mar-1999  cgd move pci/pci_machdep.h to include/pci_machdep.h. (can't do it via
repository copy because alpha already had an include/pci_machdep.h in
the attic.)
 1.9 18-Apr-1998  thorpej Add a second Alpha-specific pci_chipset_tag_t method for establishing
PCI IDE compat interrupts. Note that this function is optional, and
platform-specific code may initialize the pointer to NULL.
 1.8 19-Jul-1997  cgd don't expect/provide pci_decompose_tag to be a MI, public function. It
wasn't intended to be to begin with, and uses of it (e.g. the one in the
'de' driver) are quite likely to be incorrect.
 1.7 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 19-Nov-1996  cgd branches: 1.6.2;
fix spelling error
 1.5 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd update for new PCI, etc., interfaces.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.6.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2 03-Jun-1997  thorpej branches: 1.2.2;
Ooops! Not meant for the trunk; these need to be added to the branch!
 1.1 03-Jun-1997  thorpej Add "typedep" code to deal with both the 32-bit and 64-bit PTE formats
found on Alpha workstation and server PCI bridge chipsets.
 1.2.2.2 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.2.1 03-Jun-1997  thorpej Add "typedep" code to handle both the 32-bit and 64-bit SGMAP PTE
formats found on Alpha workstation and server PCI bridge chipsets.
 1.2 03-Jun-1997  thorpej branches: 1.2.2;
Ooops! Not meant for the trunk; these need to be added to the branch!
 1.1 03-Jun-1997  thorpej Add "typedep" code to deal with both the 32-bit and 64-bit PTE formats
found on Alpha workstation and server PCI bridge chipsets.
 1.2.2.4 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.2.3 04-Jun-1997  thorpej Garbage-collect SGMAP_PTE_OFFSET_SHIFT.
 1.2.2.2 03-Jun-1997  thorpej Specify PTE spacing, page frame shift, and valid bits.
 1.2.2.1 03-Jun-1997  thorpej Add "typedep" code to handle both the 32-bit and 64-bit SGMAP PTE
formats found on Alpha workstation and server PCI bridge chipsets.
 1.2 03-Jun-1997  thorpej branches: 1.2.2;
Ooops! Not meant for the trunk; these need to be added to the branch!
 1.1 03-Jun-1997  thorpej Add "typedep" code to deal with both the 32-bit and 64-bit PTE formats
found on Alpha workstation and server PCI bridge chipsets.
 1.2.2.2 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.2.1 03-Jun-1997  thorpej Add "typedep" code to handle both the 32-bit and 64-bit SGMAP PTE
formats found on Alpha workstation and server PCI bridge chipsets.
 1.2 03-Jun-1997  thorpej branches: 1.2.2;
Ooops! Not meant for the trunk; these need to be added to the branch!
 1.1 03-Jun-1997  thorpej Add "typedep" code to deal with both the 32-bit and 64-bit PTE formats
found on Alpha workstation and server PCI bridge chipsets.
 1.2.2.4 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.2.3 04-Jun-1997  thorpej Garbage-collect SGMAP_PTE_OFFSET_SHIFT.
 1.2.2.2 03-Jun-1997  thorpej Specify PTE spacing, page frame shift, and valid bits.
 1.2.2.1 03-Jun-1997  thorpej Add "typedep" code to handle both the 32-bit and 64-bit SGMAP PTE
formats found on Alpha workstation and server PCI bridge chipsets.
 1.10 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.9 11-Oct-2020  thorpej branches: 1.9.6;
Add some bus_dma instrumentation.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 28-Apr-2008  martin branches: 1.6.22;
Remove clause 3 and 4 from TNF licenses
 1.5 19-Jul-2001  thorpej branches: 1.5.2; 1.5.124; 1.5.126; 1.5.128;
Add support for mbufs to the Alpha SGMAP DMA maps.
 1.4 29-Jun-2000  mrg branches: 1.4.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 02-Sep-1997  thorpej branches: 1.3.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file pci_sgmap_pte32.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file pci_sgmap_pte32.c was added on branch alpha-nwscons on 1997-06-07 04:43:31 +0000
 1.3.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.5.128.1 16-May-2008  yamt sync with head.
 1.5.126.1 18-May-2008  yamt sync with head.
 1.5.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.2.2 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.5.2.1 19-Jul-2001  thorpej file pci_sgmap_pte32.c was added on branch nathanw_sa on 2001-07-19 06:40:03 +0000
 1.6.22.1 05-Mar-2011  rmind sync with head
 1.9.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.38;
Remove clause 3 and 4 from TNF licenses
 1.3 23-Mar-1998  mjacob branches: 1.3.150; 1.3.152; 1.3.154;
Spaicing for 32 bit ptes (dwlpx only, really) is 0x20, not 1
 1.2 06-Jun-1997  thorpej branches: 1.2.2;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file pci_sgmap_pte32.h was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file pci_sgmap_pte32.h was added on branch alpha-nwscons on 1997-06-07 04:43:32 +0000
 1.3.154.1 16-May-2008  yamt sync with head.
 1.3.152.1 18-May-2008  yamt sync with head.
 1.3.150.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.38.1 18-Feb-2012  mrg merge to -current.
 1.4.34.1 17-Apr-2012  yamt sync with head
 1.10 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.9 11-Oct-2020  thorpej branches: 1.9.6;
Add some bus_dma instrumentation.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 28-Apr-2008  martin branches: 1.6.22;
Remove clause 3 and 4 from TNF licenses
 1.5 19-Jul-2001  thorpej branches: 1.5.2; 1.5.124; 1.5.126; 1.5.128;
Add support for mbufs to the Alpha SGMAP DMA maps.
 1.4 29-Jun-2000  mrg branches: 1.4.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 02-Sep-1997  thorpej branches: 1.3.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file pci_sgmap_pte64.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file pci_sgmap_pte64.c was added on branch alpha-nwscons on 1997-06-07 04:43:34 +0000
 1.3.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.5.128.1 16-May-2008  yamt sync with head.
 1.5.126.1 18-May-2008  yamt sync with head.
 1.5.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.2.2 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.5.2.1 19-Jul-2001  thorpej file pci_sgmap_pte64.c was added on branch nathanw_sa on 2001-07-19 06:40:03 +0000
 1.6.22.1 05-Mar-2011  rmind sync with head
 1.9.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 28-Apr-2008  martin branches: 1.3.34; 1.3.38;
Remove clause 3 and 4 from TNF licenses
 1.2 06-Jun-1997  thorpej branches: 1.2.2; 1.2.160; 1.2.162; 1.2.164;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file pci_sgmap_pte64.h was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Rename these files (and functions) from pci_pte*_sgmap -> pci_sgmap_pte*.
Suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.164.1 16-May-2008  yamt sync with head.
 1.2.162.1 18-May-2008  yamt sync with head.
 1.2.160.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 06-Jun-1997  cgd file pci_sgmap_pte64.h was added on branch alpha-nwscons on 1997-06-07 04:43:35 +0000
 1.3.38.1 18-Feb-2012  mrg merge to -current.
 1.3.34.1 17-Apr-2012  yamt sync with head
 1.45 06-Dec-2023  thorpej bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.
 1.44 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.43 05-May-2021  thorpej Moar static.
 1.42 04-Nov-2013  christos branches: 1.42.46;
move ifdef'ed out code inside if 0
 1.41 06-Feb-2012  matt branches: 1.41.6; 1.41.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.40 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.39 25-Sep-2011  chs branches: 1.39.2; 1.39.6;
change inline to static inline to appease gcc 4.5.
 1.38 18-Mar-2009  cegger ansify function definitions
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 28-Apr-2008  martin branches: 1.36.8; 1.36.14;
Remove clause 3 and 4 from TNF licenses
 1.35 04-Mar-2007  christos branches: 1.35.40; 1.35.42; 1.35.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 11-Dec-2005  christos branches: 1.34.26;
merge ktrace-lwp.
 1.33 14-Jul-2003  lukem branches: 1.33.16;
add __KERNEL_RCSID() (using 1, for #included .c files)
 1.32 04-Sep-2001  thorpej branches: 1.32.20;
Implement bus_space_mmap().
 1.31 17-Apr-2000  drochner branches: 1.31.6; 1.31.8;
implement bus_space_vaddr()
 1.30 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.29 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.28 07-Dec-1999  thorpej Clarify what appear to the untrained eye to be two magic constants (the
address shift and access size shift), and allow them to be overridden
by chip-specific code, if necessary.
 1.27 30-Aug-1998  cgd branches: 1.27.12; 1.27.18;
use current bus_space interface names for barrier ops
 1.26 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.25 07-Jun-1998  thorpej branches: 1.25.2;
Oops, don't forget to fill in *addrp.
 1.24 06-Jun-1998  thorpej Implement bus_space_{alloc,free}() for swiz PCI I/O space.
 1.23 25-Oct-1997  thorpej Make the copy_region methods do overlapping copies properly. Fixes
port-alpha/4216 (Chris Demetriou).
 1.22 06-Sep-1997  thorpej branches: 1.22.4;
Update for Chris Demetriou's changes made to the bus.h interface:
- bus_space_copy -> bus_space_copy_region (for consistency)
- "cacheable" argument becomes a "flags" argument instead, with
BUS_SPACE_MAP_CACHEABLE and BUS_SPACE_MAP_LINEAR flags currently
defined.
 1.21 06-Sep-1997  thorpej s/BUS_BARRIER/BUS_SPACE_BARRIER/g
 1.20 02-Sep-1997  thorpej branches: 1.20.2;
Fix a think-o.
 1.19 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.18 02-Sep-1997  thorpej Clean up RCS IDs.
 1.17 02-Sep-1997  thorpej Revive these files from the Attic.
 1.16 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.15 12-Mar-1997  cgd update to allow PCI bus interfaces that wish to allocate static
extent storage per interface unit (e.g. dwlpx, where there can be multiple
units per machine) to do so. Inspired by discussion with and changes from
Matt Jacob.
 1.14 02-Dec-1996  cgd branches: 1.14.2;
implement bus_space_copy_*().
 1.13 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.12 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.11 02-Dec-1996  cgd declare the single-datum read and write methods as inline, so that
the multi and region methods can inline them.
 1.10 25-Nov-1996  cgd update these to set up and use extents to map i/o space, and sparse and
dense memory.
 1.9 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.4 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.3 09-Jun-1996  cgd wrap __STRING() in a #define so that its argument, which must be
expanded by the preprocessor, will be. Problem pointed out by Matt
Thomas.
 1.2 18-Apr-1996  cgd branches: 1.2.4;
Implement the I/O read/write-multiple functions for chipsets
that use this file (APECS, LCA, and CIA).
 1.1 12-Apr-1996  cgd chipset 'bus' functions that seem to be common to all host bus
adapters that exist in single-CPU systems. APECS, CIA, and LCA
all use this, but with different #defines.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
and
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 09-Jun-1996  cgd pull up from trunk:
>wrap __STRING() in a #define so that its argument, which must be
>expanded by the preprocessor, will be. Problem pointed out by Matt
>Thomas.
 1.14.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.20.2.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.2.1 02-Sep-1997  thorpej file pci_swiz_bus_io_chipdep.c was added on branch marc-pcmcia on 1997-09-04 00:53:54 +0000
 1.22.4.1 25-Oct-1997  thorpej Pull up from trunk:

Make the copy_region methods do overlapping copies properly. Fixes
port-alpha/4216 (Chris Demetriou).
 1.25.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.27.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.12.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.31.8.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.31.6.1 21-Sep-2001  nathanw Catch up to -current.
 1.32.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.20.1 03-Aug-2004  skrll Sync with HEAD
 1.33.16.1 03-Sep-2007  yamt sync with head.
 1.34.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.44.2 04-May-2009  yamt sync with head.
 1.35.44.1 16-May-2008  yamt sync with head.
 1.35.42.1 18-May-2008  yamt sync with head.
 1.35.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.39.6.1 18-Feb-2012  mrg merge to -current.
 1.39.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.2.1 17-Apr-2012  yamt sync with head
 1.41.10.1 18-May-2014  rmind sync with head
 1.41.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.46.1 13-May-2021  thorpej Sync with HEAD.
 1.50 07-Jan-2025  andvar s/prefectchable/prefetchable/ in variable name, messages and comments.
 1.49 04-Dec-2023  thorpej branches: 1.49.2;
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.48 05-May-2021  thorpej Moar static.
 1.47 04-Nov-2013  christos branches: 1.47.46;
move ifdef'ed out code inside if 0
 1.46 06-Feb-2012  matt branches: 1.46.6; 1.46.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.45 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.44 25-Sep-2011  chs branches: 1.44.2; 1.44.6;
change inline to static inline to appease gcc 4.5.
 1.43 18-Mar-2009  cegger ansify function definitions
 1.42 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.41 28-Apr-2008  martin branches: 1.41.8; 1.41.14;
Remove clause 3 and 4 from TNF licenses
 1.40 04-Mar-2007  christos branches: 1.40.40; 1.40.42; 1.40.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.39 11-Dec-2005  christos branches: 1.39.26;
merge ktrace-lwp.
 1.38 14-Jul-2003  lukem branches: 1.38.16;
add __KERNEL_RCSID() (using 1, for #included .c files)
 1.37 22-Jul-2002  mycroft branches: 1.37.6;
Set addr_shift and size_shift to 0 for the dense region.
 1.36 04-Sep-2001  thorpej branches: 1.36.12;
Implement bus_space_mmap().
 1.35 17-Apr-2000  drochner branches: 1.35.6; 1.35.8;
implement bus_space_vaddr()
 1.34 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.33 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.32 06-Feb-2000  elric Changed cacheable -> prefetchable.
 1.31 08-Dec-1999  thorpej Handle the case where PCI dense memory and PCI sparse memory don't
overlap; don't require allocation from the dense extent if the PCI
memory address isn't mapped into dense space.

Also, make sure to return an error if a liner mapping is requested
and dense space is not available (not just not requested).
 1.30 08-Dec-1999  thorpej Oops, committed the wrong version of this file previously.
 1.29 07-Dec-1999  thorpej Some systems don't have dense space; don't require it.
 1.28 07-Dec-1999  thorpej Clarify what appear to the untrained eye to be two magic constants (the
address shift and access size shift), and allow them to be overridden
by chip-specific code, if necessary.
 1.27 12-Mar-1999  perry branches: 1.27.8; 1.27.14;
nuke ovbcopy
 1.26 30-Aug-1998  cgd use current bus_space interface names for barrier ops
 1.25 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.24 25-Oct-1997  thorpej branches: 1.24.2;
Make the copy_region methods do overlapping copies properly. Fixes
port-alpha/4216 (Chris Demetriou).
 1.23 06-Sep-1997  thorpej branches: 1.23.4;
Update for Chris Demetriou's changes made to the bus.h interface:
- bus_space_copy -> bus_space_copy_region (for consistency)
- "cacheable" argument becomes a "flags" argument instead, with
BUS_SPACE_MAP_CACHEABLE and BUS_SPACE_MAP_LINEAR flags currently
defined.
 1.22 06-Sep-1997  thorpej s/BUS_BARRIER/BUS_SPACE_BARRIER/g
 1.21 02-Sep-1997  thorpej branches: 1.21.2;
Fix a think-o.
 1.20 02-Sep-1997  thorpej Treat bus space tags more like pci chipset tags and bus dma tags: allocate
them statically within a chipset's state structure, and pass them to
the *_bus_{io,mem}_init() functions.
 1.19 02-Sep-1997  thorpej Clean up RCS IDs.
 1.18 02-Sep-1997  thorpej Revive these files from the Attic.
 1.17 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.16 12-Mar-1997  cgd update to allow PCI bus interfaces that wish to allocate static
extent storage per interface unit (e.g. dwlpx, where there can be multiple
units per machine) to do so. Inspired by discussion with and changes from
Matt Jacob.
 1.15 02-Dec-1996  cgd branches: 1.15.2;
implement bus_space_copy_*().
 1.14 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.13 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.12 02-Dec-1996  cgd declare the single-datum read and write methods as inline, so that
the multi and region methods can inline them.
 1.11 25-Nov-1996  cgd update these to set up and use extents to map i/o space, and sparse and
dense memory.
 1.10 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.5 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.4 09-Jun-1996  cgd add support for mapping multiple memory windows. This is necessary
for mapping ISA/EISA 'hole' memory on the AlphaStation 600.
 1.3 09-Jun-1996  cgd wrap __STRING() in a #define so that its argument, which must be
expanded by the preprocessor, will be. Problem pointed out by Matt
Thomas.
 1.2 03-Jun-1996  cgd gross hack to get around the fact that there are currently devices with
common back-ends that live on multiple very-different busses (e.g. PCI and
TC), which need bus-specific DMA mapping support. As a nice side effect,
this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
to go away in favor of less nasty bus-specific function calls.
 1.1 12-Apr-1996  cgd branches: 1.1.4;
chipset 'bus' functions that seem to be common to all host bus
adapters that exist in single-CPU systems. APECS, CIA, and LCA
all use this, but with different #defines.
 1.1.4.4 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
and
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.1.4.3 09-Jun-1996  cgd pull up from trunk:
>add support for mapping multiple memory windows. This is necessary
>for mapping ISA/EISA 'hole' memory on the AlphaStation 600.
 1.1.4.2 09-Jun-1996  cgd pull up from trunk:
>wrap __STRING() in a #define so that its argument, which must be
>expanded by the preprocessor, will be. Problem pointed out by Matt
>Thomas.
 1.1.4.1 03-Jun-1996  cgd pull up from trunk:
>gross hack to get around the fact that there are currently devices with
>common back-ends that live on multiple very-different busses (e.g. PCI and
>TC), which need bus-specific DMA mapping support. As a nice side effect,
>this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
>to go away in favor of less nasty bus-specific function calls.
 1.15.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.21.2.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.2.1 02-Sep-1997  thorpej file pci_swiz_bus_mem_chipdep.c was added on branch marc-pcmcia on 1997-09-04 00:53:55 +0000
 1.23.4.1 25-Oct-1997  thorpej Pull up from trunk:

Make the copy_region methods do overlapping copies properly. Fixes
port-alpha/4216 (Chris Demetriou).
 1.24.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.27.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.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.35.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.35.8.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.35.6.2 01-Aug-2002  nathanw Catch up to -current.
 1.35.6.1 21-Sep-2001  nathanw Catch up to -current.
 1.36.12.1 30-Aug-2002  gehenna catch up with -current.
 1.37.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.37.6.1 03-Aug-2004  skrll Sync with HEAD
 1.38.16.1 03-Sep-2007  yamt sync with head.
 1.39.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.40.44.2 04-May-2009  yamt sync with head.
 1.40.44.1 16-May-2008  yamt sync with head.
 1.40.42.1 18-May-2008  yamt sync with head.
 1.40.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.41.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.44.6.1 18-Feb-2012  mrg merge to -current.
 1.44.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.2.1 17-Apr-2012  yamt sync with head
 1.46.10.1 18-May-2014  rmind sync with head
 1.46.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.46.1 13-May-2021  thorpej Sync with HEAD.
 1.49.2.1 02-Aug-2025  perseant Sync with HEAD
 1.17 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.16 22-Sep-2020  thorpej branches: 1.16.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.15 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.14 01-Jul-2011  dyoung branches: 1.14.2; 1.14.12; 1.14.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.13 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.12 04-Apr-2011  dyoung branches: 1.12.2;
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.11 15-Dec-2010  matt branches: 1.11.2;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.10 28-Apr-2008  martin branches: 1.10.22;
Remove clause 3 and 4 from TNF licenses
 1.9 04-Mar-2007  mrg branches: 1.9.40; 1.9.42; 1.9.44;
avoid unused variable warnings in pci_up1000_pickintr().
 1.8 15-May-2002  thorpej branches: 1.8.26; 1.8.64;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.7 27-Jul-2001  thorpej branches: 1.7.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.6 28-Dec-2000  sommerfeld branches: 1.6.4;
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.5 29-Jun-2000  mrg branches: 1.5.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 06-Jun-2000  thorpej branches: 1.4.4;
Report which compatibility IRQ the PCI IDE gets.
 1.3 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.2 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.1 01-Jun-2000  thorpej Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.4.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.4.1 06-Jun-2000  minoura file pci_up1000.c was added on branch minoura-xpg4dl on 2000-06-22 16:58:43 +0000
 1.5.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.5.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.5.2.1 29-Jun-2000  bouyer file pci_up1000.c was added on branch thorpej_scsipi on 2000-11-20 19:57:17 +0000
 1.6.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.7.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.7.2.1 27-Jul-2001  nathanw file pci_up1000.c was added on branch nathanw_sa on 2002-06-20 03:37:45 +0000
 1.8.64.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.26.1 03-Sep-2007  yamt sync with head.
 1.9.44.1 16-May-2008  yamt sync with head.
 1.9.42.1 18-May-2008  yamt sync with head.
 1.9.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.22.2 21-Apr-2011  rmind sync with head
 1.10.22.1 05-Mar-2011  rmind sync with head
 1.11.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14.16.1 18-May-2014  rmind sync with head
 1.14.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.3 14-Mar-2009  dsl branches: 1.3.80;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.14;
Remove clause 3 and 4 from TNF licenses
 1.1 01-Jun-2000  thorpej branches: 1.1.4; 1.1.6; 1.1.132; 1.1.134; 1.1.136;
Add support for the Alpha Processor, Inc. UP1000 EV6 system.
 1.1.136.2 04-May-2009  yamt sync with head.
 1.1.136.1 16-May-2008  yamt sync with head.
 1.1.134.1 18-May-2008  yamt sync with head.
 1.1.132.1 02-Jun-2008  mjf Sync with HEAD.
 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 01-Jun-2000  bouyer file pci_up1000.h was added on branch thorpej_scsipi on 2000-11-20 19:57:17 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 01-Jun-2000  minoura file pci_up1000.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:44 +0000
 1.2.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.80.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.5 04-Apr-2011  dyoung 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.4 16-Mar-2009  dsl branches: 1.4.4; 1.4.6;
ANSIfy functions with function-pointer arguments
 1.3 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.2 18-Apr-1998  thorpej branches: 1.2.154; 1.2.162; 1.2.168;
Fix a typo.
 1.1 18-Apr-1998  thorpej Machine-dependent bits for PCI IDE. This redirects PCI IDE compat interrupt
goop to the appropriate platform-dependent code.
 1.2.168.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.162.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.154.1 04-May-2009  yamt sync with head.
 1.4.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.4.1 21-Apr-2011  rmind sync with head
 1.1 07-Dec-1996  cgd branches: 1.1.2;
file pcimd.c was initially added on branch alpha-nwscons.
 1.1.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.14 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.13 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.12 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.8 17-Apr-1996  cgd fix bug in pcivga_erasecols() that would cause garbage to be spit out.
other minor style cleanup.
 1.7 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.6 12-Apr-1996  cgd (mostly) update for new PCI and 'bus' interfaces.
 1.5 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.4 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd PCI VGA support. should be MI, but not yet
 1.7 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.6 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.5 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.4 12-Apr-1996  cgd (mostly) update for new PCI and 'bus' interfaces.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd PCI VGA support. should be MI, but not yet
 1.18 02-Sep-1997  thorpej Renamed to pci_swiz_bus_{io,mem}_chipdep.c by repository copy.
 1.17 02-Sep-1997  thorpej Revive these files from the Attic.
 1.16 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.15 12-Mar-1997  cgd update to allow PCI bus interfaces that wish to allocate static
extent storage per interface unit (e.g. dwlpx, where there can be multiple
units per machine) to do so. Inspired by discussion with and changes from
Matt Jacob.
 1.14 02-Dec-1996  cgd branches: 1.14.2;
implement bus_space_copy_*().
 1.13 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.12 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.11 02-Dec-1996  cgd declare the single-datum read and write methods as inline, so that
the multi and region methods can inline them.
 1.10 25-Nov-1996  cgd update these to set up and use extents to map i/o space, and sparse and
dense memory.
 1.9 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.4 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.3 09-Jun-1996  cgd wrap __STRING() in a #define so that its argument, which must be
expanded by the preprocessor, will be. Problem pointed out by Matt
Thomas.
 1.2 18-Apr-1996  cgd branches: 1.2.4;
Implement the I/O read/write-multiple functions for chipsets
that use this file (APECS, LCA, and CIA).
 1.1 12-Apr-1996  cgd chipset 'bus' functions that seem to be common to all host bus
adapters that exist in single-CPU systems. APECS, CIA, and LCA
all use this, but with different #defines.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
and
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.2.4.1 09-Jun-1996  cgd pull up from trunk:
>wrap __STRING() in a #define so that its argument, which must be
>expanded by the preprocessor, will be. Problem pointed out by Matt
>Thomas.
 1.14.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.19 02-Sep-1997  thorpej Renamed to pci_swiz_bus_{io,mem}_chipdep.c by repository copy.
 1.18 02-Sep-1997  thorpej Revive these files from the Attic.
 1.17 10-Apr-1997  cgd move and split pcs_bus_{mem,io}_common.c, so that:
(1) object code can be shared (where the hardware makes that possible), and
(2) so that the file names better describe the systems which use them. (the
pci_swiz* files are for machines whose PCI interfaces require address
"swizzling." Later, there will be probably be other sets, e.g. pci_bwx*
for machines whose chipsets can easily deal with the Alpha BWX extensions
when doing device accesses.)
 1.16 12-Mar-1997  cgd update to allow PCI bus interfaces that wish to allocate static
extent storage per interface unit (e.g. dwlpx, where there can be multiple
units per machine) to do so. Inspired by discussion with and changes from
Matt Jacob.
 1.15 02-Dec-1996  cgd branches: 1.15.2;
implement bus_space_copy_*().
 1.14 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.13 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.12 02-Dec-1996  cgd declare the single-datum read and write methods as inline, so that
the multi and region methods can inline them.
 1.11 25-Nov-1996  cgd update these to set up and use extents to map i/o space, and sparse and
dense memory.
 1.10 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 11-Jun-1996  cgd add definitions and code to support use of multiple I/O and _dense_
memory regions.
 1.5 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.4 09-Jun-1996  cgd add support for mapping multiple memory windows. This is necessary
for mapping ISA/EISA 'hole' memory on the AlphaStation 600.
 1.3 09-Jun-1996  cgd wrap __STRING() in a #define so that its argument, which must be
expanded by the preprocessor, will be. Problem pointed out by Matt
Thomas.
 1.2 03-Jun-1996  cgd gross hack to get around the fact that there are currently devices with
common back-ends that live on multiple very-different busses (e.g. PCI and
TC), which need bus-specific DMA mapping support. As a nice side effect,
this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
to go away in favor of less nasty bus-specific function calls.
 1.1 12-Apr-1996  cgd branches: 1.1.4;
chipset 'bus' functions that seem to be common to all host bus
adapters that exist in single-CPU systems. APECS, CIA, and LCA
all use this, but with different #defines.
 1.1.4.4 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
and
>add definitions and code to support use of multiple I/O and _dense_
>memory regions.
 1.1.4.3 09-Jun-1996  cgd pull up from trunk:
>add support for mapping multiple memory windows. This is necessary
>for mapping ISA/EISA 'hole' memory on the AlphaStation 600.
 1.1.4.2 09-Jun-1996  cgd pull up from trunk:
>wrap __STRING() in a #define so that its argument, which must be
>expanded by the preprocessor, will be. Problem pointed out by Matt
>Thomas.
 1.1.4.1 03-Jun-1996  cgd pull up from trunk:
>gross hack to get around the fact that there are currently devices with
>common back-ends that live on multiple very-different busses (e.g. PCI and
>TC), which need bus-specific DMA mapping support. As a nice side effect,
>this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
>to go away in favor of less nasty bus-specific function calls.
 1.15.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.58 19-Oct-2025  thorpej Use {,e}isabus_attach().
 1.57 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.56 07-May-2021  thorpej branches: 1.56.6;
Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.55 24-Apr-2021  thorpej branches: 1.55.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.54 18-Nov-2020  thorpej branches: 1.54.2;
malloc(9) -> kmem(9)
 1.53 22-Sep-2020  thorpej branches: 1.53.2;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.52 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.51 01-Jul-2011  dyoung branches: 1.51.2; 1.51.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.50 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.49 12-Jan-2010  mhitch branches: 1.49.10;
Fix incorrect Acer Labs ID. PCI_PRODUCT_ALI_M1543 had been incorrectly
identified as product code 0x1533, which is what is actually in the
CS20. PCI_PRODUCT_ALI_M1543 was corrected recently and sio.c would fail
to match the bridge.
 1.48 19-Aug-2009  dyoung isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t.
 1.47 19-Aug-2009  dyoung Define isa_dmadestroy and isa_detach_hook. Hook up a couple of
isa_detach_hook implementations.
 1.46 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.45 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.44 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.43 28-Apr-2008  martin branches: 1.43.8; 1.43.14;
Remove clause 3 and 4 from TNF licenses
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.18; 1.42.20;
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.41 22-Jul-2007  tsutsui branches: 1.41.6;
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
 1.40 11-Dec-2005  christos branches: 1.40.24; 1.40.30; 1.40.38; 1.40.40; 1.40.42; 1.40.44;
merge ktrace-lwp.
 1.39 13-Sep-2004  drochner branches: 1.39.12;
put EISA attachment specific code inside "#if NPCEB > 0",
to avoid references to EISA variables if "pceb" is not defined in
kernel configurations, and save some bytes
tested by Havard Eidnes (or his colleague:-)
 1.38 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.37 23-Apr-2004  itojun pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region
 1.36 01-Jan-2003  thorpej branches: 1.36.2;
Use aprint_normal() for cfprint routines.
 1.35 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.34 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.33 29-Jul-2000  thorpej branches: 1.33.2; 1.33.4;
Add code to read the EISA configuration NVRAM as set up by
an EISA Configuration Utility. Code to access this data
is forthcoming.

XXX This could probably be made MI at some point.
 1.32 12-Jul-2000  thorpej Oops, treat 2100A_A500 just like 2100_A500 in every place necessary.
 1.31 12-Jul-2000  thorpej Deal with another odd need of the Sable/Lynx systems, which need to
have an ISA chipset present before the PCI-EISA bridge has been
attached (because the STDIO module has an ISA DMA-using device,
the floppy controller, connected to it).
 1.30 13-Jun-2000  thorpej branches: 1.30.2;
Some platforms, like the Sable, hook EISA and ISA interrupts
up Very Differently. Handle this.
 1.29 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.28 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.27 12-Nov-1999  lukem branches: 1.27.2;
recognise the ACER labs M1543 PCI-ISA Bridge in siomatch(). the DS10 now boots!
thanks to thorpej/ross/mrg for helping me out on this.
 1.26 09-Jun-1998  thorpej branches: 1.26.8; 1.26.14; 1.26.16; 1.26.20;
Use config_defer().
 1.25 08-Jun-1998  thorpej The ISA chipset must persist; it's required after autoconfig time.
 1.24 23-May-1998  matt Add sio_intr_alloc (copied from i386's isa_intr_alloc) for PCMCIA.
 1.23 12-Apr-1998  mjacob A little buglet: softc for pceb is same as sio- so declare it as such.
By not doing so, a very obscure bug followed where the config search
stuff stopped at the bridge (pceb) and didn't even call match for the
two Qlogic ISP cards that followed.
 1.22 28-Mar-1998  thorpej Add autoconfiguration support for the Cypress 82C693 PCI-ISA bridge,
found on AlphaPC164SX boards.

Partially from Anders Magnusson <ragge@ludd.luth.se>.
 1.21 12-Jan-1998  thorpej Adjust for config changes.
 1.20 02-Sep-1997  thorpej branches: 1.20.4;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.19 06-Jun-1997  thorpej branches: 1.19.4;
Pull thorpej-bus-dma branch into mainline.
 1.18 07-Apr-1997  cgd branches: 1.18.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.16 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.15 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.14 25-Nov-1996  cgd branches: 1.14.2;
use set_pci_isa_bridge_callback() to delay ISA/EISA bus attachment until
after PCI tree has been completely probed.
 1.13 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.12 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.8 13-Apr-1996  cgd add (untested) support for EISA busses hanging off of PCEBs.
 1.7 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.6 12-Apr-1996  cgd Set up and pass isa chipset tag to ISA bus, when attaching.
Should do the same for EISA, when that support is finished.
 1.5 12-Apr-1996  cgd clean up for new ISA and 'bus' code, etc.
 1.4 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.14.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.14.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.14.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.18.2.1 23-May-1997  thorpej Ask the parent for the DMA tag appropriate for the bus we're
attaching (either ISA or EISA) and pass it to the child.
 1.19.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.4.1 04-Nov-1998  cgd pull up rev 1.23 from trunk (mjacob)
 1.26.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.26.16.1 14-Nov-1999  fvdl Sync with -current.
 1.26.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.26.8.1 20-Nov-1999  he Pull up revision 1.27 (requested by lukem):
Add support for the PCI<->ISA bridge in the DS10, allowing it to
boot.
 1.27.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.30.2.2 11-Aug-2000  thorpej Pullup from trunk:
Add EISA configuration readining infrastructure.
 1.30.2.1 12-Jul-2000  thorpej Pull up revs. 1.30, 1.31:
Deal with another odd need of the Sable/Lynx systems, which need to
have an ISA chipset present before the PCI-EISA bridge has been
attached (because the STDIO module has an ISA DMA-using device,
the floppy controller, connected to it).
 1.33.4.1 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.33.2.2 03-Jan-2003  thorpej Sync with HEAD.
 1.33.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.36.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.36.2.2 03-Sep-2004  skrll Sync with HEAD
 1.36.2.1 03-Aug-2004  skrll Sync with HEAD
 1.39.12.1 03-Sep-2007  yamt sync with head.
 1.40.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.40.42.1 07-Aug-2007  matt Sync with HEAD.
 1.40.40.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.40.38.1 03-Oct-2007  garbled Sync with HEAD
 1.40.30.1 20-Aug-2007  ad Sync with HEAD.
 1.40.24.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.41.6.1 06-Nov-2007  matt sync with HEAD
 1.42.20.4 11-Mar-2010  yamt sync with head
 1.42.20.3 19-Aug-2009  yamt sync with head.
 1.42.20.2 04-May-2009  yamt sync with head.
 1.42.20.1 16-May-2008  yamt sync with head.
 1.42.18.1 18-May-2008  yamt sync with head.
 1.42.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.43.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.49.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.51.6.1 18-Feb-2012  mrg merge to -current.
 1.51.2.1 17-Apr-2012  yamt sync with head
 1.53.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.54.2.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.55.2.1 13-May-2021  thorpej Sync with HEAD.
 1.56.6.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.54 17-Aug-2024  thorpej In cy82c693_setup_elcr(), panic if cy82c693_init() fails as I suggested
should be done in a comment I wrote in this very file 26 years ago.
 1.53 15-Jul-2021  thorpej branches: 1.53.16;
- Use defined constants for PIC registers, not magic numbers.
- Inline specific_eoi().

NFC.
 1.52 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.51 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.50 25-Jun-2021  thorpej Tweak how the IRQ description strings are generated to enable additional
duplicated code re-factoring.
 1.49 25-Jun-2021  thorpej Reduce code duplication among platforms that use the i82378 SIO to
route PCI interrupts to the ISA PIC by refactoring it into a new
sio_pirq_intr_map() function.
 1.48 08-May-2021  thorpej More symbol sanitizing.
 1.47 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.46 29-Sep-2020  thorpej branches: 1.46.6;
If running in Qemu, don't report stray edge-triggered ISA interrupts.
Works around an issue I obvserved with serial console in Qemu.
 1.45 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.44 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.43 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.42 06-Feb-2012  matt branches: 1.42.6; 1.42.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.41 01-Jul-2011  dyoung branches: 1.41.2; 1.41.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.40 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.39 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.38 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 28-Apr-2008  martin branches: 1.36.8; 1.36.14;
Remove clause 3 and 4 from TNF licenses
 1.35 03-Dec-2007  ad branches: 1.35.14; 1.35.16; 1.35.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.34 11-Dec-2005  christos branches: 1.34.30; 1.34.48; 1.34.50; 1.34.56;
merge ktrace-lwp.
 1.33 29-Mar-2005  thorpej branches: 1.33.2;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.32 01-Jul-2004  mycroft branches: 1.32.4; 1.32.10;
Fix a really old ("since day one") bug: send specific EOIs to the PIC, not
non-specific EOIs. This really shouldn't matter so much, but I'm guessing
there's a strange interaction with the PALcode (possibly related to the fact
that the PALcode itself may be sending an EOI itself on some systems).

I have tested this on a Multia, and it appears to work just fine without the
INITIALLY_{ENABLED,LEVEL_TRIGGERED}() stuff now, so I'm also removing that.
 1.31 27-Sep-2002  provos branches: 1.31.6; 1.31.8;
remove trailing \n in panic(). approved perry.
 1.30 27-Jul-2001  thorpej branches: 1.30.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.29 18-Dec-2000  thorpej branches: 1.29.4;
Put back the INITIALLY_{ENABLED,LEVEL_TRIGGERED}() PROM brain-damage
work-around. It's required in order for the DEC Multia (a very
brain-damaged little machine) to work properly.

Submitted by Juergen Weiss <weiss@uni-mainz.de>, addresses
port-alpha/11202.
 1.28 06-Jun-2000  thorpej Use the common 82c693 access functions to read/write the ELCR.
 1.27 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.26 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.25 27-Feb-2000  mycroft branches: 1.25.2;
Nuke all the code associated with the INITIALLY_LEVEL_TRIGGERED() lossage, and
instead register a shutdownhook to restore the PIC state.
 1.24 30-Jul-1999  ross branches: 1.24.2;
Fix the 16-bytes-of-death bug by generating specific-EOI cycles during
sio_intr_setup().
 1.23 01-Aug-1998  thorpej branches: 1.23.6; 1.23.8; 1.23.10;
In sio_intr_disestablish, also make sure that IRQs 0, 1, 8, and 13
default to edge-triggered, just like in the setup.
 1.22 01-Aug-1998  thorpej Implement sio_intr_disestablish(), and ensure that an initially-enabled
interrupt is never disabled and an initially-level-triggered interrupt
never becomes untyped.
 1.21 23-May-1998  matt Add sio_intr_alloc (copied from i386's isa_intr_alloc) for PCMCIA.
 1.20 14-Apr-1998  thorpej Add support for the Cypress CY82C693 PCI-ISA bridge. This bridge is more or
less like an Intel SIO except that the ELCR registers are accessed differently
than on the Intel SIO.

XXX This code needs to be split up into bridge front-end and PIC back-end
XXX pieces.
 1.19 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18 07-Apr-1997  cgd branches: 1.18.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.16 17-Nov-1996  cgd branches: 1.16.2;
use the new common chained-interrupt support code.
 1.15 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.14 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 15-Aug-1996  cgd clean up stray interrupt handling a bit.
 1.10 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.9 05-Jun-1996  cgd pull down changes from NetBSD 1.2 release branch:
>Update for present reality (function names), clean up a bit (printfs,
>"panic: foo XXX"), and fix a couple of printf format specified bugs
>(which were normally #if 0'd out). Inspired by Multia/UDB support
>changes sent by Matt Thomas.
and:
>changes from Matt Thomas so that the Multia/UDB can attach its
>'com' interrupts, cleaned up some. Basically: if sharing type of
>new interrupt is different than what the hardware is currently set up
>for (e.g. requesting edge-triggered and the hardware is set up by
>the PROM for level triggered) and there are no interrupt handlers on
>that line already, warn about it and use the hardware type that the
>line was already set for (to avoid making the console blow up on
>reboot). If same circumstances but there is already a handler, panic
>as before.
 1.8 05-Jun-1996  cgd avoid lots of upper-case letters in interrupt names. prettier that way.
 1.7 13-Apr-1996  cgd branches: 1.7.4;
note that these IRQs are ISA IRQs
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 12-Apr-1996  cgd remove (hack) version of isa_intr_establish()
 1.4 12-Apr-1996  cgd clean up for new ISA and 'bus' code, etc.
 1.3 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd ISA and PCI support for DEC AlphaStations
 1.7.4.3 05-Jun-1996  cgd changes from Matt Thomas so that the Multia/UDB can attach its
'com' interrupts, cleaned up some. Basically: if sharing type of
new interrupt is different than what the hardware is currently set up
for (e.g. requesting edge-triggered and the hardware is set up by
the PROM for level triggered) and there are no interrupt handlers on
that line already, warn about it and use the hardware type that the
line was already set for (to avoid making the console blow up on
reboot). If same circumstances but there is already a handler, panic
as before.
 1.7.4.2 05-Jun-1996  cgd Update for present reality (function names), clean up a bit (printfs,
"panic: foo XXX"), and fix a couple of printf format specified bugs
(which were normally #if 0'd out). Inspired by Multia/UDB support
changes sent by Matt Thomas.
 1.7.4.1 05-Jun-1996  cgd Pull up from trunk:
>avoid lots of upper-case letters in interrupt names. prettier that way.
 1.16.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.18.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.10.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.23.8.1 02-Aug-1999  thorpej Update from trunk.
 1.23.6.1 08-Aug-1999  cgd pull up rev 1.24 from trunk (ross)
 1.24.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.24.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.29.4.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.29.4.1 03-Aug-2001  lukem update to -current
 1.30.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.30.2.1 27-Jul-2001  nathanw file sio_pic.c was added on branch nathanw_sa on 2002-10-18 02:34:25 +0000
 1.31.8.1 02-Jul-2004  he branches: 1.31.8.1.2;
Pull up revision 1.32 (requested by mycroft in ticket #582):
Fix a really old ("since day one" bug: send specific EOIs
to the PIC, not non-specific EOIs. Should not matter so
much, but strange interaction with PALcode, possibly only
on some systems, is suspected.
 1.31.8.1.2.1 11-May-2005  riz Pull up revision 1.33 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.31.6.4 01-Apr-2005  skrll Sync with HEAD.
 1.31.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.6.1 03-Aug-2004  skrll Sync with HEAD
 1.32.10.1 30-Mar-2005  tron Pull up revision 1.33 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.33.2.1 07-Dec-2007  yamt sync with head
 1.34.56.1 08-Dec-2007  mjf Sync with HEAD.
 1.34.50.1 09-Jan-2008  matt sync with HEAD
 1.34.48.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.30.1 03-Dec-2007  ad Sync with HEAD.
 1.35.18.2 04-May-2009  yamt sync with head.
 1.35.18.1 16-May-2008  yamt sync with head.
 1.35.16.1 18-May-2008  yamt sync with head.
 1.35.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.41.6.1 18-Feb-2012  mrg merge to -current.
 1.41.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.2.1 17-Apr-2012  yamt sync with head
 1.42.10.1 18-May-2014  rmind sync with head
 1.42.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.46.6.1 13-May-2021  thorpej Sync with HEAD.
 1.53.16.1 02-Aug-2025  perseant Sync with HEAD
 1.3 25-Jun-2021  thorpej Define macros to desribe the PIRQ_RTCTRL register(s).
 1.2 07-Apr-1997  cgd branches: 1.2.262;
clean up NetBSD RCS ID strings
 1.1 23-Apr-1996  cgd branches: 1.1.2;
Intel 82378 System I/O (SIO) Chip register defintions, cleaned up a
bit from a version supplied by Trevor Mendez <tmendez@bbn.com>.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.262.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 25-Jun-2021  thorpej Reduce code duplication among platforms that use the i82378 SIO to
route PCI interrupts to the ISA PIC by refactoring it into a new
sio_pirq_intr_map() function.
 1.13 22-Sep-2020  thorpej branches: 1.13.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.12 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.11 14-Mar-2009  dsl branches: 1.11.12; 1.11.22; 1.11.26;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.10 05-Jun-2000  thorpej branches: 1.10.132; 1.10.140; 1.10.146;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.9 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.8 23-May-1998  ross branches: 1.8.14; 1.8.22;
Prototype sio_intr_alloc().
 1.7 14-Apr-1998  thorpej Pass the pci_chipset_tag_t to sio_intr_setup(). XXX This code should be
rearranged so that other non-PCI-but-in-all-other-ways-ISA-PIC-like
devices can share code.
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.5 23-Oct-1996  cgd branches: 1.5.2;
update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.4 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd clean up for new ISA and 'bus' code, etc.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.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.10.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.132.1 04-May-2009  yamt sync with head.
 1.11.26.1 18-May-2014  rmind sync with head
 1.11.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.23 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.22 12-Jan-1998  thorpej Adjust for config changes.
 1.21 25-Sep-1997  thorpej branches: 1.21.2;
Add a "scrollskip" member to wscons_emulfuncs (XXX even though it's not
a function) which specifies how many lines will be skipped when scrolling
up when the bottom of the screen is reached. Dumb framebuffers skip 10
lines (as before) because the copies are s ... l ... o ... w, but it's
silly to skip 10 lines on VGA, since the copies are much faster, so we
only skip one in that case.
 1.20 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.19 23-Jul-1997  cgd branches: 1.19.2; 1.19.4;
update these to use the new 'correct' names for functions/constants
in bus.h.
 1.18 13-Apr-1997  cgd use pci_mapreg_info rather than pci_mem_find
 1.17 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.16 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.15 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.14 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.13 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.12 19-Nov-1996  cgd branches: 1.12.2;
catch up with wscons frame buffer attachment, mmap, and ioctl
interface changes.
 1.11 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 12-Apr-1996  cgd partially update for new PCI & bus macros. update to deal with new
console glue. Split out RAMDAC-specific code into seperate files.
 1.4 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd support for DEC 21030 (TGA) boards -- at this time, only the ZLXp-E1 works
 1.12.2.5 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.12.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.2.3 25-Jan-1997  cgd update for new wscons interfaces
 1.12.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.12.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.19.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.4.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.19.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.2.1 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.6 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.5 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.4 07-Apr-1997  cgd branches: 1.4.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Apr-1996  cgd branches: 1.2.2;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd partially update for new PCI & bus macros. update to deal with new
console glue. Split out RAMDAC-specific code into seperate files.
 1.2.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.2.1 25-Jan-1997  cgd update for new wscons interfaces
 1.4.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.8 24-Feb-1998  thorpej Add support for UVM.
 1.7 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.6 07-Apr-1997  cgd branches: 1.6.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 13-Nov-1996  cgd branches: 1.4.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd partially update for new PCI & bus macros. update to deal with new
console glue. Split out RAMDAC-specific code into seperate files.
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 25-Jan-1997  cgd update for new wscons interfaces
 1.6.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.5 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.4 07-Apr-1997  cgd branches: 1.4.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Apr-1996  cgd branches: 1.2.2;
clean up copyrights and RCS IDs
 1.1 12-Apr-1996  cgd partially update for new PCI & bus macros. update to deal with new
console glue. Split out RAMDAC-specific code into seperate files.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 12-Apr-1996  cgd this has moved to ../include
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd support for DEC 21030 (TGA) boards -- at this time, only the ZLXp-E1 works
 1.8 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.7 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 23-Oct-1996  cgd branches: 1.6.2;
update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.5 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.4 12-Apr-1996  cgd partially update for new PCI & bus macros. update to deal with new
console glue. Split out RAMDAC-specific code into seperate files.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd support for DEC 21030 (TGA) boards -- at this time, only the ZLXp-E1 works
 1.6.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.1 25-Jan-1997  cgd update for new wscons interfaces
 1.30 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.29 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.28 04-Jul-2021  thorpej branches: 1.28.2;
Remove unnecessary #include <sys/malloc.h>
 1.27 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.26 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.25 24-Apr-2021  thorpej branches: 1.25.2; 1.25.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.24 22-Feb-2014  martin branches: 1.24.44;
Allow kernels without tsciic to build.
 1.23 21-Feb-2014  jdc Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.
 1.22 23-Sep-2013  tsutsui KNF and TAB/space cleanup.
 1.21 23-Sep-2013  tsutsui Remove a 'register' declaration. Noted in PR port-alpha/48148.
 1.20 23-Sep-2013  tsutsui Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.
 1.19 17-May-2011  dyoung branches: 1.19.4; 1.19.14; 1.19.18;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.18 07-Oct-2010  hans branches: 1.18.2;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.17 15-Apr-2010  jakllsch Give tsc(4)/tsp(4) some attention.
- Convert to CFATTACH_DECL_NEW().
- Sprinkle static on functions.
- Improve KNF conformance.
- Use C99 integer types.
- Recycle now-empty-and/or-unused softc structures.
 1.16 14-Mar-2009  dsl branches: 1.16.2; 1.16.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.15 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.14 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.13 11-Dec-2005  christos branches: 1.13.78; 1.13.86; 1.13.92;
merge ktrace-lwp.
 1.12 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.11 15-Jun-2003  fvdl branches: 1.11.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.10 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.6 12-Jul-2001  thorpej branches: 1.6.2; 1.6.14;
bzero -> memset
 1.5 29-Nov-2000  thorpej branches: 1.5.4;
Allocate the DMA windows out of the PCI memory extent map after
DMA is initialized.
 1.4 26-Jun-2000  thorpej Do the previously slightly differently, to avoid confusing the internal
space extent maps. Pointed out by msaitoh@netbsd.org. (Someone should
send me an EV6 machine!)
 1.3 25-Jun-2000  thorpej Implement tsp_bus_get_window().
 1.2 04-Nov-1999  thorpej branches: 1.2.4;
Allow rd/line, rd/mult, and wr/inval.
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.8.1 14-Nov-1999  fvdl Sync with -current.
 1.1.6.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsc.c was added on branch netbsd-1-4 on 1999-06-29 06:46:47 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsc.c was added on branch chs-ubc2 on 1999-07-01 23:00:57 +0000
 1.2.4.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.5.4.3 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.5.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.1 03-Aug-2001  lukem update to -current
 1.6.14.1 30-May-2002  gehenna Catch up with -current.
 1.6.2.4 03-Jan-2003  thorpej Sync with HEAD.
 1.6.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.6.2.1 12-Jul-2001  nathanw file tsc.c was added on branch nathanw_sa on 2002-06-20 03:37:45 +0000
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Sep-2004  skrll Sync with HEAD
 1.13.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.78.3 09-Oct-2010  yamt sync with head
 1.13.78.2 11-Aug-2010  yamt sync with head.
 1.13.78.1 04-May-2009  yamt sync with head.
 1.16.4.3 31-May-2011  rmind sync with head
 1.16.4.2 05-Mar-2011  rmind sync with head
 1.16.4.1 30-May-2010  rmind sync with head
 1.16.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.16.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.18.1 18-May-2014  rmind sync with head
 1.19.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.44.2 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.24.44.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.25.4.1 31-May-2021  cjep sync with head
 1.25.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.25.2.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.28.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.5 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.4 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.3 24-Apr-2021  thorpej branches: 1.3.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.2 22-Dec-2019  thorpej branches: 1.2.10;
Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.1 21-Feb-2014  jdc branches: 1.1.4; 1.1.6; 1.1.10; 1.1.36;
Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.
 1.1.36.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 21-Feb-2014  tls file tsciic.c was added on branch tls-maxphys on 2014-08-20 00:02:41 +0000
 1.1.6.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.1.6.1 21-Feb-2014  yamt file tsciic.c was added on branch yamt-pagecache on 2014-05-22 11:39:27 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 21-Feb-2014  rmind file tsciic.c was added on branch rmind-smpnet on 2014-05-18 17:44:53 +0000
 1.2.10.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.3.8.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.10 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.9 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.8 01-Jul-2011  dyoung branches: 1.8.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.7 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.6 30-Oct-2009  mhitch branches: 1.6.4;
The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.5 29-Jun-2000  mrg branches: 1.5.130; 1.5.140; 1.5.148;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 26-Jun-2000  thorpej Garbage-collect CHIP_PHYSADDR().
 1.3 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.2 02-Dec-1999  thorpej branches: 1.2.4;
CIA core logic with BWX enabled appears on EV6. We require at least
EV56 for the assembler to emit BWX opcodes, so set the arch to "ev6".
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsp_bus_io.c was added on branch netbsd-1-4 on 1999-06-29 06:46:47 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsp_bus_io.c was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.2.4.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.5.148.1 21-Apr-2010  matt sync to netbsd-5
 1.5.140.1 31-Oct-2009  sborrill Pull up the following revisions(s) (requested by mhitch in ticket #1120):
sys/arch/alpha/pci/tsp_bus_io.c: revision 1.6
sys/arch/alpha/pci/tsp_bus_mem.c: revision 1.9
sys/arch/alpha/pci/tsvar.h: revision 1.7

The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.5.130.1 11-Mar-2010  yamt sync with head
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.8.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.15 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.14 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.13 19-Jan-2014  tsutsui branches: 1.13.46;
Set a proper address for PCI memspace to make bus_space_mmap(9) work correctly.

Reported and confirmed with radeonfb(4) by Naruaki Etomi in PR port-48431.
 1.12 06-Feb-2012  matt branches: 1.12.6; 1.12.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 30-Oct-2009  mhitch branches: 1.9.4;
The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.8 11-Dec-2005  christos branches: 1.8.78; 1.8.88; 1.8.96;
merge ktrace-lwp.
 1.7 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.6 29-Nov-2000  thorpej branches: 1.6.24;
Allocate the DMA windows out of the PCI memory extent map after
DMA is initialized.
 1.5 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 26-Jun-2000  thorpej Garbage-collect CHIP_PHYSADDR().
 1.3 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.2 02-Dec-1999  thorpej branches: 1.2.4;
CIA core logic with BWX enabled appears on EV6. We require at least
EV56 for the assembler to emit BWX opcodes, so set the arch to "ev6".
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.6.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsp_bus_mem.c was added on branch netbsd-1-4 on 1999-06-29 06:46:47 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsp_bus_mem.c was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.2.4.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.6.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.24.1 03-Aug-2004  skrll Sync with HEAD
 1.8.96.1 21-Apr-2010  matt sync to netbsd-5
 1.8.88.1 31-Oct-2009  sborrill Pull up the following revisions(s) (requested by mhitch in ticket #1120):
sys/arch/alpha/pci/tsp_bus_io.c: revision 1.6
sys/arch/alpha/pci/tsp_bus_mem.c: revision 1.9
sys/arch/alpha/pci/tsvar.h: revision 1.7

The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.8.78.1 11-Mar-2010  yamt sync with head
 1.9.4.1 05-Mar-2011  rmind sync with head
 1.11.6.1 18-Feb-2012  mrg merge to -current.
 1.11.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.2.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.46.1 01-Aug-2021  thorpej Sync with HEAD.
 1.22 19-Jul-2021  thorpej For CIA/Pyxis and Tsunami/Typhoon/Titan, save the firmware's idea of
the DMA window configuration, and restore it at shutdown time. Make
sure that all assumptions we've made on the firmware's configuration
of DMA windows is correct.
 1.21 18-Jul-2021  thorpej According to section 8.1.2.2 of the Tsunami/Typhoon hardware reference
manual (DS-0025A-TE), the SGMAP TLB is arranged as 168 locations of 4
consecutive quadwords. It seems that on some revisions of the Pchip,
SGMAP translation is not perfectly reliable unless we align the DMA
segments to the TLBs natural boundaries (observed on the API CS20).

N.B. the Titan (as observed on a Compaq DS25) does not seem to have this
problem, but we'll play it safe and run this way on both variants.

PR port-alpha/40604.
 1.20 18-Jul-2021  thorpej Oops, pass the correct bus_dma_tag_t to the "hi" sgmap init function.
 1.19 18-Jul-2021  thorpej - Don't bother issuing a warning if we program the WBASE / WSM register
to different values than the firmware.
- Reduce the differences in how we initialize the DMA tags vis a vis the
other Alpha implementations.
- Use Window 2 to provide a 1G @ 3G PCI SGMAP window on systems with more
than 1G of RAM, rather than falling back on the ISA DMA window which is
small and could get starved by PCI devices.
- Make sure we set TBASE to 0 for direct-mapped windows.
 1.18 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.17 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.16 05-May-2021  thorpej branches: 1.16.2;
Moar static.
 1.15 11-Oct-2020  thorpej branches: 1.15.6;
Add some bus_dma instrumentation.
 1.14 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.13 23-Sep-2013  tsutsui Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.
 1.12 06-Feb-2012  matt branches: 1.12.6; 1.12.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.9 14-Mar-2009  dsl branches: 1.9.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.8 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.76; 1.6.78;
merge ktrace-lwp.
 1.5 14-Jul-2003  lukem add __KERNEL_RCSID() (using 1, for #included .c files)
 1.4 19-Jul-2001  thorpej branches: 1.4.2; 1.4.22;
Take a guess and initialize the prefetch threshold to 256 bytes. Haven't
found this one in the manual yet.
 1.3 03-Jan-2001  thorpej branches: 1.3.4;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.2 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.6.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsp_dma.c was added on branch netbsd-1-4 on 1999-06-29 06:46:48 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsp_dma.c was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.3.4.1 03-Aug-2001  lukem update to -current
 1.4.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.2.2 19-Jul-2001  thorpej Take a guess and initialize the prefetch threshold to 256 bytes. Haven't
found this one in the manual yet.
 1.4.2.1 19-Jul-2001  thorpej file tsp_dma.c was added on branch nathanw_sa on 2001-07-19 19:09:23 +0000
 1.6.78.2 04-May-2009  yamt sync with head.
 1.6.78.1 16-May-2008  yamt sync with head.
 1.6.76.1 18-May-2008  yamt sync with head.
 1.6.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.4.1 05-Mar-2011  rmind sync with head
 1.11.6.1 18-Feb-2012  mrg merge to -current.
 1.11.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.2.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.6.3 01-Aug-2021  thorpej Sync with HEAD.
 1.15.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.15.6.1 13-May-2021  thorpej Sync with HEAD.
 1.16.2.1 31-May-2021  cjep sync with head
 1.12 25-Jun-2021  thorpej Use the default implementations of attach_hook(), bus_maxdevs(),
make_tag(), and decompose_tag().
 1.11 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.10 02-Oct-2015  msaitoh branches: 1.10.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.9 14-Jun-2011  matt branches: 1.9.12; 1.9.30;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.8 15-Dec-2010  matt branches: 1.8.6;
Remove unneeded includes of <uvm/uvm_extern.h>
 1.7 07-Oct-2010  hans Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.6 14-Mar-2009  dsl branches: 1.6.2; 1.6.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 27-Feb-2001  cgd branches: 1.3.130; 1.3.138; 1.3.144;
fix NetBSD RCS id tags
 1.2 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.6.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsp_pci.c was added on branch netbsd-1-4 on 1999-06-29 06:46:48 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsp_pci.c was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.3.144.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.138.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.130.2 09-Oct-2010  yamt sync with head
 1.3.130.1 04-May-2009  yamt sync with head.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.6.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.8.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.9.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.12.1 03-Dec-2017  jdolecek update from HEAD
 1.10.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.10.34.1 13-May-2021  thorpej Sync with HEAD.
 1.11 30-May-2022  andvar s/identifing/identifying/ and s/multipler/multiplier/ in comments.
 1.10 17-Jul-2021  thorpej - Define the DAC enable bit that's present in WSBA3.
- Define symbolic constants for the valid WSM values.
 1.9 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.8 23-Sep-2020  thorpej branches: 1.8.6; 1.8.8;
Define some additional Cchip registers.
 1.7 21-Feb-2014  jdc Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.
 1.6 23-Sep-2013  tsutsui Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.
 1.5 06-Feb-2012  matt branches: 1.5.6; 1.5.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 07-Oct-2010  hans branches: 1.4.8; 1.4.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.3 05-Jul-2001  toshii branches: 1.3.4; 1.3.130; 1.3.150; 1.3.152;
Fix typo. s/extention/extension/
 1.2 26-Jun-2000  thorpej Because of the Cool sign-extension hack we use to access PCI space,
the `get window' method ends up with the wrong physical address to
pass onto userspace (which wants to mmap the space).

Compensate by adding a CHIP_PHYSADDR() macro which un-hacks the address
suitably for mapping with other-than-KSEG.
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.18.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsreg.h was added on branch netbsd-1-4 on 1999-06-29 06:46:48 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsreg.h was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.3.152.1 05-Mar-2011  rmind sync with head
 1.3.150.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.130.1 09-Oct-2010  yamt sync with head
 1.3.4.2 05-Jul-2001  toshii Fix typo. s/extention/extension/
 1.3.4.1 05-Jul-2001  toshii file tsreg.h was added on branch nathanw_sa on 2001-07-05 08:38:25 +0000
 1.4.12.1 18-Feb-2012  mrg merge to -current.
 1.4.8.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.4.8.1 17-Apr-2012  yamt sync with head
 1.5.10.1 18-May-2014  rmind sync with head
 1.5.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.8.1 31-May-2021  cjep sync with head
 1.8.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.8.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.18 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.17 19-Jul-2021  thorpej For CIA/Pyxis and Tsunami/Typhoon/Titan, save the firmware's idea of
the DMA window configuration, and restore it at shutdown time. Make
sure that all assumptions we've made on the firmware's configuration
of DMA windows is correct.
 1.16 18-Jul-2021  thorpej - Don't bother issuing a warning if we program the WBASE / WSM register
to different values than the firmware.
- Reduce the differences in how we initialize the DMA tags vis a vis the
other Alpha implementations.
- Use Window 2 to provide a 1G @ 3G PCI SGMAP window on systems with more
than 1G of RAM, rather than falling back on the ISA DMA window which is
small and could get starved by PCI devices.
- Make sure we set TBASE to 0 for direct-mapped windows.
 1.15 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.14 17-Jun-2020  thorpej branches: 1.14.6; 1.14.8;
#include <sys/extent.h> explicitly.
 1.13 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.12 21-Feb-2014  jdc branches: 1.12.30;
Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.
 1.11 23-Sep-2013  tsutsui Add support for AlphaStation DS15.

Ported from OpenBSD via PR port-alpha/48148 by nullnilaki.
Note support for the secondary PCI bus still needs more improvements.
 1.10 06-Feb-2012  matt branches: 1.10.6; 1.10.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 07-Oct-2010  hans branches: 1.9.8; 1.9.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.8 15-Apr-2010  jakllsch Give tsc(4)/tsp(4) some attention.
- Convert to CFATTACH_DECL_NEW().
- Sprinkle static on functions.
- Improve KNF conformance.
- Use C99 integer types.
- Recycle now-empty-and/or-unused softc structures.
 1.7 30-Oct-2009  mhitch branches: 1.7.2; 1.7.4;
The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.6 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.5 11-Dec-2005  christos branches: 1.5.78; 1.5.86; 1.5.88; 1.5.92; 1.5.96;
merge ktrace-lwp.
 1.4 02-Jun-2005  drochner add more "const"
 1.3 29-Nov-2000  thorpej branches: 1.3.24;
Allocate the DMA windows out of the PCI memory extent map after
DMA is initialized.
 1.2 25-Jun-2000  thorpej Implement tsp_bus_get_window().
 1.1 29-Jun-1999  ross branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18;
Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.18.1 27-Jun-2000  thorpej Update from trunk:
Implement bus_get_window on Tsunami and MCPCIA, and compensate for
the Cool sign-extend hack we use on EV6 when mapping PCI space into
userspace.
 1.1.6.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.6.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.4.2 29-Jun-1999  ross Support for EV6 Tsunami core logic and system type 6600.
This covers most or all of the presently-available 21264 systems.
 1.1.4.1 29-Jun-1999  ross file tsvar.h was added on branch netbsd-1-4 on 1999-06-29 06:46:48 +0000
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 29-Jun-1999  thorpej file tsvar.h was added on branch chs-ubc2 on 1999-07-01 23:00:58 +0000
 1.3.24.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.96.1 21-Apr-2010  matt sync to netbsd-5
 1.5.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.88.1 31-Oct-2009  sborrill Pull up the following revisions(s) (requested by mhitch in ticket #1120):
sys/arch/alpha/pci/tsp_bus_io.c: revision 1.6
sys/arch/alpha/pci/tsp_bus_mem.c: revision 1.9
sys/arch/alpha/pci/tsvar.h: revision 1.7

The tsc(4) bus initialization was using a single statically allocated
extent storage for each tsp(4), which caused a LOCKDEBUG kernel to fail
because the extent storage contained a mutex which panics when the second
mutex_init() is attempted. Put the extent storage into the tsp_config
structure so each tsp(4) gets it own. Fixes PR port-alpha/38358.
 1.5.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.78.4 09-Oct-2010  yamt sync with head
 1.5.78.3 11-Aug-2010  yamt sync with head.
 1.5.78.2 11-Mar-2010  yamt sync with head
 1.5.78.1 04-May-2009  yamt sync with head.
 1.7.4.2 05-Mar-2011  rmind sync with head
 1.7.4.1 30-May-2010  rmind sync with head
 1.7.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.7.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.9.12.1 18-Feb-2012  mrg merge to -current.
 1.9.8.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.9.8.1 17-Apr-2012  yamt sync with head
 1.10.10.1 18-May-2014  rmind sync with head
 1.10.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.14.8.1 31-May-2021  cjep sync with head
 1.14.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.14.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.21 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.20 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.19 04-Jul-2021  thorpej branches: 1.19.2;
Remove unnecessary #include <sys/malloc.h>
 1.18 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.17 08-May-2021  thorpej More symbol sanitizing.
 1.16 24-Apr-2021  thorpej branches: 1.16.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.15 06-Feb-2012  matt branches: 1.15.62;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 14-Jun-2011  matt branches: 1.14.2; 1.14.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.13 06-Jun-2011  matt CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
 1.12 17-May-2011  dyoung branches: 1.12.2;
PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el 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
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.11 28-Apr-2008  martin branches: 1.11.22; 1.11.28;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.74; 1.10.76; 1.10.78;
merge ktrace-lwp.
 1.9 14-Sep-2004  drochner include "locators.h" explicitely (don't rely on isavar.h doing so)
 1.8 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.7 15-Jun-2003  fvdl branches: 1.7.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.6 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2 16-May-2002  thorpej * Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.18.1 30-May-2002  gehenna Catch up with -current.
 1.1.6.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.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.3 03-Jan-2003  thorpej Sync with HEAD.
 1.1.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwoga.c was added on branch thorpej_scsipi on 2001-01-05 17:33:49 +0000
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Sep-2004  skrll Sync with HEAD
 1.10.78.1 16-May-2008  yamt sync with head.
 1.10.76.1 18-May-2008  yamt sync with head.
 1.10.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.22.2 12-Jun-2011  rmind sync with head
 1.11.22.1 31-May-2011  rmind sync with head
 1.12.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14.6.1 18-Feb-2012  mrg merge to -current.
 1.14.2.1 17-Apr-2012  yamt sync with head
 1.15.62.2 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.15.62.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.16.2.2 01-Aug-2021  thorpej Sync with HEAD.
 1.16.2.1 13-May-2021  thorpej Sync with HEAD.
 1.19.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.5 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.4 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.3 01-Jul-2011  dyoung branches: 1.3.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.128; 1.1.130; 1.1.132;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwoga_bus_io.c was added on branch thorpej_scsipi on 2001-01-05 17:33:49 +0000
 1.3.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.4 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.3 01-Jul-2011  dyoung branches: 1.3.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.128; 1.1.130; 1.1.132;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwoga_bus_mem.c was added on branch thorpej_scsipi on 2001-01-05 17:33:49 +0000
 1.3.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.11 08-May-2021  thorpej More symbol sanitizing.
 1.10 05-May-2021  thorpej Moar static.
 1.9 11-Oct-2020  thorpej branches: 1.9.6;
Add some bus_dma instrumentation.
 1.8 10-Oct-2020  thorpej G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.7 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 01-Jul-2011  dyoung branches: 1.6.2; 1.6.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.5 15-Dec-2010  matt Remove unneeded includes of <uvm/uvm_extern.h>
 1.4 28-Apr-2008  martin branches: 1.4.22;
Remove clause 3 and 4 from TNF licenses
 1.3 19-Jul-2001  thorpej branches: 1.3.2; 1.3.124; 1.3.126; 1.3.128;
The T2 has a 256 byte DMA prefetch threshold.
 1.2 03-Jan-2001  thorpej branches: 1.2.2; 1.2.6;
The code that creates/destroys SGMAP DMA maps is the same; put it
in a common place and share it.
 1.1 21-Dec-2000  thorpej Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.2.6.1 03-Aug-2001  lukem update to -current
 1.2.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 03-Jan-2001  bouyer file ttwoga_dma.c was added on branch thorpej_scsipi on 2001-01-05 17:33:49 +0000
 1.3.128.1 16-May-2008  yamt sync with head.
 1.3.126.1 18-May-2008  yamt sync with head.
 1.3.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.2.2 19-Jul-2001  thorpej The T2 has a 256 byte DMA prefetch threshold.
 1.3.2.1 19-Jul-2001  thorpej file ttwoga_dma.c was added on branch nathanw_sa on 2001-07-19 18:50:26 +0000
 1.4.22.1 05-Mar-2011  rmind sync with head
 1.6.6.1 18-Feb-2012  mrg merge to -current.
 1.6.2.1 17-Apr-2012  yamt sync with head
 1.9.6.1 13-May-2021  thorpej Sync with HEAD.
 1.10 25-Jun-2021  thorpej - Use the default implementations of attach_hook(), make_tag(), and
decompose_tag().
- In ttwoga_make_type0addr(), assert that we have an IDSEL in our range,
and otherwise always succeed.
- In ttwoga_bus_maxdevs(), allow only devices 0-9 on bus #0.
 1.9 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.8 02-Oct-2015  msaitoh branches: 1.8.34;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.7 06-Feb-2012  matt branches: 1.7.6; 1.7.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 14-Jun-2011  matt branches: 1.6.2; 1.6.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.5 24-May-2011  rmind branches: 1.5.2;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.4 28-Apr-2008  martin branches: 1.4.22; 1.4.28;
Remove clause 3 and 4 from TNF licenses
 1.3 05-Jan-2008  ad branches: 1.3.6; 1.3.8; 1.3.10;
Fix includes.
 1.2 15-May-2002  thorpej branches: 1.2.26; 1.2.88; 1.2.94; 1.2.102;
Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwoga_pci.c was added on branch thorpej_scsipi on 2001-01-05 17:33:49 +0000
 1.2.102.1 08-Jan-2008  bouyer Sync with HEAD
 1.2.94.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.88.1 09-Jan-2008  matt sync with HEAD
 1.2.26.1 21-Jan-2008  yamt sync with head
 1.3.10.1 16-May-2008  yamt sync with head.
 1.3.8.1 18-May-2008  yamt sync with head.
 1.3.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.22.1 31-May-2011  rmind sync with head
 1.5.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.6.6.1 18-Feb-2012  mrg merge to -current.
 1.6.2.1 17-Apr-2012  yamt sync with head
 1.7.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.6.1 03-Dec-2017  jdolecek update from HEAD
 1.8.34.2 01-Aug-2021  thorpej Sync with HEAD.
 1.8.34.1 13-May-2021  thorpej Sync with HEAD.
 1.5 05-Dec-2021  msaitoh s/exchage/exchange/ in comment.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 28-Apr-2008  martin branches: 1.3.34; 1.3.38;
Remove clause 3 and 4 from TNF licenses
 1.2 24-Dec-2005  perry branches: 1.2.74; 1.2.76; 1.2.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.42;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.42.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwogareg.h was added on branch thorpej_scsipi on 2001-01-05 17:33:50 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.38.1 18-Feb-2012  mrg merge to -current.
 1.3.34.1 17-Apr-2012  yamt sync with head
 1.8 04-Dec-2023  thorpej Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
 1.7 08-May-2021  thorpej More symbol sanitizing.
 1.6 22-Sep-2020  thorpej branches: 1.6.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.5 17-Jun-2020  thorpej #include <sys/extent.h> explicitly.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 28-Apr-2008  martin branches: 1.3.34; 1.3.38;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Jul-2001  thorpej branches: 1.2.2; 1.2.124; 1.2.126; 1.2.128;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 03-Aug-2001  lukem update to -current
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 21-Dec-2000  bouyer file ttwogavar.h was added on branch thorpej_scsipi on 2001-01-05 17:33:50 +0000
 1.2.128.1 16-May-2008  yamt sync with head.
 1.2.126.1 18-May-2008  yamt sync with head.
 1.2.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.2.2.1 27-Jul-2001  thorpej file ttwogavar.h was added on branch nathanw_sa on 2001-07-27 00:25:22 +0000
 1.3.38.1 18-Feb-2012  mrg merge to -current.
 1.3.34.1 17-Apr-2012  yamt sync with head
 1.6.6.1 13-May-2021  thorpej Sync with HEAD.
 1.9 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.8 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 07-Apr-1997  cgd branches: 1.7.4; 1.7.6;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.6 07-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.5 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.4 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.3 27-Nov-1996  cgd branches: 1.3.2;
if we're going to do a real match (we are), ahve to special-case console
 1.2 23-Nov-1996  cgd move probe and setup code into common functions. always probe (i.e.
even if PCI and the IDs are right), just for sanity, before declaring
success. Split the single 0x3b0 -> 0x3df allocation into three seperate
ones: 0x3b0 -> 0x3bc (leaving the 4 ports available for lpt),
0x3c0 -> 0x3cf, and 0x3d0 -> 0x3df. The former chunk has to be split
off if the lpt can exist there, and it's sort-of pretty to have each
group (based on second hex digit) have its own handle.
 1.1 19-Nov-1996  cgd replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.3.2.5 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.3.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.3 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.3.2.2 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.3.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.7.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.7.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3 24-Apr-1998  drochner Drivers for PC-like console devices are MI now.
 1.2 07-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 19-Nov-1996  cgd branches: 1.1.2;
replace old PCI VGA driver with a common VGA back-end and ISA and PCI
front-ends. Unfortunately, because of the way ISA and PCI are currently
probed, if you have a PCI VGA board in your machine and both drivers
in your kernel, the ISA VGA driver may accidentally match the PCI board.
For now, the only solution to this is to not put both drivers in
the GENERIC kernels.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4 12-Apr-1996  cgd replaced by files in ../wscons
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 03-Aug-1995  cgd oops; trim some bogus 1994's from copyrights
 1.1 03-Aug-1995  cgd "Workstation Console" glue code. Badly "needs chainsawed."
Should be better integrated into autoconfig. Also, interface should
be designed rather than cobbled together... Nasty, but it Works.
needs things like ability to pass ioctl()s down to components, ability
to mmap() things, etc.
 1.2 12-Apr-1996  cgd replaced by files in ../wscons
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.16 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.15 22-Sep-2020  thorpej branches: 1.15.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.14 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.13 29-Mar-2014  christos branches: 1.13.28; 1.13.30;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.12 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.12; 1.11.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 04-Dec-2009  njoly Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.9 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 14-Mar-2008  cube branches: 1.7.2; 1.7.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.6 29-Feb-2008  dyoung Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

Add a generic suspend routine. Suspend and resume com@isa.

Protect against dereferencing a NULL softc in comioctl().

Destroy both a mutex and a callout in com_detach().

Cosmetic: use aprint_*_dev(). Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.5 13-Jul-2006  gdamore branches: 1.5.34; 1.5.54; 1.5.58;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.4 02-Oct-2002  thorpej branches: 1.4.22; 1.4.36; 1.4.40; 1.4.48;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 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.1.4.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file com_sableio.c was added on branch thorpej_scsipi on 2001-01-08 14:56:10 +0000
 1.4.48.4 17-Jun-2006  gdamore Undo the undo. Restore COM_INIT_REGS.
 1.4.48.3 17-Jun-2006  gdamore Undo most of the work I did, but leave in the change to use a common
com_cleanup().
 1.4.48.2 16-Jun-2006  gdamore Convert MD specific cleanups to com_cleanup.
 1.4.48.1 15-Jun-2006  gdamore Alpha com(4) ports.
 1.4.40.1 11-Aug-2006  yamt sync with head
 1.4.36.1 09-Sep-2006  rpaulo sync with head
 1.4.22.2 17-Mar-2008  yamt sync with head.
 1.4.22.1 30-Dec-2006  yamt sync with head.
 1.5.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.5.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.54.1 24-Mar-2008  keiichi sync with head.
 1.5.34.1 23-Mar-2008  matt sync with HEAD
 1.7.4.2 11-Mar-2010  yamt sync with head
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.11.16.1 18-May-2014  rmind sync with head
 1.11.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.30.1 10-Jun-2019  christos Sync with HEAD
 1.13.28.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.15.6.1 13-May-2021  thorpej Sync with HEAD.
 1.17 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.16 22-Sep-2020  thorpej branches: 1.16.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.15 13-Apr-2015  riastradh MD rnd.h cleanups. Please let me know if I broke anything!
 1.14 29-Mar-2014  christos branches: 1.14.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.13 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.12 02-Feb-2012  tls branches: 1.12.6; 1.12.10;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.11 01-Jul-2011  dyoung branches: 1.11.2; 1.11.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 04-Dec-2009  njoly Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 16-Mar-2008  cube branches: 1.8.2; 1.8.4;
Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4). Other cosmetic changes as appropriate.
 1.7 11-Dec-2005  christos branches: 1.7.50; 1.7.70; 1.7.74;
merge ktrace-lwp.
 1.6 25-Sep-2003  mycroft branches: 1.6.16;
Modify the fdcattach() interface again, splitting it into two parts, so that
DRQ allocation is done earlier.
 1.5 25-Sep-2003  mycroft Update for new attach method.
 1.4 02-Oct-2002  thorpej branches: 1.4.6;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 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.1.4.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file fdc_sableio.c was added on branch thorpej_scsipi on 2001-01-08 14:56:10 +0000
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 17-Mar-2008  yamt sync with head.
 1.7.74.2 02-Jun-2008  mjf Sync with HEAD.
 1.7.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.70.1 24-Mar-2008  keiichi sync with head.
 1.7.50.1 23-Mar-2008  matt sync with HEAD
 1.8.4.2 11-Mar-2010  yamt sync with head
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.11.6.1 18-Feb-2012  mrg merge to -current.
 1.11.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.2.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.2 03-Dec-2017  jdolecek update from HEAD
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.6.1 06-Jun-2015  skrll Sync with HEAD
 1.16.6.1 13-May-2021  thorpej Sync with HEAD.
 1.12 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.11 22-Sep-2020  thorpej branches: 1.11.6;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.10 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.9 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.8 01-Jul-2011  dyoung branches: 1.8.2; 1.8.12; 1.8.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.7 21-Nov-2009  rmind - Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 07-Mar-2008  cube branches: 1.5.2; 1.5.4;
Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
 1.4 02-Oct-2002  thorpej branches: 1.4.22; 1.4.84; 1.4.104; 1.4.108;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 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.1.4.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file lpt_sableio.c was added on branch thorpej_scsipi on 2001-01-08 14:56:10 +0000
 1.4.108.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.108.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.104.1 24-Mar-2008  keiichi sync with head.
 1.4.84.1 23-Mar-2008  matt sync with HEAD
 1.4.22.1 17-Mar-2008  yamt sync with head.
 1.5.4.2 11-Mar-2010  yamt sync with head
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.8.16.1 18-May-2014  rmind sync with head
 1.8.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.6.1 13-May-2021  thorpej Sync with HEAD.
 1.15 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.14 18-Nov-2020  thorpej branches: 1.14.4;
malloc(9) -> kmem(9)
 1.13 22-Sep-2020  thorpej branches: 1.13.2;
Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.12 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.11 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.10 06-Feb-2012  matt branches: 1.10.6; 1.10.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 04-Dec-2009  njoly branches: 1.9.12; 1.9.16;
Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 15-Mar-2008  cube branches: 1.7.2; 1.7.4;
Split device_t and softc for pckbc(4) and its attachments.
 1.6 05-Jan-2008  ad branches: 1.6.2; 1.6.6;
Fix includes.
 1.5 02-Oct-2002  thorpej branches: 1.5.22; 1.5.84; 1.5.90; 1.5.98;
Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2 12-Jul-2001  thorpej branches: 1.2.2;
bzero -> memset
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.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.1.6.1 03-Aug-2001  lukem update to -current
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file pckbc_sableio.c was added on branch thorpej_scsipi on 2001-01-08 14:56:11 +0000
 1.2.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1 12-Jul-2001  nathanw file pckbc_sableio.c was added on branch nathanw_sa on 2002-10-18 02:34:27 +0000
 1.5.98.1 08-Jan-2008  bouyer Sync with HEAD
 1.5.90.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.84.2 23-Mar-2008  matt sync with HEAD
 1.5.84.1 09-Jan-2008  matt sync with HEAD
 1.5.22.2 17-Mar-2008  yamt sync with head.
 1.5.22.1 21-Jan-2008  yamt sync with head
 1.6.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.7.4.2 11-Mar-2010  yamt sync with head
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.9.16.1 18-Feb-2012  mrg merge to -current.
 1.9.12.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.9.12.1 17-Apr-2012  yamt sync with head
 1.10.10.1 18-May-2014  rmind sync with head
 1.10.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.14.4.1 13-May-2021  thorpej Sync with HEAD.
 1.16 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.15 07-May-2021  thorpej branches: 1.15.6;
Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.14 24-Apr-2021  thorpej branches: 1.14.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.13 14-Jun-2011  matt branches: 1.13.68;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.12 28-Apr-2008  martin branches: 1.12.32;
Remove clause 3 and 4 from TNF licenses
 1.11 11-Dec-2005  christos branches: 1.11.74; 1.11.76; 1.11.78;
merge ktrace-lwp.
 1.10 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.9 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.8 13-Sep-2004  drochner branches: 1.8.12;
autoconf cleanup: turn xxxsubmatch() functions into the locator
passing variants
 1.7 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.6 01-Jan-2003  thorpej branches: 1.6.2;
Use aprint_normal() for cfprint routines.
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.2 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.6.1 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.1.4.2 03-Jan-2003  thorpej Sync with HEAD.
 1.1.4.1 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file sableio.c was added on branch thorpej_scsipi on 2001-01-08 14:56:11 +0000
 1.6.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Sep-2004  skrll Sync with HEAD
 1.8.12.1 21-Jun-2006  yamt sync with head.
 1.11.78.1 16-May-2008  yamt sync with head.
 1.11.76.1 18-May-2008  yamt sync with head.
 1.11.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.68.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.13.68.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.14.2.1 13-May-2021  thorpej Sync with HEAD.
 1.15.6.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 21-Dec-2000  thorpej branches: 1.1.2; 1.1.128; 1.1.130; 1.1.132;
Add support for the AlphaServer 2100 (Sable) and the AlphaServer 2100A
(Lynx), written from scratch by me over a year ago, but never committed
to the tree because there was a bug I could never quite find. I have
fixed a few problems in the code, but still don't know if that bug is
quite fixed. Since I don't have access to the hardware directly, I'll
have to call for testers again.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 21-Dec-2000  bouyer file sableiovar.h was added on branch thorpej_scsipi on 2001-01-08 14:56:11 +0000
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 20-Aug-2005  abs Support booting from ffsv2 filesystems - thanks Simon Burge
 1.15 08-May-2002  lukem branches: 1.15.10; 1.15.24; 1.15.26;
nuke MD installboot (ok-ed by thorpej)
 1.14 03-May-2002  lukem nuke installboot.old / bootxx combo (the old "primary bootstrap with
hardcoded blocks of secondary bootstrap"); it was only used by the
distrib ustarfs stuff, and that now uses usr/sbin/installboot and ustarboot
 1.13 18-Aug-1999  cgd branches: 1.13.14; 1.13.16;
add bootxx_lfs
 1.12 05-Apr-1999  cgd branches: 1.12.2;
reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.11 02-Apr-1999  cgd add ustarboot, a ustar-capable unified bootstrap intended to be
mkbootimage'd and slapped on the front of a tar file.
 1.10 02-Apr-1999  cgd add mkbootimage, a program to make a bootable image (i.e. prepend a boot
block, pad to a block boundary) from a console program (i.e. a boot
block, firmware upgrade executable, etc.)
 1.9 02-Apr-1999  cgd build the filesystem-specific primaries
 1.8 05-Sep-1997  thorpej installbood_cd9660 no longer exists.
 1.7 10-Apr-1997  cgd branches: 1.7.4; 1.7.6;
add installboot_cd9660, which is installboot(8) modified to place a boot
block (and faked-up disklabel) into an ISO-9660 file system image.
 1.6 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.5 18-Jan-1997  cgd branches: 1.5.2;
add setnetbootinfo to list of subdirs
 1.4 23-Sep-1996  cgd add netboot
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.6.2 10-Apr-1997  cgd add installboot_cd9660, which is installboot(8) modified to place a boot
block (and faked-up disklabel) into an ISO-9660 file system image.
 1.7.6.1 10-Apr-1997  cgd file Makefile was added on branch alpha-nwscons on 1997-04-10 23:03:39 +0000
 1.7.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.2 05-Apr-1999  cgd reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.12.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 03:35:25 +0000
 1.13.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.14.1 20-Jun-2002  nathanw Catch up to -current.
 1.15.26.1 21-Jun-2006  yamt sync with head.
 1.15.24.1 05-Feb-2006  tron Pull up following revision(s) (requested by abs in ticket #738):
sys/arch/alpha/stand/Makefile: revision 1.16
distrib/sets/lists/base/md.alpha: revision 1.35
sys/arch/alpha/stand/bootxx_ffsv2/Makefile: revision 1.1
Support booting from ffsv2 filesystems - thanks Simon Burge
 1.15.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.37 28-May-2022  andvar fix various typos in comments.
 1.36 08-Apr-2017  christos centralize vers.c building for standalone programs.
 1.35 20-Jan-2016  jklos branches: 1.35.2; 1.35.4;
Change base address to account for later Alpha models with later firmware
which require more space for SRM.
 1.34 16-Jan-2014  christos branches: 1.34.6;
eliminate use of bsd.sys.mk from Makefiles
 1.33 12-Jan-2014  tsutsui Add empty LIBCRTI= as LIBCRT0 to build sa programs without installed DESTDIR.

XXX: probabry we should have bsd.saprog.mk or something.
 1.32 23-Jan-2011  joerg branches: 1.32.4; 1.32.14; 1.32.18;
Define NOMAN earlier
 1.31 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.30 20-Apr-2009  tsutsui branches: 1.30.4; 1.30.6; 1.30.8;
Set STRIPFLAG= after ${MAKECONF} is included by <bsd.own.mk> via <bsd.prog.mk>.
Fixes PR install/40492.
 1.29 13-Apr-2009  tsutsui Use <bsd.klinks.mk> to create ${MACHINE} and ${MACHINE_ARCH} symlinks.
 1.28 12-Jan-2009  tsutsui branches: 1.28.2;
WARNSfy
 1.27 11-Dec-2005  christos branches: 1.27.74; 1.27.78; 1.27.86; 1.27.88;
merge ktrace-lwp.
 1.26 05-Jan-2005  simonb Revert previous method of stripping out the .eh_frame sections from
objects as they're built now that we strip them all out at final link
time.
 1.25 28-Dec-2004  jmc Make sure all objects strip out the .eh_frame section and force libsa/etc to
also do this for their objects. Otherwise this creates bootblocks that
are too large w. binutils 2.15
 1.24 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.23 08-Oct-2003  simonb Define LIB{CRT0,C,CRTBEGIN,CRTEND} as nothing, we don't need to link
against them.
 1.22 09-Nov-2002  thorpej branches: 1.22.6;
Make the bootblocks build with warnings.
 1.21 05-Jan-2002  thorpej Add -ffreestanding to CFLAGS. Remove the GCC 2.8 check around
-Wno-main (always include -Wno-main).
 1.20 30-Dec-2001  lukem add -Os to COPTS after <bsd.prog.mk> is pulled in rather than adding
it in CFLAGS beforehand, as a user's mk.conf COPTS+=-O2 results in
boot files that are too large.
 1.19 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.18 21-Jul-2000  jdolecek branches: 1.18.2; 1.18.4; 1.18.8;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.17 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.16 23-Jan-2000  mycroft Clean up the machine symlink stuff ever so slightly. Needs to be
standardized between files.
 1.15 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.14 10-Sep-1999  ross branches: 1.14.2;
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.13 11-Apr-1999  cgd add support for 'standalone programs', like kernels but not the kernel.
 1.12 05-Apr-1999  cgd branches: 1.12.2; 1.12.4;
always -D NETBSD_VERS
 1.11 05-Apr-1999  cgd i was fooling myself to believe that these would build with all warnings
 1.10 05-Apr-1999  cgd reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.9 02-Apr-1999  ross Fix typo in FILE_FORMAT_CPPFLAGS.
 1.8 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.7 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.6 31-Mar-1999  cgd separate defns for primary and unified boot blocks
 1.5 31-Mar-1999  cgd Compile with -Os (optimize for size).
Clean up the "Region 1" related definitions, and define load addresses,
max load size, and max total size for as many boot block types as we can.
(types = unified, primary, secondary). We can't always define all
values for all boot blocks, though.
Make CPP flags selection less gross.
Use objcopy rather than headersize (yay, evil gets a stake to the heart!).
Use a little shell script to verify that the sizes of the boot blocks are OK.
Do not compile too much more of libsa than we actually have to.
 1.4 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.3 28-Sep-1998  thorpej Fix for some EGCS warnings.
 1.2 28-Mar-1998  cgd GC alpha's ECOFF_TOOLCHAIN make variable, and related bits. Nobody
should be using an ECOFF toolchain on NetBSD/alpha any more.
 1.1 28-Mar-1998  thorpej Much more sane boot block builds, from Chris Demetriou.
 1.12.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.2 05-Apr-1999  cgd always -D NETBSD_VERS
 1.12.2.1 05-Apr-1999  cgd file Makefile.bootprogs was added on branch netbsd-1-4 on 1999-04-05 22:03:49 +0000
 1.14.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.8.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.5 11-Nov-2002  nathanw Catch up to -current
 1.18.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.18.2.3 11-Jan-2002  nathanw More catchup.
 1.18.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.18.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.22.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.22.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.6.1 03-Aug-2004  skrll Sync with HEAD
 1.27.88.1 06-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #418):
sys/arch/alpha/stand/Makefile.bootprogs: revision 1.28
sys/arch/alpha/stand/common/boot.c: revision 1.29
WARNSfy
 1.27.86.2 28-Apr-2009  skrll Sync with HEAD.
 1.27.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.78.1 04-May-2009  yamt sync with head.
 1.27.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.28.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.30.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.32.18.1 18-May-2014  rmind sync with head
 1.32.14.2 03-Dec-2017  jdolecek update from HEAD
 1.32.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.6.2 28-Aug-2017  skrll Sync with HEAD
 1.34.6.1 19-Mar-2016  skrll Sync with HEAD
 1.35.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.35.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.11 24-Aug-2014  apb Avoid splitting sed programs over multiple lines with
<backslash><newline><indentation>. Use multiple -e options instead.
 1.10 20-Jul-2012  matt branches: 1.10.2;
Use ${_MKTARGET_LINK} and ${_MKTARGET_CREATE}
 1.9 03-Apr-2009  tsutsui branches: 1.9.12;
Remove obsolete LIBSA_USE_MEMCPY and LIBSA_USE_MEMSET.
They were removed from <lib/libsa/stand.h> on December 2007.
 1.8 25-Oct-2008  apb branches: 1.8.2; 1.8.8;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.7 11-Dec-2005  christos branches: 1.7.74; 1.7.78; 1.7.84;
merge ktrace-lwp.
 1.6 05-Jan-2005  simonb Discard any .eh_frame sections at link time by asking ${LD} to dump the
current linker script, change references for any .eh_frame sections so
that they go in to the special "DISCARD" section so that they are not
included in the final object, and use the resultant linker script when
actually linking the bootblocks.

Idea (and most of the sed expression) from Jakub Jelinek.
 1.5 29-Aug-2003  dsl Create linker map file so it is possible to see which library members
are included and why.
 1.4 22-Sep-2001  tv branches: 1.4.18;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.3 18-Aug-1999  cgd branches: 1.3.14; 1.3.16; 1.3.18;
add a gross putulong() function which can be useful for debugging.
It's not normally included.
 1.2 05-Apr-1999  cgd branches: 1.2.2;
always -D NETBSD_VERS
 1.1 02-Apr-1999  cgd a makefile template for filesystem-using primary boot blocks
 1.2.2.2 05-Apr-1999  cgd always -D NETBSD_VERS
 1.2.2.1 05-Apr-1999  cgd file Makefile.bootxx was added on branch netbsd-1-4 on 1999-04-05 22:03:49 +0000
 1.3.18.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.14.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.4.18.4 17-Jan-2005  skrll Sync with HEAD.
 1.4.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.18.1 03-Aug-2004  skrll Sync with HEAD
 1.7.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.78.1 04-May-2009  yamt sync with head.
 1.7.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.12.1 30-Oct-2012  yamt sync with head
 1.10.2.1 03-Dec-2017  jdolecek update from HEAD
 1.23 23-Jan-2011  joerg Define NOMAN earlier
 1.22 11-Dec-2005  christos branches: 1.22.106; 1.22.108;
merge ktrace-lwp.
 1.21 05-Jan-2005  simonb Revert previous method of stripping out the .eh_frame sections from
objects as they're built now that we strip them all out at final link
time.
 1.20 28-Dec-2004  jmc Make sure all objects strip out the .eh_frame section and force libsa/etc to
also do this for their objects. Otherwise this creates bootblocks that
are too large w. binutils 2.15
 1.19 27-Aug-2002  lukem branches: 1.19.6;
arch/*/stand stuff should be LDSTATIC=-static and not LDSTATIC?=-static.
It doesn't make sense to have standalone stuff dynamically linked just
because an end-user uses LDSTATIC="".
 1.18 12-Dec-2001  lukem branches: 1.18.8;
Set NOxxx= before <bsd.own.mk> is pulled in (even indirectly).
Otherwise the appropriate MKxxx=no won't be defined .
 1.17 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.16 11-Apr-1999  cgd branches: 1.16.14; 1.16.16;
only conditionally set BINDIR to /usr/mdec
 1.15 05-Apr-1999  cgd branches: 1.15.2; 1.15.4;
-I goes in CPPFLAGS, not CFLAGS
 1.14 05-Apr-1999  cgd reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.13 28-Sep-1998  thorpej Fix for some EGCS warnings.
 1.12 27-Aug-1998  tv Nuke egcs warns: void main(), implicit int
 1.11 28-Mar-1998  thorpej Much more sane boot block builds, from Chris Demetriou.
 1.10 06-Sep-1997  drochner Oops, last change made "make depend" work incompletely. Don't define
a "depend" rule here.
 1.9 06-Sep-1997  drochner Make sure the <machine/*.h> includes come from current kernel sources,
not from installed userland.
 1.8 06-Apr-1997  cgd branches: 1.8.4; 1.8.6;
clean up NetBSD RCS ID strings
 1.7 23-Feb-1997  cgd turn Alpha's ELF_TOOLCHAIN checks to ECOFF_TOOLCHAIN checks
 1.6 16-Feb-1997  cgd protect against multiple inclusion, make HEAP_LIMIT define libsa-specific
 1.5 24-Jan-1997  cgd branches: 1.5.2; 1.5.6;
kill unnecessary newline
 1.4 16-Jan-1997  cgd move the secondary bootstrap down (to 0x20004000), and add a HEAP_LIMIT
so that we don't exhaust our bootstrap address space (when using the new,
not yet checked in, memory allocator).
 1.3 06-Oct-1996  cgd key on ELF_TOOLCHAIN being defined (presumably in /etc/mk.conf)
to signal that the build is happening on a machine with an ELF
toolchain. This is temporary, until a better toolchain-recognition
scheme is worked out.
 1.2 23-Sep-1996  cgd add -DECOFF_COMPAT to CPPFLAGS if ELF_TOOLCHAIN not defined.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.6.1 11-Mar-1997  is Merge in latest Trunk.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.8.6.1 06-Apr-1997  cgd file Makefile.inc was added on branch alpha-nwscons on 1997-04-06 08:39:39 +0000
 1.8.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.2.2 05-Apr-1999  cgd -I goes in CPPFLAGS, not CFLAGS
 1.15.2.1 05-Apr-1999  cgd file Makefile.inc was added on branch netbsd-1-4 on 1999-04-05 03:42:51 +0000
 1.16.16.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.16.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.14.2 27-Aug-2002  nathanw Catch up to -current.
 1.16.14.1 08-Jan-2002  nathanw Catch up to -current.
 1.18.8.1 30-Aug-2002  gehenna catch up with -current.
 1.19.6.1 17-Jan-2005  skrll Sync with HEAD.
 1.22.108.1 08-Feb-2011  bouyer Sync with HEAD
 1.22.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.4 13-Oct-1996  christos branches: 1.4.2;
backout previous kprintf change
 1.3 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.4 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.3 18-Jan-1997  cgd add padding to structures for future expansion. add a netbbinfo
structure to allow netboot information to be hard-coded in network
boot blocks, so that they can be made to work even on systems with
firmware which doesn't support the new "ethernet address in boot device"
convention.
 1.2 12-Apr-1996  cgd branches: 1.2.2;
clean up copyrights and RCS IDs
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.1 24-Jan-1997  cgd sync with trunk
 1.5 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.4 18-Jan-1997  cgd update for bbinfo padding changes
 1.3 14-Jun-1996  cgd branches: 1.3.2;
clean up entry printf
 1.2 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.2.1 24-Jan-1997  cgd sync with trunk
 1.6 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.5 23-Sep-1996  cgd branches: 1.5.2;
update for ELF toolchain support
 1.4 13-Jun-1996  cgd clean up copyright notices
 1.3 10-May-1996  cgd branches: 1.3.4;
a few more minor ecoff-header-related tweaks.
 1.2 09-May-1996  cgd update to include <sys/exec_ecoff.h>, rather than the alpha-specific
(and redundant) coff.h file (which has now been removed).
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.4.1 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.5.2.1 24-Jan-1997  cgd sync with trunk
 1.4 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.3 20-Jan-1997  cgd update date to date of last real modification
 1.2 16-Jan-1997  cgd clean up, deal with secondary bootstrap programs not on 'a' partition
'a' partition not starting at 0.
 1.1 06-Nov-1996  cgd branches: 1.1.2;
NetBSD/alpha installboot manual page. Copied from the sparc and lightly
tweaked by Curt Sampson <cjs@portal.ca>, then largely redone by me.
 1.1.2.1 24-Jan-1997  cgd sync with trunk
 1.7 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.6 18-Jan-1997  cgd kill bogux printf
 1.5 18-Jan-1997  cgd move the sync() calls to the correct place...
 1.4 16-Jan-1997  cgd update copyright
 1.3 16-Jan-1997  cgd clean up, deal with secondary bootstrap programs not on 'a' partition
'a' partition not starting at 0.
 1.2 20-Dec-1995  cgd branches: 1.2.2;
deal with ufs -> ffs transition.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.1 24-Jan-1997  cgd sync with trunk
 1.5 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.4 18-Jan-1997  cgd if a file name is given (i.e. BOOTED_FILE) is set, boot only that file,
but if not then try to boot "netbsd", "netbsd.bak", "netbsd.old", and
"onetbsd" (in that order) until one is found or until the list of names
is exhausted.
 1.3 23-Sep-1996  cgd branches: 1.3.2;
define ELFSIZE to 64, for exec_elf.h
 1.2 18-Sep-1996  cgd fix for elf loading, from Matt Thomas
 1.1 17-Sep-1996  cgd (1) split load-file functionality out from the 'main program' of the
boot block, since it will be shared with the network boot block.
(2) Kill a.out support, since it never worked was never used, and will
never be.
(3) Add support for booting of ELF kernels, from Matt Thomas. (Currently
untested, but it compiles.)
 1.3.2.1 24-Jan-1997  cgd sync with trunk
 1.3 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.2 25-Nov-1996  cgd branches: 1.2.2;
fix up field names for recent rpb.h changes
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.1 24-Jan-1997  cgd sync with trunk
 1.6 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.5 17-Oct-1996  cgd branches: 1.5.2;
update for changes in asm.h
 1.4 23-Sep-1996  cgd update for ELF toolchain support
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5.2.1 24-Jan-1997  cgd sync with trunk
 1.2 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1 23-Nov-1995  cgd branches: 1.1.2;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.2.1 24-Jan-1997  cgd sync with trunk
 1.5 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.4 17-Oct-1996  cgd branches: 1.4.2;
update for changes in asm.h
 1.3 23-Sep-1996  cgd update for ELF toolchain support
 1.2 17-Sep-1996  cgd add _rtt as an XLEAF into start which (like 'halt') just halts
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.32 20-Jul-2012  matt Use ${_MKTARGET_LINK} and ${_MKTARGET_CREATE}
 1.31 22-Sep-2001  tv branches: 1.31.158;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.30 26-Sep-2000  simonb branches: 1.30.2; 1.30.4; 1.30.6;
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.29 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.28 10-Sep-1999  ross branches: 1.28.2; 1.28.12;
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.27 18-Aug-1999  cgd mention that putstr.c and putulong.c might want to be included when debugging
 1.26 05-Apr-1999  cgd branches: 1.26.2;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.25 05-Apr-1999  cgd don't get the name from newvers, get it from a bootstrap-specific -D
in the Makefile. also, print the banner before we do things that
might cause us to print error messages.
 1.24 02-Apr-1999  cgd update for booted_dev and disk->blkdev changes.
 1.23 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.22 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.21 31-Mar-1999  cgd Compile with -Os (optimize for size).
Clean up the "Region 1" related definitions, and define load addresses,
max load size, and max total size for as many boot block types as we can.
(types = unified, primary, secondary). We can't always define all
values for all boot blocks, though.
Make CPP flags selection less gross.
Use objcopy rather than headersize (yay, evil gets a stake to the heart!).
Use a little shell script to verify that the sizes of the boot blocks are OK.
Do not compile too much more of libsa than we actually have to.
 1.20 28-Mar-1998  thorpej Much more sane boot block builds, from Chris Demetriou.
 1.19 06-Sep-1997  drochner enable -Wall
 1.18 09-May-1997  mycroft branches: 1.18.4; 1.18.6;
Eliminate bogus redefinitions of standard targets.
 1.17 17-Apr-1997  thorpej STRIP -> STRIPFLAG
 1.16 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.15 24-Jan-1997  cgd branches: 1.15.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.14 23-Jan-1997  cgd add support for reading gzipped kernels.
 1.13 23-Jan-1997  cgd update for new kernel library build process
 1.12 17-Jan-1997  cgd clean up a bit. include libraries more carefully, so that when compressed
read code is integrated into libsa things will work properly.
 1.11 16-Jan-1997  cgd seriously clean up makefiles. use libsa/libkern/libz as appropriate,
and don't build the various sources into objs locally by specifying
them directly in the Makefiles.
 1.10 18-Oct-1996  thorpej Use ${INSTALL}.
 1.9 23-Sep-1996  cgd update for ELF toolchain support
 1.8 17-Sep-1996  cgd (1) split load-file functionality out from the 'main program' of the
boot block, since it will be shared with the network boot block.
(2) Kill a.out support, since it never worked was never used, and will
never be.
(3) Add support for booting of ELF kernels, from Matt Thomas. (Currently
untested, but it compiles.)
 1.7 14-Jun-1996  cgd Don't pass arguments to the kernel, trim unnecessary environment
calls, kill 'ask' loop (i.e. if boot fails, halt), seperate
ECOFF and a.out support into seperate options.
 1.6 12-Apr-1996  cgd don't forget dkcksum.c, now that it's seperate
 1.5 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4 28-Jun-1995  cgd make boot blocks work on AlphaStation systems
 1.3 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.15.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.18.6.2 09-May-1997  mycroft Eliminate bogus redefinitions of standard targets.
 1.18.6.1 09-May-1997  mycroft file Makefile was added on branch alpha-nwscons on 1997-05-09 07:50:27 +0000
 1.18.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.2.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.26.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 06:56:24 +0000
 1.28.12.1 26-Sep-2000  simonb Pull up rev 1.30 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 1.28.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.30.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.30.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.31.158.1 30-Oct-2012  yamt sync with head
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.12 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.11 23-Jan-1997  cgd add support for reading gzipped kernels.
 1.10 18-Jan-1997  cgd if a file name is given (i.e. BOOTED_FILE) is set, boot only that file,
but if not then try to boot "netbsd", "netbsd.bak", "netbsd.old", and
"onetbsd" (in that order) until one is found or until the list of names
is exhausted.
 1.9 18-Jan-1997  cgd move an 'int debug;' into boot.c (it was the only diff between boot.c and
netboot.c), and nuke netboot.c (using boot.c instead for network boot blocks).
 1.8 17-Sep-1996  cgd branches: 1.8.2;
(1) split load-file functionality out from the 'main program' of the
boot block, since it will be shared with the network boot block.
(2) Kill a.out support, since it never worked was never used, and will
never be.
(3) Add support for booting of ELF kernels, from Matt Thomas. (Currently
untested, but it compiles.)
 1.7 14-Jun-1996  cgd Don't pass arguments to the kernel, trim unnecessary environment
calls, kill 'ask' loop (i.e. if boot fails, halt), seperate
ECOFF and a.out support into seperate options.
 1.6 10-May-1996  cgd a few more minor ecoff-header-related tweaks.
 1.5 09-May-1996  cgd update to include <sys/exec_ecoff.h>, rather than the alpha-specific
(and redundant) coff.h file (which has now been removed).
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 28-Jun-1995  cgd make boot blocks work on AlphaStation systems
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.8.2.1 24-Jan-1997  cgd sync with trunk
 1.5 02-Apr-1999  cgd this should have been gc'd with the disk->blkdev changes
 1.4 06-Apr-1997  cgd branches: 1.4.6;
clean up NetBSD RCS ID strings
 1.3 23-Nov-1995  cgd branches: 1.3.8;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.8.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4.6.1 06-Apr-1997  cgd file conf.c was added on branch alpha-nwscons on 1997-04-06 08:40:32 +0000
 1.4 02-Apr-1999  cgd this should have been gc'd with the disk->blkdev changes
 1.3 06-Sep-1997  drochner -Wall fixes
 1.2 06-Apr-1997  cgd branches: 1.2.4; 1.2.6;
clean up NetBSD RCS ID strings
 1.1 23-Nov-1995  cgd branches: 1.1.8;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.8.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file devopen.c was added on branch alpha-nwscons on 1997-04-06 08:40:33 +0000
 1.2.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12 02-Apr-1999  cgd move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.11 27-Mar-1999  ross Bug fix for the bug fix. Be sure to prom_close() in bootxx and boot, but not
in netboot, and not in diskclose(), but after trying all kernelnames[].
 1.10 26-Mar-1999  ross Fix bug found by Bernd "Veego" Ernesti: close the console disk channel.
 1.9 28-Dec-1998  ross We don't call prom_open() here anymore, so don't call prom_close() either!
 1.8 15-Oct-1998  ross Don't actually do the raw prom open here.
 1.7 06-Sep-1997  drochner -Wall fixes
 1.6 06-Apr-1997  cgd branches: 1.6.4; 1.6.6;
clean up NetBSD RCS ID strings
 1.5 01-Apr-1997  cgd hack to fake up disklabel
 1.4 18-Jan-1997  cgd branches: 1.4.2;
remove a kludge which was breaking multiple opens/closes of the disk
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6.6.1 06-Apr-1997  cgd file disk.c was added on branch alpha-nwscons on 1997-04-06 08:40:34 +0000
 1.6.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 02-Apr-1999  cgd move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.3 15-Oct-1998  ross Extern def for raw prom disk file descriptor.
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 23-Nov-1995  cgd branches: 1.1.8;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1.8.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file disk.h was added on branch alpha-nwscons on 1997-04-06 08:40:35 +0000
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 20-Aug-2005  abs Include the ffsv2 filesystem ops. Necessary but not sufficient for booting
from an FFSv2 filesystem. Similar change tested on NetBSD-3
 1.10 23-Jun-2005  junyoung branches: 1.10.2;
Use FS_OPS() macro.
 1.9 23-Jun-2005  junyoung Drop trailing spaces.
 1.8 23-Feb-2003  simonb branches: 1.8.2; 1.8.16;
Update for LFSv2 support. Ports that have "bootxx_lfs"-style
bootblocks currently only support LFSv2, but the second level
"boot" program supports both LFS versions.
 1.7 18-Aug-1999  cgd add lfs support
 1.6 15-Oct-1998  ross Try the ustarfs open first...it's the only one that can't necessarily
seek. We might be reading a tape and the extra superblock reads will
eat up tape records.
 1.5 24-Sep-1998  ross Track tfs -> ustarfs change.
 1.4 22-Sep-1998  ross Add fs_ops to file_system[] for the ustar-format `tfs'.
 1.3 06-Apr-1997  cgd branches: 1.3.6;
clean up NetBSD RCS ID strings
 1.2 18-Jan-1997  cgd branches: 1.2.2;
add cd9660 file system ops to the file system ops table
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.6.1 06-Apr-1997  cgd file filesystem.c was added on branch alpha-nwscons on 1997-04-06 08:40:36 +0000
 1.8.16.1 05-Feb-2006  tron Pull up following revision(s) (requested by abs in ticket #738):
sys/arch/alpha/stand/boot/filesystem.c: revision 1.11 via patch
Include the ffsv2 filesystem ops. Necessary but not sufficient for booting
from an FFSv2 filesystem. Similar change tested on NetBSD-3
 1.8.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.5 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.4 06-Apr-1997  cgd branches: 1.4.6;
clean up NetBSD RCS ID strings
 1.3 14-Jun-1996  cgd branches: 1.3.6;
Don't pass arguments to the kernel, trim unnecessary environment
calls, kill 'ask' loop (i.e. if boot fails, halt), seperate
ECOFF and a.out support into seperate options.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.6.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4.6.1 06-Apr-1997  cgd file newvers.sh was added on branch alpha-nwscons on 1997-04-06 08:40:36 +0000
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 28-Jun-1995  cgd make boot blocks work on AlphaStation systems
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 24-Jan-1997  cgd reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.4 17-Oct-1996  cgd branches: 1.4.2;
update for changes in asm.h
 1.3 23-Sep-1996  cgd update for ELF toolchain support
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4 31-Mar-1999  cgd GC; unused
 1.3 06-Apr-1997  cgd branches: 1.3.6;
clean up NetBSD RCS ID strings
 1.2 16-Feb-1995  cgd branches: 1.2.10;
RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.10.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.6.1 06-Apr-1997  cgd file test.c was added on branch alpha-nwscons on 1997-04-06 08:40:37 +0000
 1.15 09-Nov-2001  scw Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.14 02-Aug-2001  bjh21 branches: 1.14.2; 1.14.6;
Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.13 22-Jul-2001  wiz seperate -> separate
 1.12 26-Sep-2000  simonb branches: 1.12.4;
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.11 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.10 05-Apr-1999  cgd branches: 1.10.2; 1.10.8; 1.10.18;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.9 23-Jan-1997  cgd branches: 1.9.12;
add support for reading gzipped kernels.
 1.8 18-Jan-1997  cgd bump version
 1.7 16-Jan-1997  cgd seriously clean up makefiles. use libsa/libkern/libz as appropriate,
and don't build the various sources into objs locally by specifying
them directly in the Makefiles.
 1.6 14-Jun-1996  cgd Don't pass arguments to the kernel, trim unnecessary environment
calls, kill 'ask' loop (i.e. if boot fails, halt), seperate
ECOFF and a.out support into seperate options.
 1.5 09-May-1996  cgd update to include <sys/exec_ecoff.h>, rather than the alpha-specific
(and redundant) coff.h file (which has now been removed).
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 28-Jun-1995  cgd make boot blocks work on AlphaStation systems
 1.2 16-Feb-1995  cgd RCS ids, some missing copyrights.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.12.2 23-Jan-1997  cgd add support for reading gzipped kernels.
 1.9.12.1 23-Jan-1997  cgd file version was added on branch alpha-nwscons on 1997-01-23 23:10:39 +0000
 1.10.18.1 26-Sep-2000  simonb Pull up rev 1.12 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 1.10.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.10.2.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.10.2.1 05-Apr-1999  cgd file version was added on branch netbsd-1-4 on 1999-04-05 06:56:24 +0000
 1.12.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.4.1 03-Aug-2001  lukem update to -current
 1.14.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.14.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.14.2.1 02-Aug-2001  nathanw file version was added on branch nathanw_sa on 2001-11-14 19:12:41 +0000
 1.3 26-Sep-2000  simonb Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.2 05-Apr-1999  cgd branches: 1.2.2; 1.2.8; 1.2.18;
install bootxx_cd9660 and bootxx_ffs
 1.1 02-Apr-1999  cgd makefiles for some filesystem-using primary boot blocks. much as
i hate to say it, these still contain bugs that can't easily be
addressed yet.
 1.2.18.1 26-Sep-2000  simonb Pull up rev 1.3 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 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.2.2.2 05-Apr-1999  cgd install bootxx_cd9660 and bootxx_ffs
 1.2.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 03:37:29 +0000
 1.4 01-Feb-2003  simonb Use a 32-bit daddr_t so that lib/libsa/{ufs,lfs}.c don't pull in 64
bit divide and modulus library routines that break the tight space
constraints on bootblocks on these platforms.

May not be the final solution, but gets bootblocks building again.
 1.3 26-Sep-2000  simonb Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.2 05-Apr-1999  cgd branches: 1.2.2; 1.2.8; 1.2.18;
install bootxx_cd9660 and bootxx_ffs
 1.1 02-Apr-1999  cgd makefiles for some filesystem-using primary boot blocks. much as
i hate to say it, these still contain bugs that can't easily be
addressed yet.
 1.2.18.1 26-Sep-2000  simonb Pull up rev 1.3 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 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.2.2.2 05-Apr-1999  cgd install bootxx_cd9660 and bootxx_ffs
 1.2.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 03:37:30 +0000
 1.2 11-Dec-2005  christos branches: 1.2.8; 1.2.20;
merge ktrace-lwp.
 1.1 20-Aug-2005  abs branches: 1.1.6;
Support booting from ffsv2 filesystems - thanks Simon Burge
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 20-Aug-2005  skrll file Makefile was added on branch ktrace-lwp on 2005-11-10 13:50:24 +0000
 1.2.20.2 21-Jun-2006  yamt sync with head.
 1.2.20.1 11-Dec-2005  yamt file Makefile was added on branch yamt-lazymbuf on 2006-06-21 14:48:16 +0000
 1.2.8.2 05-Feb-2006  tron Pull up following revision(s) (requested by abs in ticket #738):
sys/arch/alpha/stand/Makefile: revision 1.16
distrib/sets/lists/base/md.alpha: revision 1.35
sys/arch/alpha/stand/bootxx_ffsv2/Makefile: revision 1.1
Support booting from ffsv2 filesystems - thanks Simon Burge
 1.2.8.1 11-Dec-2005  tron file Makefile was added on branch netbsd-3 on 2006-02-05 18:47:13 +0000
 1.4 23-Feb-2003  simonb Update for LFSv2 support. Ports that have "bootxx_lfs"-style
bootblocks currently only support LFSv2, but the second level
"boot" program supports both LFS versions.
 1.3 01-Feb-2003  simonb Use a 32-bit daddr_t so that lib/libsa/{ufs,lfs}.c don't pull in 64
bit divide and modulus library routines that break the tight space
constraints on bootblocks on these platforms.

May not be the final solution, but gets bootblocks building again.
 1.2 26-Sep-2000  simonb Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.1 18-Aug-1999  cgd branches: 1.1.2; 1.1.12;
add a makefile for an LFS primary
 1.1.12.1 26-Sep-2000  simonb Pull up rev 1.2 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 1.1.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 12-Apr-2021  mrg avoid common symbols.
 1.9 18-Mar-2009  cegger branches: 1.9.78;
Ansify function definitions w/o arguments. Generated with sed.
 1.8 22-Jul-2001  wiz branches: 1.8.2; 1.8.128; 1.8.136; 1.8.142;
bcopy -> memcpy, bzero -> memset
 1.7 28-Sep-1998  thorpej branches: 1.7.26;
Set the primary CPU's PAL revision to the OSF/1 PAL revision after switching
to it, per the Green Book (pointed out by Chris Demetriou).
 1.6 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.5 24-Jun-1998  ross Use the new LOCATE_PCS() macro.
 1.4 29-Jan-1998  ross Avoid VMS palcode ops by using a different technique for cpu_number(),
and don't execute the VMS->OSF palcode switch if the OSF palcode
is already running...which will be the case if the console is not
the venerable SRM.
 1.3 06-Sep-1997  drochner -Wall fixes
 1.2 06-Apr-1997  cgd branches: 1.2.4; 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file OSFpal.c was added on branch alpha-nwscons on 1997-04-06 08:40:57 +0000
 1.2.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.26.1 03-Aug-2001  lukem update to -current
 1.8.142.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.136.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.128.1 04-May-2009  yamt sync with head.
 1.8.2.2 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset
 1.8.2.1 22-Jul-2001  wiz file OSFpal.c was added on branch nathanw_sa on 2001-07-22 15:17:31 +0000
 1.9.78.1 17-Apr-2021  thorpej Sync with HEAD.
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file bbinfo.h was added on branch alpha-nwscons on 1997-04-06 08:40:58 +0000
 1.9 27-Dec-2019  msaitoh s/transfered/transferred/
 1.8 14-Mar-2009  dsl branches: 1.8.64;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.7 24-Dec-2005  perry branches: 1.7.78; 1.7.86; 1.7.92;
bare asm -> __asm
 1.6 11-Dec-2005  christos 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 26-Sep-2000  simonb branches: 1.4.24;
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.

NOTE: This brings the size of the alpha first-stage bootblocks up to
close to the maximum. RAID1 support is controlled by the
BOOTXX_RAID1_SUPPORT define, and is easy to disable if size
becomes an issue.
 1.3 13-Nov-1999  thorpej branches: 1.3.4;
Backout my libsa changes.
 1.2 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.1 02-Apr-1999  cgd branches: 1.1.2; 1.1.8; 1.1.10; 1.1.14;
move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.10.1 14-Nov-1999  fvdl Sync with -current.
 1.1.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.2.2 02-Apr-1999  cgd move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.1.2.1 02-Apr-1999  cgd file blkdev.c was added on branch netbsd-1-4 on 1999-04-02 03:17:30 +0000
 1.3.4.1 26-Sep-2000  simonb Pull up rev 1.4 (approved by thorpej):
Add support for booting off RAIDframe RAID1 mirrors.
Check the first partition type in devopen(), and if it is of type
FS_RAID, add 64 to blkdev_part_offset.
 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 21-Jun-2006  yamt sync with head.
 1.7.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.7.78.1 04-May-2009  yamt sync with head.
 1.8.64.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 17-Mar-2009  he Correct the sense of the test for LIBSA_NO_FS_CLOSE
so that this builds again.
 1.2 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.1 02-Apr-1999  cgd branches: 1.1.2; 1.1.148; 1.1.156; 1.1.162;
move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.1.162.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.156.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.148.1 04-May-2009  yamt sync with head.
 1.1.2.2 02-Apr-1999  cgd move the boot/disk.* code to common/blkdev.*, and gut it. The previous
guts were actually functionally equivalent to the current guts, but were
much larger, filled with bugs, and indeed poked around at the disklabel
when some of those bugs prevented them from ever using the disklabel!
 1.1.2.1 02-Apr-1999  cgd file blkdev.h was added on branch netbsd-1-4 on 1999-04-02 03:17:30 +0000
 1.33 11-Jun-2016  dholland PR 51200 gets in libsa considered harmful: use kgets
 1.32 22-Jan-2011  joerg branches: 1.32.14; 1.32.32;
Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.31 25-Aug-2010  christos branches: 1.31.2; 1.31.4;
change LOAD_NOTE to LOAD_BACKWARDS
 1.30 03-Feb-2009  tsutsui branches: 1.30.4; 1.30.6;
Disable LOAD_NOTE on ustarboot to avoid backward seek on loading a kernel.
Tested on DEC 3000/300 and AlphaPC 164, fixes PR install/38943 on alpha.

XXX: should we enable LOAD_NOTE on ustarfs tape boot to load modules?
 1.29 12-Jan-2009  tsutsui WARNSfy
 1.28 11-Dec-2005  christos branches: 1.28.74; 1.28.78; 1.28.86; 1.28.88;
merge ktrace-lwp.
 1.27 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.26 22-Jul-2001  wiz branches: 1.26.2; 1.26.22;
bcopy -> memcpy, bzero -> memset
 1.25 12-Jun-2000  matt branches: 1.25.6;
Add netbsd.alpha & netbsd.alpha.gz for installation cds.
 1.24 13-Nov-1999  thorpej branches: 1.24.2;
Backout my libsa changes.
 1.23 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.22 10-Sep-1999  ross branches: 1.22.2; 1.22.4; 1.22.8;
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.21 09-Apr-1999  cgd constify bootprog_*, move their definitions into common.h, and have
the generated vers.c include common.h to check against definitions.
 1.20 05-Apr-1999  cgd branches: 1.20.2; 1.20.4;
consistency in boot message printouts
 1.19 05-Apr-1999  cgd don't get the name from newvers, get it from a bootstrap-specific -D
in the Makefile. also, print the banner before we do things that
might cause us to print error messages.
 1.18 05-Apr-1999  cgd come a little closer to compiling with warnings turned on
 1.17 02-Apr-1999  cgd abstract the prom device open/close into a separate module, which
provides the correct functions for primary, secondary, and unified
boot blocks. actually behave correctly (e.g. expect correct arguments,
perform correct operations) depending on which you are. also
some minor cleanup.
 1.16 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.15 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.14 31-Mar-1999  cgd as pointed out by simonb, since we've moved to ELF __main() calls
aren't emittid anymore.
 1.13 31-Mar-1999  cgd rename the C main() function to main_(). this avoids gcc's implicit
call to __main(), and therefore saves the size of the call and the
size of a stub implementation of __main().
in the primary boot block, don't bother saving/restoring the argument
passed in from the caller. There is no such argument (that we care
about, at least) to the primary. (for secondary, it's the firmware
FD being used.)
 1.12 27-Mar-1999  ross Bug fix for the bug fix. Be sure to prom_close() in bootxx and boot, but not
in netboot, and not in diskclose(), but after trying all kernelnames[].
 1.11 15-Oct-1998  ross Grab booted_dev_fd parameter from bootxx. It won't be there for netboot
but there should be no harm done.
 1.10 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.9 07-Aug-1998  drochner Implement the 'i' flag which makes the bootloader ask for the file to
load (as in OSF/1).
Useful for netboot where "-file" doesn't work as needed.
 1.8 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.7 29-Jan-1998  ross While here in alpha/stand, add a technically required imb coherency op
just before transferring to the kernel entry point.
 1.6 06-Sep-1997  drochner -Wall fixes
 1.5 13-Aug-1997  cgd don't forget to set hwrpbsize to zero explicitly
 1.4 25-Jul-1997  cgd branches: 1.4.2; 1.4.4;
fill in the new pointers in the bootinfo_v1 structure.
 1.3 25-Jul-1997  thorpej Set up a version 1 bootinfo for the kernel.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.4.2 25-Jul-1997  cgd fill in the new pointers in the bootinfo_v1 structure.
 1.4.4.1 25-Jul-1997  cgd file boot.c was added on branch alpha-nwscons on 1997-07-25 07:00:43 +0000
 1.4.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.2.2 05-Apr-1999  cgd consistency in boot message printouts
 1.20.2.1 05-Apr-1999  cgd file boot.c was added on branch netbsd-1-4 on 1999-04-05 22:03:57 +0000
 1.22.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.4.1 14-Nov-1999  fvdl Sync with -current.
 1.22.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.24.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.6.1 03-Aug-2001  lukem update to -current
 1.26.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.22.1 03-Aug-2004  skrll Sync with HEAD
 1.26.2.2 22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset
 1.26.2.1 22-Jul-2001  wiz file boot.c was added on branch nathanw_sa on 2001-07-22 15:17:32 +0000
 1.28.88.2 06-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #418):
sys/arch/alpha/stand/common/boot.c: revision 1.30
sys/arch/alpha/stand/ustarboot/Makefile: revision 1.7
Disable LOAD_NOTE on ustarboot to avoid backward seek on loading a kernel.
Tested on DEC 3000/300 and AlphaPC 164, fixes PR install/38943 on alpha.
XXX: should we enable LOAD_NOTE on ustarfs tape boot to load modules?
 1.28.88.1 06-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #418):
sys/arch/alpha/stand/Makefile.bootprogs: revision 1.28
sys/arch/alpha/stand/common/boot.c: revision 1.29
WARNSfy
 1.28.86.2 03-Mar-2009  skrll Sync with HEAD.
 1.28.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.78.2 09-Oct-2010  yamt sync with head
 1.28.78.1 04-May-2009  yamt sync with head.
 1.28.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.1 05-Mar-2011  rmind sync with head
 1.30.4.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.31.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.32.1 09-Jul-2016  skrll Sync with HEAD
 1.32.14.1 03-Dec-2017  jdolecek update from HEAD
 1.4 13-Oct-2016  flxd Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000.
OK skrll@
 1.3 13-Nov-1999  thorpej branches: 1.3.174; 1.3.178; 1.3.196; 1.3.198; 1.3.200; 1.3.202; 1.3.204;
Backout my libsa changes.
 1.2 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.1 02-Apr-1999  cgd branches: 1.1.2; 1.1.8; 1.1.10; 1.1.14;
abstract the prom device open/close into a separate module, which
provides the correct functions for primary, secondary, and unified
boot blocks. actually behave correctly (e.g. expect correct arguments,
perform correct operations) depending on which you are. also
some minor cleanup.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.10.1 14-Nov-1999  fvdl Sync with -current.
 1.1.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.2.2 02-Apr-1999  cgd abstract the prom device open/close into a separate module, which
provides the correct functions for primary, secondary, and unified
boot blocks. actually behave correctly (e.g. expect correct arguments,
perform correct operations) depending on which you are. also
some minor cleanup.
 1.1.2.1 02-Apr-1999  cgd file booted_dev.c was added on branch netbsd-1-4 on 1999-04-02 03:19:09 +0000
 1.3.204.1 18-Jan-2017  skrll Sync with netbsd-5
 1.3.202.1 04-Nov-2016  pgoyette Sync with HEAD
 1.3.200.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.3.198.1 05-Dec-2016  skrll Sync with HEAD
 1.3.196.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.3.178.1 03-Dec-2017  jdolecek update from HEAD
 1.3.174.1 16-Nov-2016  snj Pull up following revision(s) (requested by flxd in ticket #1416):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 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.6 13-Nov-1999  thorpej branches: 1.6.28;
Backout my libsa changes.
 1.5 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.4 26-May-1999  cgd branches: 1.4.2; 1.4.4; 1.4.8;
uh, get the port name consistently correct (NetBSD/alpha, not NetBSD/Alpha)
 1.3 05-Apr-1999  cgd branches: 1.3.2; 1.3.4; 1.3.6;
consistency in boot message printouts
 1.2 05-Apr-1999  cgd come a little closer to compiling with warnings turned on
 1.1 02-Apr-1999  cgd add a template for a filesystem-using primary boot block, just like
'boot' is a template for secondary and unified boot blocks.
 1.3.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.2 21-Jun-1999  perry pullup 1.3->1.4 (cgd): NetBSD/alpha, not NetBSD/Alpha
 1.3.2.1 05-Apr-1999  perry file bootxx.c was added on branch netbsd-1-4 on 1999-06-21 14:42:08 +0000
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.4.1 14-Nov-1999  fvdl Sync with -current.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.1 31-Mar-1999  cgd Compile with -Os (optimize for size).
Clean up the "Region 1" related definitions, and define load addresses,
max load size, and max total size for as many boot block types as we can.
(types = unified, primary, secondary). We can't always define all
values for all boot blocks, though.
Make CPP flags selection less gross.
Use objcopy rather than headersize (yay, evil gets a stake to the heart!).
Use a little shell script to verify that the sizes of the boot blocks are OK.
Do not compile too much more of libsa than we actually have to.
 1.14 22-Jan-2011  joerg Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.13 14-Mar-2009  dsl branches: 1.13.4; 1.13.6; 1.13.8;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.12 30-Nov-1999  thorpej branches: 1.12.134; 1.12.142; 1.12.148;
don't need private `imb' inline anymore.
 1.11 18-Aug-1999  cgd branches: 1.11.2; 1.11.8;
add a gross putulong() function which can be useful for debugging.
It's not normally included.
 1.10 09-Apr-1999  cgd constify bootprog_*, move their definitions into common.h, and have
the generated vers.c include common.h to check against definitions.
 1.9 02-Apr-1999  cgd branches: 1.9.2; 1.9.4;
add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.8 02-Apr-1999  cgd abstract the prom device open/close into a separate module, which
provides the correct functions for primary, secondary, and unified
boot blocks. actually behave correctly (e.g. expect correct arguments,
perform correct operations) depending on which you are. also
some minor cleanup.
 1.7 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.6 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.5 31-Mar-1999  cgd GC cpu_number() and turn alpha_pal_imb() into inline assembler.
 1.4 27-Mar-1999  ross Bug fix for the bug fix. Be sure to prom_close() in bootxx and boot, but not
in netboot, and not in diskclose(), but after trying all kernelnames[].
 1.3 15-Oct-1998  ross Delete bogus prom_open() prototype.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 06-Sep-1997  drochner branches: 1.1.2;
Collect prototypes here.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file common.h was added on branch marc-pcmcia on 1997-09-06 18:00:05 +0000
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.2 02-Apr-1999  cgd add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.9.2.1 02-Apr-1999  cgd file common.h was added on branch netbsd-1-4 on 1999-04-02 03:23:50 +0000
 1.11.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.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.148.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.142.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.134.1 04-May-2009  yamt sync with head.
 1.13.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.13.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.4.1 05-Mar-2011  rmind sync with head
 1.6 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.5 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.4 31-Mar-1999  cgd Compile with -Os (optimize for size).
Clean up the "Region 1" related definitions, and define load addresses,
max load size, and max total size for as many boot block types as we can.
(types = unified, primary, secondary). We can't always define all
values for all boot blocks, though.
Make CPP flags selection less gross.
Use objcopy rather than headersize (yay, evil gets a stake to the heart!).
Use a little shell script to verify that the sizes of the boot blocks are OK.
Do not compile too much more of libsa than we actually have to.
 1.3 06-Sep-1997  drochner -Wall fixes
 1.2 06-Apr-1997  cgd branches: 1.2.4; 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file headersize.c was added on branch alpha-nwscons on 1997-04-06 08:40:59 +0000
 1.2.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12 10-Sep-1999  ross Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.11 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.10 25-Jun-1998  ross Don't bother reading the ELF string table out of a stripped /netbsd[.gz].
In this case, all it has in it are the never-referenced printable names
for the ELF sections themselves. It's located at the end of the (ramdisk)
netbsd.gz file, so it is a very expensive seek and read for only 85 bytes.

Boot floppy load time:

before: 5 minutes
now: 3 minutes
 1.9 28-Feb-1998  ross Force elf symbol sections to an addressable boundary.
 1.8 18-Oct-1997  cjs branches: 1.8.2;
Check return values from lseek; use SEEK_SET instead of 0.
 1.7 06-Sep-1997  drochner -Wall fixes
 1.6 05-Sep-1997  thorpej When loading a symbol section, make sure it is aligned.
 1.5 25-Jul-1997  thorpej branches: 1.5.2; 1.5.4;
If loading an Elf kernel, load the symbol table immediately after
the kernel image.
 1.4 20-Jun-1997  cjs bzero() wants pointers, not ints, for its first arg.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 25-Jan-1997  cgd use strerror() to print errors, rather than just printing error numbers
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.1.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 25-Jan-1997  cgd sync with trunk
 1.5.4.2 25-Jul-1997  thorpej If loading an Elf kernel, load the symbol table immediately after
the kernel image.
 1.5.4.1 25-Jul-1997  thorpej file loadfile.c was added on branch alpha-nwscons on 1997-07-25 00:09:02 +0000
 1.5.2.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.1 09-May-1998  mycroft Pull up 1.9, per request of ross.
 1.4 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.3 09-Apr-1999  cgd branches: 1.3.2;
constify bootprog_*, move their definitions into common.h, and have
the generated vers.c include common.h to check against definitions.
 1.2 07-Apr-1999  cgd branches: 1.2.2; 1.2.4;
save 4.3 bytes on the date string! 4 == day of week plus space,
.3 == a space on days of the month 1-9.
 1.1 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.2.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.2 07-Apr-1999  cgd save 4.3 bytes on the date string! 4 == day of week plus space,
.3 == a space on days of the month 1-9.
 1.2.2.1 07-Apr-1999  cgd file newvers.sh was added on branch netbsd-1-4 on 1999-04-07 06:30:35 +0000
 1.3.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.1 02-Apr-1999  cgd branches: 1.1.2;
add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.1.2.2 02-Apr-1999  cgd add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.1.2.1 02-Apr-1999  cgd file panic_putstr.c was added on branch netbsd-1-4 on 1999-04-02 03:23:50 +0000
 1.16 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.15 13-Oct-2016  flxd branches: 1.15.14; 1.15.16;
Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000.
OK skrll@
 1.14 18-Mar-2009  cegger branches: 1.14.18; 1.14.22; 1.14.38; 1.14.40; 1.14.42; 1.14.44; 1.14.46;
Ansify function definitions w/o arguments. Generated with sed.
 1.13 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.12 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.11 30-Jul-2002  nathanw branches: 1.11.112; 1.11.120; 1.11.126;
Experimentation reveals that the implementation of GET_ENV on at least
some systems chokes if the buffer is not 8-byte aligned. GCC only aligns
character arrays to 4-byte boundaries by default, so it's possible to get
unlucky and die in the boot blocks with a "kernel stack not valid halt".

Avoid the problem by using a local, aligned buffer as the argument to GET_ENV,
and copying the result into the caller's buffer.

Should fix PRs port-alpha/17682 and port-alpha/17717.
CVS ----------------------------------------------------------------------
 1.10 02-Apr-1999  cgd branches: 1.10.2; 1.10.20; 1.10.22; 1.10.34; 1.10.36;
unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.9 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.8 31-Mar-1999  cgd implement NO_GETCHAR, to remove getchar(), and NO_PUTCHAR_HALT to remove
the check in putchar() for character input (specifically control-c, which
causes a halt).
 1.7 31-Mar-1999  cgd no point in passing &ret to test_getchar(); nobody cares! also, no
point in doing the check-for-abort functionality twice in putchar()
(once with a call to test_getchar(), once open coded).
 1.6 31-Mar-1999  cgd In putchar(), don't open-code two calls to the prom puts routine. Instead,
call a helper function (putonechar()). Savings: 64 bytes. Cha-ching!
 1.5 15-Oct-1998  ross Delete prom_open() wrapper routine. Other clients of prom_open
can use the prom.h dispatch macros instead, especially since they
all presently expect the raw return bits.
 1.4 22-Sep-1998  ross While we are here in alpha/stand, bail out on ^C during boot.
 1.3 06-Sep-1997  drochner -Wall fixes
 1.2 06-Apr-1997  cgd branches: 1.2.4; 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file prom.c was added on branch alpha-nwscons on 1997-04-06 08:41:01 +0000
 1.2.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.36.1 31-Jul-2002  lukem Pull up revision 1.11 (requested by nathanw in ticket #591):
Experimentation reveals that the implementation of GET_ENV on at least
some systems chokes if the buffer is not 8-byte aligned. GCC only aligns
character arrays to 4-byte boundaries by default, so it's possible to get
unlucky and die in the boot blocks with a "kernel stack not valid halt".
Avoid the problem by using a local, aligned buffer as the argument to GET_ENV,
and copying the result into the caller's buffer.
Should fix PRs port-alpha/17682 and port-alpha/17717.
 1.10.34.1 30-Aug-2002  gehenna catch up with -current.
 1.10.22.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.20.1 01-Aug-2002  nathanw Catch up to -current.
 1.10.2.2 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.10.2.1 02-Apr-1999  cgd file prom.c was added on branch netbsd-1-4 on 1999-04-02 03:11:58 +0000
 1.11.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.11.112.1 04-May-2009  yamt sync with head.
 1.14.46.1 18-Jan-2017  skrll Sync with netbsd-5
 1.14.44.1 04-Nov-2016  pgoyette Sync with HEAD
 1.14.42.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.14.40.1 05-Dec-2016  skrll Sync with HEAD
 1.14.38.1 01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.14.22.1 03-Dec-2017  jdolecek update from HEAD
 1.14.18.1 16-Nov-2016  snj Pull up following revision(s) (requested by flxd in ticket #1416):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.15.16.1 10-Jun-2019  christos Sync with HEAD
 1.15.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file prom_disp.S was added on branch alpha-nwscons on 1997-04-06 08:41:01 +0000
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file prom_swpal.S was added on branch alpha-nwscons on 1997-04-06 08:41:02 +0000
 1.1 02-Apr-1999  cgd branches: 1.1.2;
add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.1.2.2 02-Apr-1999  cgd add a common putstr() function which just puts()'s the chars in
its argument string. implement a broken version of panic() in terms
of it, for cases where we need panic() but can't affort printf().
 1.1.2.1 02-Apr-1999  cgd file putstr.c was added on branch netbsd-1-4 on 1999-04-02 03:23:51 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.1 18-Aug-1999  cgd branches: 1.1.36;
add a gross putulong() function which can be useful for debugging.
It's not normally included.
 1.1.36.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 29-Aug-2003  dsl Use memset (instead of bzero) to clear bss.
bootxx_lfs now fits in the available space.
 1.12 11-Apr-1999  cgd branches: 1.12.36;
add support for 'standalone programs', like kernels but not the kernel.
 1.11 02-Apr-1999  cgd branches: 1.11.2; 1.11.4;
unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.10 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.9 31-Mar-1999  cgd as pointed out by simonb, since we've moved to ELF __main() calls
aren't emittid anymore.
 1.8 31-Mar-1999  cgd separate defns for primary and unified boot blocks
 1.7 31-Mar-1999  cgd GC cpu_number() and turn alpha_pal_imb() into inline assembler.
 1.6 31-Mar-1999  cgd rename the C main() function to main_(). this avoids gcc's implicit
call to __main(), and therefore saves the size of the call and the
size of a stub implementation of __main().
in the primary boot block, don't bother saving/restoring the argument
passed in from the caller. There is no such argument (that we care
about, at least) to the primary. (for secondary, it's the firmware
FD being used.)
 1.5 15-Oct-1998  ross Save a0 during bss clear.
 1.4 28-Mar-1998  cgd GC alpha's ECOFF_TOOLCHAIN make variable, and related bits. Nobody
should be using an ECOFF toolchain on NetBSD/alpha any more.
 1.3 29-Jan-1998  ross While here in alpha/stand, add a technically required imb coherency op
just before transferring to the kernel entry point.
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file start.S was added on branch alpha-nwscons on 1997-04-06 08:41:03 +0000
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.2.2 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.11.2.1 02-Apr-1999  cgd file start.S was added on branch netbsd-1-4 on 1999-04-02 03:11:58 +0000
 1.12.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.36.1 03-Aug-2004  skrll Sync with HEAD
 1.2 05-Apr-1999  cgd branches: 1.2.2;
reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.1 02-Apr-1999  cgd add mkbootimage, a program to make a bootable image (i.e. prepend a boot
block, pad to a block boundary) from a console program (i.e. a boot
block, firmware upgrade executable, etc.)
 1.2.2.2 05-Apr-1999  cgd reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.2.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 03:35:25 +0000
 1.7 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.6 14-May-2002  lukem branches: 1.6.116; 1.6.124; 1.6.130;
Migrate alpha/pmax/vax bootblock stuff from <dev/dec/dec_boot.h> to
<sys/bootblock.h> (leaving ultrix compat goo in the former)
 1.5 03-Apr-2002  lukem remove boot_block stuff from include/disklabel.h, and migrate to
alpha_boot_block stuff in dev/dec/dec_boot.h
 1.4 19-Feb-2001  cgd branches: 1.4.2; 1.4.4;
convert to use getprogname()
 1.3 14-Jun-1999  cgd branches: 1.3.2;
set bb_flags to 0. Though not strictly necessary (because of an earlier
memset()), this is nice for source-level consistency.
 1.2 05-Apr-1999  cgd branches: 1.2.2; 1.2.4;
clean up, use disklabel.h boot block checksum macro, exit with
EXIT_SUCCESS and EXIT_FAILURE rather than 0 and 1.
 1.1 02-Apr-1999  cgd add mkbootimage, a program to make a bootable image (i.e. prepend a boot
block, pad to a block boundary) from a console program (i.e. a boot
block, firmware upgrade executable, etc.)
 1.2.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.2 05-Apr-1999  cgd clean up, use disklabel.h boot block checksum macro, exit with
EXIT_SUCCESS and EXIT_FAILURE rather than 0 and 1.
 1.2.2.1 05-Apr-1999  cgd file mkbootimage.c was added on branch netbsd-1-4 on 1999-04-05 02:56:34 +0000
 1.3.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.1 17-Apr-2002  nathanw Catch up to -current.
 1.6.130.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.124.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.116.1 04-May-2009  yamt sync with head.
 1.27 23-Sep-2019  christos Consistently use ${RELEASEDIR}/${RELEASEMACHINE} instead of
${RELEASEDIR}/${MACHINE} (Paul Ripke)
 1.26 20-Jul-2012  matt branches: 1.26.40;
Use ${_MKTARGET_LINK} and ${_MKTARGET_CREATE}
 1.25 03-Jan-2003  lukem branches: 1.25.142;
Install release files under "${RELEASEDIR}/${MACHINE}/..." instead of
"${RELEASEDIR}/...".

${RELEASEDIR} is never cleaned , and ${RELEASEDIR}/${MACHINE} is only
cleaned if UPDATE is not defined.
 1.24 22-Sep-2001  tv objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.23 28-May-2001  he branches: 1.23.2; 1.23.4; 1.23.6;
Add Makefile snippets to install netboot in installation/netboot
under ``make release''.
 1.22 21-Jul-2000  jdolecek branches: 1.22.2;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.21 10-Sep-1999  ross branches: 1.21.2; 1.21.12;
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.20 05-Apr-1999  cgd branches: 1.20.2;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.19 05-Apr-1999  cgd don't get the name from newvers, get it from a bootstrap-specific -D
in the Makefile. also, print the banner before we do things that
might cause us to print error messages.
 1.18 02-Apr-1999  cgd update for booted_dev and disk->blkdev changes.
 1.17 02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.16 01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.15 31-Mar-1999  cgd Compile with -Os (optimize for size).
Clean up the "Region 1" related definitions, and define load addresses,
max load size, and max total size for as many boot block types as we can.
(types = unified, primary, secondary). We can't always define all
values for all boot blocks, though.
Make CPP flags selection less gross.
Use objcopy rather than headersize (yay, evil gets a stake to the heart!).
Use a little shell script to verify that the sizes of the boot blocks are OK.
Do not compile too much more of libsa than we actually have to.
 1.14 28-Mar-1998  thorpej Much more sane boot block builds, from Chris Demetriou.
 1.13 06-Sep-1997  drochner -use DHCP extensions in bootp()
-enable -Wall
 1.12 09-May-1997  mycroft branches: 1.12.4; 1.12.6;
Eliminate bogus redefinitions of standard targets.
 1.11 17-Apr-1997  thorpej STRIP -> STRIPFLAG
 1.10 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.9 24-Jan-1997  cgd branches: 1.9.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.8 23-Jan-1997  cgd add support for reading gzipped kernels.
 1.7 23-Jan-1997  cgd update for new kernel library build process
 1.6 18-Jan-1997  cgd move an 'int debug;' into boot.c (it was the only diff between boot.c and
netboot.c), and nuke netboot.c (using boot.c instead for network boot blocks).
 1.5 17-Jan-1997  cgd clean up a bit. include libraries more carefully, so that when compressed
read code is integrated into libsa things will work properly.
 1.4 16-Jan-1997  cgd seriously clean up makefiles. use libsa/libkern/libz as appropriate,
and don't build the various sources into objs locally by specifying
them directly in the Makefiles.
 1.3 18-Oct-1996  thorpej Use ${INSTALL}.
 1.2 23-Sep-1996  cgd checkpoint current development, add ELF toolchain build support
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.6.2 09-May-1997  mycroft Eliminate bogus redefinitions of standard targets.
 1.12.6.1 09-May-1997  mycroft file Makefile was added on branch alpha-nwscons on 1997-05-09 07:50:29 +0000
 1.12.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.2.2 13-Jul-2000  he Apply patch (requested by he):
Enhance the "make release" process:
o Install the distrib bits under "make release"
 1.20.2.1 05-Apr-1999  he file Makefile was added on branch netbsd-1-4 on 2000-07-13 17:16:17 +0000
 1.21.12.1 28-May-2001  he Pull up revision 1.23 (via patch, requested by he):
Add Makefile snippets to install ``netboot'' under ``make release''.
 1.21.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.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.23.4.3 07-Jan-2003  thorpej Sync with HEAD.
 1.23.4.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.23.4.1 28-May-2001  nathanw file Makefile was added on branch nathanw_sa on 2001-09-26 19:54:42 +0000
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.25.142.1 30-Oct-2012  yamt sync with head
 1.26.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4 06-Apr-1997  cgd branches: 1.4.6;
clean up NetBSD RCS ID strings
 1.3 16-Jan-1997  cgd branches: 1.3.2;
more carefully include libkern and libsa headers
 1.2 02-Oct-1996  cgd spaces/tabs cleanup
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4.6.1 06-Apr-1997  cgd file conf.c was added on branch alpha-nwscons on 1997-04-06 08:41:24 +0000
 1.17 12-Apr-2021  mrg remove shadowed (common) declarations of various libsa variables
from various boot programs. for macppc and zaurus, avoid building
with -fcommon any more.
 1.16 17-Jul-2011  joerg branches: 1.16.68;
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.15 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.14 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.13 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.12 19-Mar-2003  drochner branches: 1.12.108; 1.12.116; 1.12.122;
"bootparam" specific variables are defined in libsa/bootparam.c now.
 1.11 09-Nov-2002  thorpej Make the bootblocks build with warnings.
 1.10 13-Nov-1999  thorpej branches: 1.10.6;
Backout my libsa changes.
 1.9 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.8 07-May-1999  drochner branches: 1.8.2; 1.8.4; 1.8.8;
include <lib/libkern/libkern.h> for intoa()/inet_ntoa()
 1.7 23-Jan-1998  thorpej branches: 1.7.10;
Print the correct error number if nfs_mount() fails. From Chris Demetriou.
 1.6 06-Sep-1997  drochner -Wall fixes
 1.5 22-Jul-1997  drochner branches: 1.5.2; 1.5.4;
Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 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.2 16-Jan-1997  cgd branches: 1.2.2; 1.2.6;
more carefully include libkern and libsa headers
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.2.6.1 07-Mar-1997  is Use libsa's copy of old-style if_ether.h for now.
 1.2.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.2 22-Jul-1997  drochner Don't use <lib/libsa/if_ether.h> anymore. This was a copy of the
old (before ARP changes) <netinet/if_ether.h>, intended for
temporary use.
 1.5.4.1 22-Jul-1997  drochner file dev_net.c was added on branch alpha-nwscons on 1997-07-22 17:41:02 +0000
 1.5.2.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.4.1 14-Nov-1999  fvdl Sync with -current.
 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.6.1 11-Nov-2002  nathanw Catch up to -current
 1.12.122.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.116.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.108.2 11-Mar-2010  yamt sync with head
 1.12.108.1 04-May-2009  yamt sync with head.
 1.16.68.1 17-Apr-2021  thorpej Sync with HEAD.
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 09-Nov-2002  thorpej branches: 1.3.112; 1.3.120; 1.3.126;
Make the bootblocks build with warnings.
 1.2 05-Jan-1998  perry branches: 1.2.26;
RCSID Police.
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.2.26.1 11-Nov-2002  nathanw Catch up to -current
 1.3.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.112.1 04-May-2009  yamt sync with head.
 1.9 03-Nov-2013  christos more unused inside 0
 1.8 03-Nov-2013  christos move unused code inside if 0
 1.7 14-Mar-2009  dsl branches: 1.7.12; 1.7.22; 1.7.26;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.6 11-Dec-2005  christos branches: 1.6.78; 1.6.86; 1.6.92;
merge ktrace-lwp.
 1.5 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.4 06-Sep-1997  drochner branches: 1.4.52;
-Wall fixes
 1.3 06-Apr-1997  cgd branches: 1.3.4; 1.3.6;
clean up NetBSD RCS ID strings
 1.2 16-Jan-1997  cgd branches: 1.2.2;
more carefully include libkern and libsa headers
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.6.1 06-Apr-1997  cgd file devopen.c was added on branch alpha-nwscons on 1997-04-06 08:41:26 +0000
 1.3.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.52.1 03-Aug-2004  skrll Sync with HEAD
 1.6.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.78.1 04-May-2009  yamt sync with head.
 1.7.26.1 18-May-2014  rmind sync with head
 1.7.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11 03-Nov-2013  christos move unused variable inside if 0
 1.10 10-Jan-2013  he branches: 1.10.2;
Include <machine/cpu.h> for alpha_rpcc declaration.
 1.9 12-Jan-2009  tsutsui branches: 1.9.14; 1.9.24;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.8 12-Jan-2009  tsutsui Uset uint64_t rather than (signed) long to read the PCC register.
 1.7 11-Jan-2009  dogcow Make it compile.
 1.6 09-Nov-2002  thorpej branches: 1.6.108; 1.6.112; 1.6.120;
Make the bootblocks build with warnings.
 1.5 05-Jan-1998  perry branches: 1.5.26;
RCSID Police.
 1.4 06-Sep-1997  drochner -Wall fixes
 1.3 02-Oct-1996  cgd branches: 1.3.12;
spaces/tabs cleanup
 1.2 23-Sep-1996  cgd checkpoint current development, add ELF toolchain build support
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.3.12.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.26.1 11-Nov-2002  nathanw Catch up to -current
 1.6.120.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.112.1 04-May-2009  yamt sync with head.
 1.6.108.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.24.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.24.1 25-Feb-2013  tls resync with head
 1.9.14.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.9.14.1 23-Jan-2013  yamt sync with head
 1.10.2.1 18-May-2014  rmind sync with head
 1.21 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.20 12-Jan-2009  tsutsui branches: 1.20.64; 1.20.66;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.19 13-Mar-2003  drochner branches: 1.19.104; 1.19.108; 1.19.116;
kill the last use of NENTS
(We shouldn't use libsa/netif here at all.)
 1.18 13-Mar-2003  drochner cope with removal of this sick NENTS macro from libsa/netif.h
 1.17 09-Nov-2002  thorpej Make the bootblocks build with warnings.
 1.16 22-Jul-2001  wiz branches: 1.16.2;
bcopy -> memcpy, bzero -> memset
 1.15 13-Nov-1999  thorpej branches: 1.15.8;
Backout my libsa changes.
 1.14 12-Nov-1999  simonb Don't include <lib/libkern/libkern.h> for prototypes that are also in
<lib/libsa/stand.h>. The alpha still needs libkern for the division
and remainder support.
 1.13 26-May-1999  cgd branches: 1.13.2; 1.13.4; 1.13.8;
uh, get the port name consistently correct (NetBSD/alpha, not NetBSD/Alpha)
 1.12 02-Apr-1999  cgd branches: 1.12.2; 1.12.4; 1.12.6;
abstract the prom device open/close into a separate module, which
provides the correct functions for primary, secondary, and unified
boot blocks. actually behave correctly (e.g. expect correct arguments,
perform correct operations) depending on which you are. also
some minor cleanup.
 1.11 27-Mar-1999  ross Bug fix for the bug fix. Be sure to prom_close() in bootxx and boot, but not
in netboot, and not in diskclose(), but after trying all kernelnames[].
 1.10 06-Sep-1997  drochner -Wall fixes
 1.9 06-Apr-1997  cgd branches: 1.9.4; 1.9.6;
clean up NetBSD RCS ID strings
 1.8 24-Jan-1997  cgd branches: 1.8.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.7 18-Jan-1997  cgd printfs newline cosmetics
 1.6 18-Jan-1997  cgd allow netboot ethernet address to be hard-coded into binary so that
machines with old firmware which doesn't pass it in the boot device
can work. Assume that if the ethernet address isn't passed in, it
uses the old (dain-bramaged) 'read' interface works on my 3000/300LX.
 1.5 16-Jan-1997  cgd more carefully include libkern and libsa headers
 1.4 02-Oct-1996  cgd spaces/tabs cleanup
 1.3 02-Oct-1996  cgd clean and polish a bit
 1.2 23-Sep-1996  cgd checkpoint current development, add ELF toolchain build support
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.8.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.9.6.1 06-Apr-1997  cgd file if_prom.c was added on branch alpha-nwscons on 1997-04-06 08:41:27 +0000
 1.9.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.12.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.2 21-Jun-1999  perry pullup 1.12->1.13 (cgd): NetBSD/alpha, not NetBSD/Alpha
 1.12.2.1 02-Apr-1999  perry file if_prom.c was added on branch netbsd-1-4 on 1999-06-21 14:42:53 +0000
 1.13.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.4.1 14-Nov-1999  fvdl Sync with -current.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.8.1 03-Aug-2001  lukem update to -current
 1.16.2.2 11-Nov-2002  nathanw Catch up to -current
 1.16.2.1 22-Jul-2001  nathanw file if_prom.c was added on branch nathanw_sa on 2002-11-11 21:56:04 +0000
 1.19.116.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.108.1 04-May-2009  yamt sync with head.
 1.19.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.20.66.1 10-Jun-2019  christos Sync with HEAD
 1.20.64.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2 18-Jan-1997  cgd move an 'int debug;' into boot.c (it was the only diff between boot.c and
netboot.c), and nuke netboot.c (using boot.c instead for network boot blocks).
 1.1 18-Sep-1996  cgd branches: 1.1.2;
start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.1.2.1 24-Jan-1997  cgd sync with trunk
 1.3 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.2 06-Apr-1997  cgd branches: 1.2.6;
clean up NetBSD RCS ID strings
 1.1 18-Sep-1996  cgd branches: 1.1.6;
start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.1.6.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1 06-Apr-1997  cgd file newvers.sh was added on branch alpha-nwscons on 1997-04-06 08:41:28 +0000
 1.3 06-Apr-1997  cgd branches: 1.3.6;
clean up NetBSD RCS ID strings
 1.2 02-Oct-1996  cgd branches: 1.2.6;
spaces/tabs cleanup
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.2.6.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.6.1 06-Apr-1997  cgd file rpcc.S was added on branch alpha-nwscons on 1997-04-06 08:41:28 +0000
 1.10 09-Nov-2001  scw Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.9 02-Aug-2001  bjh21 branches: 1.9.2; 1.9.6;
Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.8 21-Jul-2000  jdolecek branches: 1.8.4;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.7 05-Apr-1999  cgd branches: 1.7.2; 1.7.8;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.6 23-Jan-1997  cgd branches: 1.6.12;
add support for reading gzipped kernels.
 1.5 18-Jan-1997  cgd bump version
 1.4 18-Jan-1997  cgd note that enet address can be hard-coded
 1.3 16-Jan-1997  cgd seriously clean up makefiles. use libsa/libkern/libz as appropriate,
and don't build the various sources into objs locally by specifying
them directly in the Makefiles.
 1.2 02-Oct-1996  cgd bump the version
 1.1 18-Sep-1996  cgd start on some network boot blocks. they work, but:
(1) the if_prom code needs to be cleaned up quite a bit
(right now it hard-codes client's ethernet address), and
(2) much of this code (esp: getsecs.c, netboot.c, newvers.sh,
rpcc.S) should be shared with other Alpha boot blocks,
and dev_net.[ch] should maybe go in libsa proper.
 1.6.12.2 23-Jan-1997  cgd add support for reading gzipped kernels.
 1.6.12.1 23-Jan-1997  cgd file version was added on branch alpha-nwscons on 1997-01-23 23:10:42 +0000
 1.7.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.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.7.2.1 05-Apr-1999  cgd file version was added on branch netbsd-1-4 on 1999-04-05 06:56:24 +0000
 1.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 03-Aug-2001  lukem update to -current
 1.9.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.9.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.9.2.1 02-Aug-2001  nathanw file version was added on branch nathanw_sa on 2001-11-14 19:12:41 +0000
 1.10 05-Apr-1999  cgd branches: 1.10.2;
reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.9 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.8 02-Mar-1998  cgd fix typo in last commit (noticed on inspection)
 1.7 02-Mar-1998  cgd allow LDSTATIC definition to be overridden by bsd.own.mk/mk.conf
 1.6 22-Jun-1997  mrg branches: 1.6.6;
move man pages into share/man.
 1.5 18-May-1997  mycroft Remove bogus .PATHs.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 24-Jan-1997  cgd branches: 1.3.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.2 20-Jan-1997  cgd add a manual page for setnetbootinfo
 1.1 18-Jan-1997  cgd program to hard code an ethernet address into a network boot.
 1.3.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.6.2 22-Jun-1997  mrg move man pages into share/man.
 1.6.6.1 22-Jun-1997  mrg file Makefile was added on branch alpha-nwscons on 1997-06-22 05:09:59 +0000
 1.10.2.2 05-Apr-1999  cgd reorganize Makefiles so that warning flags aren't accidentally omitted,
and so that all programs and boot blocks are built.
 1.10.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 03:35:25 +0000
 1.3 22-Jun-1997  mrg move man pages into share/man.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 20-Jan-1997  cgd branches: 1.1.2;
add a manual page for setnetbootinfo
 1.1.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 20-Jan-1997  cgd file setnetbootinfo.8 was added on branch alpha-nwscons on 1997-06-01 04:14:28 +0000
 1.14 26-Mar-2014  christos kill sprintf
 1.13 14-Mar-2009  dsl branches: 1.13.12; 1.13.22; 1.13.26;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.12 22-Sep-2002  mycroft branches: 1.12.112; 1.12.120; 1.12.126;
Remove redundant declaration of ether_ntoa() so this builds again.
 1.11 22-Jul-2001  wiz branches: 1.11.2;
bcopy -> memcpy, bzero -> memset
 1.10 05-Apr-1999  cgd branches: 1.10.2; 1.10.22;
clean up for compiler warning flags
 1.9 03-Dec-1998  ross Tweak this so it will build and run on ILP32 hosts, anyway, 0x...LL constants
are blessed by the C9X draft.
 1.8 04-Feb-1998  thorpej Fixup includes.
 1.7 13-Nov-1997  mjacob remove unneeded and conflicting prototype
 1.6 01-Nov-1997  lukem getopt returns -1 not EOF
 1.5 06-Apr-1997  cgd branches: 1.5.6; 1.5.10;
clean up NetBSD RCS ID strings
 1.4 18-Mar-1997  cgd fix up new-arp goofups
 1.3 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.2 24-Jan-1997  cgd branches: 1.2.2; 1.2.6;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1 18-Jan-1997  cgd program to hard code an ethernet address into a network boot.
 1.2.6.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.10.1 13-Nov-1997  mellon Pull rev 1.6 and 1.7 up from trunk (mjacob)
 1.5.6.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.5.6.1 06-Apr-1997  cgd file setnetbootinfo.c was added on branch alpha-nwscons on 1997-04-06 08:41:38 +0000
 1.10.22.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.10.22.1 03-Aug-2001  lukem update to -current
 1.10.2.2 05-Apr-1999  cgd clean up for compiler warning flags
 1.10.2.1 05-Apr-1999  cgd file setnetbootinfo.c was added on branch netbsd-1-4 on 1999-04-05 02:55:39 +0000
 1.11.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.1 22-Jul-2001  nathanw file setnetbootinfo.c was added on branch nathanw_sa on 2002-10-18 02:34:28 +0000
 1.12.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.12.112.1 04-May-2009  yamt sync with head.
 1.13.26.1 18-May-2014  rmind sync with head
 1.13.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 20-Jul-2012  matt Use ${_MKTARGET_LINK} and ${_MKTARGET_CREATE}
 1.2 21-Jul-2000  jdolecek branches: 1.2.164;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.1 11-Apr-1999  cgd branches: 1.1.2; 1.1.4;
start on a glorified system-examination console program.
 1.1.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.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.164.1 30-Oct-2012  yamt sync with head
 1.7 11-Jun-2016  dholland PR 51200 gets in libsa considered harmful: use kgets
 1.6 13-Dec-2015  christos PR/50530: David Binderman: Add missing printf args
 1.5 22-Jan-2011  joerg branches: 1.5.14; 1.5.32;
Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh. Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
 1.4 14-Mar-2009  dsl branches: 1.4.4; 1.4.6; 1.4.8;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.3 08-Jun-2002  yamt branches: 1.3.112; 1.3.120; 1.3.126;
make auto const variables static.
 1.2 11-May-1999  cgd branches: 1.2.2; 1.2.16; 1.2.18; 1.2.30;
add some more bits, mostly stubs
 1.1 11-Apr-1999  cgd start on a glorified system-examination console program.
 1.2.30.1 09-Jul-2002  gehenna catch up with -current.
 1.2.18.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.16.1 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.3.112.1 04-May-2009  yamt sync with head.
 1.4.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.4.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.4.1 05-Mar-2011  rmind sync with head
 1.5.32.2 09-Jul-2016  skrll Sync with HEAD
 1.5.32.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.5.14.1 03-Dec-2017  jdolecek update from HEAD
 1.2 21-Jul-2000  jdolecek switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.1 11-Apr-1999  cgd branches: 1.1.2; 1.1.4;
start on a glorified system-examination console program.
 1.1.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.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9 20-Jul-2012  matt Use ${_MKTARGET_LINK} and ${_MKTARGET_CREATE}
 1.8 25-Aug-2010  christos branches: 1.8.8;
change LOAD_NOTE to LOAD_BACKWARDS
 1.7 03-Feb-2009  tsutsui branches: 1.7.4; 1.7.6;
Disable LOAD_NOTE on ustarboot to avoid backward seek on loading a kernel.
Tested on DEC 3000/300 and AlphaPC 164, fixes PR install/38943 on alpha.

XXX: should we enable LOAD_NOTE on ustarfs tape boot to load modules?
 1.6 22-Sep-2001  tv branches: 1.6.124; 1.6.132; 1.6.134;
objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
 1.5 21-Jul-2000  jdolecek branches: 1.5.2; 1.5.4; 1.5.6;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.4 10-Sep-1999  ross branches: 1.4.2;
Nuke the alpha ecoff/elf bootloader and use the libsa/ one instead.
 1.3 05-Apr-1999  cgd branches: 1.3.2;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.2 05-Apr-1999  cgd don't get the name from newvers, get it from a bootstrap-specific -D
in the Makefile. also, print the banner before we do things that
might cause us to print error messages.
 1.1 02-Apr-1999  cgd add ustarboot, a ustar-capable unified bootstrap intended to be
mkbootimage'd and slapped on the front of a tar file.
 1.3.2.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.3.2.1 05-Apr-1999  cgd file Makefile was added on branch netbsd-1-4 on 1999-04-05 06:56:25 +0000
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.6.134.1 06-Feb-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #418):
sys/arch/alpha/stand/common/boot.c: revision 1.30
sys/arch/alpha/stand/ustarboot/Makefile: revision 1.7
Disable LOAD_NOTE on ustarboot to avoid backward seek on loading a kernel.
Tested on DEC 3000/300 and AlphaPC 164, fixes PR install/38943 on alpha.
XXX: should we enable LOAD_NOTE on ustarfs tape boot to load modules?
 1.6.132.1 03-Mar-2009  skrll Sync with HEAD.
 1.6.124.2 09-Oct-2010  yamt sync with head
 1.6.124.1 04-May-2009  yamt sync with head.
 1.7.6.1 05-Mar-2011  rmind sync with head
 1.7.4.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.8.8.1 30-Oct-2012  yamt sync with head
 1.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.1 02-Apr-1999  cgd add ustarboot, a ustar-capable unified bootstrap intended to be
mkbootimage'd and slapped on the front of a tar file.
 1.5 09-Nov-2001  scw Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
 1.4 02-Aug-2001  bjh21 branches: 1.4.2; 1.4.6;
Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading. I should probably have done this at the time,
but it's better late than never.
 1.3 21-Jul-2000  jdolecek branches: 1.3.4;
switch to sys/conf/newvers_stand.sh for generation of version files
move the vers.c depend/build goo to Makefile.bootprogs and remove
explicit rules in other Makefiles
sync the message in */version files with other ports using newvers_stand.sh

XXX the new depend rules were tested to limited extend (also with obj dirs)
XXX on i386 and should be ok; the changes should not otherwise influence build
 1.2 05-Apr-1999  cgd branches: 1.2.2; 1.2.8;
now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.1 02-Apr-1999  cgd add ustarboot, a ustar-capable unified bootstrap intended to be
mkbootimage'd and slapped on the front of a tar file.
 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.2.2.2 05-Apr-1999  cgd now that boot.c does the bootstrap name with a -D, the newvers scripts
are all the same, so eliminate the redundancy. also, use mrg's
"Version:" trick to find the version rather than using the RCS ID.
(I must have been having a ... bad day.) Also, bump boot and netboot
versions for all the changes that have been happening lately.
 1.2.2.1 05-Apr-1999  cgd file version was added on branch netbsd-1-4 on 1999-04-05 06:56:25 +0000
 1.3.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 03-Aug-2001  lukem update to -current
 1.4.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.1 02-Aug-2001  nathanw file version was added on branch nathanw_sa on 2001-11-14 19:12:41 +0000
 1.18 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.17 05-Jun-2000  nisimura Have MI ncr53c9x_attach() the 2nd and 3rd arguments for scsipi_adater
and scsipi_device respectively, with size reduction of ncr53c9x_softc.
Specifying NULL instructs the driver to use default adapter and default
device codes. Every target port has ncr53c9x_attach(sc, NULL, NULL) anyway.
 1.16 22-Sep-1999  mhitch branches: 1.16.2; 1.16.10;
Use the correct definition for the Fast Clock bit in cfg3, and set the
Fast SCSI bit used by the 53C9x chips.
 1.15 19-Nov-1998  thorpej branches: 1.15.4;
Adapt to the new scsipi_adapter interface.
 1.14 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.13 05-Sep-1998  pk Assign my copyright to TNF.
 1.12 15-Aug-1998  mycroft Minor edit.
 1.11 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.10 26-May-1998  thorpej - Make this into a proper attachment (i.e. use asc_tcds) and clean up
the namespace accordingly.
- Set FCLK in the CFG3 register if we have a > 25MHz clock.
- Indicate that we support Fast mode to the back-end if we're told we're
fast by the TCDS layer.
- Correctly compute the minimum sync period.
 1.9 24-May-1998  thorpej Several changes to the TurboChannel Dual SCSI driver:
- Fix the autoconfiguration model; the TCDS children don't attach to
TurboChannel, so don't make it look like they do.
- Make the driver use bus_space (not bus_dma yet; soon)
- Recognize the PMAZ-FS (baseboard fast SCSI on DEC 3000s) and the
PMAZB-AA (TCDS option card) and PMAZC-AA (TCDS fast SCSI option card).
- Rearrange it a bit, so that it can eventually be made into an "MI"
TurboChannel driver (i.e. work on DECstations).
 1.8 12-Jan-1998  thorpej Adjust for config changes.
 1.7 04-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.6 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.5 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.4 07-Apr-1997  cgd branches: 1.4.2; 1.4.4; 1.4.6;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 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 27-Feb-1997  thorpej branches: 1.1.2;
Add a front-end for the MI 53c9x driver, called "asc", which is the
name used by Digital UNIX (formerly DEC OSF/1).
 1.1.2.2 11-Mar-1997  is Merge in latest Trunk.
 1.1.2.1 27-Feb-1997  is file asc.c was added on branch is-newarp on 1997-03-11 20:50:22 +0000
 1.4.6.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.6.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.6.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.4.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 07-Apr-1997  cgd file asc.c was added on branch alpha-nwscons on 1997-06-01 04:14:30 +0000
 1.15.4.1 04-Dec-1999  he Pull up revision 1.16 (requested by mhitch):
Fix the problems in detecting the clock speed on the TCDS Dual
SCSI Option cards, and correctly configure the Fast SCSI interfaces.
This allows installation on the 3000/500 -> 3000/900 Alphas which
have the Fast SCSI interface on the on-board SCSI adapters.
 1.16.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.16.2.2 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.16.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.7 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.6 26-May-1998  thorpej branches: 1.6.14;
Make this into a proper attachment (i.e. use asc_tcds) and clean up
the namespace accordingly.
 1.5 24-May-1998  thorpej Several changes to the TurboChannel Dual SCSI driver:
- Fix the autoconfiguration model; the TCDS children don't attach to
TurboChannel, so don't make it look like they do.
- Make the driver use bus_space (not bus_dma yet; soon)
- Recognize the PMAZ-FS (baseboard fast SCSI on DEC 3000s) and the
PMAZB-AA (TCDS option card) and PMAZC-AA (TCDS fast SCSI option card).
- Rearrange it a bit, so that it can eventually be made into an "MI"
TurboChannel driver (i.e. work on DECstations).
 1.4 04-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.3 06-Apr-1997  cgd branches: 1.3.2; 1.3.6;
clean up NetBSD RCS ID strings
 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 27-Feb-1997  thorpej branches: 1.1.2;
Add a front-end for the MI 53c9x driver, called "asc", which is the
name used by Digital UNIX (formerly DEC OSF/1).
 1.1.2.2 11-Mar-1997  is Merge in latest Trunk.
 1.1.2.1 27-Feb-1997  is file ascvar.h was added on branch is-newarp on 1997-03-11 20:50:23 +0000
 1.3.6.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.2.1 06-Apr-1997  cgd file ascvar.h was added on branch alpha-nwscons on 1997-06-01 04:14:32 +0000
 1.6.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.6 20-Dec-1995  cgd these have been renamed
 1.5 03-Aug-1995  cgd MB -> wbflush
 1.4 28-Jun-1995  cgd update for new clock interrupt handling
 1.3 24-Mar-1995  cgd print out mode (slow vs. fast)
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3 20-Dec-1995  cgd these have been renamed
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4 26-Mar-2000  nisimura - Remove unused bt459reg.h.
- sfbvar.h has gone, placing patch on holes for now. Every TC framebuffer
has a single explosure of xxfb_cnattach() which could be bridged by MI
land.
 1.3 12-Apr-1999  pk branches: 1.3.2;
Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.2 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.1 22-Oct-1998  briggs branches: 1.1.6;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.1.6.2 12-Apr-1999  pk branches: 1.1.6.2.2;
Pullup copyright text corrections.
 1.1.6.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.1.6.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.26 23-Aug-2001  nisimura Add MX (PMAG-A), CX (PMAG-B), TX (PMAG-RO/PMAG[B]-J) TC framebuffer
supports. None of them has any acceleration capability.
 1.25 26-Jun-2000  simonb branches: 1.25.4;
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.24 26-Mar-2000  nisimura branches: 1.24.4;
- Remove unused bt459reg.h.
- sfbvar.h has gone, placing patch on holes for now. Every TC framebuffer
has a single explosure of xxfb_cnattach() which could be bridged by MI
land.
 1.23 06-Dec-1999  drochner update for changed struct wsdisplay_accessops:show_screen signature.
no functional changes
 1.22 11-Jan-1999  drochner branches: 1.22.8; 1.22.14;
remove dummy "load_font" entries
 1.21 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.20 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.19 30-Jun-1998  drochner adapt to wscons interface change
 1.18 21-Jun-1998  drochner adapt to wscons interface change
 1.17 14-May-1998  drochner Simple screen attribute handling for wscons.
The graphics device driver passes a "default attribute" for normal text
output to the wscons framework. If the emulation module needs more
attributes (for different "renditions") it can allocate them via a
callback.
For now, only the "sun" emulation makes use of it.
 1.16 16-Apr-1998  drochner count allocated screens correctly
 1.15 15-Apr-1998  drochner convert to mi wscons
 1.14 12-Jan-1998  thorpej Adjust for config changes.
 1.13 25-Sep-1997  thorpej branches: 1.13.2;
Add a "scrollskip" member to wscons_emulfuncs (XXX even though it's not
a function) which specifies how many lines will be skipped when scrolling
up when the bottom of the screen is reached. Dumb framebuffers skip 10
lines (as before) because the copies are s ... l ... o ... w, but it's
silly to skip 10 lines on VGA, since the copies are much faster, so we
only skip one in that case.
 1.12 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.11 07-Apr-1997  cgd branches: 1.11.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.10 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.9 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.8 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.7 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.6 19-Nov-1996  cgd branches: 1.6.2;
catch up with wscons frame buffer attachment, mmap, and ioctl
interface changes.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.2 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.1 01-May-1996  cgd Preliminary CFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap, cursor,
etc.) support. Digital UNIX does not support CFB frame buffers in the
Alpha, but they appear to work OK (with an appropriate monitor) in my
3000/300.
 1.6.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 25-Jan-1997  cgd note that these drivers need to be converted to use the new wscons interfaces
 1.6.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.6.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.11.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.1 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.22.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.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.24.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.25.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.6 23-Aug-2001  nisimura Add MX (PMAG-A), CX (PMAG-B), TX (PMAG-RO/PMAG[B]-J) TC framebuffer
supports. None of them has any acceleration capability.
 1.5 22-Oct-1998  briggs branches: 1.5.26;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.4 19-Oct-1998  briggs vm_offset_t no longer exists. Change to paddr_t, vaddr_t, and psize_t.
 1.3 15-Apr-1998  drochner convert to mi wscons
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
Preliminary CFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap, cursor,
etc.) support. Digital UNIX does not support CFB frame buffers in the
Alpha, but they appear to work OK (with an appropriate monitor) in my
3000/300.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.26.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3 19-Apr-1995  cgd they've moved.
 1.2 16-Feb-1995  cgd and with 0x1fff, rather than 0x1000
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2 19-Apr-1995  cgd they've moved.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.29 27-Feb-1997  thorpej Remove this driver; it is now obsolete.
 1.28 10-Dec-1996  thorpej branches: 1.28.6;
Fill in sc_link.max_target
 1.27 10-Dec-1996  cgd kill the last vestiges of __BROKEN_INDIRECT_CONFIG.
 1.26 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.25 27-Nov-1996  pk branches: 1.25.2;
Sync with sparc port:
>Pay attention to DMA errors as reported by DMAINTR() returning -1. If this
>happens reset everything.
>
>Re-schedule a timeout when first attempting to abort an operation.
>Cancel any queued timer events before re-scheduling a timeout, so esp_abort()
>can be called from other places besides the timeout handler.
 1.24 16-Nov-1996  pk Sync with sparc revision 1.61:
Add explicit casts to `%l*' formatted arguments.
 1.23 12-Nov-1996  cgd -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual cleanups.
 1.22 15-Oct-1996  mycroft Minor cosmetic change.
 1.21 13-Oct-1996  christos backout previous kprintf change
 1.20 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19 28-Sep-1996  mycroft Remove unused variable.
 1.18 28-Sep-1996  mycroft * Bitbucket extra status bytes rather than barfing.
* Add copyright.
 1.17 28-Sep-1996  mycroft Restructure code more like aic6360 driver. Also:
* Check for some errors during reselect.
* Don't recognize MESSAGE PARITY ERROR. A target is not allowed to
send it.
* Check the size of a SDTR.
 1.16 27-Sep-1996  thorpej - Add some missing prototypes and kill an unused label.
- Add some missing SPARC_DRIVER stuff.
- Make SPARC_DRIVER automatic.

This driver now compiles as-is and works on both the SPARC and Alpha.
 1.15 27-Sep-1996  mycroft Fix dangling pointer in debugging message.
 1.14 27-Sep-1996  mycroft If we get an unexpected disconnect while issuing a REQUEST SENSE, do a reset.
 1.13 27-Sep-1996  mycroft Functional changes:
* Handle message retransmissions and partially sent messages correctly.
* Make sure we clear ATN after the last message is sent.
* Do the right thing if the target initiates negotiation for async mode
after having negotiated sync mode.
* Fix some cases where we set ATN with no message queued, or schedule a
message without setting ATN.
* Issue a REQUEST SENSE after an unexpected disconnect, per SCSI spec.
* Fix abort handling in a number of cases.
* Recognize selection timeouts better (to speed up probing).
 1.12 09-Sep-1996  cgd Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
match the interfaces required by the driver.
 1.11 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.10 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.9 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.8 12-Apr-1996  cgd branches: 1.8.4;
update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.7 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.6 20-Dec-1995  cgd update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.5 03-Aug-1995  cgd MB -> wbflush
 1.4 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.3 22-Apr-1995  cgd deal with renamed header file.
 1.2 03-Mar-1995  cgd use charles's cleaner message input code
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.8.4.3 15-Oct-1996  mycroft Integrate post-1.2 bug fixes to date.
 1.8.4.2 10-Sep-1996  cgd pull up from trunk:
>Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
>match the interfaces required by the driver.
 1.8.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.25.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.25.2.2 24-Jan-1997  cgd sync with trunk
 1.25.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.28.6.1 11-Mar-1997  is Merge in latest Trunk.
 1.4 27-Feb-1997  thorpej Remove this driver; it is now obsolete.
 1.3 09-Sep-1996  cgd branches: 1.3.2; 1.3.8;
Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
match the interfaces required by the driver.
 1.2 20-Dec-1995  cgd branches: 1.2.4;
update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 10-Sep-1996  cgd pull up from trunk:
>Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
>match the interfaces required by the driver.
 1.3.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13 27-Feb-1997  thorpej Remove this driver; it is now obsolete.
 1.12 24-Nov-1996  cgd branches: 1.12.2; 1.12.8;
sync up with pk's commit to the sparc port:
>One control block per target is insufficient if you have a full complement
>of targets attached and access those simultaneously (like in a ccd(4) array).
>We (now) allocate (somewhat arbitrarily) three per target.
>Noticed by Marshall Midden.
 1.11 12-Nov-1996  cgd -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual cleanups.
 1.10 15-Oct-1996  mycroft Increase the maximum number of ECBs.
 1.9 13-Oct-1996  christos backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 27-Sep-1996  thorpej - Add some missing prototypes and kill an unused label.
- Add some missing SPARC_DRIVER stuff.
- Make SPARC_DRIVER automatic.

This driver now compiles as-is and works on both the SPARC and Alpha.
 1.6 27-Sep-1996  mycroft Functional changes:
* Handle message retransmissions and partially sent messages correctly.
* Make sure we clear ATN after the last message is sent.
* Do the right thing if the target initiates negotiation for async mode
after having negotiated sync mode.
* Fix some cases where we set ATN with no message queued, or schedule a
message without setting ATN.
* Issue a REQUEST SENSE after an unexpected disconnect, per SCSI spec.
* Fix abort handling in a number of cases.
* Recognize selection timeouts better (to speed up probing).
 1.5 09-Sep-1996  cgd Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
match the interfaces required by the driver.
 1.4 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.3 20-Dec-1995  cgd branches: 1.3.4;
update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.2 03-Aug-1995  cgd MB -> wbflush
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.4.2 15-Oct-1996  mycroft Integrate post-1.2 bug fixes to date.
 1.3.4.1 10-Sep-1996  cgd pull up from trunk:
>Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
>match the interfaces required by the driver.
 1.12.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.12.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10 20-Dec-1995  cgd these are going to be made machine-independent
 1.9 25-Nov-1995  cgd update for am7990var.h, am7990.c changes
 1.8 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.7 03-Aug-1995  cgd MB -> wbflush
 1.6 28-Jun-1995  cgd update to use new paths for MI lance driver
 1.5 28-Jun-1995  cgd update to use machine-independent lance driver
 1.4 22-Apr-1995  cgd adjust for networking code changes
 1.3 24-Mar-1995  cgd make bpf work, by appending ether header before mtap, then discarding it.
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2 28-Jun-1995  cgd update to use machine-independent lance driver
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2 20-Dec-1995  cgd these are going to be made machine-independent
 1.1 28-Jun-1995  cgd update to use machine-independent lance driver
 1.49 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.48 18-Nov-2020  thorpej branches: 1.48.4;
malloc(9) -> kmem(9)
 1.47 10-Nov-2019  chs branches: 1.47.8;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.46 26-Mar-2014  christos branches: 1.46.10; 1.46.20; 1.46.30;
kill sprintf
 1.45 06-Feb-2012  matt branches: 1.45.6; 1.45.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.44 01-Jul-2011  dyoung branches: 1.44.2; 1.44.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.43 04-Jun-2011  tsutsui Split device_t/softc. pmax is tested on GXemul, compile test only for alpha.
 1.42 14-Mar-2009  dsl branches: 1.42.4; 1.42.6; 1.42.10;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.41 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.40 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.39 13-Jun-2008  cegger branches: 1.39.4; 1.39.10;
use device_lookup_private to get softc
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.4;
Remove clause 3 and 4 from TNF licenses
 1.37 02-Oct-2002  thorpej branches: 1.37.108; 1.37.110; 1.37.112;
Use CFATTACH_DECL().
 1.36 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.35 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.34 18-Jul-2000  thorpej branches: 1.34.2; 1.34.4;
Clear the ISDN TXPTR/RXPTR/OVRN interrupt bits here. Based on
a suggestion by Gregory McGarry.
 1.33 11-Jul-2000  nisimura - Use PMAD-BA name for device match logic. It's not a real TURBOchannel
device and the id string is not found in option ROM string, but
ULTRIX/OSF1 call it so anyway.
- Squash IOASIC DMA buffer allocation into device attach() sequence.
 1.32 05-Jun-2000  thorpej branches: 1.32.2;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.31 29-May-2000  matt make egcs happy: ioasic.c:327: warning: suggest parentheses
around arithmetic in operand of |
 1.30 28-May-2000  gmcgarry IOASIC_INTR_ISDN is used for interrupts on every sample. We use DMA so
need IOASIC_INTR_ISDN_TXLOAD|IOASIC_INTR_ISDN_RXLOAD.
 1.29 15-Mar-2000  nisimura branches: 1.29.2;
Eliminate unused sc_cookie field of struct ioasic_softc.
 1.28 03-Feb-2000  nisimura Merge IOASIC register definitions.
 1.27 07-Nov-1999  mrg make this compile without DEC_3000_300
 1.26 27-Oct-1999  nisimura Use an MI routine in ioasic_subr.c.
 1.25 01-Oct-1999  nisimura branches: 1.25.2; 1.25.4; 1.25.6;
- Remove defunct codes and arrange consistency between pmax and alpha.
- Reduce 'ioasic_base' expose.
 1.24 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.23 17-Mar-1999  ross branches: 1.23.4;
g/c proto
 1.22 17-Mar-1999  ross XXX rm ioasicprint() & ioasic_submatch() because of <dev/tc/ioasic_subr.c> XXX
 1.21 15-Mar-1999  jonathan MI ioasic softc and child-device structs, gc duplicate struct definitions.
Add MI ioasic functions, but dont enable on alpha until tested.
 1.20 12-Feb-1999  thorpej Fix printf format problems on Alpha. (IRONIC?!)
 1.19 27-May-1998  thorpej Define ioasic device offsets in terms of standard ioasic "slot" offsets.
 1.18 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.17 19-Jan-1998  thorpej Allocate the LANCE DMA area and set it up here. This is still not
optimal (really should be done further down the food chain), but we
can't really do that in a nice way right now, and this is much better
than what we had before (which was to steal memory pages before the
VM system was bootstrapped).
 1.16 12-Jan-1998  thorpej Adjust for config changes.
 1.15 02-Sep-1997  thorpej Pull in DEC_3000_300 option.
 1.14 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.13 07-Apr-1997  cgd branches: 1.13.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.12 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.11 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.10 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.9 13-Oct-1996  christos branches: 1.9.2;
backout previous kprintf change
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.4 12-Apr-1996  cgd branches: 1.4.4;
clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.2 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.1 20-Dec-1995  cgd update for new turbochannel configuration code.
 1.4.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.9.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.9.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.13.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.25.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.4.1 14-Nov-1999  fvdl Sync with -current.
 1.25.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.29.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.32.2.1 18-Jul-2000  thorpej Pull up rev. 1.34:
Clear the ISDN TXPTR/RXPTR/OVRN interrupt bits here. Based on
a suggestion by Gregory McGarry.
 1.34.4.1 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.34.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.37.112.2 04-May-2009  yamt sync with head.
 1.37.112.1 16-May-2008  yamt sync with head.
 1.37.110.2 17-Jun-2008  yamt sync with head.
 1.37.110.1 18-May-2008  yamt sync with head.
 1.37.108.2 29-Jun-2008  mjf Sync with HEAD.
 1.37.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.38.4.1 18-Jun-2008  simonb Sync with head.
 1.38.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.39.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.42.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.42.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.4.1 12-Jun-2011  rmind sync with head
 1.44.6.1 18-Feb-2012  mrg merge to -current.
 1.44.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.2.1 17-Apr-2012  yamt sync with head
 1.45.10.1 18-May-2014  rmind sync with head
 1.45.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.46.20.2 14-May-2017  pgoyette Fix typo - causes build failure!
 1.46.20.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.46.10.2 20-Jul-2016  pgoyette Redo previous. Rather than separately extracting the device_t, we can
rely on sc->sc_dev when we need to call device_release().
 1.46.10.1 19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.47.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.48.4.1 13-May-2021  thorpej Sync with HEAD.
 1.3 03-Feb-2000  nisimura Merge IOASIC register definitions.
 1.2 06-Apr-1997  cgd branches: 1.2.22;
clean up NetBSD RCS ID strings
 1.1 20-Dec-1995  cgd branches: 1.1.2;
update for new turbochannel configuration code.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.22.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.19 06-Mar-2024  thorpej Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.
 1.18 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.17 06-Feb-2012  matt branches: 1.17.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.16 01-Jul-2011  dyoung branches: 1.16.2; 1.16.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.15 29-Mar-2008  tsutsui Don't forget to initialize sc_dev.
 1.14 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.13 17-Oct-2007  garbled branches: 1.13.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.12 21-Jul-2007  tsutsui branches: 1.12.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.11 02-Oct-2002  thorpej branches: 1.11.22; 1.11.64; 1.11.72; 1.11.76; 1.11.78;
Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 04-Jul-2000  nisimura branches: 1.9.2; 1.9.4;
Unnecessary to include <dev/tc/tcreg.h>.
 1.8 02-Sep-1997  thorpej branches: 1.8.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.7 22-Jul-1997  jonathan branches: 1.7.2;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.6 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.4 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.3 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.2 17-Apr-1996  cgd branches: 1.2.2;
fix copyrights
 1.1 17-Apr-1996  cgd clean up clock handling: clock drivers are now seperate from the
chip-independent clock code. 'clock' has been renamed 'mcclock' 'clock'
has been renamed 'mcclock' (since it's a driver for that particular
clock, and since eventually there may be another clock chip driver),
and now attaches via seperate match/attach functions to both TC and ISA.
This removes a whole lot of #ifdefs...
 1.2.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.2.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.7.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.18.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.9.4.1 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.9.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.11.78.1 15-Aug-2007  skrll Sync with HEAD.
 1.11.76.1 07-Aug-2007  matt Sync with HEAD.
 1.11.72.1 03-Oct-2007  garbled Sync with HEAD
 1.11.64.1 20-Aug-2007  ad Sync with HEAD.
 1.11.22.1 03-Sep-2007  yamt sync with head.
 1.12.6.1 06-Nov-2007  matt sync with HEAD
 1.13.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.6.1 18-Feb-2012  mrg merge to -current.
 1.16.2.1 17-Apr-2012  yamt sync with head
 1.17.64.1 13-May-2021  thorpej Sync with HEAD.
 1.61 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.60 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.59 13-May-2002  matt branches: 1.59.2;
Eliminate common.
 1.58 17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.57 06-Sep-2001  thorpej branches: 1.57.2;
Don't require tp->t_dev to be filled in in cold_sccparam().
 1.56 06-Sep-2001  thorpej Garbage-collect all the (outdated and totally useless) pmax stuff
in this code.
 1.55 26-Aug-2001  simonb Yanking a pmax-specific header should not have broken Alpha
compiles! Remove all pmax include files, copying 'struct pdma'
from <pmax/dev/pdma.h> into sccvar.h.

XXX: diffs between current pmax and alpha scc.c are almost as large
as the files themselves. Should clean this up...
 1.54 02-May-2001  scw branches: 1.54.2; 1.54.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.53 31-Mar-2001  enami Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
 1.52 10-Nov-2000  itojun branches: 1.52.2;
/t_line/t_linesw (typo)
 1.51 02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.50 06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.49 09-Feb-2000  thorpej Adjust for IOASIC register changes.
 1.48 03-Feb-2000  nisimura Merge IOASIC register definitions.
 1.47 17-Sep-1999  thorpej branches: 1.47.2;
Centralize the declaration and clearing of `cold'.
 1.46 08-Aug-1999  ross In the kludges-on-top-of-kludges dept, print SWITCHING TO SERIAL CONSOLE
(but iff we started on the framebuffer) so the would-be installer doesn't
think everything just locked up.
 1.45 12-Apr-1999  pk Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.44 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.43 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.42 04-Jul-1998  jonathan branches: 1.42.8;
defopt DDB.
 1.41 22-Mar-1998  jonathan Update #ifdef'ed-out changes from pmax :
* Add more #ifdef pmax/#endif, #ifdef alpha/#endif where appropriate.
Config and heade files need more work (or replacement)
change TK_NOTYET to HAVE_RCONS
change commented-out /* && cn_tab.cn_screen */ to && raster_console()
* Add DDB hooks.
* Note where Alpha console ignores carrier on consoles.
* Add pmax-derived console tty-size code inside HAVE_RCONS
* Fold in gross pmax rcons-input hooks, inside HAVE_RCONS

Untested, but whitespace/ifdef only, cross-compiles OK,
preprocessing shows no significat differences (famous last words)
 1.40 21-Mar-1998  mjacob more TS_WOPEN to tp->t_wopen changes
 1.39 02-Mar-1998  ross Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.38 15-Jan-1998  thorpej Make this compile again after recent config changes.
 1.37 12-Jan-1998  thorpej Adjust for config changes.
 1.36 02-Sep-1997  thorpej Pull in DEC_3000_300 option.
 1.35 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.34 17-Jul-1997  jtk branches: 1.34.2;
use locator defines in "locators.h" to index cf_loc[]
 1.33 15-May-1997  thorpej - In sccmatch(), check any user-specified offset, allowing scc unit numbers
to be nailed down. From Ken Hornstein <kenh@cmf.nrl.navy.mil>, PR #3626,
slightly modified to allow wildcarded offsets.
- Blow away the cf->cf_unit check in sccmatch(); it's bogus.
 1.32 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.31 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.30 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.29 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.28 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.27 13-Nov-1996  cgd branches: 1.27.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.26 16-Oct-1996  jonathan alpha_mb() -> tc_mb(), for alpha/pmax convergence, even tho the tc_mb()
interface in tc_machdep.h is obsolete.
Change "#if 0" around pmax rcons mouse-redirection to "#ifdef HAVE_RCONS"
 1.25 16-Oct-1996  cgd spaces -> tabs where appropriate, some (minor) KNF (it needs much more),
kill spaces at EOL.
 1.24 16-Oct-1996  cgd more updates from jonathan. kill scc_tty array and needs-count
 1.23 16-Oct-1996  cgd various bits of cleanup, from jonathan stone, to make this and the pmax
driver slowly converge.
 1.22 13-Oct-1996  christos backout previous kprintf change
 1.21 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.20 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.19 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.18 03-Jun-1996  cgd only do tty_attach() for first tty of each chip; that's the only real tty.
 1.17 30-May-1996  cgd add tty_attach() calls where appropriate
 1.16 29-Apr-1996  cgd branches: 1.16.4;
clean up setting of the default tty cflag. don't do the "delay if
high bit set" thing.
 1.15 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.14 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.13 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.12 02-Feb-1996  mycroft Fix #includes.
 1.11 20-Dec-1995  cgd update for new turbochannel configuration code.
 1.10 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.9 03-Aug-1995  cgd MB -> wbflush
 1.8 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.7 28-Jun-1995  cgd update for (old) new tty changes
 1.6 22-Apr-1995  cgd console putc returns void
 1.5 11-Apr-1995  mycroft Use global 8530 defs. Needs more work.
 1.4 24-Mar-1995  cgd deal reasonably with the 3000/300's console (annoying engineers!)
 1.3 03-Mar-1995  cgd don't reset the chip when setting paramters
 1.2 27-Feb-1995  cgd fill up device switches, clean up a couple of mistakes.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.16.4.2 03-Jun-1996  cgd pull up from trunk:
>only do tty_attach() for first tty of each chip; that's the only real tty.
 1.16.4.1 03-Jun-1996  cgd pull up from trunk:
>add tty_attach() calls where appropriate
 1.27.2.4 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.27.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.27.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.27.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.34.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.42.8.3 08-Aug-1999  cgd pull up rev 1.46 from trunk (ross)
 1.42.8.2 12-Apr-1999  pk branches: 1.42.8.2.2; 1.42.8.2.4;
Pullup copyright text corrections.
 1.42.8.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.42.8.2.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.42.8.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.47.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.47.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.47.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.52.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.52.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.54.4.10 18-Oct-2002  nathanw Catch up to -current.
 1.54.4.9 17-Sep-2002  nathanw Catch up to -current.
 1.54.4.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.54.4.7 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.54.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.54.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.54.4.4 21-Sep-2001  nathanw Catch up to -current.
 1.54.4.3 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.54.4.2 28-Aug-2001  nathanw Catch up with -current.
 1.54.4.1 02-May-2001  nathanw file scc.c was added on branch nathanw_sa on 2001-08-28 18:57:39 +0000
 1.54.2.3 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.54.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.54.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.57.2.4 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.57.2.3 10-Oct-2001  fvdl Convert all remaining devices.
 1.57.2.2 26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.57.2.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.59.2.1 16-May-2002  gehenna Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
 1.4 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.3 06-Apr-1997  cgd branches: 1.3.34; 1.3.36;
clean up NetBSD RCS ID strings
 1.2 11-Apr-1995  mycroft branches: 1.2.4;
Use global 8530 defs. Needs more work.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.36.1 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.3.34.1 18-Oct-2002  nathanw Catch up to -current.
 1.9 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.8 13-May-2002  matt Eliminate common.
 1.7 26-Aug-2001  simonb Yanking a pmax-specific header should not have broken Alpha
compiles! Remove all pmax include files, copying 'struct pdma'
from <pmax/dev/pdma.h> into sccvar.h.

XXX: diffs between current pmax and alpha scc.c are almost as large
as the files themselves. Should clean this up...
 1.6 08-Aug-1999  ross branches: 1.6.14; 1.6.16;
In the kludges-on-top-of-kludges dept, print SWITCHING TO SERIAL CONSOLE
(but iff we started on the framebuffer) so the would-be installer doesn't
think everything just locked up.
 1.5 06-Apr-1997  cgd branches: 1.5.16; 1.5.20;
clean up NetBSD RCS ID strings
 1.4 16-Nov-1996  cgd branches: 1.4.2;
Add short delays after accessing registers, so that the z8530's settle
times are respected. This solves the duplicated characters problem.
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 03-Aug-1995  cgd branches: 1.2.6;
MB -> wbflush
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.6.1 05-Dec-1996  rat Patch request from Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>

>Add short delays after accessing registers, so that the z8530's settle
>times are respected. This solves the duplicated characters problem.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.20.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.5.16.1 08-Aug-1999  cgd pull up rev 1.6 from trunk (ross)
 1.6.16.3 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.6.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.16.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.14.3 18-Oct-2002  nathanw Catch up to -current.
 1.6.14.2 20-Jun-2002  nathanw Catch up to -current.
 1.6.14.1 28-Aug-2001  nathanw Catch up with -current.
 1.24 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.23 06-Dec-1999  drochner update for changed struct wsdisplay_accessops:show_screen signature.
no functional changes
 1.22 11-Jan-1999  drochner branches: 1.22.8; 1.22.14;
remove dummy "load_font" entries
 1.21 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.20 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.19 30-Jun-1998  drochner adapt to wscons interface change
 1.18 21-Jun-1998  drochner adapt to wscons interface change
 1.17 14-May-1998  drochner Simple screen attribute handling for wscons.
The graphics device driver passes a "default attribute" for normal text
output to the wscons framework. If the emulation module needs more
attributes (for different "renditions") it can allocate them via a
callback.
For now, only the "sun" emulation makes use of it.
 1.16 16-Apr-1998  drochner count allocated screens correctly
 1.15 15-Apr-1998  drochner convert to mi wscons
 1.14 12-Jan-1998  thorpej Adjust for config changes.
 1.13 25-Sep-1997  thorpej branches: 1.13.2;
Add a "scrollskip" member to wscons_emulfuncs (XXX even though it's not
a function) which specifies how many lines will be skipped when scrolling
up when the bottom of the screen is reached. Dumb framebuffers skip 10
lines (as before) because the copies are s ... l ... o ... w, but it's
silly to skip 10 lines on VGA, since the copies are much faster, so we
only skip one in that case.
 1.12 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.11 07-Apr-1997  cgd branches: 1.11.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.10 07-Apr-1997  cgd use machine/conf.h instead of sys/conf.h and/or machine/cpuconf.h
 1.9 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.8 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.7 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.6 19-Nov-1996  cgd branches: 1.6.2;
catch up with wscons frame buffer attachment, mmap, and ioctl
interface changes.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.2 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.1 01-May-1996  cgd preliminary SFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap,
cursor, etc.) support.
 1.6.2.4 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.3 25-Jan-1997  cgd note that these drivers need to be converted to use the new wscons interfaces
 1.6.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.6.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.11.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.1 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.22.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.6 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.5 22-Oct-1998  briggs branches: 1.5.12;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.4 19-Oct-1998  briggs vm_offset_t no longer exists. Change to paddr_t, vaddr_t, and psize_t.
 1.3 15-Apr-1998  drochner convert to mi wscons
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
preliminary SFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap,
cursor, etc.) support.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3 20-Dec-1995  cgd these are going to be made machine-independent
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2 20-Dec-1995  cgd these are going to be made machine-independent
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.39 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.38 18-Nov-2020  thorpej branches: 1.38.4;
malloc(9) -> kmem(9)
 1.37 25-Sep-2020  thorpej branches: 1.37.2;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.36 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.35 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.34 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.33 26-Mar-2014  christos branches: 1.33.30;
kill sprintf
 1.32 06-Feb-2012  matt branches: 1.32.6; 1.32.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.31 14-Jun-2011  matt branches: 1.31.2; 1.31.6;
struct device * -> device_t
 1.30 16-Mar-2009  dsl branches: 1.30.10;
ANSIfy functions with function-pointer arguments
 1.29 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.27 27-Sep-2002  provos branches: 1.27.112; 1.27.120; 1.27.126;
remove trailing \n in panic(). approved perry.
 1.26 27-Jul-2001  thorpej branches: 1.26.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.25 05-Jun-2000  thorpej branches: 1.25.6;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.24 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.23 26-Mar-2000  nisimura branches: 1.23.2;
- Remove unused bt459reg.h.
- sfbvar.h has gone, placing patch on holes for now. Every TC framebuffer
has a single explosure of xxfb_cnattach() which could be bridged by MI
land.
 1.22 14-Mar-2000  nisimura Fix DEC3000/300 TC slot numbering. There is an address space hole
between two TC option cards and 3 builtin TC devices. Was uncovered by
mrg's change made at Nov 1999 and pointed by tsutsui.
 1.21 03-Feb-2000  nisimura Merge IOASIC register definitions.
 1.20 07-Aug-1999  drochner branches: 1.20.2;
clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.19 28-Mar-1999  drochner Leave out display console related bits if wscons is not compiled in.
Should fix link error reported by Kevin <kev@drule.org>.
 1.18 12-Feb-1999  thorpej Fix printf format problems on Alpha. (IRONIC?!)
 1.17 23-Oct-1998  briggs DTRT if sfb is not configured in the kernel.
 1.16 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.15 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.14 07-Apr-1997  cgd branches: 1.14.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.13 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.12 13-Oct-1996  christos branches: 1.12.2;
backout previous kprintf change
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.9 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.8 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.7 01-May-1996  cgd branches: 1.7.4;
fix the test for option slot interrupts. If a given interrupt is
disabled (and therefore can't have caused the actual I/O interrupt),
don't try to call its handler even if its bit is set in the interrupt
register.
 1.6 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.5 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.4 20-Dec-1995  cgd update for new turbochannel configuration code.
 1.3 03-Aug-1995  cgd MB -> wbflush
 1.2 24-Mar-1995  cgd cleanup, add some comments, and (oh yeah!) look at interrupt bits
 1.1 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.7.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.12.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.6.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.25.6.1 03-Aug-2001  lukem update to -current
 1.26.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.26.2.1 27-Jul-2001  nathanw file tc_3000_300.c was added on branch nathanw_sa on 2002-10-18 02:34:32 +0000
 1.27.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.27.112.1 04-May-2009  yamt sync with head.
 1.30.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.31.6.1 18-Feb-2012  mrg merge to -current.
 1.31.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.2.1 17-Apr-2012  yamt sync with head
 1.32.10.1 18-May-2014  rmind sync with head
 1.32.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.37.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.38.4.1 13-May-2021  thorpej Sync with HEAD.
 1.7 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.6 06-Feb-2012  matt branches: 1.6.6; 1.6.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 14-Mar-2009  dsl branches: 1.5.12; 1.5.16;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 22-Oct-1998  briggs branches: 1.4.152; 1.4.160; 1.4.166;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 20-Dec-1995  cgd branches: 1.2.2;
update for new turbochannel configuration code.
 1.1 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.166.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.160.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.152.1 04-May-2009  yamt sync with head.
 1.5.16.1 18-Feb-2012  mrg merge to -current.
 1.5.12.1 17-Apr-2012  yamt sync with head
 1.6.24.1 28-Aug-2017  skrll Sync with HEAD
 1.6.6.1 03-Dec-2017  jdolecek update from HEAD
 1.38 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.37 18-Nov-2020  thorpej branches: 1.37.4;
malloc(9) -> kmem(9)
 1.36 25-Sep-2020  thorpej branches: 1.36.2;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.35 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.34 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.33 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.32 26-Mar-2014  christos branches: 1.32.30;
kill sprintf
 1.31 06-Feb-2012  matt branches: 1.31.6; 1.31.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.30 14-Jun-2011  matt branches: 1.30.2; 1.30.6;
struct device * -> device_t
 1.29 16-Mar-2009  dsl branches: 1.29.10;
ANSIfy functions with function-pointer arguments
 1.28 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.27 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.26 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.25 27-Sep-2002  provos branches: 1.25.112; 1.25.120; 1.25.126;
remove trailing \n in panic(). approved perry.
 1.24 27-Jul-2001  thorpej branches: 1.24.2;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.23 05-Jun-2000  thorpej branches: 1.23.6;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.22 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.21 26-Mar-2000  nisimura branches: 1.21.2;
- Remove unused bt459reg.h.
- sfbvar.h has gone, placing patch on holes for now. Every TC framebuffer
has a single explosure of xxfb_cnattach() which could be bridged by MI
land.
 1.20 07-Aug-1999  drochner branches: 1.20.2;
clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.19 28-Mar-1999  drochner Leave out display console related bits if wscons is not compiled in.
Should fix link error reported by Kevin <kev@drule.org>.
 1.18 12-Feb-1999  thorpej Fix printf format problems on Alpha. (IRONIC?!)
 1.17 23-Oct-1998  briggs DTRT if sfb is not configured in the kernel.
 1.16 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.15 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.14 07-Apr-1997  cgd branches: 1.14.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.13 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.12 15-Nov-1996  cgd branches: 1.12.2;
Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
is set in the RPB's rpb_variation field. This fixes a bug where machines
(e.g. the 3000/900) would see that they could touch memory where a built-in
PMAGB-BA, assume that it was there, and panic later because the memory they
were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.11 13-Oct-1996  christos backout previous kprintf change
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.8 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.7 13-Jun-1996  cgd clean up copyright notices
 1.6 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.5 04-Jun-1996  cgd don't depend on being able to read the IMR. Apparently, it doesn't
work (as documented in the DEC 3000/[3-9]00 System Programmer's Manual)
in some of the older 3000/500 systems.
 1.4 02-May-1996  cgd branches: 1.4.4;
add a bit of clarafication in a comment, and change the interrupt
handling code so that if a given interrupt is disabled (and therefore
can't have caused the actual I/O interrupt), its handler won't be
called even if its bit is set in the interrupt register.
 1.3 20-Dec-1995  cgd update for new turbochannel configuration code.
 1.2 03-Aug-1995  cgd MB -> wbflush
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.4.4 05-Dec-1996  rat Patch request from Chris Demetriou <cgd@NetBSD.ORG>

>Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
>is set in the RPB's rpb_variation field. This fixes a bug where machines
>(e.g. the 3000/900) would see that they could touch memory where a built-in
>PMAGB-BA, assume that it was there, and panic later because the memory they
>were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.4.4.3 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.4.4.2 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.4.4.1 04-Jun-1996  cgd pull up from trunk:
>don't depend on being able to read the IMR. Apparently, it doesn't
>work (as documented in the DEC 3000/[3-9]00 System Programmer's Manual)
>in some of the older 3000/500 systems.
 1.12.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.21.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.6.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.23.6.1 03-Aug-2001  lukem update to -current
 1.24.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.24.2.1 27-Jul-2001  nathanw file tc_3000_500.c was added on branch nathanw_sa on 2002-10-18 02:34:32 +0000
 1.25.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.112.1 04-May-2009  yamt sync with head.
 1.29.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.30.6.1 18-Feb-2012  mrg merge to -current.
 1.30.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.2.1 17-Apr-2012  yamt sync with head
 1.31.10.1 18-May-2014  rmind sync with head
 1.31.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.36.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.37.4.1 13-May-2021  thorpej Sync with HEAD.
 1.7 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.6 06-Feb-2012  matt branches: 1.6.6; 1.6.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 14-Mar-2009  dsl branches: 1.5.12; 1.5.16;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 22-Oct-1998  briggs branches: 1.4.152; 1.4.160; 1.4.166;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 20-Dec-1995  cgd branches: 1.2.2;
update for new turbochannel configuration code.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.166.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.160.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.152.1 04-May-2009  yamt sync with head.
 1.5.16.1 18-Feb-2012  mrg merge to -current.
 1.5.12.1 17-Apr-2012  yamt sync with head
 1.6.24.1 28-Aug-2017  skrll Sync with HEAD
 1.6.6.1 03-Dec-2017  jdolecek update from HEAD
 1.1 09-Mar-2025  thorpej branches: 1.1.4;
Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 09-Mar-2025  perseant file tc_bootdev.c was added on branch perseant-exfatfs on 2025-08-02 05:55:23 +0000
 1.4 22-Oct-1996  cgd there is no TC I/O space, so in the new bus.h world order there
is no tc_bus_io.c.
 1.3 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.2 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.1 17-May-1996  cgd branches: 1.1.4;
bus_io_* functions. These have no meaning on the TurboChannel, since
it's a memory-mapped bus and has no I/O space. They all are
fancy wrappers around panic().
 1.1.4.1 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
 1.40 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.39 05-May-2021  thorpej Moar static.
 1.38 22-Jun-2017  flxd branches: 1.38.22;
spelling (DEC called it "TURBOchannel")
 1.37 03-Aug-2016  christos More cleanups from Felix Deichmann (code) and me (panics).
 1.36 26-Jul-2016  christos From Felix Deichmann:
While writing "slhci at tc" support, I noticed TC bus_space functions
for alpha don't work as they should (tc_bus_mem.c). Consideration of
dense vs. sparse space seems problematic, especially for widths < 4.

I found information mainly in

[1] https://web-docs.gsi.de/~kraemer/COLLECTION/DEC/d3syspmb.pdf
[2]
http://h20565.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c04623255

and a dirty (but tested) hack based on this is attached as an example.
It would be great if someone could have a look and do a cleaner version
preferably.

Especially the end of ([2] section 12.2.2) provides a summary of which
"instruction" to use for which data width in which space, and possible
side effects (unintentional double reads/writes) in dense space...
 1.35 04-Nov-2013  christos branches: 1.35.6; 1.35.10;
remove unused code
 1.34 06-Feb-2012  matt branches: 1.34.6; 1.34.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.33 25-Sep-2011  chs branches: 1.33.2; 1.33.6;
change inline to static inline to appease gcc 4.5.
 1.32 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.31 15-Dec-2010  matt rework <uvm/uvm_extern.h> includes.
 1.30 14-Mar-2009  dsl branches: 1.30.4;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.29 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.27 11-Dec-2005  christos branches: 1.27.78; 1.27.86; 1.27.92;
merge ktrace-lwp.
 1.26 08-Jun-2005  he Rename an inner variable shadowing the 'v' parameter to appease -Wshadow.
 1.25 04-Sep-2001  thorpej branches: 1.25.20;
Implement bus_space_mmap().
 1.24 29-Jun-2000  mrg branches: 1.24.2; 1.24.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.23 18-Apr-2000  tron Fix typo in last commit.
 1.22 17-Apr-2000  drochner implement bus_space_vaddr()
 1.21 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.20 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.19 12-Mar-1999  perry branches: 1.19.8;
ovbcopy -> memmove
 1.18 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.17 02-Sep-1997  thorpej branches: 1.17.6;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.16 23-Jul-1997  cgd branches: 1.16.2;
when i was documenting the bus_space interfaces (the document
was sent to developers, but will eventually become a man page or
something), i noticed a few in various names:
(1) _map and _alloc should take a flags argument, rather than a
'cacheable' boolean.
(2) BUS_BARRIER_* flags should be BUS_SPACE_BARRIER_*.
(3) bus_space_copy_* should be bus_space_copy_region_* for consistency
with other region ops.
Fix all of these (in a backward-compatible way, at least for now). Redefine
internal usees of those names to use the new names. Also, while at it,
clean up the copy functions (remove unnecessary variables) and make sure
that they and other functions conform to the spec.
 1.15 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.14 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.13 02-Dec-1996  cgd branches: 1.13.2;
implement bus_space_copy_*().
 1.12 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.11 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.10 02-Dec-1996  cgd declare the single-datum read and write methods as inline, so that
the multi and region methods can inline them.
 1.9 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.8 22-Oct-1996  cgd update for new bus.h
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 11-Jun-1996  cgd fix pasto in last commit.
 1.5 11-Jun-1996  cgd since bus_mem_subregion() can return failure, don't even bother to try
to handle the case where subregion offset isn't a multiple of 8.
 1.4 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.3 03-Jun-1996  cgd gross hack to get around the fact that there are currently devices with
common back-ends that live on multiple very-different busses (e.g. PCI and
TC), which need bus-specific DMA mapping support. As a nice side effect,
this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
to go away in favor of less nasty bus-specific function calls.
 1.2 20-May-1996  cgd branches: 1.2.4;
add wbflush() calls in strategic places. These really shouldn't be
here, and there should be a generic 'bus' interface to do memory
read/write barriers.
 1.1 18-May-1996  cgd TurboChannel bus_mem_* functions. bus_mem_{read,write}_8, and
bus_mem_read_{1,2} are not yet supported for sparse space.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
and:
>since bus_mem_subregion() can return failure, don't even bother to try
>to handle the case where subregion offset isn't a multiple of 8.
and:
>fix pasto in last commit.
 1.2.4.1 03-Jun-1996  cgd pull up from trunk:
>gross hack to get around the fact that there are currently devices with
>common back-ends that live on multiple very-different busses (e.g. PCI and
>TC), which need bus-specific DMA mapping support. As a nice side effect,
>this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
>to go away in favor of less nasty bus-specific function calls.
 1.13.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.13.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.16.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.17.6.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.19.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.24.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.24.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.25.20.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.92.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.86.1 28-Apr-2009  skrll Sync with HEAD.
 1.27.78.1 04-May-2009  yamt sync with head.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.33.6.1 18-Feb-2012  mrg merge to -current.
 1.33.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.2.1 17-Apr-2012  yamt sync with head
 1.34.10.1 18-May-2014  rmind sync with head
 1.34.6.2 03-Dec-2017  jdolecek update from HEAD
 1.34.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.10.1 06-Aug-2016  pgoyette Sync with HEAD
 1.35.6.2 28-Aug-2017  skrll Sync with HEAD
 1.35.6.1 05-Oct-2016  skrll Sync with HEAD
 1.38.22.2 01-Aug-2021  thorpej Sync with HEAD.
 1.38.22.1 13-May-2021  thorpej Sync with HEAD.
 1.15 07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.14 22-Jun-2017  flxd branches: 1.14.22;
spelling (DEC called it "TURBOchannel")
 1.13 06-Feb-2012  matt branches: 1.13.6; 1.13.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.12 14-Jun-2011  matt branches: 1.12.2; 1.12.6;
struct device * -> device_t
 1.11 14-Mar-2009  dsl branches: 1.11.10;
Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.10 04-Jun-2000  cgd branches: 1.10.132; 1.10.140; 1.10.146;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.9 22-Oct-1998  briggs branches: 1.9.12; 1.9.20;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.8 02-Sep-1997  thorpej Pull in DEC_3000_300 and DEC_3000_500 options.
 1.7 06-Jun-1997  thorpej branches: 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 06-Jun-1997  thorpej branches: 1.6.2;
Oops, last commit was meant for the thorpej-bus-dma branch, not the
trunk.
 1.5 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 15-Nov-1996  cgd branches: 1.3.2;
Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
is set in the RPB's rpb_variation field. This fixes a bug where machines
(e.g. the 3000/900) would see that they could touch memory where a built-in
PMAGB-BA, assume that it was there, and panic later because the memory they
were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.2 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.1 20-Dec-1995  cgd branches: 1.1.4;
update for new turbochannel configuration code.
 1.1.4.1 05-Dec-1996  rat Patch request from Chris Demetriou <cgd@NetBSD.ORG>

>Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
>is set in the RPB's rpb_variation field. This fixes a bug where machines
>(e.g. the 3000/900) would see that they could touch memory where a built-in
>PMAGB-BA, assume that it was there, and panic later because the memory they
>were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.3.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.2.2 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.6.2.1 06-Jun-1997  thorpej file tc_conf.h was added on branch thorpej-bus-dma on 1997-06-06 02:44:39 +0000
 1.7.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.12.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.146.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.140.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.132.1 04-May-2009  yamt sync with head.
 1.11.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.12.6.1 18-Feb-2012  mrg merge to -current.
 1.12.2.1 17-Apr-2012  yamt sync with head
 1.13.24.1 28-Aug-2017  skrll Sync with HEAD
 1.13.6.1 03-Dec-2017  jdolecek update from HEAD
 1.14.22.1 13-May-2021  thorpej Sync with HEAD.
 1.15 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.14 10-Oct-2020  thorpej branches: 1.14.6;
G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.13 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.12 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.11 28-Apr-2008  martin branches: 1.11.8; 1.11.14;
Remove clause 3 and 4 from TNF licenses
 1.10 19-Jul-2001  thorpej branches: 1.10.2; 1.10.124; 1.10.126; 1.10.128;
Add support for mbufs to the Alpha SGMAP DMA maps.
 1.9 14-Aug-1998  thorpej branches: 1.9.26;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.8 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.7 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.6 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.5 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.4 19-Jan-1998  thorpej G/c an unused function pointer.
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file tc_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.2 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.1.2.1 03-Jun-1997  thorpej Add Alpha TurboChannel SGMAP-mapped DMA support. Note, SGMAPs are
currently not used by anything, and there is not yet a sane way
to configure use of SGMAPs (and communicate it to the MI TurboChannel
code), since:

(a) Pelicans (3000/300-series) don't have SGMAPs, and

(b) SGMAPs are enabled on a per-slot basis, and this needs
to be known by the MI TurboChannel code.

The code is there, at least, and should work.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_dma.c was added on branch alpha-nwscons on 1997-06-07 04:43:38 +0000
 1.9.26.1 03-Aug-2001  lukem update to -current
 1.10.128.2 04-May-2009  yamt sync with head.
 1.10.128.1 16-May-2008  yamt sync with head.
 1.10.126.1 18-May-2008  yamt sync with head.
 1.10.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.2.2 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.10.2.1 19-Jul-2001  thorpej file tc_dma.c was added on branch nathanw_sa on 2001-07-19 06:40:03 +0000
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.5 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.4 28-Apr-2008  martin branches: 1.4.8; 1.4.14;
Remove clause 3 and 4 from TNF licenses
 1.3 02-Sep-1997  thorpej branches: 1.3.154; 1.3.156; 1.3.158;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file tc_dma_3000_300.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_dma_3000_300.c was added on branch alpha-nwscons on 1997-06-07 04:43:39 +0000
 1.3.158.2 04-May-2009  yamt sync with head.
 1.3.158.1 16-May-2008  yamt sync with head.
 1.3.156.1 18-May-2008  yamt sync with head.
 1.3.154.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.160; 1.2.162; 1.2.164;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file tc_dma_3000_300.h was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.164.2 04-May-2009  yamt sync with head.
 1.2.164.1 16-May-2008  yamt sync with head.
 1.2.162.1 18-May-2008  yamt sync with head.
 1.2.160.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_dma_3000_300.h was added on branch alpha-nwscons on 1997-06-07 04:43:41 +0000
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.24 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.23 18-Nov-2020  thorpej branches: 1.23.4;
malloc(9) -> kmem(9)
 1.22 11-Oct-2020  thorpej branches: 1.22.2;
Add some bus_dma instrumentation.
 1.21 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.20 22-Jun-2017  flxd branches: 1.20.6;
spelling (DEC called it "TURBOchannel")
 1.19 04-Nov-2013  christos branches: 1.19.6;
remove unused variable
 1.18 06-Feb-2012  matt branches: 1.18.6; 1.18.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.17 01-Jul-2011  dyoung branches: 1.17.2; 1.17.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16 15-Dec-2010  matt rework <uvm/uvm_extern.h> includes.
 1.15 14-Mar-2009  dsl branches: 1.15.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.14 28-Apr-2008  martin branches: 1.14.8; 1.14.14;
Remove clause 3 and 4 from TNF licenses
 1.13 19-Jul-2001  thorpej branches: 1.13.2; 1.13.124; 1.13.126; 1.13.128;
Add support for mbufs to the Alpha SGMAP DMA maps.
 1.12 12-Jul-2001  thorpej bcopy -> memcpy
 1.11 12-Jul-2001  thorpej bzero -> memset
 1.10 29-Jun-2000  mrg branches: 1.10.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 16-Nov-1999  enami Include sys/device.h so that this file compiles again; file dev/tc/tcvar.h
now contains the definition of tc_softc.
 1.8 03-Jun-1998  thorpej branches: 1.8.14; 1.8.20;
Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.7 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.6 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.5 04-Feb-1998  thorpej Use the common _bus_dmamap_sync() as the _dmamap_sync method in the
bus_dma_tag_t.
 1.4 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.3 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file tc_dma_3000_500.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_dma_3000_500.c was added on branch alpha-nwscons on 1997-06-07 04:43:43 +0000
 1.8.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.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.10.4.1 03-Aug-2001  lukem update to -current
 1.13.128.2 04-May-2009  yamt sync with head.
 1.13.128.1 16-May-2008  yamt sync with head.
 1.13.126.1 18-May-2008  yamt sync with head.
 1.13.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.2.2 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.13.2.1 19-Jul-2001  thorpej file tc_dma_3000_500.c was added on branch nathanw_sa on 2001-07-19 06:40:04 +0000
 1.14.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.4.1 05-Mar-2011  rmind sync with head
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.10.1 18-May-2014  rmind sync with head
 1.18.6.2 03-Dec-2017  jdolecek update from HEAD
 1.18.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.6.1 28-Aug-2017  skrll Sync with HEAD
 1.20.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.22.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.23.4.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.160; 1.2.162; 1.2.164;
Pull thorpej-bus-dma branch into mainline.
 1.1 06-Jun-1997  thorpej branches: 1.1.2;
file tc_dma_3000_500.h was initially added on branch thorpej-bus-dma.
 1.1.2.1 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.2.164.2 04-May-2009  yamt sync with head.
 1.2.164.1 16-May-2008  yamt sync with head.
 1.2.162.1 18-May-2008  yamt sync with head.
 1.2.160.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_dma_3000_500.h was added on branch alpha-nwscons on 1997-06-07 04:43:44 +0000
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.7 19-Mar-1999  cgd move tc/tc_machdep.h to include/tc_machdep.h. (can't do it via
repository copy because alpha already had an include/tc_machdep.h in
the attic.)
 1.6 19-Jan-1998  thorpej Get the per-slot DMA tag a bit differently.
 1.5 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.4 06-Apr-1997  cgd branches: 1.4.2;
clean up NetBSD RCS ID strings
 1.3 22-Oct-1996  cgd branches: 1.3.2;
update for new bus.h
 1.2 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.1 20-Dec-1995  cgd portability definitions for machine-independent TC configuration code.
 1.3.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.2 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.4.2.1 03-Jun-1997  thorpej Add DMA-related constants and prototypes.
 1.10 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.9 11-Oct-2020  thorpej branches: 1.9.6;
Add some bus_dma instrumentation.
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 15-Dec-2010  matt rework <uvm/uvm_extern.h> includes.
 1.6 28-Apr-2008  martin branches: 1.6.22;
Remove clause 3 and 4 from TNF licenses
 1.5 19-Jul-2001  thorpej branches: 1.5.2; 1.5.124; 1.5.126; 1.5.128;
Add support for mbufs to the Alpha SGMAP DMA maps.
 1.4 29-Jun-2000  mrg branches: 1.4.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 02-Sep-1997  thorpej branches: 1.3.18;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file tc_sgmap.c was initially added on branch thorpej-bus-dma.
 1.1.2.1 03-Jun-1997  thorpej Add Alpha TurboChannel SGMAP-mapped DMA support. Note, SGMAPs are
currently not used by anything, and there is not yet a sane way
to configure use of SGMAPs (and communicate it to the MI TurboChannel
code), since:

(a) Pelicans (3000/300-series) don't have SGMAPs, and

(b) SGMAPs are enabled on a per-slot basis, and this needs
to be known by the MI TurboChannel code.

The code is there, at least, and should work.
 1.2.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_sgmap.c was added on branch alpha-nwscons on 1997-06-07 04:43:46 +0000
 1.3.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.5.128.1 16-May-2008  yamt sync with head.
 1.5.126.1 18-May-2008  yamt sync with head.
 1.5.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.2.2 19-Jul-2001  thorpej Add support for mbufs to the Alpha SGMAP DMA maps.
 1.5.2.1 19-Jul-2001  thorpej file tc_sgmap.c was added on branch nathanw_sa on 2001-07-19 06:40:04 +0000
 1.6.22.1 05-Mar-2011  rmind sync with head
 1.9.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.5 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.4 06-Feb-2012  matt branches: 1.4.6; 1.4.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 28-Apr-2008  martin branches: 1.3.34; 1.3.38;
Remove clause 3 and 4 from TNF licenses
 1.2 07-Jun-1997  thorpej branches: 1.2.2; 1.2.160; 1.2.162; 1.2.164;
Pull thorpej-bus-dma branch into mainline.
 1.1 03-Jun-1997  thorpej branches: 1.1.2;
file tc_sgmap.h was initially added on branch thorpej-bus-dma.
 1.1.2.3 06-Jun-1997  thorpej Update for function naming changes in sgmap_typedep.*.
 1.1.2.2 04-Jun-1997  thorpej Garbage-collect SGMAP_PTE_OFFSET_SHIFT.
 1.1.2.1 03-Jun-1997  thorpej Add Alpha TurboChannel SGMAP-mapped DMA support. Note, SGMAPs are
currently not used by anything, and there is not yet a sane way
to configure use of SGMAPs (and communicate it to the MI TurboChannel
code), since:

(a) Pelicans (3000/300-series) don't have SGMAPs, and

(b) SGMAPs are enabled on a per-slot basis, and this needs
to be known by the MI TurboChannel code.

The code is there, at least, and should work.
 1.2.164.1 16-May-2008  yamt sync with head.
 1.2.162.1 18-May-2008  yamt sync with head.
 1.2.160.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1 07-Jun-1997  cgd file tc_sgmap.h was added on branch alpha-nwscons on 1997-06-07 04:43:47 +0000
 1.3.38.1 18-Feb-2012  mrg merge to -current.
 1.3.34.1 17-Apr-2012  yamt sync with head
 1.4.24.1 28-Aug-2017  skrll Sync with HEAD
 1.4.6.1 03-Dec-2017  jdolecek update from HEAD
 1.52 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.51 07-May-2021  thorpej branches: 1.51.6;
Static'ify more symbols.
 1.50 24-Apr-2021  thorpej branches: 1.50.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.49 25-Sep-2020  thorpej branches: 1.49.4;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.48 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.47 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.46 09-Jun-2017  flxd Make VAXstation 4000 TURBOchannel adaptor work.
PIO and IRQ tested on VS4000/60 and /96 with TC-USB (slhci) and PMAD-AA (le).
DMA is untested.
vax needs space to be mapped out, so memory space is pre-mapped for TC option
drivers not bus_space'ified yet, also providing custom bus_space methods for
this kludge.
 1.45 12-Dec-2016  flxd branches: 1.45.8;
Clean-up (remove redundant declarations, concentrate checks).
 1.44 06-Feb-2012  matt branches: 1.44.6; 1.44.24; 1.44.28;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.43 04-Jun-2011  tsutsui branches: 1.43.2; 1.43.6;
Split device_t/softc. pmax is tested on GXemul.
Compile test only for alpha and vax.

XXX: alpha/tc/tcasic.c calls tcattach() via config_found(9), but
XXX: pmax/tc/tcbus.c and vax/vsa/tc_vsbus.c calls tcattach() directly.
XXX: It looks horrible...
 1.42 14-Mar-2009  dsl branches: 1.42.4; 1.42.6; 1.42.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.41 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.40 03-Dec-2007  ad branches: 1.40.18; 1.40.26; 1.40.32;
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.39 01-Jan-2003  thorpej branches: 1.39.18; 1.39.60; 1.39.78; 1.39.80; 1.39.86;
Use aprint_normal() for cfprint routines.
 1.38 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.37 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.36 23-Aug-2001  nisimura branches: 1.36.2;
Add MX (PMAG-A), CX (PMAG-B), TX (PMAG-RO/PMAG[B]-J) TC framebuffer
supports. None of them has any acceleration capability.
 1.35 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.34 04-Mar-2001  ad branches: 1.34.4;
Hook in px & pxg devices.
 1.33 22-Feb-2001  nisimura Add code segment for PMAGD, which is under development this moment.
 1.32 23-Dec-2000  tron Fix typo in last commit.
 1.31 22-Dec-2000  ad In tc_fb_cnattach(): match from a table, and add #ifdef'ed out glue for the
px/pxg devices.
 1.30 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.29 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.28 26-Mar-2000  nisimura branches: 1.28.2;
- Remove unused bt459reg.h.
- sfbvar.h has gone, placing patch on holes for now. Every TC framebuffer
has a single explosure of xxfb_cnattach() which could be bridged by MI
land.
 1.27 07-Aug-1999  drochner branches: 1.27.2;
clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.26 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.25 19-Nov-1998  ross branches: 1.25.6;
More include shuffling.
 1.24 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.23 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.22 19-Jan-1998  thorpej Pass a pointer to the "get this slot's DMA tag" function pointer to
the tc instance just like we do with the interrupt functions.
 1.21 12-Jan-1998  thorpej Adjust for config changes.
 1.20 02-Sep-1997  thorpej Pull in DEC_3000_300 and DEC_3000_500 options.
 1.19 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.18 06-Jun-1997  thorpej branches: 1.18.4;
Pull thorpej-bus-dma branch into mainline.
 1.17 07-Apr-1997  cgd branches: 1.17.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.16 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.15 08-Dec-1996  cgd remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.14 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.13 15-Nov-1996  cgd branches: 1.13.2;
Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
is set in the RPB's rpb_variation field. This fixes a bug where machines
(e.g. the 3000/900) would see that they could touch memory where a built-in
PMAGB-BA, assume that it was there, and panic later because the memory they
were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.12 23-Oct-1996  cgd update for new bus.h macros. bus_io_* and bus_mem_* integrated into
single bus_space_* framework. Unfortunately, bus_space_{read,write}_*
operations still imply barriers. That will change soon.
 1.11 22-Oct-1996  cgd update for new bus.h
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.7 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
 1.6 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.5 17-May-1996  cgd branches: 1.5.4;
set up a bus_chpiset_tag_t, and pass it to the TC code
 1.4 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.3 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.2 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.1 20-Dec-1995  cgd update for new turbochannel configuration code.
 1.5.4.1 05-Dec-1996  rat Patch request from Chris Demetriou <cgd@NetBSD.ORG>

>Include a PMAGB-BA in the list of built-in devices only if SV_GRAPHICS
>is set in the RPB's rpb_variation field. This fixes a bug where machines
>(e.g. the 3000/900) would see that they could touch memory where a built-in
>PMAGB-BA, assume that it was there, and panic later because the memory they
>were accessing didn't look like PMAGB-BA registers (because it wasn't).
 1.13.2.4 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.13.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.13.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.17.2.2 06-Jun-1997  thorpej Split DEC 3000/300 and 3000/500 DMA functions into separate files,
suggested by Chris Demetriou <cgd@netbsd.org>.
 1.17.2.1 03-Jun-1997  thorpej Call tc_dma_init() to intialize DMA-related things.
 1.18.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.27.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.27.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.27.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.28.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.34.4.3 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.34.4.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.34.4.1 03-Aug-2001  lukem update to -current
 1.36.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.36.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.36.2.1 23-Aug-2001  nathanw file tcasic.c was added on branch nathanw_sa on 2002-10-18 02:34:33 +0000
 1.39.86.1 08-Dec-2007  mjf Sync with HEAD.
 1.39.80.1 09-Jan-2008  matt sync with HEAD
 1.39.78.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.39.60.1 03-Dec-2007  ad Sync with HEAD.
 1.39.18.1 07-Dec-2007  yamt sync with head
 1.40.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.40.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.40.18.1 04-May-2009  yamt sync with head.
 1.42.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.42.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.4.1 12-Jun-2011  rmind sync with head
 1.43.6.1 18-Feb-2012  mrg merge to -current.
 1.43.2.1 17-Apr-2012  yamt sync with head
 1.44.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.44.24.2 28-Aug-2017  skrll Sync with HEAD
 1.44.24.1 05-Feb-2017  skrll Sync with HEAD
 1.44.6.1 03-Dec-2017  jdolecek update from HEAD
 1.45.8.1 01-Jul-2017  snj Pull up following revision(s) (requested by flxd in ticket #65):
share/man/man4/tc.4: revision 1.7
sys/arch/alpha/tc/tcasic.c: revision 1.46
sys/arch/pmax/tc/tcbus.c: revision 1.33
sys/arch/vax/conf/files.vax: revision 1.121
sys/arch/vax/vsa/tc_vsbus.c: revision 1.8, 1.9
sys/dev/tc/tc.c: revision 1.55
sys/dev/tc/tcvar.h: revision 1.27
Make VAXstation 4000 TURBOchannel adaptor work.
PIO and IRQ tested on VS4000/60 and /96 with TC-USB (slhci) and PMAD-AA (le).
DMA is untested.
vax needs space to be mapped out, so memory space is pre-mapped for TC option
drivers not bus_space'ified yet, also providing custom bus_space methods for
this kludge.
--
whitespace
--
Add vax.
 1.49.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.50.2.1 13-May-2021  thorpej Sync with HEAD.
 1.51.6.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.31 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.30 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.29 08-Nov-1999  mhitch branches: 1.29.2;
&& doesn't work very well for testing a flag - tcds_params() was always using
the baseboard ID and FAST settings instead of getting them from the TC option
card EEPROM.
 1.28 22-Sep-1999  mhitch branches: 1.28.2; 1.28.4; 1.28.8;
Correct the clock speed setting: the GPI2 bit is only for the Alpha baseboard
TCDS; the TC option card has it's own clock.

Also don't use the TCDSF_FASTSCSI flag to clear fast mode - just rely on the
PROM environment.
 1.27 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.26 02-Mar-1999  nisimura branches: 1.26.2; 1.26.4;
- Make compilable with DECstation. Looks running well on MI SCSI enabled
kernel. Will be relocated to sys/dev/tc/ soon.
 1.25 26-May-1998  thorpej - Additional rearrangement for the sake of running on the DECstation some
day.
- Convert to use bus_dma.
- Fix cleaning up unaligned start address.
- Correctly determine if the device supports Fast SCSI, and adjust the
minimum sync period accordingly.
- Compute minimum sync period correctly on the 25MHz devices.
- Use GPI2 to determine if we're a 25MHz or 40MHz device.
- Currectly determine SCSI ID and "fast mode enabled" for the built-in
TCDS on DEC 3000 models, using cached information from the PROM environment.
 1.24 25-May-1998  thorpej Add support for reading the SCSI ID and "fast mode enabled" from the
PMAZB-AA and PMAZC-AA EEPROM.
 1.23 24-May-1998  thorpej Several changes to the TurboChannel Dual SCSI driver:
- Fix the autoconfiguration model; the TCDS children don't attach to
TurboChannel, so don't make it look like they do.
- Make the driver use bus_space (not bus_dma yet; soon)
- Recognize the PMAZ-FS (baseboard fast SCSI on DEC 3000s) and the
PMAZB-AA (TCDS option card) and PMAZC-AA (TCDS fast SCSI option card).
- Rearrange it a bit, so that it can eventually be made into an "MI"
TurboChannel driver (i.e. work on DECstations).
 1.22 12-Jan-1998  thorpej Adjust for config changes.
 1.21 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.20 07-Apr-1997  cgd branches: 1.20.4;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.19 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.18 27-Feb-1997  thorpej Update for new 53c9x driver.
 1.17 08-Dec-1996  cgd branches: 1.17.6;
remove all traces of __BROKEN_INDIRECT_CONFIG (except in shared drivers)
 1.16 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.15 13-Oct-1996  christos branches: 1.15.2;
backout previous kprintf change
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.12 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.11 05-Jun-1996  cgd print slot number as decimal, not hex
 1.10 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.9 12-Apr-1996  cgd branches: 1.9.4;
clean up copyrights and RCS IDs
 1.8 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.7 17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.6 20-Dec-1995  cgd update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.5 03-Aug-1995  cgd MB -> wbflush
 1.4 22-Apr-1995  cgd deal with renamed header file.
 1.3 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.2 03-Mar-1995  cgd Follow suggestions put forth by Roger Ivie, and be a bit more careful
about setting and clearing bits in the CIR.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.4.2 05-Jun-1996  cgd pull up from trunk:
>print slot number as decimal, not hex
 1.9.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.15.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.2.2 08-Dec-1996  cgd sync __BROKEN_INDIRECT_CONFIG removal with trunk.
 1.15.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.17.6.1 11-Mar-1997  is Merge in latest Trunk.
 1.20.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.26.2.1 04-Dec-1999  he Pull up revisions 1.28-1.29 (requested by mhitch):
Fix the problems in detecting the clock speed on the TCDS Dual
SCSI Option cards, and correctly configure the Fast SCSI interfaces.
This allows installation on the 3000/500 -> 3000/900 Alphas which
have the Fast SCSI interface on the on-board SCSI adapters.
 1.28.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.4.1 14-Nov-1999  fvdl Sync with -current.
 1.28.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.29.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3 20-Dec-1995  cgd rename these more appropriately
 1.2 03-Mar-1995  cgd Follow suggestions put forth by Roger Ivie, and be a bit more careful
about setting and clearing bits in the CIR.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.31 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.30 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.29 02-Jun-2000  nisimura Make clarified SCSI transfer direction flag. sc_ispullup == pullup
data from SCSI device == DMA into main memory == datain.
 1.28 15-Mar-1999  nisimura branches: 1.28.8; 1.28.16;
- Make compilable with 32bit long integer system.
 1.27 12-Feb-1999  thorpej Fix printf format problems on Alpha. (IRONIC?!)
 1.26 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.25 26-May-1998  thorpej - Additional rearrangement for the sake of running on the DECstation some
day.
- Convert to use bus_dma.
- Fix cleaning up unaligned start address.
- Correctly determine if the device supports Fast SCSI, and adjust the
minimum sync period accordingly.
- Compute minimum sync period correctly on the 25MHz devices.
- Use GPI2 to determine if we're a 25MHz or 40MHz device.
- Currectly determine SCSI ID and "fast mode enabled" for the built-in
TCDS on DEC 3000 models, using cached information from the PROM environment.
 1.24 24-May-1998  thorpej Several changes to the TurboChannel Dual SCSI driver:
- Fix the autoconfiguration model; the TCDS children don't attach to
TurboChannel, so don't make it look like they do.
- Make the driver use bus_space (not bus_dma yet; soon)
- Recognize the PMAZ-FS (baseboard fast SCSI on DEC 3000s) and the
PMAZB-AA (TCDS option card) and PMAZC-AA (TCDS fast SCSI option card).
- Rearrange it a bit, so that it can eventually be made into an "MI"
TurboChannel driver (i.e. work on DECstations).
 1.23 07-Mar-1998  thorpej Nuke the vatopa() macro.
 1.22 17-Oct-1997  mjacob more compile foo.
 1.21 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.20 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.19 08-May-1997  thorpej branches: 1.19.2; 1.19.4;
Sync w/ SPARC port, from Paul Krannenburg <pk@netbsd.org>:
Remove esp FLUSH when residual bytes are present in FIFO, the ncr53c9x
driver will flush when necessary. Doing the FLUSH here interferes
with DMA-enabled target selection.
 1.18 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.17 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.16 27-Feb-1997  thorpej Update for new 53c9x driver.
 1.15 04-Dec-1996  mycroft branches: 1.15.6;
Fix a race condition in tcds_scsi_isintr().
Also, remove the annoying and bogus `empty FIFO of N' message.
 1.14 13-Nov-1996  cgd branches: 1.14.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 15-Sep-1996  cgd s/k0segtophys/ALPHA_K0SEG_TO_PHYS/
 1.10 09-Sep-1996  cgd Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
match the interfaces required by the driver.
 1.9 20-Aug-1996  cgd OLD_PMAP -> NEW_PMAP
 1.8 11-Jul-1996  cgd make this compile with pmap work in progress
 1.7 09-Jul-1996  cgd clean and update for new defintions, prototypes, etc.
 1.6 20-Dec-1995  cgd branches: 1.6.4;
update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.5 05-Sep-1995  cgd replace bogus tcl with tch, thanks to briggs
 1.4 03-Aug-1995  cgd MB -> wbflush
 1.3 22-Apr-1995  cgd deal with renamed header file.
 1.2 16-Feb-1995  cgd and with 0x1fff, rather than 0x1000
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.4.2 04-Dec-1996  mycroft Fix a race condition in tcds_scsi_isintr().
Also, remove the annoying and bogus `empty FIFO of N' message.
 1.6.4.1 10-Sep-1996  cgd pull up from trunk:
>Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
>match the interfaces required by the driver.
 1.14.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.14.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.15.6.1 11-Mar-1997  is Merge in latest Trunk.
 1.19.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.28.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.28.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 20-Dec-1995  cgd rename these more appropriately
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.5 26-May-1998  thorpej branches: 1.5.14;
GPI2 in the CIR register indicates our clock speed: 1 = 25MHz, 0 = 40MHz.
 1.4 25-May-1998  thorpej Add support for reading the SCSI ID and "fast mode enabled" from the
PMAZB-AA and PMAZC-AA EEPROM.
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 09-Jul-1996  cgd branches: 1.2.2;
clean and update for new defintions, prototypes, etc.
 1.1 20-Dec-1995  cgd update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.14 04-Jul-2000  nisimura Repopulate TCDS dual channel SCSI adapter to MI dev/tc, squashing
internals for better layering between TCDS DMA ASIC and ASC SCSI
controller.
 1.13 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.12 02-Jun-2000  nisimura Make clarified SCSI transfer direction flag. sc_ispullup == pullup
data from SCSI device == DMA into main memory == datain.
 1.11 13-Mar-2000  soren branches: 1.11.2;
Fix doubled 'the's in comments.
 1.10 26-May-1998  thorpej branches: 1.10.14;
- Additional rearrangement for the sake of running on the DECstation some
day.
- Convert to use bus_dma.
- Fix cleaning up unaligned start address.
- Correctly determine if the device supports Fast SCSI, and adjust the
minimum sync period accordingly.
- Compute minimum sync period correctly on the 25MHz devices.
- Use GPI2 to determine if we're a 25MHz or 40MHz device.
- Currectly determine SCSI ID and "fast mode enabled" for the built-in
TCDS on DEC 3000 models, using cached information from the PROM environment.
 1.9 24-May-1998  thorpej Several changes to the TurboChannel Dual SCSI driver:
- Fix the autoconfiguration model; the TCDS children don't attach to
TurboChannel, so don't make it look like they do.
- Make the driver use bus_space (not bus_dma yet; soon)
- Recognize the PMAZ-FS (baseboard fast SCSI on DEC 3000s) and the
PMAZB-AA (TCDS option card) and PMAZC-AA (TCDS fast SCSI option card).
- Rearrange it a bit, so that it can eventually be made into an "MI"
TurboChannel driver (i.e. work on DECstations).
 1.8 12-Jan-1998  thorpej Adjust for config changes.
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 27-Feb-1997  thorpej Update for new 53c9x driver.
 1.5 13-Nov-1996  cgd branches: 1.5.2; 1.5.8;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 09-Sep-1996  cgd Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
match the interfaces required by the driver.
 1.3 12-Apr-1996  cgd branches: 1.3.4;
clean up copyrights and RCS IDs
 1.2 12-Apr-1996  cgd update for latest MI TC and SCSI code, and clean up in the face of
config changes.
 1.1 20-Dec-1995  cgd update to include most of pk's changes to the sparc esp driver.
rework TC configuration code.
 1.3.4.1 10-Sep-1996  cgd pull up from trunk:
>Sync the 53c94 SCSI driver with the sparc version. Update the DMA code to
>match the interfaces required by the driver.
 1.5.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13 05-Jul-2000  nisimura Repopulate 4 files, zs_ioasic.c and zs_ioasicvar.h from arch/alpha/tc,
zskbd.c and zsms.c from dev/dec/, respectively. No functionality
change this time.
 1.12 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.11 24-Mar-2000  nisimura branches: 1.11.2;
A minimal fix to make this compilable.
 1.10 23-Mar-2000  thorpej Use a software interrupt for tty input processing, not a callout.
 1.9 06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.8 03-Feb-2000  nisimura Merge IOASIC register definitions.
 1.7 07-Aug-1999  drochner branches: 1.7.2;
clean up error handling in TC graphics console attachment: all functions
return 0 on success and an errno on failure
 1.6 03-Aug-1999  nisimura - A minimal patch work to make TCWSCONS useful with sfb/zskbd.
 1.5 03-Feb-1999  mycroft Don't set DCD_IE in the frontends. KGDB doesn't even use DCD, and the tty
frontends get it from zsparam() anyway.
 1.4 22-Oct-1998  briggs Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.3 04-Jul-1998  jonathan defopt DDB.
 1.2 23-May-1998  thorpej cs_heldchar is gone.
 1.1 24-Mar-1998  thorpej Initial mostly-working ioasic attachment for the MI 8530 SCC driver. It is
enough to use as a console on my DEC 3000/400 (connected to a VT-520
terminal).

XXX The MI SCC driver needs serious changes to handle platforms which
have muliple SCC attachments (e.g. the Alpha port, which has an ioasic
attachment for TurboChannel systems and a gbus attachment for TurboLaser
systems).

XXX The MI SCC driver also needs changes to deal with the wacky (to put
it mildly) way the chips are wired up on the ioasic (on both TC Alphas
and DECstations). These are going to come along later.
 1.7.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.11.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3 05-Jul-2000  nisimura Repopulate 4 files, zs_ioasic.c and zs_ioasicvar.h from arch/alpha/tc,
zskbd.c and zsms.c from dev/dec/, respectively. No functionality
change this time.
 1.2 22-Oct-1998  briggs branches: 1.2.12;
Preliminary support for both serial consoles and kbd/display wscons
consoles for TC alphas. Based on code from Takuya Koumoto
<takuya-k@is.aist-nara.ac.jp> as well as some parts of Toru Nishimura's
and Matthias Drochner's work on pmax wscons. This relies on the
NEW_SCC_DRIVER.
 1.1 24-Mar-1998  thorpej Initial mostly-working ioasic attachment for the MI 8530 SCC driver. It is
enough to use as a console on my DEC 3000/400 (connected to a VT-520
terminal).

XXX The MI SCC driver needs serious changes to handle platforms which
have muliple SCC attachments (e.g. the Alpha port, which has an ioasic
attachment for TurboChannel systems and a gbus attachment for TurboLaser
systems).

XXX The MI SCC driver also needs changes to deal with the wacky (to put
it mildly) way the chips are wired up on the ioasic (on both TC Alphas
and DECstations). These are going to come along later.
 1.2.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.26 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 07-May-2021  thorpej branches: 1.24.6;
Static'ify more symbols.
 1.23 24-Apr-2021  thorpej branches: 1.23.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.22 14-Jun-2011  matt branches: 1.22.68;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.21 14-Mar-2009  dsl branches: 1.21.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.20 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.19 04-Mar-2007  christos branches: 1.19.44; 1.19.52; 1.19.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 11-Dec-2005  christos branches: 1.18.26;
merge ktrace-lwp.
 1.17 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.16 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.15 13-Sep-2004  drochner branches: 1.15.12;
autoconf cleanup: turn xxxsubmatch() functions into the locator
passing variants
 1.14 01-Jan-2003  thorpej branches: 1.14.2;
Use aprint_normal() for cfprint routines.
 1.13 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.10 19-Jul-2001  thorpej branches: 1.10.2;
Only match the "gbus" on the primary CPU's CPU module.
 1.9 10-Apr-1999  cgd branches: 1.9.16;
be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.8 13-May-1998  thorpej branches: 1.8.10;
Implement and use gbussubmatch().
 1.7 13-May-1998  thorpej Normalize gbus configuration somewhat, and add support for configuring
the Zilog DUARTs.
 1.6 12-Jan-1998  thorpej Adjust for config changes.
 1.5 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.4 07-Apr-1997  cgd branches: 1.4.2; 1.4.6; 1.4.8;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.8.2 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.4.8.1 07-Apr-1997  cgd file gbus.c was added on branch alpha-nwscons on 1997-04-07 23:41:06 +0000
 1.4.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.16.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.9.16.1 03-Aug-2001  lukem update to -current
 1.10.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.10.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.10.2.1 19-Jul-2001  nathanw file gbus.c was added on branch nathanw_sa on 2002-10-18 02:34:33 +0000
 1.14.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.15.12.2 03-Sep-2007  yamt sync with head.
 1.15.12.1 21-Jun-2006  yamt sync with head.
 1.18.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.44.1 04-May-2009  yamt sync with head.
 1.21.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.68.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.22.68.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.23.2.1 13-May-2021  thorpej Sync with HEAD.
 1.24.6.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.3 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 13-May-1998  thorpej branches: 1.1.150; 1.1.152; 1.1.154;
Normalize gbus configuration somewhat, and add support for configuring
the Zilog DUARTs.
 1.1.154.1 16-May-2008  yamt sync with head.
 1.1.152.1 18-May-2008  yamt sync with head.
 1.1.150.1 02-Jun-2008  mjf Sync with HEAD.
 1.4 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.3 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 13-May-1998  thorpej branches: 1.1.150; 1.1.152; 1.1.154;
Normalize gbus configuration somewhat, and add support for configuring
the Zilog DUARTs.
 1.1.154.1 16-May-2008  yamt sync with head.
 1.1.152.1 18-May-2008  yamt sync with head.
 1.1.150.1 02-Jun-2008  mjf Sync with HEAD.
 1.19 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.18 04-Jul-2021  thorpej branches: 1.18.2;
Remove unnecessary #include <sys/malloc.h>
 1.17 24-Apr-2021  thorpej branches: 1.17.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.16 14-Jun-2011  matt branches: 1.16.68;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.15 14-Mar-2009  dsl branches: 1.15.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.14 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.13 04-Mar-2007  christos branches: 1.13.44; 1.13.52; 1.13.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 01-Jan-2003  thorpej branches: 1.12.18; 1.12.56;
Use aprint_normal() for cfprint routines.
 1.11 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 14-May-1998  thorpej branches: 1.9.26; 1.9.28;
Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.8 13-May-1998  thorpej Clean up a buglet.
 1.7 12-Jan-1998  thorpej Adjust for config changes.
 1.6 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.5 08-Jun-1997  thorpej branches: 1.5.4; 1.5.6;
Print the hose number in kftprint().
 1.4 07-Apr-1997  cgd branches: 1.4.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.6.2 08-Jun-1997  thorpej Print the hose number in kftprint().
 1.5.6.1 08-Jun-1997  thorpej file kftxx.c was added on branch alpha-nwscons on 1997-06-08 07:02:46 +0000
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.28.1 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.9.26.2 03-Jan-2003  thorpej Sync with HEAD.
 1.9.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.12.56.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.18.1 03-Sep-2007  yamt sync with head.
 1.13.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.44.1 04-May-2009  yamt sync with head.
 1.15.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.16.68.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.17.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.18.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.5 08-Jul-1998  mjacob add some more offset definitions
 1.4 04-Jun-1997  cgd branches: 1.4.6;
make REGVAL macros use volatile pointers
 1.3 06-Apr-1997  cgd branches: 1.3.2;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.6.2 04-Jun-1997  cgd make REGVAL macros use volatile pointers
 1.4.6.1 04-Jun-1997  cgd file kftxxreg.h was added on branch alpha-nwscons on 1997-06-04 01:47:16 +0000
 1.6 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 11-Dec-2005  christos branches: 1.5.112; 1.5.116;
merge ktrace-lwp.
 1.4 02-Jun-2005  drochner add more "const"
 1.3 06-Apr-1997  cgd branches: 1.3.2; 1.3.8; 1.3.60;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.60.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.8.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.8.1 06-Apr-1997  cgd file kftxxvar.h was added on branch alpha-nwscons on 1997-04-06 20:08:39 +0000
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.116.1 18-Feb-2012  mrg merge to -current.
 1.5.112.1 17-Apr-2012  yamt sync with head
 1.19 02-Mar-2024  thorpej Shuffle GBus-related files into their own directory in preparation for
other GBus attachments. No functional change here; just minimal editing
to reflect path differences after moving the files.
 1.18 07-May-2021  thorpej Static'ify more symbols.
 1.17 01-Jul-2011  dyoung branches: 1.17.70;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16 29-Mar-2008  tsutsui Don't forget to initialize sc_dev.
 1.15 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.14 17-Oct-2007  garbled branches: 1.14.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.13 21-Jul-2007  tsutsui branches: 1.13.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.10; 1.12.12; 1.12.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 24-Nov-2006  christos branches: 1.11.4;
fix spelling of accommodate; from Zapher.
 1.10 02-Oct-2002  thorpej branches: 1.10.22; 1.10.52; 1.10.54;
Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 13-May-1998  thorpej branches: 1.8.26; 1.8.28;
Normalize gbus configuration somewhat, and add support for configuring
the Zilog DUARTs.
 1.7 12-Jan-1998  thorpej Adjust for config changes.
 1.6 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.5 22-Jul-1997  jonathan branches: 1.5.2; 1.5.4;
Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.4 07-Apr-1997  cgd branches: 1.4.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.2 22-Jul-1997  jonathan Use new <dev/dec/clockvar.h> and and <dev/dec/mcclokvar.h>.
Garbage-collect original headers from sys/arch/alpha.
 1.5.4.1 22-Jul-1997  jonathan file mcclock_tlsb.c was added on branch alpha-nwscons on 1997-07-22 18:51:04 +0000
 1.5.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.28.1 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.8.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.10.54.1 10-Dec-2006  yamt sync with head.
 1.10.52.1 12-Jan-2007  ad Sync with head.
 1.10.22.2 03-Sep-2007  yamt sync with head.
 1.10.22.1 30-Dec-2006  yamt sync with head.
 1.11.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.12.12.1 07-Aug-2007  matt Sync with HEAD.
 1.12.10.1 03-Oct-2007  garbled Sync with HEAD
 1.12.2.1 20-Aug-2007  ad Sync with HEAD.
 1.13.6.1 06-Nov-2007  matt sync with HEAD
 1.14.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.70.1 13-May-2021  thorpej Sync with HEAD.
 1.42 06-Mar-2024  thorpej Tidy up TLSB autoconfiguration just a bit.
 1.41 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.40 04-Jul-2021  thorpej branches: 1.40.2;
Remove unnecessary #include <sys/malloc.h>
 1.39 24-Apr-2021  thorpej branches: 1.39.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.38 26-Mar-2014  christos branches: 1.38.44;
kill sprintf
 1.37 06-Feb-2012  matt branches: 1.37.6; 1.37.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.36 14-Jun-2011  matt branches: 1.36.2; 1.36.6;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.35 06-Jun-2011  matt CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
 1.34 14-Mar-2009  dsl branches: 1.34.4; 1.34.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.33 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.32 04-Mar-2007  christos branches: 1.32.44; 1.32.52; 1.32.58;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 11-Dec-2005  christos branches: 1.31.26;
merge ktrace-lwp.
 1.30 26-Aug-2005  drochner kill some more simple submatch() functions, use config_stdsubmatch()
 1.29 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.28 02-Jun-2005  drochner branches: 1.28.2;
add more "const"
 1.27 13-Sep-2004  drochner pass locators to tlsbsubmatch()
XXX the "offset" locator is unused appearently, assume that "0"
is a sensible value
 1.26 01-Jan-2003  thorpej branches: 1.26.2;
Use aprint_normal() for cfprint routines.
 1.25 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.24 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.23 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.22 12-Jul-2001  thorpej branches: 1.22.2;
bzero -> memset
 1.21 21-Apr-2001  thorpej branches: 1.21.2;
Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.20 20-Apr-2001  thorpej Adjust for a multiprocessor data structure change (whee, I guess
I haven't built a GENERIC.MP for a while...)
 1.19 10-Aug-1999  thorpej branches: 1.19.2; 1.19.14;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.18 10-Apr-1999  cgd be more consistent about use of 'cputype'. e.g. it's in a header, don't
bother 'externing' it everywhere!
 1.17 23-Feb-1999  thorpej branches: 1.17.4;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.16 12-Feb-1999  thorpej Fix printf format problems on Alpha. (IRONIC?!)
 1.15 19-Nov-1998  ross More include shuffling.
 1.14 01-Oct-1998  ross If not MULTIPROCESSOR then identify the interrupt target cpu by hwrpb id (%d)
rather than attachment name, and hence avoid referencing `cpus'.
 1.13 29-Sep-1998  thorpej - Do not set TLCPUMASK on non-I/O nodes. That register exists only on
I/O nodes. Previous code erroneously set it on CPU nodes only.
- In both the single- and multi-processor case, route all interrupts from
I/O nodes to the primary CPU, for now.
 1.12 08-Jul-1998  mjacob Clarify comment about what nodes are being 'found' and noted for later
use by an error handler:

* There can be only one TurboLaser, and we'll overload it
* with a bitmap of found turbo laser nodes. Note that
* these are just the actual hard TL node IDS that we
* discover here, not the virtual IDs that get assigned
* to CPUs. During TLSB specific error handling we
* only need to know which actual TLSB slots have boards
* in them (irrespective of how many CPUs they have).
 1.11 08-Jul-1998  mjacob There can only be one TurboLaser node, and now we'll overload
into the integer tlsb_found a bit map of found nodes and export
it to the rest of the kernel. This is so that at machine check
time when we're doing some TLSB/KFTXX error handling we don't
have to attempt a badaddr to look at all TLSB nodes (which will
just be too sad to try...).
 1.10 14-May-1998  thorpej Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.9 13-May-1998  thorpej Cleanup TurboLaser autoconfiguration somewhat.
 1.8 15-Apr-1998  mjacob some cleanup
 1.7 12-Jan-1998  thorpej Adjust for config changes.
 1.6 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.5 17-Jul-1997  jtk branches: 1.5.2; 1.5.4;
use locator defines in "locators.h" to index cf_loc[]
 1.4 07-Apr-1997  cgd branches: 1.4.2;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.2 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.5.4.1 17-Jul-1997  jtk file tlsb.c was added on branch alpha-nwscons on 1997-07-17 01:27:23 +0000
 1.5.2.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.19.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.2.1 23-Apr-2001  bouyer Sync with HEAD.
 1.21.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.21.2.1 03-Aug-2001  lukem update to -current
 1.22.2.3 03-Jan-2003  thorpej Sync with HEAD.
 1.22.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.22.2.1 12-Jul-2001  nathanw file tlsb.c was added on branch nathanw_sa on 2002-10-18 02:34:34 +0000
 1.26.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.26.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.2 03-Sep-2007  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.31.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.44.1 04-May-2009  yamt sync with head.
 1.34.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.34.4.1 12-Jun-2011  rmind sync with head
 1.36.6.1 18-Feb-2012  mrg merge to -current.
 1.36.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.2.1 17-Apr-2012  yamt sync with head
 1.37.10.1 18-May-2014  rmind sync with head
 1.37.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.44.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.38.44.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.39.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.40.2.1 03-Aug-2021  thorpej Adapt to CFARGS().
 1.12 04-Jul-2021  thorpej Remove unnecessary #include <sys/malloc.h>
 1.11 14-Jun-2011  matt branches: 1.11.70;
Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.10 14-Mar-2009  dsl branches: 1.10.10;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.9 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.8 02-Oct-2002  thorpej branches: 1.8.112; 1.8.120; 1.8.126;
Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 12-Jan-1998  thorpej branches: 1.6.26; 1.6.28;
Adjust for config changes.
 1.5 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.4 07-Apr-1997  cgd branches: 1.4.2; 1.4.6; 1.4.8;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings, include machine/options.h
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.4.8.2 07-Apr-1997  cgd by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.4.8.1 07-Apr-1997  cgd file tlsbmem.c was added on branch alpha-nwscons on 1997-04-07 23:41:11 +0000
 1.4.6.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.28.1 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.6.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.8.126.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.120.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.112.1 04-May-2009  yamt sync with head.
 1.10.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 01-Jan-2022  andvar fix typos in word "diagnostic".
 1.6 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.5 27-Jan-2000  mjacob branches: 1.5.168; 1.5.172;
Add some defines for TLSB interrupt mask and summary registers. Update
copyright.
 1.4 08-Jul-1998  mjacob branches: 1.4.14;
add some error handling specific definitions
 1.3 06-Apr-1997  cgd branches: 1.3.2; 1.3.8;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.8.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.8.1 06-Apr-1997  cgd file tlsbreg.h was added on branch alpha-nwscons on 1997-04-06 20:08:41 +0000
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.172.1 18-Feb-2012  mrg merge to -current.
 1.5.168.1 17-Apr-2012  yamt sync with head
 1.8 06-Mar-2024  thorpej Tidy up TLSB autoconfiguration just a bit.
 1.7 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 08-Jul-1998  mjacob branches: 1.6.188; 1.6.192;
There can only be one TurboLaser node, and now we'll overload
into the integer tlsb_found a bit map of found nodes and export
it to the rest of the kernel. This is so that at machine check
time when we're doing some TLSB/KFTXX error handling we don't
have to attempt a badaddr to look at all TLSB nodes (which will
just be too sad to try...).
 1.5 13-May-1998  thorpej Cleanup TurboLaser autoconfiguration somewhat.
 1.4 15-Apr-1998  mjacob some cleanup
 1.3 06-Apr-1997  cgd branches: 1.3.2; 1.3.8;
clean up NetBSD RCS ID strings
 1.2 12-Mar-1997  cgd Copyright notice consistency, per Matthew Jacob.
 1.1 12-Mar-1997  cgd AlphaServer 8200 & 8400 support, including CPU specific details, TurboLaser
system bus support, and KFTxx support. From Matthew Jacob, NASA Ames
Research Center.
 1.3.8.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3.8.1 06-Apr-1997  cgd file tlsbvar.h was added on branch alpha-nwscons on 1997-04-06 20:08:42 +0000
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.192.1 18-Feb-2012  mrg merge to -current.
 1.6.188.1 17-Apr-2012  yamt sync with head

RSS XML Feed