Home | History | Annotate | only in /src/sys/arch/alpha/pci
History log of /src/sys/arch/alpha/pci
RevisionDateAuthorComments
 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.

RSS XML Feed