Home | History | Annotate | only in /src/sys/arch/i386/pci
History log of /src/sys/arch/i386/pci
RevisionDateAuthorComments
 1.3 27-Jan-1995  mycroft Clean up deleted files.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.2 09-Aug-1994  mycroft Add PCI autoconfiguration support.
 1.1.2.1 09-Aug-1994  mycroft file README was added on branch netbsd-1-0 on 1994-08-09 00:47:47 +0000
 1.5 18-Dec-2006  christos move to x86/pci/agp_machdep.c from Blair Sadewitz
 1.4 22-Nov-2002  fvdl branches: 1.4.22; 1.4.52; 1.4.54;
New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.3 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.2 15-Nov-2001  lukem branches: 1.2.2;
add RCSID
 1.1 10-Sep-2001  fvdl branches: 1.1.2; 1.1.4; 1.1.8;
Attach agp gart support @ pchb. Not very clean, but agp support may
be spread over several devices, and the phcb is usually the main one.

Add agp_machdep.c file which implements MD agp functions (currently
just agp_flush_cache).
 1.1.8.2 01-Oct-2001  fvdl Catch up with -current.
 1.1.8.1 10-Sep-2001  fvdl file agp_machdep.c was added on branch thorpej-devvp on 2001-10-01 12:40:07 +0000
 1.1.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.1.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.4.1 10-Sep-2001  nathanw file agp_machdep.c was added on branch nathanw_sa on 2001-09-21 22:35:11 +0000
 1.1.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.2.1 10-Sep-2001  thorpej file agp_machdep.c was added on branch kqueue on 2001-09-13 01:13:50 +0000
 1.2.2.2 27-Apr-2002  sommerfeld Merge with current as of today
 1.2.2.1 15-Nov-2001  sommerfeld file agp_machdep.c was added on branch sommerfeld_i386mp_1 on 2002-04-27 20:24:49 +0000
 1.4.54.1 21-Dec-2006  yamt sync with head.
 1.4.52.1 12-Jan-2007  ad Sync with head.
 1.4.22.1 30-Dec-2006  yamt sync with head.
 1.13 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.12 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.11 15-Dec-2009  snj Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.10 28-Apr-2008  martin branches: 1.10.14;
Remove clause 3 and 4 from TNF licenses
 1.9 16-Nov-2006  christos branches: 1.9.52; 1.9.54; 1.9.56;
__unused removal on arguments; approved by core.
 1.8 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 03-Feb-2005  perry de-__P, partially ANSIfy
 1.5 26-Feb-2003  fvdl branches: 1.5.2; 1.5.10; 1.5.12;
Adapt for i386/x86 change.
 1.4 20-Jan-2003  simonb Put the storage class first.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 13-Sep-2001  tshiozak branches: 1.2.2; 1.2.8;
correct the set/get trigger code for ALi M1543 interrupt router.
 1.1 27-Aug-2001  haya branches: 1.1.4; 1.1.6;
Add support for ALi M1543 in pcibios.
 1.1.6.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.6.1 27-Aug-2001  thorpej file ali1543.c was added on branch kqueue on 2001-09-13 01:13:50 +0000
 1.1.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.8.2 27-Oct-2001  he Pull up revisions 1.1-1.2 (new, requested by hubertf):
Add support for ALi M1543 in pcibios as e.g. found in a Toshiba
Portege 4000.
Tested by hubertf.
 1.2.8.1 13-Sep-2001  he file ali1543.c was added on branch netbsd-1-5 on 2001-10-27 20:29:09 +0000
 1.2.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.2.1 13-Sep-2001  nathanw file ali1543.c was added on branch nathanw_sa on 2001-09-21 22:35:12 +0000
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file ali1543.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.5.12.1 12-Feb-2005  yamt sync with head.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Feb-2005  skrll Sync with HEAD.
 1.7.22.2 10-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.9.56.2 11-Mar-2010  yamt sync with head
 1.9.56.1 16-May-2008  yamt sync with head.
 1.9.54.1 18-May-2008  yamt sync with head.
 1.9.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.14.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.10.14.1 24-Oct-2010  jym Sync with HEAD
 1.9 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.8 28-Apr-2008  martin branches: 1.8.14;
Remove clause 3 and 4 from TNF licenses
 1.7 16-Nov-2006  christos branches: 1.7.52; 1.7.54; 1.7.56;
__unused removal on arguments; approved by core.
 1.6 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.5 11-Dec-2005  christos branches: 1.5.20; 1.5.22;
merge ktrace-lwp.
 1.4 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.3 26-Feb-2003  fvdl branches: 1.3.2;
Adapt for i386/x86 change.
 1.2 15-Nov-2001  lukem branches: 1.2.2;
add RCSID
 1.1 19-Apr-2001  uch branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10;
patch PR port-i386/11114 by MINOURA Makoto.
 1.1.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.8.3 08-Jan-2002  nathanw Catch up to -current.
 1.1.8.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.8.1 19-Apr-2001  nathanw file amd756.c was added on branch nathanw_sa on 2001-06-21 19:26:04 +0000
 1.1.4.2 23-Apr-2001  bouyer Sync with HEAD.
 1.1.4.1 19-Apr-2001  bouyer file amd756.c was added on branch thorpej_scsipi on 2001-04-23 09:41:50 +0000
 1.1.2.1 21-Apr-2001  thorpej Add files to sommerfeld_i386mp_1 branch that have recently
appeared on the trunk.
 1.2.2.2 15-Nov-2001  lukem add RCSID
 1.2.2.1 15-Nov-2001  lukem file amd756.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.22.2 10-Dec-2006  yamt sync with head.
 1.5.22.1 22-Oct-2006  yamt sync with head
 1.5.20.1 18-Nov-2006  ad Sync with head.
 1.7.56.1 16-May-2008  yamt sync with head.
 1.7.54.1 18-May-2008  yamt sync with head.
 1.7.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 19-Apr-2001  uch branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.132; 1.1.134; 1.1.136;
patch PR port-i386/11114 by MINOURA Makoto.
 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.8.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.8.1 19-Apr-2001  nathanw file amd756reg.h was added on branch nathanw_sa on 2001-06-21 19:26:05 +0000
 1.1.6.2 19-Apr-2001  uch patch PR port-i386/11114 by MINOURA Makoto.
 1.1.6.1 19-Apr-2001  uch file amd756reg.h was added on branch sommerfeld_i386mp_1 on 2001-04-19 17:32:41 +0000
 1.1.4.2 23-Apr-2001  bouyer Sync with HEAD.
 1.1.4.1 19-Apr-2001  bouyer file amd756reg.h was added on branch thorpej_scsipi on 2001-04-23 09:41:50 +0000
 1.1.2.1 21-Apr-2001  thorpej Add files to sommerfeld_i386mp_1 branch that have recently
appeared on the trunk.
 1.52 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.51 24-Apr-2021  thorpej branches: 1.51.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.50 08-Nov-2013  christos branches: 1.50.44;
fix unused variable warnings
 1.49 01-Jul-2011  dyoung branches: 1.49.2; 1.49.12; 1.49.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.48 26-Feb-2010  jym Fixes regarding paddr_t/pd_entry_t types in MD x86 code, exposed by PAE:

- NBPD_* macros are set to the types that better match their architecture
(UL for i386 and amd64, ULL for i386 PAE) - will revisit when paddr_t is
set to 64 bits for i386 non-PAE.

- type fixes in printf/printk messages (Use PRIxPADDR when printing paddr_t
values, instead of %lx - paddr_t/pd_entry_t being 64 bits with PAE)

- remove casts that are no more needed now that Xen2 support has been dropped

Some fixes are from jmorse@ patches for PAE.

Compile + tested for i386 GENERIC and XEN3 kernels. Only compile tested for
amd64.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
 1.47 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.46 08-Jan-2010  dyoung branches: 1.46.2;
Expand PMF_FN_* macros.
 1.45 08-Jan-2010  dyoung Move all copies of ifattr_match() to sys/kern/subr_autoconf.c.
 1.44 01-Dec-2009  dyoung KNF: define struct pareg near the top of the file.
 1.43 17-Sep-2009  dyoung As Jonathan Kollasch points out, elansc_attach() does not actually
use gba after filling it out. Delete it.
 1.42 29-Apr-2009  dyoung Add elansc_shutdown() for turning off the watchdog.

Don't try to unregister the watchdog in elansc_detach() if we are
shutting the system down, because unregistering is designed to fail if
the watchdog is armed.
 1.41 29-Apr-2009  dyoung Delete dead code.
 1.40 08-Apr-2009  dyoung Move elanpar0 and elanpex0 attachment out of the #if NGPIO > 0 block in
elansc_attach().

Let us detach gpio0 at elansc0.

Let us re-attach pci0 at elansc0.

Reduce code duplication between elansc_rescan() and elansc_attach():
call _rescan() from _attach() to attach elanpex0, elanpar0, gpio0, and
pci0.
 1.39 02-Apr-2009  dyoung During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
 1.38 24-Feb-2009  yamt - rewrite x86 nmi dispatcher so that establish and disesablish are safe
on a running system.
- adapt existing users of the api. (elan)
- adapt tprof_pmi driver to use the api.
 1.37 06-Feb-2009  dyoung branches: 1.37.2;
When elansc(4) is detached, restore BIOS settings on the SC520's
programmable interrupt controller (PIC).
 1.36 06-Feb-2009  dyoung So that I can both detach and *re-attach* elanpar0, elanpex0, and
gpio0, let elansc(4) rescan for them.
 1.35 31-May-2008  dyoung branches: 1.35.6;
Use printf_tolog() instead of aprint_error_dev() to report PCI
exceptions and write-protection violations.

While I'm here, add a comment to describe the interrupt configuration.
 1.34 30-May-2008  ad Add a 'known_mpsafe' argument to intr_establish().
 1.33 01-May-2008  dyoung branches: 1.33.2;
Release mutex before unmapping bus space to stop a locking error.
 1.32 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.31 08-Apr-2008  dyoung branches: 1.31.2; 1.31.4;
Attach elansc(4) at mainbus(4) instead of at pci(4). Attach pci(4)
at elansc(4). Take advantage of a suspend/resume cycle to reconfigure
the SC520's PCI host-bridge bus for higher performance. Update
the manual pages and the NET4501 kernel.
 1.30 07-Apr-2008  dyoung Defer write-protecting the kernel text until after interrupts are
enabled. This is a grotty hack that lets a MULTIPROCESSOR kernel
patch the kernel with x86_patch() without trapping to the debugger.
 1.29 07-Apr-2008  dyoung Complete device_t/softc split.
 1.28 26-Mar-2008  dyoung Define fkb and sfkb once instead of in both elansc_protect_text()
and elansc_protect(). Should stop GCC from complaining about an
unused variable fkb.
 1.27 26-Mar-2008  dyoung Use as many as two Programmable Address Regions (PARs) with 4kB
granularity to protect some of the kernel text that is not protected
by the PAR with 64kB granularity.
 1.26 04-Mar-2008  dyoung Extract shutdown handlers from the detach methods of elanpar(4)
and elanpex(4). Register them using pmf_device_register1(). This
ensures that neither comBIOS nor NetBSD will hang during boot,
after I reboot a Soekris net45xx.
 1.25 03-Mar-2008  dyoung Fix a typo that could lead to a panic when I suspend elanpar(4).
 1.24 29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.23 18-Feb-2008  dyoung branches: 1.23.2; 1.23.6;
Adapt the code for write-protecting the Interrupt Descriptor Table,
which wasn't such a good idea, to protect physical page 0, instead.
 1.22 21-Jan-2008  dyoung Attach two new devices to the AMD Elan SC520 System Controller,
elansc(4).

elanpex(4) is for PCI exception reporting. I've already found some
kernel bugs by reading the exceptions reported. Beware that it
will spam the console a lot while the kernel and pcictl(8) probe
non-existing addresses in PCI configuration space.

elanpar(4) protects the kernel text from writes by the CPU and by
PCI bus masters. As you might guess, this is not compatible with
setting breakpoints using a debugger; detach the device using
'drvctl -d elanpar0' before you try to set breakpoints. In the
future, I hope to extend elanpar(4) to provide general-purpose RAM
write-protection.
 1.21 08-Jan-2008  dyoung Use aprint_*_dev(), device_xname(), and device_t. Join a line.
 1.20 21-Dec-2007  dyoung Get rid of sc_suspended, it is redundant because the device_t
contains the same state.
 1.19 16-Dec-2007  dyoung Miscellaneous changes designed to improve elansc suspend/detachment:

1 Synchronize access to the softc and hardware with a mutex.
2 Add the sc_suspended flag, and observe it in the watchdog routines.
3 Re-order operations in elansc_attach() and elansc_detach() to
protect against access while the device is not fully configured.
4 Cancel detachment if sysmon_wdog_unregister() is cancelled by a
signal.
5 Add an empty childdetached method so that I can detach gpio0 at
elansc0. (XXX cannot individually re-attach gpio0.)
 1.18 16-Dec-2007  dyoung Add a detach routine.
 1.17 15-Dec-2007  dyoung Add a suspend/resume handler. Do not suspend if the watchdog timer
is active. Reinitialize the watchdog timer on resume. If the
device is not powered, neither tickle the watchdog nor set the
watchdog's mode, but return EBUSY, instead.
 1.16 16-Nov-2006  christos branches: 1.16.28; 1.16.34; 1.16.38; 1.16.42;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 19-Feb-2006  thorpej branches: 1.14.14; 1.14.16;
Use aprint_*().
 1.13 26-Dec-2005  perry branches: 1.13.2; 1.13.4; 1.13.6;
u_intN_t -> uintN_t
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 14-Oct-2005  riz Move a little more under #if NGPIO > 0
 1.10 11-Oct-2005  drochner -put gpio stuff inside #if NGPIO > 0
-kill gba_name in attach arg, specify interface attribute
 1.9 07-Oct-2005  riz Add support for the gpio(4) framework to the elansc(4) system controller.

From Alexander Yurchenko (grange@openbsd), via OpenBSD.
Approved by jmcneill.
 1.8 04-Dec-2003  keihan branches: 1.8.16;
netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.7 25-Oct-2003  christos Fix uninitialized variable warnings.
 1.6 25-Oct-2003  christos Fix uninitialized variable warnings
 1.5 01-Apr-2003  thorpej branches: 1.5.2;
Use PAGE_SIZE rather than NBPG.
 1.4 02-Oct-2002  thorpej Tidy up CFATTACH_DECL() formatting.
 1.3 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 12-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Add a driver for the AMD Elan SC520 System Controller. The "elansc"
driver attaches where "pchb" would normally attach (it matches at a
higher match priority). The "elansc" driver currently provides support
for the watchdog timer built-in the SC520.

Thanks to Jasper Wallace for laying the ground-work for this (most
notably by providing a work-around for a watchdog-related bug in the
SC520).
 1.1.8.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.1.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.8.1 12-Aug-2002  jdolecek file elan520.c was added on branch kqueue on 2002-09-06 08:36:31 +0000
 1.1.6.2 31-Aug-2002  gehenna catch up with -current.
 1.1.6.1 12-Aug-2002  gehenna file elan520.c was added on branch gehenna-devsw on 2002-08-31 13:44:58 +0000
 1.1.4.2 12-Aug-2002  thorpej Add a driver for the AMD Elan SC520 System Controller. The "elansc"
driver attaches where "pchb" would normally attach (it matches at a
higher match priority). The "elansc" driver currently provides support
for the watchdog timer built-in the SC520.

Thanks to Jasper Wallace for laying the ground-work for this (most
notably by providing a work-around for a watchdog-related bug in the
SC520).
 1.1.4.1 12-Aug-2002  thorpej file elan520.c was added on branch sommerfeld_i386mp_1 on 2002-08-12 01:03:14 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file elan520.c was added on branch nathanw_sa on 2002-08-13 02:18:24 +0000
 1.5.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.5 17-Mar-2008  yamt sync with head.
 1.8.16.4 27-Feb-2008  yamt sync with head.
 1.8.16.3 21-Jan-2008  yamt sync with head
 1.8.16.2 30-Dec-2006  yamt sync with head.
 1.8.16.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 01-Mar-2006  yamt sync with head.
 1.14.16.2 10-Dec-2006  yamt sync with head.
 1.14.16.1 22-Oct-2006  yamt sync with head
 1.14.14.1 18-Nov-2006  ad Sync with head.
 1.16.42.3 23-Jan-2008  bouyer Sync with HEAD.
 1.16.42.2 08-Jan-2008  bouyer Sync with HEAD
 1.16.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.38.1 26-Dec-2007  ad Sync with head.
 1.16.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.16.28.2 23-Mar-2008  matt sync with HEAD
 1.16.28.1 09-Jan-2008  matt sync with HEAD
 1.23.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.23.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.2.1 24-Mar-2008  keiichi sync with head.
 1.31.4.3 11-Mar-2010  yamt sync with head
 1.31.4.2 04-May-2009  yamt sync with head.
 1.31.4.1 16-May-2008  yamt sync with head.
 1.31.2.2 04-Jun-2008  yamt sync with head
 1.31.2.1 18-May-2008  yamt sync with head.
 1.33.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.35.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.37.2.4 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.37.2.3 24-Oct-2010  jym Sync with HEAD
 1.37.2.2 01-Nov-2009  jym Sync with HEAD.
 1.37.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.46.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.49.16.1 18-May-2014  rmind sync with head
 1.49.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.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.50.44.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.51.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 07-Jan-2008  dyoung branches: 1.9.6; 1.9.8; 1.9.10;
Define some "special" values of register MMCR_WPVMAP.
 1.8 20-Dec-2007  dyoung Add definitions for several more registers on the AMD Elan SC520
System Controller.
 1.7 17-Oct-2007  garbled branches: 1.7.2; 1.7.4; 1.7.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 10-Aug-2007  dyoung branches: 1.6.2;
Add offset for Host Bridge Target Interrupt Control register.
 1.5 18-Apr-2007  dyoung branches: 1.5.2; 1.5.6; 1.5.10;
Add definitions for the AMD Elan 520 Host Bridge Master Interrupt
Control register.
 1.4 26-Jan-2007  dyoung branches: 1.4.2; 1.4.6; 1.4.8;
Define some more registers on the AMD Elan SC520, according to the
datasheet.
 1.3 11-Dec-2005  christos branches: 1.3.20;
merge ktrace-lwp.
 1.2 07-Oct-2005  riz Add support for the gpio(4) framework to the elansc(4) system controller.

From Alexander Yurchenko (grange@openbsd), via OpenBSD.
Approved by jmcneill.
 1.1 12-Aug-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.30;
Add a driver for the AMD Elan SC520 System Controller. The "elansc"
driver attaches where "pchb" would normally attach (it matches at a
higher match priority). The "elansc" driver currently provides support
for the watchdog timer built-in the SC520.

Thanks to Jasper Wallace for laying the ground-work for this (most
notably by providing a work-around for a watchdog-related bug in the
SC520).
 1.1.30.4 21-Jan-2008  yamt sync with head
 1.1.30.3 03-Sep-2007  yamt sync with head.
 1.1.30.2 26-Feb-2007  yamt sync with head.
 1.1.30.1 21-Jun-2006  yamt sync with head.
 1.1.14.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.8.1 12-Aug-2002  jdolecek file elan520reg.h was added on branch kqueue on 2002-09-06 08:36:31 +0000
 1.1.6.2 31-Aug-2002  gehenna catch up with -current.
 1.1.6.1 12-Aug-2002  gehenna file elan520reg.h was added on branch gehenna-devsw on 2002-08-31 13:44:58 +0000
 1.1.4.2 12-Aug-2002  thorpej Add a driver for the AMD Elan SC520 System Controller. The "elansc"
driver attaches where "pchb" would normally attach (it matches at a
higher match priority). The "elansc" driver currently provides support
for the watchdog timer built-in the SC520.

Thanks to Jasper Wallace for laying the ground-work for this (most
notably by providing a work-around for a watchdog-related bug in the
SC520).
 1.1.4.1 12-Aug-2002  thorpej file elan520reg.h was added on branch sommerfeld_i386mp_1 on 2002-08-12 01:03:15 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 12-Aug-2002  nathanw file elan520reg.h was added on branch nathanw_sa on 2002-08-13 02:18:24 +0000
 1.3.20.1 01-Feb-2007  ad Sync with head.
 1.4.8.1 11-Jul-2007  mjf Sync with head.
 1.4.6.2 20-Aug-2007  ad Sync with HEAD.
 1.4.6.1 27-May-2007  ad Sync with head.
 1.4.2.1 07-May-2007  yamt sync with head.
 1.5.10.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.5.6.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.2.1 03-Oct-2007  garbled Sync with HEAD
 1.6.2.2 09-Jan-2008  matt sync with HEAD
 1.6.2.1 06-Nov-2007  matt sync with HEAD
 1.7.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.7.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.7.4.1 26-Dec-2007  ad Sync with head.
 1.7.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.9.10.1 16-May-2008  yamt sync with head.
 1.9.8.1 18-May-2008  yamt sync with head.
 1.9.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.14 24-Apr-2021  thorpej branches: 1.14.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.13 09-Apr-2018  jakllsch branches: 1.13.16;
Stop potential misuse of vendor names and USB vendor IDs in root hub
device and string descriptors.

Firstly: Few vendors have identical PCI-SIG vendor IDs and USB-IF vendor
IDs. As such, using the PCI vendor ID as a USB vendor ID may trample
on whomever is allocated that USB vendor ID.

Secondly: The vendor of the host controller hardware implementation has
little to nothing to do with our usbroothub implementation. Thus we
should not potentially associate any problems therewith to such third
party.

This change will result in root hubs being identified by USB Vendor ID
0x0000. Root hub vendor string will now be "NetBSD" (or, specifically:
ostype). Product ID (0x0000) and product strings remain unchanged.
 1.12 23-Apr-2016  skrll branches: 1.12.16;
Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.11 21-Sep-2014  christos branches: 1.11.2;
adjust for the new findvendor
 1.10 29-Mar-2014  christos branches: 1.10.4; 1.10.8;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.9 01-Jul-2011  dyoung branches: 1.9.2; 1.9.12; 1.9.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.8 25-May-2010  pgoyette Revert earlier changes to callers of pci_find{vendor,product} since
the original routine entrypoint name has been restored.

Requested by dyoung@ and mrg@
 1.7 24-May-2010  pgoyette Update all callers of the pci_find{vendor,product} routines to now call
these routines through their global pointers.
 1.6 04-Dec-2009  njoly Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.5 04-May-2009  cegger struct device * -> device_t, use device_private()
No functional changes intended.
 1.4 06-Jul-2008  cegger branches: 1.4.10;
ryo shimizu: gscsehci doesn't work.

Correctly initialize softc. Fix from PR port-i386/39109.
 1.3 28-Apr-2008  martin branches: 1.3.2; 1.3.4;
Remove clause 3 and 4 from TNF licenses
 1.2 28-Mar-2008  drochner branches: 1.2.2; 1.2.4;
split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
 1.1 08-Jul-2007  jmcneill branches: 1.1.2; 1.1.4; 1.1.16; 1.1.36;
Add gcscehci(4), an EHCI glue driver for the AMD CS5536 companion
controller. This driver enables USB 2.0 high speed support on the
Soekris net5501 (comBIOS ver. 1.31m).
 1.1.36.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.36.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.36.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.16.2 03-Sep-2007  yamt sync with head.
 1.1.16.1 08-Jul-2007  yamt file gcscehci.c was added on branch yamt-lazymbuf on 2007-09-03 14:26:52 +0000
 1.1.4.2 15-Jul-2007  ad Sync with head.
 1.1.4.1 08-Jul-2007  ad file gcscehci.c was added on branch vmlocking on 2007-07-15 13:21:03 +0000
 1.1.2.2 11-Jul-2007  mjf Sync with head.
 1.1.2.1 08-Jul-2007  mjf file gcscehci.c was added on branch mjf-ufs-trans on 2007-07-11 20:00:11 +0000
 1.2.4.4 11-Mar-2010  yamt sync with head
 1.2.4.3 16-May-2009  yamt sync with head
 1.2.4.2 04-May-2009  yamt sync with head.
 1.2.4.1 16-May-2008  yamt sync with head.
 1.2.2.1 18-May-2008  yamt sync with head.
 1.3.4.1 18-Jul-2008  simonb Sync with head.
 1.3.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.10.4 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.4.10.3 24-Oct-2010  jym Sync with HEAD
 1.4.10.2 01-Nov-2009  jym Sync with HEAD.
 1.4.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.16.1 18-May-2014  rmind sync with head
 1.9.12.2 03-Dec-2017  jdolecek update from HEAD
 1.9.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.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.10.8.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.10.4.1 05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.11.2.4 12-Feb-2016  skrll Don't check ehci_init against USBD_NORMAL_COMPLETION as it returns int
and not usb_status_t
 1.11.2.3 05-Dec-2014  skrll Use int for return type for [eou]chi_init and motg_init.
 1.11.2.2 05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.11.2.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.12.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.13.16.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.14.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.16 11-Jul-2016  msaitoh KNF. No functional change.
 1.15 07-Oct-2013  jakllsch branches: 1.15.6;
Use the universal pciide_detach() for detach function of all remaining
pciide-core drivers, except pciide at pnpbios which isn't actually PCI.
 1.14 31-Jul-2012  bouyer branches: 1.14.2; 1.14.4;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.13 26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.12 24-Jul-2012  jakllsch Revert dsl@'s changes of Sun, 15 Jul 2012 10:55:35 +0000 and
Sun, 15 Jul 2012 10:56:50 +0000, excepting the kernel version bump.
First step in reverting regressions to ata(4) subsystem during the addition of
port multiplier support.
 1.11 15-Jul-2012  dsl Some namespace protection (and add greppablity).
Prefix the DRIVE_ and DRIVET_ constants from atavar.h with ATA_.
Don't use an enum for drive_type - you don't know how big it will be.
Move driver_type to avoid implicit structure padding (esp on arm).
This change is purely lexical and mechanical.

Update to 6.99.9 - this wasn't done when the SATA PMP changes
were made - I'm sure they warranted a bump.
 1.10 02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.9 04-Apr-2011  dyoung branches: 1.9.4;
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.8 05-Nov-2010  jakllsch branches: 1.8.2;
Pave the way for detachment of pciide(4)-family ATA controllers.
 1.7 18-Mar-2008  cube branches: 1.7.18; 1.7.24; 1.7.26;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.6 06-Oct-2007  xtraeme branches: 1.6.14; 1.6.18;
Use a two clause license for all the code I contributed.

The envsys code will be changed later.
 1.5 03-Sep-2007  xtraeme branches: 1.5.2; 1.5.4;
- Always use PIO Format 1, which allows independent control of command
and data (PIO Format 0 selects the speed of the slowest drive).
- Set correctly Ultra DMA and Multi-word DMA modes.
- Update comments to be more correct after reading again the datasheet.
 1.4 28-Jun-2007  xtraeme branches: 1.4.2; 1.4.4; 1.4.8; 1.4.12; 1.4.14; 1.4.16; 1.4.18;
Set the PIO mode to the correct drive not for drive1 always.
 1.3 28-Jun-2007  xtraeme Improve a comment.
 1.2 28-Jun-2007  xtraeme Fix a typo and remove unneeded assignments.
 1.1 27-Jun-2007  xtraeme Import i386/gcscide(4). A driver for the IDE Controller of the
AMD CS5535 Companion device found in the decTOP.

gcscide0 at pci0 dev 15 function 2
gcscide0: National Semiconductor/AMD CS5535 IDE Controller (rev. 0x00)

Supports Ultra DMA mode 4, Pio Mode 4 and MDMA mode 2.

"Go for it" jmcneill@.
 1.4.18.3 23-Sep-2007  wrstuden Sync with somewhat-recent netbsd-4.
 1.4.18.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.4.18.1 28-Jun-2007  wrstuden file gcscide.c was added on branch wrstuden-fixsa on 2007-09-03 07:03:35 +0000
 1.4.16.3 11-Sep-2007  msaitoh Pull up following revision(s) (requested by xtraeme in ticket #862):
sys/arch/i386/pci/gcscide.c: revision 1.5
- Always use PIO Format 1, which allows independent control of command
and data (PIO Format 0 selects the speed of the slowest drive).
- Set correctly Ultra DMA and Multi-word DMA modes.
- Update comments to be more correct after reading again the datasheet.
 1.4.16.2 29-Aug-2007  liamjfoy Pull up following (requested by xtraeme ticket #846):

Import i386/gcscide(4). A driver for the IDE Controller of the
AMD CS5535 Companion device found in the decTOP.

gcscide0 at pci0 dev 15 function 2
gcscide0: National Semiconductor/AMD CS5535 IDE Controller (rev. 0x00)

Supports Ultra DMA mode 4, Pio Mode 4 and MDMA mode 2.

"Go for it" jmcneill@.
 1.4.16.1 28-Jun-2007  liamjfoy file gcscide.c was added on branch netbsd-4 on 2007-08-29 18:34:18 +0000
 1.4.14.2 23-Mar-2008  matt sync with HEAD
 1.4.14.1 06-Nov-2007  matt sync with HEAD
 1.4.12.2 07-Oct-2007  joerg Sync with HEAD.
 1.4.12.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.4.8.1 10-Sep-2007  skrll Sync with HEAD.
 1.4.4.3 09-Oct-2007  ad Sync with head.
 1.4.4.2 15-Jul-2007  ad Sync with head.
 1.4.4.1 28-Jun-2007  ad file gcscide.c was added on branch vmlocking on 2007-07-15 13:21:04 +0000
 1.4.2.2 11-Jul-2007  mjf Sync with head.
 1.4.2.1 28-Jun-2007  mjf file gcscide.c was added on branch mjf-ufs-trans on 2007-07-11 20:00:12 +0000
 1.5.4.1 14-Oct-2007  yamt sync with head.
 1.5.2.4 24-Mar-2008  yamt sync with head.
 1.5.2.3 27-Oct-2007  yamt sync with head.
 1.5.2.2 03-Sep-2007  yamt sync with head.
 1.5.2.1 03-Sep-2007  yamt file gcscide.c was added on branch yamt-lazymbuf on 2007-09-03 14:26:52 +0000
 1.6.18.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.14.1 24-Mar-2008  keiichi sync with head.
 1.7.26.2 21-Apr-2011  rmind sync with head
 1.7.26.1 05-Mar-2011  rmind sync with head
 1.7.24.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.7.18.2 02-May-2011  jym Sync with head.
 1.7.18.1 10-Jan-2011  jym Sync with HEAD
 1.8.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.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.9.4.1 30-Oct-2012  yamt sync with head
 1.14.4.1 18-May-2014  rmind sync with head
 1.14.2.2 03-Dec-2017  jdolecek update from HEAD
 1.14.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.6.1 05-Oct-2016  skrll Sync with HEAD
 1.9 27-Aug-2011  bouyer Split gcscpcib into MI part, and MD pci attachement which is also in
charge of attaching the MD pcib device.
Will be used by the upcoming evbmips loongson support.
 1.8 27-Sep-2009  jakllsch Make this build without gpio(4).
 1.7 04-May-2009  cegger struct cfdata * -> cfdata_t
 1.6 20-Jul-2008  martin branches: 1.6.8;
Fix previous.
 1.5 20-Jul-2008  martin Explicitly add struct pcib_softc to the softc since the pcib functions
we call expect this.
 1.4 09-Jan-2008  xtraeme branches: 1.4.2; 1.4.4; 1.4.6; 1.4.12; 1.4.14; 1.4.18; 1.4.20; 1.4.22; 1.4.24;
Remove the unused mutex from softc.
 1.3 09-Jan-2008  xtraeme emo-style(9).
 1.2 09-Jan-2008  xtraeme Fix up some comments, from Yojiro UO in private email.
 1.1 09-Jan-2008  xtraeme Add gcscpcib(4): a driver for the AMD CS5535 and CS5536 Companion Device
that acts as PCI-ISA bridge and supports a Timecounter, Watchdog Timer
and GPIO.

Adapted by Yojiro UO and minor tweaks by me from OpenBSD. Tested on
CS5535 and CS5536. This closes PR kern/37577.
 1.4.24.1 19-Oct-2008  haad Sync with HEAD.
 1.4.22.1 28-Jul-2008  simonb Sync with head.
 1.4.20.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.18.3 11-Mar-2010  yamt sync with head
 1.4.18.2 16-May-2009  yamt sync with head
 1.4.18.1 04-May-2009  yamt sync with head.
 1.4.14.2 23-Mar-2008  matt sync with HEAD
 1.4.14.1 09-Jan-2008  matt file gcscpcib.c was added on branch matt-armv6 on 2008-03-23 02:04:07 +0000
 1.4.12.1 28-Sep-2008  mjf Sync with HEAD.
 1.4.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.4.6.1 09-Jan-2008  mjf file gcscpcib.c was added on branch mjf-devfs on 2008-02-18 21:04:41 +0000
 1.4.4.2 21-Jan-2008  yamt sync with head
 1.4.4.1 09-Jan-2008  yamt file gcscpcib.c was added on branch yamt-lazymbuf on 2008-01-21 09:37:11 +0000
 1.4.2.2 10-Jan-2008  bouyer Sync with HEAD
 1.4.2.1 09-Jan-2008  bouyer file gcscpcib.c was added on branch bouyer-xeni386 on 2008-01-10 23:43:25 +0000
 1.6.8.2 01-Nov-2009  jym Sync with HEAD.
 1.6.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3 02-Feb-2024  andvar s/attachement/attachment/ and s/detachement/detachment/.
 1.2 29-Aug-2011  bouyer Add a flags argument to gcscpcib_attach().
Add a flag argument which cause the waychdog to not be attached.
Use it to disable the watchdog on loongson-based platforms, where
the CS5536's reset output is not wired to the CPU reset line :(
 1.1 27-Aug-2011  bouyer Split gcscpcib into MI part, and MD pci attachement which is also in
charge of attaching the MD pcib device.
Will be used by the upcoming evbmips loongson support.
 1.2 27-Aug-2011  bouyer Split gcscpcib into MI part, and MD pci attachement which is also in
charge of attaching the MD pcib device.
Will be used by the upcoming evbmips loongson support.
 1.1 09-Jan-2008  xtraeme branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14;
Add gcscpcib(4): a driver for the AMD CS5535 and CS5536 Companion Device
that acts as PCI-ISA bridge and supports a Timecounter, Watchdog Timer
and GPIO.

Adapted by Yojiro UO and minor tweaks by me from OpenBSD. Tested on
CS5535 and CS5536. This closes PR kern/37577.
 1.1.14.2 23-Mar-2008  matt sync with HEAD
 1.1.14.1 09-Jan-2008  matt file gcscpcibreg.h was added on branch matt-armv6 on 2008-03-23 02:04:07 +0000
 1.1.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.6.1 09-Jan-2008  mjf file gcscpcibreg.h was added on branch mjf-devfs on 2008-02-18 21:04:41 +0000
 1.1.4.2 21-Jan-2008  yamt sync with head
 1.1.4.1 09-Jan-2008  yamt file gcscpcibreg.h was added on branch yamt-lazymbuf on 2008-01-21 09:37:11 +0000
 1.1.2.2 10-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 09-Jan-2008  bouyer file gcscpcibreg.h was added on branch bouyer-xeni386 on 2008-01-10 23:43:26 +0000
 1.17 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.16 24-Apr-2021  thorpej branches: 1.16.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.15 01-Jul-2011  dyoung branches: 1.15.68;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.14 19-Oct-2009  rmind Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
 1.13 10-May-2008  jmcneill branches: 1.13.12;
Use aprint_naive, cleanup error printing.
 1.12 05-May-2008  xtraeme branches: 1.12.2;
device_t/softc split and other related cosmetic changes.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 04-Apr-2008  cegger branches: 1.10.2; 1.10.4;
use aprint_*_dev and device_xname
OK joerg
 1.9 03-Jan-2008  dyoung branches: 1.9.6;
Support detachment of geodegcb(4) and its children, geodecntr(4)
and geodewdog(4). Support detachment of gscpcib0 and its child,
gpio0.
 1.8 16-Nov-2006  christos branches: 1.8.28; 1.8.34; 1.8.42;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 07-Jun-2006  kardel branches: 1.6.4; 1.6.8; 1.6.10;
convert to timecounters (from branch simonb-timecounters)
 1.5 08-Mar-2006  dyoung branches: 1.5.4; 1.5.6;
Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them. Improve the macros' names. Simplify their
implementation.

A brief description of each macro is below.

BIT(n): Return a bitmask with bit m set, where the least
significant bit is bit 0.

BITS(m, n): Return a bitmask with bits m through n, inclusive,
set. It does not matter whether m>n or m<=n.
The least significant bit is bit 0.

A "bitfield" is a span of consecutive bits defined by a
bitmask, where 1s select the bits in the bitfield. SHIFTIN,
SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
from device registers.

SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
defined by `mask', and return them. No
side-effects.

SHIFTOUT(v, mask): Extract and return the bitfield selected
by `mask' from `v', right-shifting the
bits so that the rightmost selected bit
is at bit 0. No side-effects.

SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
the rightmost non-zero bit is at bit
0. This is useful for finding the
greatest unsigned value that a bitfield
can hold. No side-effects. Note that
SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
* Register definitions taken from the RFMD RF3000 manual.
*/
#define RF3000_GAINCTL 0x11 /* TX variable gain control */
#define RF3000_GAINCTL_TXVGC_MASK BITS(7, 2)
#define RF3000_GAINCTL_SCRAMBLER BIT(1)

/*
* Shift the transmit power into the transmit-power field of the
* gain-control register and write it to the baseband processor.
*/
atw_rf3000_write(sc, RF3000_GAINCTL,
SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
* Register definitions taken from the ADMtek ADM8211 manual.
*
*/
#define ATW_RXSTAT_OWN BIT(31) /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1 BIT(17) /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0 BIT(16) /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK BITS(15,12) /* RX data rate */
#define ATW_RXSTAT_FL_MASK BITS(11,0) /* RX frame length, last
* descriptor only
*/

/* Extract the frame length from the Rx descriptor's
* status field.
*/
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
 1.4 19-Feb-2006  thorpej branches: 1.4.2; 1.4.4;
Use aprint_*().
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 22-Sep-2005  dyoung branches: 1.2.6;
Suppress false 'WARNING: LAST RESET DUE TO WATCHDOG EXPIRATION!'
indications by clearing the WDOVF status flag for real. The way
to do that is by writing 1, not 0.
 1.1 22-Sep-2005  dyoung Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 22-Sep-2005  skrll file geode.c was added on branch ktrace-lwp on 2005-11-10 13:56:53 +0000
 1.3.6.2 22-Apr-2006  simonb Sync with head.
 1.3.6.1 28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 01-Mar-2006  yamt sync with head.
 1.4.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.4.2.2 26-Jun-2006  yamt sync with head.
 1.4.2.1 13-Mar-2006  yamt sync with head.
 1.5.6.3 20-May-2006  tron Pull up following revision(s) (requested by riz in ticket #1333):
sys/arch/i386/pci/geode.c: revision 1.2
Suppress false 'WARNING: LAST RESET DUE TO WATCHDOG EXPIRATION!'
indications by clearing the WDOVF status flag for real. The way
to do that is by writing 1, not 0.
 1.5.6.2 20-May-2006  tron Pull up following revision(s) (requested by riz in ticket #1331):
sys/arch/i386/conf/GENERIC: revision 1.701
sys/arch/i386/pci/geodereg.h: revision 1.1
sys/arch/i386/conf/files.i386: revision 1.270
sys/arch/i386/pci/geode.c: revision 1.1
Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.5.6.1 08-Mar-2006  tron file geode.c was added on branch netbsd-3 on 2006-05-20 12:25:40 +0000
 1.5.4.1 19-Jun-2006  chap Sync with head.
 1.6.10.2 10-Dec-2006  yamt sync with head.
 1.6.10.1 22-Oct-2006  yamt sync with head
 1.6.8.1 18-Nov-2006  ad Sync with head.
 1.6.4.4 21-Jan-2008  yamt sync with head
 1.6.4.3 30-Dec-2006  yamt sync with head.
 1.6.4.2 21-Jun-2006  yamt sync with head.
 1.6.4.1 07-Jun-2006  yamt file geode.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.8.42.1 08-Jan-2008  bouyer Sync with HEAD
 1.8.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.8.28.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.2 11-Mar-2010  yamt sync with head
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.12.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.12.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.13.12.1 01-Nov-2009  jym Sync with HEAD.
 1.15.68.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.16.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.8 10-May-2008  jmcneill branches: 1.8.12;
Mhz -> MHz in aprint, use aprint_naive.
 1.7 05-May-2008  xtraeme branches: 1.7.2;
device_t/softc split and other related cosmetic changes.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 03-Jan-2008  dyoung branches: 1.5.6; 1.5.8; 1.5.10;
Support detachment of geodegcb(4) and its children, geodecntr(4)
and geodewdog(4). Support detachment of gscpcib0 and its child,
gpio0.
 1.4 16-Nov-2006  christos branches: 1.4.28; 1.4.34; 1.4.42;
__unused removal on arguments; approved by core.
 1.3 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.2 07-Jun-2006  kardel branches: 1.2.4; 1.2.6; 1.2.10; 1.2.12; 1.2.14;
convert to timecounters (from branch simonb-timecounters)
 1.1 28-Feb-2006  kardel branches: 1.1.2; 1.1.4;
file geodecntr.c was initially added on branch simonb-timecounters.
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.1 28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.2.14.2 10-Dec-2006  yamt sync with head.
 1.2.14.1 22-Oct-2006  yamt sync with head
 1.2.12.2 09-Sep-2006  rpaulo sync with head
 1.2.12.1 07-Jun-2006  rpaulo file geodecntr.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:14 +0000
 1.2.10.1 18-Nov-2006  ad Sync with head.
 1.2.6.4 21-Jan-2008  yamt sync with head
 1.2.6.3 30-Dec-2006  yamt sync with head.
 1.2.6.2 21-Jun-2006  yamt sync with head.
 1.2.6.1 07-Jun-2006  yamt file geodecntr.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.2.4.2 19-Jun-2006  chap Sync with head.
 1.2.4.1 07-Jun-2006  chap file geodecntr.c was added on branch chap-midi on 2006-06-19 03:44:26 +0000
 1.4.42.1 08-Jan-2008  bouyer Sync with HEAD
 1.4.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.4.28.1 09-Jan-2008  matt sync with HEAD
 1.5.10.1 16-May-2008  yamt sync with head.
 1.5.8.1 18-May-2008  yamt sync with head.
 1.5.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.12.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.9 19-Oct-2009  rmind Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
 1.8 31-Aug-2006  dyoung branches: 1.8.60; 1.8.74;
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
 1.7 07-Jun-2006  kardel branches: 1.7.4;
convert to timecounters (from branch simonb-timecounters)
 1.6 08-Mar-2006  dyoung branches: 1.6.4; 1.6.6;
Change macro names to avoid collisions:

BIT -> __BIT
BITS -> __BITS
 1.5 08-Mar-2006  dyoung Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them. Improve the macros' names. Simplify their
implementation.

A brief description of each macro is below.

BIT(n): Return a bitmask with bit m set, where the least
significant bit is bit 0.

BITS(m, n): Return a bitmask with bits m through n, inclusive,
set. It does not matter whether m>n or m<=n.
The least significant bit is bit 0.

A "bitfield" is a span of consecutive bits defined by a
bitmask, where 1s select the bits in the bitfield. SHIFTIN,
SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
from device registers.

SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
defined by `mask', and return them. No
side-effects.

SHIFTOUT(v, mask): Extract and return the bitfield selected
by `mask' from `v', right-shifting the
bits so that the rightmost selected bit
is at bit 0. No side-effects.

SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
the rightmost non-zero bit is at bit
0. This is useful for finding the
greatest unsigned value that a bitfield
can hold. No side-effects. Note that
SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
* Register definitions taken from the RFMD RF3000 manual.
*/
#define RF3000_GAINCTL 0x11 /* TX variable gain control */
#define RF3000_GAINCTL_TXVGC_MASK BITS(7, 2)
#define RF3000_GAINCTL_SCRAMBLER BIT(1)

/*
* Shift the transmit power into the transmit-power field of the
* gain-control register and write it to the baseband processor.
*/
atw_rf3000_write(sc, RF3000_GAINCTL,
SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
* Register definitions taken from the ADMtek ADM8211 manual.
*
*/
#define ATW_RXSTAT_OWN BIT(31) /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1 BIT(17) /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0 BIT(16) /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK BITS(15,12) /* RX data rate */
#define ATW_RXSTAT_FL_MASK BITS(11,0) /* RX frame length, last
* descriptor only
*/

/* Extract the frame length from the Rx descriptor's
* status field.
*/
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
 1.4 26-Dec-2005  perry branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10;
u_intN_t -> uintN_t
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 22-Sep-2005  dyoung branches: 1.2.6;
Cosmetic: s/writing writing/writing/ in comments.
 1.1 22-Sep-2005  dyoung Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 22-Sep-2005  skrll file geodereg.h was added on branch ktrace-lwp on 2005-11-10 13:56:53 +0000
 1.4.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.4.8.3 03-Sep-2006  yamt sync with head.
 1.4.8.2 26-Jun-2006  yamt sync with head.
 1.4.8.1 13-Mar-2006  yamt sync with head.
 1.4.6.3 22-Apr-2006  simonb Catch up with BIT->__BIT changes.
 1.4.6.2 22-Apr-2006  simonb Sync with head.
 1.4.6.1 28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.6.6.2 20-May-2006  tron Pull up following revision(s) (requested by riz in ticket #1331):
sys/arch/i386/conf/GENERIC: revision 1.701
sys/arch/i386/pci/geodereg.h: revision 1.1
sys/arch/i386/conf/files.i386: revision 1.270
sys/arch/i386/pci/geode.c: revision 1.1
Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.6.6.1 08-Mar-2006  tron file geodereg.h was added on branch netbsd-3 on 2006-05-20 12:25:40 +0000
 1.6.4.1 19-Jun-2006  chap Sync with head.
 1.7.4.3 30-Dec-2006  yamt sync with head.
 1.7.4.2 21-Jun-2006  yamt sync with head.
 1.7.4.1 07-Jun-2006  yamt file geodereg.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.8.74.1 01-Nov-2009  jym Sync with HEAD.
 1.8.60.1 11-Mar-2010  yamt sync with head
 1.4 20-Oct-2009  kardel update copyright to 2 clause version of the NetBSD Foundation
 1.3 05-May-2008  xtraeme branches: 1.3.14;
device_t/softc split and other related cosmetic changes.
 1.2 07-Jun-2006  kardel branches: 1.2.4; 1.2.6; 1.2.12; 1.2.66; 1.2.68; 1.2.70;
convert to timecounters (from branch simonb-timecounters)
 1.1 28-Feb-2006  kardel branches: 1.1.2; 1.1.4;
file geodevar.h was initially added on branch simonb-timecounters.
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.1 28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.2.70.2 11-Mar-2010  yamt sync with head
 1.2.70.1 16-May-2008  yamt sync with head.
 1.2.68.1 18-May-2008  yamt sync with head.
 1.2.66.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.12.2 09-Sep-2006  rpaulo sync with head
 1.2.12.1 07-Jun-2006  rpaulo file geodevar.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:14 +0000
 1.2.6.2 21-Jun-2006  yamt sync with head.
 1.2.6.1 07-Jun-2006  yamt file geodevar.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.2.4.2 19-Jun-2006  chap Sync with head.
 1.2.4.1 07-Jun-2006  chap file geodevar.h was added on branch chap-midi on 2006-06-19 03:44:26 +0000
 1.3.14.1 01-Nov-2009  jym Sync with HEAD.
 1.12 11-Jul-2016  msaitoh KNF. No functional change.
 1.11 01-Jul-2011  dyoung branches: 1.11.12; 1.11.30;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 19-Oct-2009  rmind Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
 1.9 05-May-2008  xtraeme branches: 1.9.14;
device_t/softc split and other related cosmetic changes.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 03-Jan-2008  dyoung branches: 1.7.6; 1.7.8; 1.7.10;
Support detachment of geodegcb(4) and its children, geodecntr(4)
and geodewdog(4). Support detachment of gscpcib0 and its child,
gpio0.
 1.6 17-Dec-2007  dyoung Cosmetic: wrap some lines. Join some lines. struct device * ->
device_t. Use device_t accessor functions.
 1.5 16-Nov-2006  christos branches: 1.5.28; 1.5.34; 1.5.38; 1.5.42;
__unused removal on arguments; approved by core.
 1.4 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.3 31-Aug-2006  dyoung branches: 1.3.2; 1.3.4; 1.3.6;
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
 1.2 07-Jun-2006  kardel branches: 1.2.4; 1.2.6;
convert to timecounters (from branch simonb-timecounters)
 1.1 28-Feb-2006  kardel branches: 1.1.2; 1.1.4;
file geodewdg.c was initially added on branch simonb-timecounters.
 1.1.4.2 03-Sep-2006  yamt sync with head.
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.2 22-Apr-2006  simonb Sync with head.
 1.1.2.1 28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.2.6.4 21-Jan-2008  yamt sync with head
 1.2.6.3 30-Dec-2006  yamt sync with head.
 1.2.6.2 21-Jun-2006  yamt sync with head.
 1.2.6.1 07-Jun-2006  yamt file geodewdg.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.2.4.2 19-Jun-2006  chap Sync with head.
 1.2.4.1 07-Jun-2006  chap file geodewdg.c was added on branch chap-midi on 2006-06-19 03:44:26 +0000
 1.3.6.2 10-Dec-2006  yamt sync with head.
 1.3.6.1 22-Oct-2006  yamt sync with head
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 31-Aug-2006  rpaulo file geodewdg.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:14 +0000
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.5.42.2 08-Jan-2008  bouyer Sync with HEAD
 1.5.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.38.1 26-Dec-2007  ad Sync with head.
 1.5.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.28.1 09-Jan-2008  matt sync with HEAD
 1.7.10.2 11-Mar-2010  yamt sync with head
 1.7.10.1 16-May-2008  yamt sync with head.
 1.7.8.1 18-May-2008  yamt sync with head.
 1.7.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.14.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.9.14.1 01-Nov-2009  jym Sync with HEAD.
 1.11.30.1 05-Oct-2016  skrll Sync with HEAD
 1.11.12.1 03-Dec-2017  jdolecek update from HEAD
 1.19 22-May-2022  riastradh opencrypto: Make freesession callback return void.

No functional change intended: all drivers already return zero
unconditionally.
 1.18 22-May-2022  riastradh glxsb(4): Prune dead branches. Assert session id validity.
 1.17 22-May-2022  riastradh glxsb(4): Return zero, not error, if we've issued crypto_done.
 1.16 29-Jun-2020  riastradh glxsb(4): Remove rijndael dependency.

This doesn't actually seem to depend on it in any way.

XXX Compile-tested only.
 1.15 14-Jun-2020  riastradh glxsb(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.
 1.14 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.13 13-Apr-2015  riastradh Need <sys/rndsource.h>, not <sys/cprng.h>, for rnd source stuff.
 1.12 10-Aug-2014  tls branches: 1.12.4;
Merge tls-earlyentropy branch into HEAD.
 1.11 04-Apr-2014  christos branches: 1.11.2;
PR/48701: Timo Buhrmester: spurious messages while booting silently (gpio,
glxsb); use aprint_normal()
>Category: kern
>Synopsis: spurious messages while booting silently (gpio, glxsb)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
 1.10 19-Nov-2011  tls branches: 1.10.8; 1.10.12;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.9 16-May-2009  cegger branches: 1.9.12;
KNF, same object code generated.
 1.8 18-Mar-2009  cegger bcopy -> memcpy
 1.7 18-Mar-2009  cegger bzero -> memset
 1.6 05-May-2008  xtraeme branches: 1.6.8; 1.6.14;
device_t/softc split and other related cosmetic changes.
 1.5 04-Apr-2008  cegger branches: 1.5.2; 1.5.4;
use aprint_*_dev and device_xname
OK joerg
 1.4 04-Jan-2008  ad branches: 1.4.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.3 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.2 09-Jul-2007  ad branches: 1.2.2; 1.2.4; 1.2.14; 1.2.16; 1.2.18; 1.2.24; 1.2.26; 1.2.28; 1.2.30;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.1 15-Jun-2007  jmcneill branches: 1.1.2;
Import driver for the AMD Geode LX AES Security Block, from OpenBSD. The
glxsb(4) driver provides random numbers and AES acceleration.
 1.1.2.2 19-Jun-2007  liamjfoy Pull up following revision(s) (requested by riz in ticket #734):
sys/arch/i386/pci/glxsb.c: revision 1.1
sys/arch/i386/conf/GENERIC: revision 1.833
share/man/man4/man4.i386/glxsb.4: revision 1.1
sys/arch/i386/conf/ALL: revision 1.104
share/man/man4/man4.i386/Makefile: revision 1.66
sys/arch/i386/conf/files.i386: revision 1.309
distrib/sets/lists/man/mi: revision 1.1007
Import driver for the AMD Geode LX AES Security Block, from OpenBSD. The
glxsb(4) driver provides random numbers and AES acceleration.
Add man page for AMD Geode LX AES Security Block driver.
Enable glxsb(4)
 1.1.2.1 15-Jun-2007  liamjfoy file glxsb.c was added on branch netbsd-4 on 2007-06-19 09:26:30 +0000
 1.2.30.2 08-Jan-2008  bouyer Sync with HEAD
 1.2.30.1 13-Dec-2007  bouyer Sync with HEAD
 1.2.28.1 11-Dec-2007  yamt sync with head.
 1.2.26.1 26-Dec-2007  ad Sync with head.
 1.2.24.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.18.3 21-Jan-2008  yamt sync with head
 1.2.18.2 03-Sep-2007  yamt sync with head.
 1.2.18.1 09-Jul-2007  yamt file glxsb.c was added on branch yamt-lazymbuf on 2007-09-03 14:26:52 +0000
 1.2.16.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.16.1 09-Jul-2007  wrstuden file glxsb.c was added on branch wrstuden-fixsa on 2007-09-03 07:03:35 +0000
 1.2.14.1 09-Jan-2008  matt sync with HEAD
 1.2.4.2 15-Jul-2007  ad Sync with head.
 1.2.4.1 09-Jul-2007  ad file glxsb.c was added on branch vmlocking on 2007-07-15 13:21:04 +0000
 1.2.2.2 11-Jul-2007  mjf Sync with head.
 1.2.2.1 09-Jul-2007  mjf file glxsb.c was added on branch mjf-ufs-trans on 2007-07-11 20:00:12 +0000
 1.4.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.3 20-Jun-2009  yamt sync with head
 1.5.4.2 04-May-2009  yamt sync with head.
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.14.3 01-Nov-2009  jym Sync with HEAD.
 1.6.14.2 31-May-2009  jym Sync with HEAD.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.12.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.12.1 17-Apr-2012  yamt sync with head
 1.10.12.1 18-May-2014  rmind sync with head
 1.10.8.2 03-Dec-2017  jdolecek update from HEAD
 1.10.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.12.4.2 05-Oct-2016  skrll Sync with HEAD
 1.12.4.1 06-Jun-2015  skrll Sync with HEAD
 1.20 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.19 24-Apr-2021  thorpej branches: 1.19.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.18 13-Nov-2011  mbalmer branches: 1.18.66;
Pickup NGPIO.
 1.17 04-Sep-2011  sborrill branches: 1.17.2;
Don't attach GPIO framework if NGPIO = 0
 1.16 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.15 08-Jan-2010  dyoung Move all copies of ifattr_match() to sys/kern/subr_autoconf.c.
 1.14 18-Aug-2009  dyoung Fix the gscpcib(4) detachment routine: add a call to pcibdetach().

Write child-detachment and rescan routines to let us detach and
re-attach gpio0 and isa0 at gscpcib0:

# drvctl -d isa0
# drvctl -d gpio0
# drvctl -r -a isabus gscpcib0
# drvctl -r -a gpiobus gscpcib0
 1.13 17-Aug-2009  mbalmer Add struct pcib_softc to the gscpcib's softc, it is needed since we call
pcibattach() later. This fixes the driver and lets the GPIO pins attach.
While here, remove the empty gscpcib_childdetach function. Fixes GPIO
on my Soekris net4801 where I can now control the error LED...

"please commit" joerg@
 1.12 04-May-2009  cegger struct cfdata * -> cfdata_t
 1.11 05-May-2008  xtraeme branches: 1.11.14;
device_t/softc split and other related cosmetic changes.
 1.10 03-Jan-2008  dyoung branches: 1.10.6; 1.10.8; 1.10.10;
Support detachment of geodegcb(4) and its children, geodecntr(4)
and geodewdog(4). Support detachment of gscpcib0 and its child,
gpio0.
 1.9 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.8 16-Nov-2006  christos branches: 1.8.28; 1.8.34; 1.8.38; 1.8.40; 1.8.42;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 24-Sep-2006  jmcneill Nuke checks for SMALL_KERNEL define; this is not a NetBSD option.
 1.5 26-Dec-2005  perry branches: 1.5.18; 1.5.22; 1.5.24;
u_intN_t -> uintN_t
 1.4 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 11-Oct-2005  drochner branches: 1.2.6;
kill gba_name in attach arg, specify interface attribute
 1.1 27-Sep-2005  jmcneill Add NS Geode PCI-ISA bridge GPIO support.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 11-Oct-2005  skrll file gscpcib.c was added on branch ktrace-lwp on 2005-11-10 13:56:53 +0000
 1.5.24.2 10-Dec-2006  yamt sync with head.
 1.5.24.1 22-Oct-2006  yamt sync with head
 1.5.22.1 18-Nov-2006  ad Sync with head.
 1.5.18.4 21-Jan-2008  yamt sync with head
 1.5.18.3 30-Dec-2006  yamt sync with head.
 1.5.18.2 21-Jun-2006  yamt sync with head.
 1.5.18.1 26-Dec-2005  yamt file gscpcib.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.8.42.2 08-Jan-2008  bouyer Sync with HEAD
 1.8.42.1 13-Dec-2007  bouyer Sync with HEAD
 1.8.40.1 11-Dec-2007  yamt sync with head.
 1.8.38.1 26-Dec-2007  ad Sync with head.
 1.8.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.8.28.1 09-Jan-2008  matt sync with HEAD
 1.10.10.4 11-Mar-2010  yamt sync with head
 1.10.10.3 19-Aug-2009  yamt sync with head.
 1.10.10.2 16-May-2009  yamt sync with head
 1.10.10.1 16-May-2008  yamt sync with head.
 1.10.8.1 18-May-2008  yamt sync with head.
 1.10.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.14.4 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.11.14.3 24-Oct-2010  jym Sync with HEAD
 1.11.14.2 01-Nov-2009  jym Sync with HEAD.
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.66.2 26-Mar-2021  thorpej gscpcib_rescan(): "gpiobus" doesn't have locators, so no need to pass any
to config_found().
 1.18.66.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.19.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 27-Sep-2005  jmcneill branches: 1.1.6;
Add NS Geode PCI-ISA bridge GPIO support.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 27-Sep-2005  skrll file gscpcibreg.h was added on branch ktrace-lwp on 2005-11-10 13:56:53 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file gscpcibreg.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.4 12-Feb-2006  tron Share Intel hardware random number generator support between amd64 and
i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 19-Feb-2004  uebayasi branches: 1.2.16;
Update some URLs.
 1.1 27-Oct-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.28;
Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.1.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.28.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.4.1 27-Oct-2000  bouyer file i82802reg.h was added on branch thorpej_scsipi on 2000-11-22 16:00:27 +0000
 1.1.2.2 27-Oct-2000  thorpej Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.1.2.1 27-Oct-2000  thorpej file i82802reg.h was added on branch sommerfeld_i386mp_1 on 2000-10-27 22:49:22 +0000
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.20 26-Aug-2007  xtraeme Some changes for the ichlpcib driver:

- Moved to x86/pci, so that EM64T systems running NetBSD/amd64 can use it.
- Added support for the TCO on ICH6 or newer chipsets, adapted from
FreeBSD.
- Added timecounter support for the power management timer, adapted from
OpenBSD.
- Plus some misc/cosmetic changes.

Thanks to yukonbob on irc@freenode for testing the TCO part on ICH4-M.
Tested by me with ICH7 too.
 1.19 27-Nov-2006  drochner branches: 1.19.8; 1.19.16; 1.19.22; 1.19.26;
match ICH-7M / -DH
(The watchdog doesn't reset the box for me, but it is present according
to the datasheet.)
 1.18 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.17 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.16 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.15 19-Jun-2006  jmcneill branches: 1.15.4; 1.15.6;
cube@ says that acpi_pci_fixup() only writes in devices interrupt line
registers, so restore the PCI-ISA bridge IRQ routing here again.
 1.14 19-Jun-2006  jmcneill Don't try to fixup PCI interrupt routing here; we're going to use ACPI to
do this for us instead. This prevents us from having to write chipset
specific support -- yay!
 1.13 16-Jun-2006  jmcneill Add powerhook to restore IRQ routing on resume.
 1.12 19-Feb-2006  thorpej branches: 1.12.2; 1.12.8; 1.12.10;
Use aprint_*().
 1.11 26-Dec-2005  perry branches: 1.11.2; 1.11.4; 1.11.6;
u_intN_t -> uintN_t
 1.10 04-Dec-2005  xtraeme Attach to ICH6, ICH6-M and ICH7 Intel I/O Controller Hub.
Tested by seb with ICH6-M.
 1.9 20-Jun-2005  atatat branches: 1.9.2;
Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone. Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
 1.8 03-Feb-2005  perry de-__P, partially ANSIfy
 1.7 12-Jan-2005  drochner branches: 1.7.2; 1.7.4;
On my laptop, the SMI handler for the TCO interrupt appearently
re-tickles the watchdog, keeping the system from rebooting.
So enable the SMI for TCO only if the hardware reset is not available,
as a last resort.
 1.6 31-Jul-2004  mrg branches: 1.6.2;
implement ICH-based Intel SpeedStep(TM), based on both the linux and
freebsd drivers for the same. if found and supported, export a
"machdep.speedstep_state" sysctl that can be set to "0" (low) or "1"
(high).

tested on a dell inspiron 8500 (supported, working) and a dual P4
system (supports ichlpcib not speedstep, comes up properly disabled.)
 1.5 04-Apr-2004  kochi add one more PCI ID (ICH4-M).
 1.4 29-Mar-2004  jwise Fix grammar in error message.
 1.3 15-Mar-2004  minoura Fix typo.
 1.2 15-Mar-2004  minoura Stop the timer explicitly before initialization.
Apparently certain BIOS requires this. Noted by yamt.
 1.1 14-Mar-2004  minoura Add Intel ICHn PCI-LPC bridge driver.
It is a pcib, but with sysmon watchdog support.
 1.6.2.8 11-Dec-2005  christos Sync with head.
 1.6.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.6.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.6.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.2 03-Aug-2004  skrll Sync with HEAD
 1.6.2.1 31-Jul-2004  skrll file ichlpcib.c was added on branch ktrace-lwp on 2004-08-03 10:36:13 +0000
 1.7.4.1 12-Feb-2005  yamt sync with head.
 1.7.2.1 29-Apr-2005  kent sync with -current
 1.9.2.3 03-Sep-2007  yamt sync with head.
 1.9.2.2 30-Dec-2006  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 01-Mar-2006  yamt sync with head.
 1.12.10.1 13-Jul-2006  gdamore Merge from HEAD.
 1.12.8.1 19-Jun-2006  chap Sync with head.
 1.12.2.1 26-Jun-2006  yamt sync with head.
 1.15.6.2 10-Dec-2006  yamt sync with head.
 1.15.6.1 22-Oct-2006  yamt sync with head
 1.15.4.2 12-Jan-2007  ad Sync with head.
 1.15.4.1 18-Nov-2006  ad Sync with head.
 1.19.26.3 03-Sep-2007  jmcneill Sync with HEAD.
 1.19.26.2 05-Aug-2007  jmcneill Since ichlpcib calls pcibattach, we need to ensure that pcibattach doesn't
try to overwrite a power handler that has already been registered.
 1.19.26.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.19.22.1 03-Sep-2007  skrll Sync with HEAD.
 1.19.16.1 03-Oct-2007  garbled Sync with HEAD
 1.19.8.1 12-Oct-2007  ad Fix merge errors.
 1.3 02-Feb-2002  jdolecek Reduce the massive code duplication regarding joy(4). Split it into
MI and MD parts, and make ISA/ISAPNP/PCI joy(4) attachments MI.
 1.2 15-Nov-2001  lukem branches: 1.2.2;
add RCSID
 1.1 26-Mar-2000  martin branches: 1.1.8; 1.1.10; 1.1.12;
Added a PCI frontend for the legacy ISA joystick driver.
Some PCI soundcards don't seem to use the generic gameport function with
interface 0x10 used here, but have either an own BAR dedicated to this
(i.e. Sonic Vibes or ESS Solo-1) or specify their own device (see
PCI_PRODUCT_CREATIVELABS_SBJOY in sys/dev/pci/pcidevs.h).
Probably these use a similar simple sheme and adding a frontend for them would
be trivial, but I don't own any of these cards, so I didn't.
 1.1.12.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.12.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.10.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.10.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.8.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.8.1 26-Mar-2000  bouyer file joy_pci.c was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.2.2.2 15-Nov-2001  lukem add RCSID
 1.2.2.1 15-Nov-2001  lukem file joy_pci.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.11 27-Jan-1995  mycroft Clean up deleted files.
 1.10 16-Jan-1995  mycroft Incorporate recent changes from Wolfgang. Recognize the 815.
 1.9 04-Jan-1995  mycroft Remove many of the `static's, to facilitate debugging.
 1.8 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.7 04-Nov-1994  mycroft Make a wrapper match function to check the bus and device numbers, rather
than insisting that every driver do it.
 1.6 03-Nov-1994  mycroft Always use direct configuration.
 1.5 27-Oct-1994  cgd new RCS ID format.
 1.4 27-Oct-1994  andrew Default to decent performance.
 1.3 27-Oct-1994  andrew Merge changes from Wolfgang Stanglmeier's 941012 release.
 1.2 01-Oct-1994  mycroft branches: 1.2.2;
Update from Wolfgang Stanglemeier.
 1.1 09-Aug-1994  mycroft Add NCR 53c8XX driver, originally from Wolfgang Stanglmeier.
 1.2.2.2 01-Oct-1994  mycroft Update from Wolfgang Stanglemeier.
 1.2.2.1 01-Oct-1994  mycroft file ncr.c was added on branch netbsd-1-0 on 1994-10-01 06:27:57 +0000
 1.5 27-Jan-1995  mycroft Clean up deleted files.
 1.4 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.3 27-Oct-1994  cgd new RCS ID format.
 1.2 01-Oct-1994  mycroft branches: 1.2.2;
Update from Wolfgang Stanglemeier.
 1.1 09-Aug-1994  mycroft Add NCR 53c8XX driver, originally from Wolfgang Stanglmeier.
 1.2.2.2 01-Oct-1994  mycroft Update from Wolfgang Stanglemeier.
 1.2.2.1 01-Oct-1994  mycroft file ncr_reg.h was added on branch netbsd-1-0 on 1994-10-01 06:28:02 +0000
 1.6 27-Jan-1995  mycroft Clean up deleted files.
 1.5 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 01-Oct-1994  mycroft branches: 1.3.2;
Update from Wolfgang Stanglemeier.
 1.2 11-Aug-1994  mycroft Make this work.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add NCR 53c8XX driver, originally from Wolfgang Stanglmeier.
 1.1.2.1 11-Aug-1994  mycroft update from trunk
 1.3.2.2 01-Oct-1994  mycroft Update from Wolfgang Stanglemeier.
 1.3.2.1 01-Oct-1994  mycroft file ncrstat.c was added on branch netbsd-1-0 on 1994-10-01 06:28:03 +0000
 1.10 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin branches: 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 16-Nov-2006  christos branches: 1.8.52; 1.8.54; 1.8.56;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 11-Dec-2005  christos branches: 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.4 26-Feb-2003  fvdl branches: 1.4.2;
Adapt for i386/x86 change.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 18-Jul-2000  soda branches: 1.2.4; 1.2.6; 1.2.8;
use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCI_INTERRUPT_PIN_MAX and use it instead of magic number.
- define I386_PCI_INTERRUPT_LINE_NO_CONNECTION and use it instead of
magic number.

Revisions pulled up:
> cvs rdiff -r1.28 -r1.29 syssrc/sys/dev/pci/pcireg.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/pci_machdep.h
> cvs rdiff -r1.38 -r1.39 syssrc/sys/arch/i386/pci/pci_machdep.c
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c558.c \
> syssrc/sys/arch/i386/pci/sis85c503.c \
> syssrc/sys/arch/i386/pci/via82c586.c
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file opti82c558.c was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file opti82c558.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.8.56.1 16-May-2008  yamt sync with head.
 1.8.54.1 18-May-2008  yamt sync with head.
 1.8.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.10.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.10.1 17-Nov-1999  bouyer file opti82c558reg.h was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin branches: 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 16-Nov-2006  christos branches: 1.8.52; 1.8.54; 1.8.56;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 11-Dec-2005  christos branches: 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 11-Apr-2004  kochi branches: 1.5.12;
de __P, ANSIfy PCIBIOS related files.
 1.4 26-Feb-2003  fvdl branches: 1.4.2;
Adapt for i386/x86 change.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 18-Jul-2000  soda branches: 1.2.4; 1.2.6; 1.2.8;
- deal with FIRESTAR_PIR_SELECT_PIRQ case on set/get_trigger(),
to prevent a panic on a Panasonic Let's Note AL-N2T516J5.
- add several debug printf which can be enabled by FIRESTARDEBUG.
by UCHIYAMA Yasushi <uch@netbsd.org>

- use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

deal with FIRESTAR_PIR_SELECT_PIRQ case on set/get_trigger(),
to prevent a panic on a Panasonic Let's Note AL-N2T516J5.
add several debug printf which can be enabled by FIRESTARDEBUG.
use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.

Revisions pulled up:
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c700.c \
> syssrc/sys/arch/i386/pci/opti82c700reg.h
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file opti82c700.c was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file opti82c700.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.12.1 30-Dec-2006  yamt sync with head.
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.8.56.1 16-May-2008  yamt sync with head.
 1.8.54.1 18-May-2008  yamt sync with head.
 1.8.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.2 18-Jul-2000  soda branches: 1.2.2; 1.2.4;
- deal with FIRESTAR_PIR_SELECT_PIRQ case on set/get_trigger(),
to prevent a panic on a Panasonic Let's Note AL-N2T516J5.
- add several debug printf which can be enabled by FIRESTARDEBUG.
by UCHIYAMA Yasushi <uch@netbsd.org>

- use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

deal with FIRESTAR_PIR_SELECT_PIRQ case on set/get_trigger(),
to prevent a panic on a Panasonic Let's Note AL-N2T516J5.
add several debug printf which can be enabled by FIRESTARDEBUG.
use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.

Revisions pulled up:
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c700.c \
> syssrc/sys/arch/i386/pci/opti82c700reg.h
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file opti82c700reg.h was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.2.2.2 18-Jul-2000  soda - deal with FIRESTAR_PIR_SELECT_PIRQ case on set/get_trigger(),
to prevent a panic on a Panasonic Let's Note AL-N2T516J5.
- add several debug printf which can be enabled by FIRESTARDEBUG.
by UCHIYAMA Yasushi <uch@netbsd.org>

- use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.2.2.1 18-Jul-2000  soda file opti82c700reg.h was added on branch sommerfeld_i386mp_1 on 2000-07-18 11:07:22 +0000
 1.15 04-May-2009  cegger struct device * -> device_t, use device_private()
No functional changes intended.
 1.14 09-Jul-2008  joerg branches: 1.14.8;
device/softc split
 1.13 28-Apr-2008  martin branches: 1.13.2; 1.13.4; 1.13.6;
Remove clause 3 and 4 from TNF licenses
 1.12 04-Apr-2008  cegger branches: 1.12.2; 1.12.4;
use aprint_*_dev and device_xname
OK joerg
 1.11 16-Nov-2006  christos branches: 1.11.52;
__unused removal on arguments; approved by core.
 1.10 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.9 19-Feb-2006  thorpej branches: 1.9.14; 1.9.16;
Use aprint_*().
 1.8 11-Dec-2005  christos branches: 1.8.2; 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 03-Feb-2005  perry branches: 1.7.6;
de-__P, partially ANSIfy
 1.6 23-Apr-2004  itojun branches: 1.6.4; 1.6.6;
pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region
 1.5 14-Jul-2003  lukem add __KERNEL_RCSID()
 1.4 17-Oct-2002  thorpej branches: 1.4.2; 1.4.8;
* Add "struct device" to the softc.
* Add missing notice.

Problems pointed out by Jonathan Stone.
 1.3 02-Oct-2002  thorpej branches: 1.3.2;
Tidy up CFATTACH_DECL() formatting.
 1.2 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.1 25-Jun-2002  sommerfeld branches: 1.1.2;
file p64h2apic.c was initially added on branch sommerfeld_i386mp_1.
 1.1.2.1 25-Jun-2002  sommerfeld Resynch with -current.
 1.3.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.3.2.1 02-Oct-2002  jdolecek file p64h2apic.c was added on branch kqueue on 2002-10-10 18:33:34 +0000
 1.4.8.4 04-Feb-2005  skrll Sync with HEAD.
 1.4.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.8.1 03-Aug-2004  skrll Sync with HEAD
 1.4.2.3 23-Oct-2002  thorpej Sync with HEAD.
 1.4.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.1 17-Oct-2002  nathanw file p64h2apic.c was added on branch nathanw_sa on 2002-10-18 02:38:05 +0000
 1.6.6.1 12-Feb-2005  yamt sync with head.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.7.6.2 30-Dec-2006  yamt sync with head.
 1.7.6.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 01-Mar-2006  yamt sync with head.
 1.9.16.2 10-Dec-2006  yamt sync with head.
 1.9.16.1 22-Oct-2006  yamt sync with head
 1.9.14.1 18-Nov-2006  ad Sync with head.
 1.11.52.2 28-Sep-2008  mjf Sync with HEAD.
 1.11.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.4.3 16-May-2009  yamt sync with head
 1.12.4.2 04-May-2009  yamt sync with head.
 1.12.4.1 16-May-2008  yamt sync with head.
 1.12.2.1 18-May-2008  yamt sync with head.
 1.13.6.1 19-Oct-2008  haad Sync with HEAD.
 1.13.4.1 18-Jul-2008  simonb Sync with head.
 1.13.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.8.2 01-Nov-2009  jym Sync with HEAD.
 1.14.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27 19-Oct-2025  thorpej Use {,e}isabus_attach().
 1.26 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.25 24-Apr-2021  thorpej branches: 1.25.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.24 01-Jul-2011  dyoung branches: 1.24.68;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.23 28-Apr-2010  dyoung On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag. For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM. In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem. Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.
 1.22 05-May-2008  xtraeme branches: 1.22.14; 1.22.20; 1.22.22;
device_t/softc split and other related cosmetic changes.
 1.21 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.20 04-Apr-2008  cegger branches: 1.20.2; 1.20.4;
use aprint_*_dev and device_xname
OK joerg
 1.19 16-Nov-2006  christos branches: 1.19.52;
__unused removal on arguments; approved by core.
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 19-Feb-2006  thorpej branches: 1.17.14; 1.17.16;
Use aprint_*().
 1.16 11-Dec-2005  christos branches: 1.16.2; 1.16.4; 1.16.6;
merge ktrace-lwp.
 1.15 03-Feb-2005  perry branches: 1.15.6;
de-__P, partially ANSIfy
 1.14 30-Aug-2004  drochner branches: 1.14.4; 1.14.6;
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.13 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.12 26-Feb-2003  fvdl branches: 1.12.2;
Adapt for i386/x86 change.
 1.11 08-Feb-2003  jdolecek match anything which claims to be PCI-EISA bridge
the explicit check for Intel PCI-EISA bridge was left in, just in case
it wouldn't identify itself as PCI-EISA bridge

fixes PR kern/9589 by Johan Danielsson
 1.10 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.9 02-Oct-2002  thorpej Tidy up CFATTACH_DECL() formatting.
 1.8 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 15-Nov-2001  lukem branches: 1.6.2;
add RCSID
 1.5 05-Aug-1998  perry branches: 1.5.26; 1.5.28;
bzero->memset
 1.4 09-Jun-1998  thorpej Use config_defer().
 1.3 08-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.2 06-Feb-1998  thorpej Use __BROKEN_INDIRECT_CONFIG where appropriate.
 1.1 06-Feb-1998  thorpej Add an autoconfig node for PCI-EISA bridges. Configures EISA and ISA
bridges via callback.
 1.5.28.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.5.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.26.3 03-Jan-2003  thorpej Sync with HEAD.
 1.5.26.2 18-Oct-2002  nathanw Catch up to -current.
 1.5.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.6.2.2 15-Nov-2001  lukem add RCSID
 1.6.2.1 15-Nov-2001  lukem file pceb.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:34 +0000
 1.12.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.12.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2 03-Sep-2004  skrll Sync with HEAD
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.6.1 12-Feb-2005  yamt sync with head.
 1.14.4.1 29-Apr-2005  kent sync with -current
 1.15.6.2 30-Dec-2006  yamt sync with head.
 1.15.6.1 21-Jun-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.16.2.1 01-Mar-2006  yamt sync with head.
 1.17.16.2 10-Dec-2006  yamt sync with head.
 1.17.16.1 22-Oct-2006  yamt sync with head
 1.17.14.1 18-Nov-2006  ad Sync with head.
 1.19.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.2 11-Aug-2010  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.22.22.1 30-May-2010  rmind sync with head
 1.22.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.22.14.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.22.14.1 24-Oct-2010  jym Sync with HEAD
 1.24.68.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.25.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.67 26-Oct-2007  xtraeme - Share pchb(4) between i386 and amd64; one copy is enough for both.
- Move some of the x86 PCI devices into x86/pci/files.pci.
- Add more x86 stuff into x86/conf/files.x86.

ok joerg.
 1.66 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.65 15-Aug-2007  markd branches: 1.65.2; 1.65.6;
Add agp support for i965Q.

Based on a patch for FreeBSD by Eric Anholt.
OKed on tech-kern some months ago.
 1.64 27-Jan-2007  he branches: 1.64.6; 1.64.14; 1.64.18; 1.64.22;
Fix description of the 82443BX workaround to use "stepping" instead
of "revision".
 1.63 23-Jan-2007  he According to http://www.intel.com/design/chipsets/specupdt/290639.htm,
the BIOS bug workaround for the i82443BX chipset's DRAM leadoff timing
parameter is not needed for revisions >= C0, so avoid tweaking that
parameter in that case.

Earlier, this would trigger NMIs on fully memory-populated Compaq
1850R systems, where the BIOS appears to program and require a non-
standard value for this parameter.

Thanks to Chris Ross for the diagnosis and the fix!
 1.62 16-Nov-2006  christos branches: 1.62.2;
__unused removal on arguments; approved by core.
 1.61 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.60 30-Jul-2006  simonb branches: 1.60.4; 1.60.6;
Add support for 82945GM and (untested) 82945P AGP. FreeBSD and
Linux both treat the 945 series exactly the same as the 915 series
for AGP, so just match a few extra device IDs.
 1.59 19-Feb-2006  thorpej branches: 1.59.2;
Use aprint_*().
 1.58 12-Feb-2006  tron Share Intel hardware random number generator support between amd64 and
i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
 1.57 16-Jan-2006  christos branches: 1.57.2; 1.57.4;
PR/32550: Michael Eriksson: No agp(4) support for i915 integrated graphics
 1.56 11-Dec-2005  christos branches: 1.56.2;
merge ktrace-lwp.
 1.55 03-Feb-2005  perry branches: 1.55.4; 1.55.6;
de-__P, partially ANSIfy
 1.54 30-Aug-2004  drochner branches: 1.54.4; 1.54.6;
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.53 05-Jul-2004  mycroft Attempt to handle unknown ServerWorks chips, although I wouldn't bet on it
working cleanly.
 1.52 04-Jul-2004  mycroft Update Serverworks chip names, and add a few more.
 1.51 04-Jul-2004  mycroft Be more careful about what ServerWorks devices we attempt to map PCI buses
behind.
This should address PR 21458 and PR 25670.
 1.50 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.49 27-Feb-2004  jdolecek branches: 1.49.2;
add yet another ServerWorks variant
from PR port-i386/24570 by Ray Phillips
 1.48 28-Oct-2003  mycroft XXX: gcc
 1.47 25-Oct-2003  christos Fix uninitialized variable warnings
 1.46 28-Aug-2003  tron Add missing blank line.
Don't treat pointers as boolean values.
 1.45 26-Aug-2003  tron Add support for i865G integrated graphics support to agp(4). Patches
contributed by Michael D. Allen in PR port-i386/22600.
 1.44 20-Jul-2003  hannken Add support for i855 agp. From FreeBSD.

Approved by: Frank van der Linden <fvdl@netbsd.org>
 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 16-Apr-2003  scw From PR port-i386/20464, by Yoshihisa Nakagawa: Match i845G AGP bridge.
 1.41 14-Feb-2003  jdolecek One more ServerWorks host bridge, seen on Dell PowerEdge server
fix provided in PR port-i386/20333 by Sverre Froyen
 1.40 14-Jan-2003  fvdl Remove duplicate assignment.
 1.39 14-Jan-2003  fvdl Add a couple more ServerWorks host bridges that explicitly need IO space
enabled.
 1.38 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.37 02-Oct-2002  thorpej Tidy up CFATTACH_DECL() formatting.
 1.36 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.35 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.34 21-Jun-2002  thorpej Add support for auxillary busses on the Intel 82452 PCI-Host
bridge. PR 17353, from MOCHIDA Shuji.
 1.33 16-May-2002  thorpej branches: 1.33.2; 1.33.4;
* 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.32 16-Mar-2002  he Also correct the attach flags to enable IO space on the Intel 450NX.
OK'ed by fvdl.
 1.31 14-Jan-2002  augustss Add the i830 bridge.
 1.30 16-Dec-2001  fvdl Also correct the attach flags to enable IO space on the ServerWorks
CNB20LE.
 1.29 15-Nov-2001  lukem add RCSID
 1.28 17-Sep-2001  drochner branches: 1.28.2;
-fix botched switch/case nesting which made AGP on i810 in GFX mode fail
-remove the check for i810's internal graphics completely: we'll attach
AGP whether in GFX or AGP mode anyway, and the SMRAM register test
was of questionable value (should have masked with 0xc0, but even then
the builtin graphics appeared enabled although I used an external
PCI card)
 1.27 15-Sep-2001  thorpej Clean up the AGP match/attach code somewhat.
 1.26 12-Sep-2001  fvdl Apparently some ServerWorks Host-PCI bridges only get their memory space
enabled, even though IO space does work. A few drivers (like ahc)
will only work reliably with IO space, so check for this condition
and correct it.
 1.25 10-Sep-2001  fvdl wrap decl in #if NAGP > 0
 1.24 10-Sep-2001  fvdl Attach agp gart support @ pchb. Not very clean, but agp support may
be spread over several devices, and the phcb is usually the main one.

Add agp_machdep.c file which implements MD agp functions (currently
just agp_flush_cache).
 1.23 03-Nov-2000  ad branches: 1.23.4; 1.23.6; 1.23.8;
- Pequr -> Serverworks. It pays to do a cvs update first...
- Pay attention only to the low byte of config reg 0x44 on Serverworks chips,
as Linux does.
- Compress duplicatated code.
 1.22 28-Oct-2000  simonb Fix NRND == 0 case (unused variable).
 1.21 27-Oct-2000  thorpej Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.20 27-Oct-2000  thorpej Support the second PCI bus on SeverWorks chipsets. From OpenBSD.
 1.19 27-Oct-2000  thorpej BIOS BUG WORKAROUND! The 82443BX datasheet indicates that the only legal
setting for the "Idle/Pipeline DRAM Leadoff Timing (IPLDT)" parameter
(bits 9:8) is 01. Unfortunately, some BIOSs do not set these bits properly.

Based on a hint from OpenBSD.
 1.18 11-May-2000  drochner branches: 1.18.4;
-attach auxilary PCI buses at the 450NX chipset,
tested by hubertf in a small configuration (1 PXB - 2 PCI buses)
-being here, remove the per-VID/DID matching code which was commented
out for a while
 1.17 10-Oct-1998  drochner branches: 1.17.12;
Match pchb by class/subclass, like pcib.
Add a note about this strange Pequr host bridge in Compaq machines.
 1.16 08-Oct-1998  thorpej Add the Intel 82443BX PCI host bus adapter. From Soren S. Jorvang, PR #6250.
 1.15 13-Jul-1998  mark Recognise the ALI M1541 in order to support motherboards with the
ALI Aladdin V chipset.
 1.14 08-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.13 06-Feb-1998  thorpej Use __BROKEN_INDIRECT_CONFIG where appropriate.
 1.12 12-Jan-1998  thorpej Update for changes to config.
 1.11 10-Jan-1998  perry add yet another PCI brige -- from pr 4780 from Nathan J. Williams
 1.10 09-Jan-1998  fvdl Switch off CPU-PCI write posting for the Saturn chipset; it is known
to cause problems with PCI busmasters.
 1.9 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.8 01-Oct-1997  drochner adapt to changed device names
 1.7 03-Aug-1997  fvdl Recognize some more chipsets.
 1.6 06-Jun-1997  thorpej branches: 1.6.4;
Pull thorpej-bus-dma branch into mainline.
 1.5 18-May-1997  thorpej branches: 1.5.2;
Remove comment about bus dma tag. I've been convinced otherwise.
 1.4 18-May-1997  thorpej Add a comment about why the bus dma tag is not forwarded from parent
to child if an auxillary PCI bus is attached to the bridge. Also,
remove an extra ';'.
 1.3 13-May-1997  jtk add support for dual PCI bus Intel host/PCI bridge. Thanks to Chris Demetriou for his assistance in educating me about the vagaries of PCI and its configuration model.
 1.2 13-Apr-1997  jtk add support for ACC Micro host bridges
 1.1 28-Nov-1996  thorpej Implement a simple generic PCI-Host bridge driver. At the moment, this
driver is a place-holder, which will nicely print version information
about your PCI chipset (try with "options PCIVERBOSE"). Eventually,
this can be used to enable/disable features/bugs of individual PCI
chipsets.
 1.5.2.2 18-May-1997  thorpej Forward the bus dma tag from parent to child.
 1.5.2.1 18-May-1997  thorpej file pchb.c was added on branch thorpej-bus-dma on 1997-05-18 23:41:54 +0000
 1.6.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.12.2 22-Nov-2000  bouyer Sync with HEAD.
 1.17.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.18.4.4 20-Mar-2002  he Pull up revision 1.31 (requested by he):
Correct the attach flags to enable IO space on the Intel 450NX.
 1.18.4.3 16-Jan-2002  he Pull up revision 1.30 (via patch, requested by jlam):
Also correct the attach flags to enable IO space on the ServerWorks
CNB20LE.
 1.18.4.2 09-Dec-2001  he Pull up revisions 1.23,1.26 (via patch, requested by jlam):
Some ServerWorks (Pequr) Host-PCI bridges only get their memory
space enabled, even though IO space works. Some drivers only work
reliably with IO space (ahc(4) being a notable example), so check
for this condition and correct it.

Also only pay attention to the low byte of configuration register
0x44 on ServerWorks chips, and compress some duplicated code.
 1.18.4.1 30-Oct-2000  tv Pullup 1.20 [thorpej]:
Support the second PCI bus on SeverWorks chipsets. From OpenBSD.
 1.23.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.23.6.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.23.6.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.23.6.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.6.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.23.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.6.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.4.9 15-Jan-2003  thorpej Sync with HEAD.
 1.23.4.8 03-Jan-2003  thorpej Sync with HEAD.
 1.23.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.23.4.6 01-Aug-2002  nathanw Catch up to -current.
 1.23.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.23.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.23.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.23.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.28.2.7 25-Jun-2002  sommerfeld Resynch with -current.
 1.28.2.6 18-May-2002  sommerfeld Catch up with -current. (commons elimination, changes to MI pci framework)
 1.28.2.5 27-Apr-2002  sommerfeld Merge with current as of today
 1.28.2.4 28-Jan-2002  sommerfeld Yet Another mergeup with -current.
 1.28.2.3 29-Dec-2001  sommerfeld Yet another mergeup.

New work:
- Frank van der Linden's tlb shootdown fix.
Mainline functionality merged:
- IrDA
- Kernel RCSID's
- Transmeta CPU support
- ACPI
- XMM register access through procfs
 1.28.2.2 11-Dec-2001  sommerfeld Make sure we initialize all of pba when attaching a second pci bus
 1.28.2.1 17-Sep-2001  sommerfeld file pchb.c was added on branch sommerfeld_i386mp_1 on 2001-12-11 23:56:10 +0000
 1.33.4.1 21-Jun-2002  lukem Pull up revision 1.34 (requested by thorpej in ticket #346):
Add support for auxillary busses on the Intel 82452 PCI-Host
bridge. PR 17353, from MOCHIDA Shuji.
 1.33.2.2 16-Jul-2002  gehenna catch up with -current.
 1.33.2.1 16-May-2002  gehenna file pchb.c was added on branch gehenna-devsw on 2002-07-16 08:29:54 +0000
 1.43.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.43.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.43.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.43.2.2 03-Sep-2004  skrll Sync with HEAD
 1.43.2.1 03-Aug-2004  skrll Sync with HEAD
 1.49.2.2 06-Jul-2004  he Pull up revision 1.52 (requested by mycroft in ticket #606):
Update Serverworks chip names, and add a few more.
 1.49.2.1 05-Jul-2004  he Pull up revisoin 1.51 (requested by mycroft in ticket #606):
Be more careful about what ServerWorks devices we attempt
to map PCI buses behind. Fixes PR#21458 and PR#25670.
 1.54.6.1 12-Feb-2005  yamt sync with head.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.55.6.5 27-Oct-2007  yamt sync with head.
 1.55.6.4 03-Sep-2007  yamt sync with head.
 1.55.6.3 26-Feb-2007  yamt sync with head.
 1.55.6.2 30-Dec-2006  yamt sync with head.
 1.55.6.1 21-Jun-2006  yamt sync with head.
 1.55.4.4 29-Jan-2007  tron Pull up following revision(s) (requested by he in ticket #1657):
sys/arch/i386/pci/pchb.c: revision 1.64
Fix description of the 82443BX workaround to use "stepping" instead
of "revision".
 1.55.4.3 29-Jan-2007  tron Pull up following revision(s) (requested by he in ticket #1657):
sys/arch/i386/pci/pchb.c: revision 1.63
According to http://www.intel.com/design/chipsets/specupdt/290639.htm,
the BIOS bug workaround for the i82443BX chipset's DRAM leadoff timing
parameter is not needed for revisions >= C0, so avoid tweaking that
parameter in that case.
Earlier, this would trigger NMIs on fully memory-populated Compaq
1850R systems, where the BIOS appears to program and require a non-
standard value for this parameter.
Thanks to Chris Ross for the diagnosis and the fix!
 1.55.4.2 29-Jan-2007  tron Pull up following revision(s) (requested by he in ticket #1657):
sys/arch/i386/pci/pchb.c: revision 1.59
Use aprint_*().
 1.55.4.1 14-Feb-2006  riz Pull up following revision(s) (requested by tron in ticket #1168):
sys/dev/pci/agp_i810.c: revision 1.28
sys/arch/i386/pci/pchb.c: revision 1.57
sys/dev/pci/agpvar.h: revision 1.11
sys/dev/pci/agp_via.c: revision 1.9
sys/dev/pci/agp.c: revision 1.37
sys/dev/pci/agpreg.h: revision 1.10
sys/dev/pci/pcidevs: revision 1.757
sys/dev/pci/agp_amd.c: revision 1.14
sys/dev/pci/agp_intel.c: revision 1.17
sys/dev/pci/agp_sis.c: revision 1.8
sys/dev/pci/agp_ali.c: revision 1.9
sys/arch/i386/pci/pchb_rnd.c: revision 1.16
PR/32550: Michael Eriksson: No agp(4) support for i915 integrated graphics
 1.56.2.3 01-Mar-2006  yamt sync with head.
 1.56.2.2 18-Feb-2006  yamt sync with head.
 1.56.2.1 01-Feb-2006  yamt sync with head.
 1.57.4.1 22-Apr-2006  simonb Sync with head.
 1.57.2.1 09-Sep-2006  rpaulo sync with head
 1.59.2.1 11-Aug-2006  yamt sync with head
 1.60.6.2 10-Dec-2006  yamt sync with head.
 1.60.6.1 22-Oct-2006  yamt sync with head
 1.60.4.2 01-Feb-2007  ad Sync with head.
 1.60.4.1 18-Nov-2006  ad Sync with head.
 1.62.2.2 29-Jan-2007  tron Pull up following revision(s) (requested by he in ticket #392):
sys/arch/i386/pci/pchb.c: revision 1.64
Fix description of the 82443BX workaround to use "stepping" instead
of "revision".
 1.62.2.1 29-Jan-2007  tron Pull up following revision(s) (requested by he in ticket #392):
sys/arch/i386/pci/pchb.c: revision 1.63
According to http://www.intel.com/design/chipsets/specupdt/290639.htm,
the BIOS bug workaround for the i82443BX chipset's DRAM leadoff timing
parameter is not needed for revisions >= C0, so avoid tweaking that
parameter in that case.
Earlier, this would trigger NMIs on fully memory-populated Compaq
1850R systems, where the BIOS appears to program and require a non-
standard value for this parameter.
Thanks to Chris Ross for the diagnosis and the fix!
 1.64.22.5 28-Oct-2007  joerg Sync with HEAD.
 1.64.22.4 06-Sep-2007  jmcneill Add Intel G33 AGP support, resolves PR36902, PR36903, PR36904, PR36906,
PR36907, PR36908, PR36909, PR36910, PR36911, PR36912, PR36913, and PR36925.
 1.64.22.3 27-Aug-2007  jmcneill Add 965 PM AGP support.
 1.64.22.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.64.22.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.64.18.1 15-Aug-2007  skrll Sync with HEAD.
 1.64.14.1 03-Oct-2007  garbled Sync with HEAD
 1.64.6.1 20-Aug-2007  ad Sync with HEAD.
 1.65.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.65.2.1 06-Nov-2007  matt sync with HEAD
 1.19 12-Feb-2006  tron Share Intel hardware random number generator support between amd64 and
i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
 1.18 12-Feb-2006  tron Add hardware RNG support for Intel i925X chipset.
 1.17 12-Feb-2006  tron Add hardware RNG support for Intel i945G/P and i955X chipsets.
 1.16 16-Jan-2006  christos branches: 1.16.2; 1.16.4;
PR/32550: Michael Eriksson: No agp(4) support for i915 integrated graphics
 1.15 26-Dec-2005  perry branches: 1.15.2;
u_intN_t -> uintN_t
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 06-Jul-2003  tron branches: 1.13.2; 1.13.6; 1.13.14; 1.13.16; 1.13.22; 1.13.26;
Add hardware random number generator support for Intel 865 and
875P chipsets.
 1.12 09-Jun-2002  tron branches: 1.12.2; 1.12.8;
Add missing calls to bus_space_unmap(9) when the hardware RNG is not
detected, cannot be activated or doesn't work.
 1.11 28-May-2002  tron Remove senceless benchmark loop for i8xx hardware random generator
attach code. The throughput was neither calculated nor displayed.
 1.10 28-May-2002  tron Add hardware random generator support for Intel i845, i850 and i860
chipsets.
 1.9 15-Nov-2001  lukem branches: 1.9.10; 1.9.12;
add RCSID
 1.8 09-Sep-2001  enami Mix random data directly into the pool and increase entropy instead of
estimating entropy with polling based timing.
 1.7 30-Mar-2001  mycroft branches: 1.7.4; 1.7.6;
The `speed' statistic from the RNG was brought to you by the letter `B' and
the letter `S'. I don't think anyone will miss it.
 1.6 21-Dec-2000  enami branches: 1.6.4;
- Zero is a valid random data. Don't give up to attach.
- 4 cycle is enough to get 4 octet of data.
 1.5 06-Nov-2000  augustss branches: 1.5.4;
Fix speeling in cooment.
 1.4 06-Nov-2000  augustss Print a newline after the random number speed message.
 1.3 30-Oct-2000  thorpej Change the RNG callout -- don't spin until data is available. If
none is available, just wait until the next clock tick.
 1.2 28-Oct-2000  itojun fix busy-wait logic against random number register. (missing semicolon)
 1.1 27-Oct-2000  thorpej Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.5.4.4 21-Apr-2001  bouyer Sync with HEAD
 1.5.4.3 05-Jan-2001  bouyer Sync with HEAD
 1.5.4.2 22-Nov-2000  bouyer Sync with HEAD.
 1.5.4.1 06-Nov-2000  bouyer file pchb_rnd.c was added on branch thorpej_scsipi on 2000-11-22 16:00:29 +0000
 1.6.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.6.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.6.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.6.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.7.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.9.12.4 17-Apr-2006  jmc Patch from ticket 6049 (requested by tron)
PR port-i386/33264: Fix build of kernels with the DIAGNOSTIC option
defined in the kernel configuration.
 1.9.12.3 26-Feb-2006  riz Apply patch (requested by tron in ticket #6015):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.9.12.2 10-Sep-2003  grant Pull up revision 1.13 (requested by tron in ticket #1418):

Add hardware random number generator support for Intel 865 and
875P chipsets.
 1.9.12.1 03-Nov-2002  he Pull up revisions 1.10-1.12 (requested by tron in ticket #231):
Add hardware random generator support for Intel i845, i850
and i860 chipsets, and make sure to unmap if it's not there.
 1.9.10.2 14-Jul-2002  gehenna catch up with -current.
 1.9.10.1 30-May-2002  gehenna Catch up with -current.
 1.12.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.8.1 03-Aug-2004  skrll Sync with HEAD
 1.12.2.2 09-Jun-2002  tron Add missing calls to bus_space_unmap(9) when the hardware RNG is not
detected, cannot be activated or doesn't work.
 1.12.2.1 09-Jun-2002  tron file pchb_rnd.c was added on branch sommerfeld_i386mp_1 on 2002-06-09 15:02:26 +0000
 1.13.26.1 26-Feb-2006  riz Apply patch (requested by tron in ticket #1181):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.13.22.1 26-Feb-2006  riz Apply patch (requested by tron in ticket #10327):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.13.14.4 26-Feb-2006  riz Apply patch (requested by tron in ticket #1181):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.13.14.3 15-Feb-2006  riz Pull up following revision(s) (requested by tron in ticket #1169):
sys/arch/i386/pci/pchb_rnd.c: revision 1.18
Add hardware RNG support for Intel i925X chipset.
 1.13.14.2 15-Feb-2006  riz Pull up following revision(s) (requested by tron in ticket #1169):
sys/arch/i386/pci/pchb_rnd.c: revision 1.17
Add hardware RNG support for Intel i945G/P and i955X chipsets.
 1.13.14.1 14-Feb-2006  riz Pull up following revision(s) (requested by tron in ticket #1168):
sys/dev/pci/agp_i810.c: revision 1.28
sys/arch/i386/pci/pchb.c: revision 1.57
sys/dev/pci/agpvar.h: revision 1.11
sys/dev/pci/agp_via.c: revision 1.9
sys/dev/pci/agp.c: revision 1.37
sys/dev/pci/agpreg.h: revision 1.10
sys/dev/pci/pcidevs: revision 1.757
sys/dev/pci/agp_amd.c: revision 1.14
sys/dev/pci/agp_intel.c: revision 1.17
sys/dev/pci/agp_sis.c: revision 1.8
sys/dev/pci/agp_ali.c: revision 1.9
sys/arch/i386/pci/pchb_rnd.c: revision 1.16
PR/32550: Michael Eriksson: No agp(4) support for i915 integrated graphics
 1.13.6.1 26-Feb-2006  riz Apply patch (requested by tron in ticket #10327):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.13.2.1 26-Feb-2006  riz Apply patch (requested by tron in ticket #10327):
sys/arch/i386/pci/pchb_rnd.c
Improve code probing for the Intel hardware RNG to avoid false detections
 1.15.2.2 18-Feb-2006  yamt sync with head.
 1.15.2.1 01-Feb-2006  yamt sync with head.
 1.16.4.1 22-Apr-2006  simonb Sync with head.
 1.16.2.1 09-Sep-2006  rpaulo sync with head
 1.3 12-Feb-2006  tron Share Intel hardware random number generator support between amd64 and
i386 port. This will benefit EM64T systems using Intel i9xx chipsets.
 1.2 26-Dec-2005  perry branches: 1.2.2; 1.2.4; 1.2.6;
u_intN_t -> uintN_t
 1.1 27-Oct-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.44;
Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.1.44.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.4.1 27-Oct-2000  bouyer file pchbvar.h was added on branch thorpej_scsipi on 2000-11-22 16:00:29 +0000
 1.1.2.2 27-Oct-2000  thorpej Add support for sampling the random number generator on
the 810, 815, 820, and 840 chipsets. From OpenBSD, modified
for NetBSD by me.
 1.1.2.1 27-Oct-2000  thorpej file pchbvar.h was added on branch sommerfeld_i386mp_1 on 2000-10-27 22:49:22 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.7 27-Jan-1995  mycroft Clean up deleted files.
 1.6 04-Nov-1994  mycroft Make a wrapper match function to check the bus and device numbers, rather
than insisting that every driver do it.
 1.5 03-Nov-1994  mycroft Rename pciprobe() to pcimatch(), and move it to pci_machdep.c.
 1.4 03-Nov-1994  mycroft Always use direct configuration.
 1.3 27-Oct-1994  cgd new RCS ID format.
 1.2 10-Aug-1994  mycroft branches: 1.2.2;
Update some comments.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.1 10-Aug-1994  mycroft update from trunk
 1.2.2.2 10-Aug-1994  mycroft Update some comments.
 1.2.2.1 10-Aug-1994  mycroft file pci.c was added on branch netbsd-1-0 on 1994-08-10 04:37:53 +0000
 1.20 18-May-2008  jmcneill Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64.
 1.19 16-Nov-2006  christos branches: 1.19.52; 1.19.54; 1.19.56; 1.19.58;
__unused removal on arguments; approved by core.
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 26-Dec-2005  perry branches: 1.17.20; 1.17.22;
u_intN_t -> uintN_t
 1.16 11-Dec-2005  christos merge ktrace-lwp.
 1.15 22-Jun-2005  sekiya branches: 1.15.2;
It turns out that pci_addr_fixup() doesn't require PCIBIOS either. Decouple,
run it from mainbus_attach().
 1.14 31-May-2005  christos PR/30387: Nicolas Joly: -current i386 GENERIC_LAPTOP kernel compilation failure
 1.13 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.12 26-Feb-2003  fvdl branches: 1.12.2;
Adapt for i386/x86 change.
 1.11 15-Nov-2001  lukem branches: 1.11.2;
add RCSID
 1.10 27-Aug-2001  kanaoka - Correct a value of subend.
Pointed out by enami tsugutomo <enami@but-b.or.jp>.
 1.9 06-Jul-2001  mcr branches: 1.9.2;
added context parameter to pciaddr_resource_{reserve,allocate}
and to pci_device_foreach().
added new function pci_device_foreach_min().
 1.8 23-Apr-2001  kanaoka - fixup only #0 bus --> fixup maxbus.
- Don't pciaddr_do_resource_allocate if device is AGP
to avoid conflict.
 1.7 03-Aug-2000  nathanw branches: 1.7.4; 1.7.6;
Fix a problem uncovered by rev 1.5 of pcibios.c:

Avoid interpreting the upper 32 bits of 64-bit BARs as a 32-bit BAR.
Otherwise, the code would assume that the value 0 was incorrect and either:
(a) [on bus 0] "fix up" the address to some nonzero value, thus placing
the decoded address range outside of 32-bit address space, or
(b) [elsewhere] completely disable the device.

The fact that this behaviour depends on the bus number of the device is
already XXX'd.

XXX: This will need revisiting if and when we ever want to handle a PCI bus
XXX: with more than 32 bits of address space on an i386.

The onboard Adaptec 7890 on my Dell Precision Workstation 410 works again.
 1.6 02-Aug-2000  soda fix oversight introduced in previous my commmitment (revision 1.4),
pointed out by Michael Shalayeff <mickey@openbsd.org>.
 1.5 01-Aug-2000  uch reserve AGP space to avoid resource conflict.
 1.4 18-Jul-2000  soda use PCIBIOS_PRINTV() defined in pcibios.h, instead of homegrown DPRINTF().
 1.3 31-May-2000  uch branches: 1.3.2;
don't destroy PCI bus space extent for rbus_machdep.c
 1.2 17-May-2000  uch branches: 1.2.2;
Skip fixup phase when system BIOS setting were perfect.
don't write 0 to command register. (it is harmful).
 1.1 28-Apr-2000  uch PCI I/O address fixup routine.
When BIOS don't asign PCI I/O address space to device,
allocate it without conflict and write to PCI configuration header.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCIBIOS_PRINTV() as pcibiosverbose printf(),
instead of DPRINTF() in each C source.

- define PIR_DEVFUNC_{DEVICE,FUNCTION}.

- fix oversight introduced in pci_addr_fixup.c revision 1.4,
pointed out by Michael Shalayeff <mickey@openbsd.org>.

- reserve AGP space to avoid resource conflict.

by UCHIYAMA Yasushi <uch@netbsd.org>

- Fix a problem uncovered by rev 1.5 of pcibios.c:

Avoid interpreting the upper 32 bits of 64-bit BARs as a 32-bit BAR.
Otherwise, the code would assume that the value 0 was incorrect and either:
(a) [on bus 0] "fix up" the address to some nonzero value, thus placing
the decoded address range outside of 32-bit address space, or
(b) [elsewhere] completely disable the device.

The fact that this behaviour depends on the bus number of the device is
already XXX'd.

XXX: This will need revisiting if and when we ever want to handle a PCI bus
XXX: with more than 32 bits of address space on an i386.

The onboard Adaptec 7890 on my Dell Precision Workstation 410 works again.

by Nathan J Williams <nathanw@netbsd.org>

Revisions pulled up:
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/i386/pci/pcibios.h
> cvs rdiff -r1.3 -r1.5 syssrc/sys/arch/i386/pci/pcibios.c
> cvs rdiff -r1.3 -r1.7 syssrc/sys/arch/i386/pci/pci_addr_fixup.c
 1.7.6.4 08-Jan-2002  nathanw Catch up to -current.
 1.7.6.3 21-Sep-2001  nathanw Catch up to -current.
 1.7.6.2 24-Aug-2001  nathanw Catch up with -current.
 1.7.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.4.1 03-Aug-2000  bouyer file pci_addr_fixup.c was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.2.2 15-Nov-2001  lukem add RCSID
 1.11.2.1 15-Nov-2001  lukem file pci_addr_fixup.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:35 +0000
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.2 30-Dec-2006  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.17.22.2 10-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.19.58.1 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.19.56.1 04-May-2009  yamt sync with head.
 1.19.54.1 17-Jun-2008  yamt fix merge botches
 1.19.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 18-May-2008  jmcneill Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64.
 1.6 26-Dec-2005  perry branches: 1.6.74; 1.6.76; 1.6.78; 1.6.80;
u_intN_t -> uintN_t
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 11-Apr-2004  kochi branches: 1.4.12;
de __P, ANSIfy PCIBIOS related files.
 1.3 06-Jul-2001  mcr branches: 1.3.4; 1.3.24;
added context parameter to pciaddr_resource_{reserve,allocate}
and to pci_device_foreach().
added new function pci_device_foreach_min().
 1.2 31-May-2000  uch branches: 1.2.6; 1.2.8;
don't destroy PCI bus space extent for rbus_machdep.c
 1.1 28-Apr-2000  uch branches: 1.1.4;
PCI I/O address fixup routine.
When BIOS don't asign PCI I/O address space to device,
allocate it without conflict and write to PCI configuration header.
 1.1.4.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.8.1 24-Aug-2001  nathanw Catch up with -current.
 1.2.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.2.6.1 31-May-2000  bouyer file pci_addr_fixup.h was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.3.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.4.2 06-Jul-2001  mcr added context parameter to pciaddr_resource_{reserve,allocate}
and to pci_device_foreach().
added new function pci_device_foreach_min().
 1.3.4.1 06-Jul-2001  mcr file pci_addr_fixup.h was added on branch sommerfeld_i386mp_1 on 2001-07-06 18:02:36 +0000
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.6.80.2 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.6.80.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.78.1 04-May-2009  yamt sync with head.
 1.6.76.1 17-Jun-2008  yamt fix merge botches
 1.6.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 18-May-2008  jmcneill Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64.
 1.8 16-Nov-2006  christos branches: 1.8.52; 1.8.54; 1.8.56; 1.8.58;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 11-Dec-2005  christos branches: 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 20-Jun-2005  sekiya Remove unneeded dependancy on PCIBIOS.
 1.4 22-Jan-2002  uch branches: 1.4.2; 1.4.18;
Reset configuration of bridge order before enumerating bridge devices.
This is required when two or more bridges on the same bus, and some of
them are incompletely initialized by BIOS.
Reported by NAKAGAWA Yoshihisa <y-nakaga@nwsl.mesh.ad.jp>
 1.3 15-Nov-2001  lukem add RCSID
 1.2 06-Jul-2001  mcr branches: 1.2.2;
when fixing up buses, keep track of the parent of each bus,
and the pcitag to access the primary side of that bridge.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10; 1.1.12;
Code from UCHIYAMA Yasushi's PCI BIOS patches to renumber the PCI
busses.
 1.1.12.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.12.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.12.1 24-Aug-2001  nathanw Catch up with -current.
 1.1.10.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.10.1 17-Nov-1999  bouyer file pci_bus_fixup.c was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.18.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.2 22-Jan-2002  uch Reset configuration of bridge order before enumerating bridge devices.
This is required when two or more bridges on the same bus, and some of
them are incompletely initialized by BIOS.
Reported by NAKAGAWA Yoshihisa <y-nakaga@nwsl.mesh.ad.jp>
 1.4.2.1 22-Jan-2002  uch file pci_bus_fixup.c was added on branch sommerfeld_i386mp_1 on 2002-01-22 15:08:54 +0000
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.8.58.1 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.8.56.1 04-May-2009  yamt sync with head.
 1.8.54.1 17-Jun-2008  yamt fix merge botches
 1.8.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 18-May-2008  jmcneill Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64.
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78; 1.4.80;
merge ktrace-lwp.
 1.3 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.2 06-Jul-2001  mcr branches: 1.2.4; 1.2.24;
when fixing up buses, keep track of the parent of each bus,
and the pcitag to access the primary side of that bridge.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10; 1.1.12;
Code from UCHIYAMA Yasushi's PCI BIOS patches to renumber the PCI
busses.
 1.1.12.1 24-Aug-2001  nathanw Catch up with -current.
 1.1.10.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.10.1 17-Nov-1999  bouyer file pci_bus_fixup.h was added on branch thorpej_scsipi on 2000-11-20 20:09:34 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2.4.2 06-Jul-2001  mcr when fixing up buses, keep track of the parent of each bus,
and the pcitag to access the primary side of that bridge.
 1.2.4.1 06-Jul-2001  mcr file pci_bus_fixup.h was added on branch sommerfeld_i386mp_1 on 2001-07-06 18:03:18 +0000
 1.4.80.2 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.4.80.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.78.1 04-May-2009  yamt sync with head.
 1.4.76.1 17-Jun-2008  yamt fix merge botches
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 24-Apr-1997  mycroft This is no longer needed.
 1.4 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.3 13-Oct-1996  christos backout previous kprintf changes
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 27-Mar-1996  cgd modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) deprecate the pci_map_* functions, and provide them only
as compatibility interfaces (in pci_compat.c) which will
eventually go away, implemented as wrappers around
the functions described above.
(5) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
 1.52 16-Sep-2021  andvar fix typos in word "successfully", mainly s/succesfully/successfully/.
 1.51 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.50 09-Sep-2014  apb branches: 1.50.20;
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.
 1.49 01-Jul-2011  dyoung branches: 1.49.12; 1.49.28;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.48 06-Jun-2011  msaitoh Rename to use PCI_PRODUCT_INTEL_82801DBM_LPC
 1.47 28-Apr-2008  martin branches: 1.47.14; 1.47.22; 1.47.32;
Remove clause 3 and 4 from TNF licenses
 1.46 10-Dec-2006  uwe branches: 1.46.44; 1.46.46; 1.46.48;
For consistency use PCIBIOS_PRINTV instead of printf even under
#ifdef PCIBIOSVERBOSE.
 1.45 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.44 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.43 03-Sep-2006  christos branches: 1.43.2; 1.43.4;
add missing initializers.
 1.42 22-Jun-2006  jmcneill Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.41 21-Jun-2006  jmcneill Allow pci_intr_fixup() to be called more than once.
 1.40 18-Jun-2006  xtraeme Fix AMD 766 PMC entry.
 1.39 18-Jun-2006  xtraeme Match the following products:

* SIS 962 and SIS 963
* AMD 766 and AMD 768
* ALI M1533

... syncing the code with openbsd.
 1.38 20-May-2006  christos branches: 1.38.2;
Add another fixup entry Arthur Dimitrelis
 1.37 16-Feb-2006  kochi branches: 1.37.2; 1.37.6; 1.37.8;
add some more Intel LPC controllers
 1.36 01-Jan-2006  xtraeme branches: 1.36.2; 1.36.4;
PCI Interrupt router support for VIA VT823[1357] Southbridges.
From OpenBSD.
 1.35 26-Dec-2005  perry branches: 1.35.2;
u_intN_t -> uintN_t
 1.34 25-Dec-2005  rpaulo Add Intel 82801FBM ICH6M LPC Interface Bridge. There seem to be more
pci products missing, but I can only test this one.
 1.33 11-Dec-2005  christos merge ktrace-lwp.
 1.32 21-Jun-2005  sekiya branches: 1.32.2;
Rework the configuration scheme for PCI fixups:

* bus enumeration fixups are not PCIBIOS-specific, interrupt fixups are done
by both PCIBIOS and ACPI. The redundancy is very redundant. Therefore,
rename PCIBIOS_*_FIXUP to PCI_*_FIXUP, use PCI_INTR_FIXUP in place of
ACPI_PCI_FIXUP, and change code refences to match.

* move the fixup defines from opt_pcibios.h to opt_pcifixup.h to reflect
the above.

* fix up the PCI bus numbering in mainbus_attach(), right after we detect the
configuration mode. This probably renders the fixup in pcibios.c
redundant -- but it should be harmless.

These changes make cardbus work in ACPI-only machines, when PCI_BUS_FIXUP
and PCI_INTR_FIXUP are defined.
 1.31 03-Feb-2005  perry de-__P, partially ANSIfy
 1.30 30-Apr-2004  christos branches: 1.30.4; 1.30.6;
Deal with edge versus level interrupts properly. From Masanori Kanaoka.
 1.29 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.28 04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.27 27-Oct-2003  christos branches: 1.27.2;
Back out the libretto related hacks I accidentally committed. They are
in CVS in case one wants them :-)
 1.26 25-Oct-2003  christos Fix uninitialized variable warnings
 1.25 13-Oct-2003  dyoung Add the 82801EB LPC, which provides the PCI Interrupt Router on
the Dell PowerEdge 400SC.
 1.24 05-Apr-2003  perry branches: 1.24.2;
Recognize VT82C596A
Patch from Christopher SEKIYA in PR port-i386/21013
 1.23 26-Feb-2003  fvdl Adapt for i386/x86 change.
 1.22 22-Nov-2002  fvdl New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.21 20-Sep-2002  kanaoka Add support for "Intel 82801DB LPC".
kern/18348: From Andreas Wrede <andreas@planix.com>.
 1.20 01-Jun-2002  lukem branches: 1.20.2;
SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.19 07-Dec-2001  onoe branches: 1.19.10;
Add 82801BAM as piix.
Do not initialize global variables 'pciintr_icu_tag' to NULL.
Its type is 'const struct pciintr_icu *' (typedef'ed) and gcc sometimes(!)
put it in Text region. So force arrrange it to BSS.
 1.18 15-Nov-2001  lukem add RCSID
 1.17 27-Aug-2001  haya Add support for ALi M1543 in pcibios.
 1.16 01-Aug-2001  haya Add new entry for intel ICH2 LPC interrupt router. It has
upper compatibility with piix.
 1.15 17-Jul-2001  mrg fix a statementless label that gcc-current picked up.
 1.14 06-Jul-2001  mcr branches: 1.14.2;
extra argument to pci_device_foreach().
 1.13 16-May-2001  kanaoka Search the entire device-space of bus 0 if the router device
address is set to 000:00:0, and the compatible router entry
is undefined.

Patch PR port-i386/12880 by Dave Sainty <dave@dtsp.co.nz>.
 1.12 19-Apr-2001  uch patch PR port-i386/11114 by MINOURA Makoto.
 1.11 05-Jan-2001  aymeric branches: 1.11.4;
Initialize VIA Technologies' 82C686's ICU as if it were a 82C586.
This fixes interrupt allocation problems on modern Compaq laptops.
 1.10 10-Aug-2000  soda branches: 1.10.2;
Add another option PCIBIOS_INTR_GUESS for no compatible ICU found case.

Under this option, if only one IRQ is available for the link,
we assumes that the IRQ is already connected, and configure
PCI Interrupt Configuration Register accordingly.
This is what Linux pcmcia-cs-3.1.19 does by default.

This fixes unconfigured pccbb interrupt problem of
Sharp Mebius MN-5500. It's interrupt router is ITExpress Inc. IT8330G.
(http://www.ite.com.tw/, vendor=0x1283, product=0x8330)
Problem reporeted by Kitagawa <sk@kiu.ac.jp> in
http://www.kaynet.or.jp/~kay/ml/netbsd-pcmcia/msg/msg00608.html
 1.9 22-Jul-2000  soda better message from John Hawkinson <jhawk@MIT.EDU>
 1.8 18-Jul-2000  soda make PCIBIOS_IRQS_HINT patchable.
 1.7 18-Jul-2000  soda - Use PCIBIOS_PRINTV().
- Use PCI_INTERRUPT_PIN_MAX and I386_PCI_INTERRUPT_LINE_NO_CONNECTION
instead of magic number.

the Following changes are
{Modified with,Approved by} UCHIYAMA Yasushi <uch@netbsd.org>:

- Do not touch a PIRQ router, if the PIRQ is already routed
by the BIOS, or no appropriate IRQ is found for the PIRQ.
The latter prevents a panic on the machine of Frank van der Linden.

- Do not modify a PCI Interrupt Configuration register,
if it is already set by the BIOS, even if it is inconsistent
with the PCI IRQ routing table provided by the BIOS.
(The PCI Interrupt Configuration register seems to be more reliable
than the PCI IRQ routing table.)
This is needed to prevent a incorrect header_fixup() caused
by the incorrect PIR table on a Panasonic Let's Note AL-N2T516J5.

Provide "options PCIBIOS_INTR_FIXUP_FORCE" to retain
previous behavior, i.e. believe the PCI IRQ routing table
and ignore the PCI Interrupt Configuration register.
Although I'm not sure this is really needed.

- Do not modify a PCI Interrupt Configuration register,
if appropriate IRQ is not found for the link.

- Move a pciintr_icu_getclink() call and a pciintr_icu_get_intr()
call from pciintr_link_fixup() to pciintr_link_alloc(),
and only allocate pciintr_link_map if those calls succeeded.
This reduces number of calls of pciintr_icu_getclink(),
and also avoid necessity to validate a clink value in
ICU's {get,set}_{intr,trigger}() functions.
The sanity checks are not removed yet, though.

- Fix uninitialized usage of variable `bitmap' on stage 3
of pciintr_link_fixup().

- Remove a member variable `old_irq' from struct pciintr_link_map.

- Always use 0x%02x for printf format of canonical link value.

- Use DIAGNOSTIC instead of PCIINTR_DEBUG for really weird situation.
 1.6 09-Jul-2000  mycroft Do the interrupt fixup for all busses, not just bus 0.
This is necessary on some machines with multiple onboard PCI busses.
 1.5 28-Apr-2000  uch branches: 1.5.6;
PCIBIOS_IRQS changed to PCIBIOS_IRQS_HINT. PCIBIOS_IRQS_HINT is
used when no IRQ guess. when at least 1 PCI device configured
correctly, unused.
 1.4 25-Jan-2000  augustss Allow the set of PCI irqs to be overridden.
 1.3 13-Dec-1999  uch branches: 1.3.2;
initialize pciirq.
 1.2 17-Nov-1999  thorpej If we see a bogus $PIR table entry, just ignore it. The MPIIX has
entries for the IRQs used by the IDE controller, which aren't really
PCI IRQs (they're ISA compat IRQs), and thus have link values that
don't make a lot of sense.
 1.1 17-Nov-1999  thorpej PCI interrupt routing fixup code, from UCHIYAMA Yasushi's PCI BIOS
patches, cleaned up and heavily reworked by me. Basic algorithm is
the same, although the code structure is now quite different.

Main differences:
- Initialization path is totally different.
- We use the `compat router' information, if present, to determine which
PCI ICU driver we should use.
- Fixup configuration headers on devices not on bus 0.
 1.3.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.6.4 27-Oct-2001  he Pull up revision 1.17 (requested by hubertf):
Add support for ALi M1543 in pcibios as e.g. found in a Toshiba
Portege 4000.
Tested by hubertf.
 1.5.6.3 07-Jun-2001  he Pull up revision 1.11 (requested by aymeric):
Initialize VIA Tehcnologies' 82C686's ICU as if it were an 82C586.
Fixes interrupt allocation on modern Compaq laptops.
 1.5.6.2 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- Use PCIBIOS_PRINTV().

- Use PCI_INTERRUPT_PIN_MAX and I386_PCI_INTERRUPT_LINE_NO_CONNECTION
instead of magic number.

- Do not touch a PIRQ router, if the PIRQ is already routed
by the BIOS, or no appropriate IRQ is found for the PIRQ.
The latter prevents a panic on the machine of Frank van der Linden.

Do not modify a PCI Interrupt Configuration register,
if it is already set by the BIOS, even if it is inconsistent
with the PCI IRQ routing table provided by the BIOS.
(The PCI Interrupt Configuration register seems to be more reliable
than the PCI IRQ routing table.)
This is needed to prevent a incorrect header_fixup() caused
by the incorrect PIR table on a Panasonic Let's Note AL-N2T516J5.
Provide "options PCIBIOS_INTR_FIXUP_FORCE" to retain
previous behavior, i.e. believe the PCI IRQ routing table
and ignore the PCI Interrupt Configuration register.
Although I'm not sure this is really needed.

Do not modify a PCI Interrupt Configuration register,
if appropriate IRQ is not found for the link.

Move a pciintr_icu_getclink() call and a pciintr_icu_get_intr()
call from pciintr_link_fixup() to pciintr_link_alloc(),
and only allocate pciintr_link_map if those calls succeeded.
This reduces number of calls of pciintr_icu_getclink(),
and also avoid necessity to validate a clink value in
ICU's {get,set}_{intr,trigger}() functions.
The sanity checks are not removed yet, though.

Fix uninitialized usage of variable `bitmap' on stage 3
of pciintr_link_fixup().

Remove a member variable `old_irq' from struct pciintr_link_map.

Always use 0x%02x for printf format of canonical link value.

Use DIAGNOSTIC instead of PCIINTR_DEBUG for really weird situation.

Modified with UCHIYAMA Yasushi <uch@netbsd.org>.

- make PCIBIOS_IRQS_HINT patchable.

- better message from John Hawkinson <jhawk@MIT.EDU>

- Add another option PCIBIOS_INTR_GUESS for no compatible ICU found case.

Under this option, if only one IRQ is available for the link,
we assumes that the IRQ is already connected, and configure
PCI Interrupt Configuration Register accordingly.
This is what Linux pcmcia-cs-3.1.19 does by default.

This fixes unconfigured pccbb interrupt problem of
Sharp Mebius MN-5500. It's interrupt router is ITExpress Inc. IT8330G.
(http://www.ite.com.tw/, vendor=0x1283, product=0x8330)
Problem reporeted by Kitagawa <sk@kiu.ac.jp> in
http://www.kaynet.or.jp/~kay/ml/netbsd-pcmcia/msg/msg00608.html

Revision pulled up:
> cvs rdiff -r1.6 -r1.10 syssrc/sys/arch/i386/pci/pci_intr_fixup.c
 1.5.6.1 27-Jul-2000  mycroft Approved by thorpej:
Do interrupt fixup for all busses, not just bus 0. (There may be onboard
devices at other bus numbers, particularly on a machine with multiple primary
busses.)

syssrc/sys/arch/i386/pci/pci_intr_fixup.c 1.5 -> 1.6
 1.10.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.10.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.10.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.10.2.1 10-Aug-2000  bouyer file pci_intr_fixup.c was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.11.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.11.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.11.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.11.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.11.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.11.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.11.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.14.2.1 03-Aug-2001  lukem update to -current
 1.19.10.1 14-Jul-2002  gehenna catch up with -current.
 1.20.2.2 01-Jun-2002  lukem SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.20.2.1 01-Jun-2002  lukem file pci_intr_fixup.c was added on branch sommerfeld_i386mp_1 on 2002-06-01 23:50:56 +0000
 1.24.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.24.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 28-Apr-2004  jmc Pullup rev 1.28 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.30.6.1 12-Feb-2005  yamt sync with head.
 1.30.4.1 29-Apr-2005  kent sync with -current
 1.32.2.2 30-Dec-2006  yamt sync with head.
 1.32.2.1 21-Jun-2006  yamt sync with head.
 1.35.2.2 18-Feb-2006  yamt sync with head.
 1.35.2.1 15-Jan-2006  yamt sync with head.
 1.36.4.2 01-Jun-2006  kardel Sync with head.
 1.36.4.1 22-Apr-2006  simonb Sync with head.
 1.36.2.1 09-Sep-2006  rpaulo sync with head
 1.37.8.1 19-Jun-2006  chap Sync with head.
 1.37.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.2.3 14-Sep-2006  yamt sync with head.
 1.37.2.2 26-Jun-2006  yamt sync with head.
 1.37.2.1 24-May-2006  yamt sync with head.
 1.38.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.43.4.2 10-Dec-2006  yamt sync with head.
 1.43.4.1 22-Oct-2006  yamt sync with head
 1.43.2.2 12-Jan-2007  ad Sync with head.
 1.43.2.1 18-Nov-2006  ad Sync with head.
 1.46.48.1 16-May-2008  yamt sync with head.
 1.46.46.1 18-May-2008  yamt sync with head.
 1.46.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.47.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.47.22.1 12-Jun-2011  rmind sync with head
 1.47.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.49.28.1 11-Sep-2014  martin Pull up following revision(s) (requested by apb in ticket #88):
sys/arch/i386/pci/pci_intr_fixup.c: revision 1.50
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.
 1.49.12.1 03-Dec-2017  jdolecek update from HEAD
 1.50.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9 22-Jun-2006  jmcneill Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.8 01-Jan-2006  xtraeme branches: 1.8.2; 1.8.6; 1.8.14;
PCI Interrupt router support for VIA VT823[1357] Southbridges.
From OpenBSD.
 1.7 26-Dec-2005  perry branches: 1.7.2;
u_intN_t -> uintN_t
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 11-Apr-2004  kochi branches: 1.5.12;
de __P, ANSIfy PCIBIOS related files.
 1.4 04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.3 27-Aug-2001  haya branches: 1.3.2; 1.3.22; 1.3.24;
Add support for ALi M1543 in pcibios.
 1.2 19-Apr-2001  uch branches: 1.2.4;
patch PR port-i386/11114 by MINOURA Makoto.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8; 1.1.10; 1.1.12;
PCI interrupt routing fixup code, from UCHIYAMA Yasushi's PCI BIOS
patches, cleaned up and heavily reworked by me. Basic algorithm is
the same, although the code structure is now quite different.

Main differences:
- Initialization path is totally different.
- We use the `compat router' information, if present, to determine which
PCI ICU driver we should use.
- Fixup configuration headers on devices not on bus 0.
 1.1.12.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.12.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.10.3 23-Apr-2001  bouyer Sync with HEAD.
 1.1.10.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.10.1 17-Nov-1999  bouyer file pci_intr_fixup.h was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.1.8.1 27-Oct-2001  he Pull up revision 1.3 (via patch, requested by hubertf):
Add support for ALi M1543 in pcibios as e.g. found in a Toshiba
Portege 4000.
Tested by hubertf.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.3.24.1 28-Apr-2004  jmc Pullup rev 1.4 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.3.2.2 27-Aug-2001  haya Add support for ALi M1543 in pcibios.
 1.3.2.1 27-Aug-2001  haya file pci_intr_fixup.h was added on branch sommerfeld_i386mp_1 on 2001-08-27 08:21:22 +0000
 1.5.12.2 30-Dec-2006  yamt sync with head.
 1.5.12.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.8.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.8.6.1 26-Jun-2006  yamt sync with head.
 1.8.2.1 09-Sep-2006  rpaulo sync with head
 1.52 27-Feb-2003  fvdl Moved to x86/pci.
 1.51 26-Feb-2003  fvdl Adapt for i386/x86 change.
 1.50 22-Nov-2002  fvdl New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.49 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.48 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.47 23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.46 10-Aug-2002  minoura Add quirk for Connectix Virtual PC 5 (for Windows at least) emulated
PCI bridge (440BX).
Note that there's still a problem that emulated 21140 cannot be driven
by if_tlp. Workaround is to use if_de.
 1.45 25-Jun-2002  drochner use PCI_ID_CODE instead of a local macro (cosmetics)
 1.44 28-Feb-2002  thorpej branches: 1.44.8; 1.44.10;
Default to telling the MI PCI code that rd/line, rd/mult, and wr/inv
commands are OK.
 1.43 15-Nov-2001  lukem add RCSID
 1.42 06-Jul-2001  mcr branches: 1.42.2;
added some debugging to error message in pci_intr_map().
 1.41 15-May-2001  lukem delint: don't try & return something from void pci_intr_disestablish()
 1.40 28-Dec-2000  sommerfeld branches: 1.40.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.39 18-Jul-2000  soda use PCI_INTERRUPT_PIN_MAX and I386_PCI_INTERRUPT_LINE_NO_CONNECTION,
instead of magic number
 1.38 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.37 26-Jun-2000  mrg remove/move more mach vm header files:

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

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.36 04-Jun-2000  cgd branches: 1.36.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.35 11-Dec-1999  thorpej branches: 1.35.2; 1.35.4;
Put an interrupt-safe mutex around PCI configuration space access.
 1.34 28-Jan-1999  drochner branches: 1.34.8; 1.34.14;
defopt PCI_CONF_MODE
 1.33 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.32 09-Jul-1998  drochner redo the PCI configuration mode detection - should make some less
standard compliant PCI chipsets work (Compaq, Connectix emulated Triton)
fix the bug reported in PR port-i386/5727 (soda@sra.co.jp)
 1.31 03-Jun-1998  thorpej EISA and PCI do not require bouncing; specify a bounce threshold of 0.
 1.30 04-May-1998  thorpej Add a function, pci_bus_flags(), that determines which flags (for memory
and i/o enabled) should be passed to the primary PCI bus's autconfiguration
node. Use this function to detect broken PCI-Host bridges, which have
problems with memory-mapped access. Add the SIS 85C496 to this list.
 1.29 26-Apr-1998  thorpej Garbage-collect the DMA tag's "_cookie" member; it's not used for anything.
 1.28 06-Jun-1997  thorpej branches: 1.28.8;
Pull thorpej-bus-dma branch into mainline.
 1.27 17-Dec-1996  thorpej branches: 1.27.8;
Implement pci_decompose_tag().
 1.26 24-Oct-1996  fvdl Make this compile again if PCI_CONF_MODE is defined (unused label).
 1.25 13-Oct-1996  christos backout previous kprintf changes
 1.24 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.23 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.22 27-Mar-1996  mycroft Use a more standard and more sane error cleanup convention...
 1.21 27-Mar-1996  cgd modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) deprecate the pci_map_* functions, and provide them only
as compatibility interfaces (in pci_compat.c) which will
eventually go away, implemented as wrappers around
the functions described above.
(5) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
 1.20 04-Mar-1996  cgd reorganize mapping register definitions
 1.19 28-Feb-1996  cgd make PCI bus match/attach and sub-device attachment machine-independent.
(remove that code from this file.)
 1.18 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.17 27-Jul-1995  cgd fix a pasto
 1.16 27-Jul-1995  mycroft Add stuff for I/O mapping.
 1.15 18-Jun-1995  cgd use new pcireg.h macros
 1.14 05-Jun-1995  mycroft Use the memory mapping set up by the BIOS.
 1.13 23-May-1995  cgd define pcicd, pciattach() here now.
 1.12 17-Apr-1995  cgd clean up several ISA device interfaces: autoconfiguration, header
inclusion, and interrupt configuration. more work still needs to be done,
but it's getting better...
 1.11 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.10 27-Jan-1995  cgd move mi pci files to /sys/dev
 1.9 03-Jan-1995  mycroft Add interrupt sharing types.
 1.8 28-Dec-1994  mycroft Don't turn on the SCE bit in the enable register.
 1.7 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.6 04-Nov-1994  mycroft Change all of the uses of IRQ{0-15} and bit masks to use plain numbers
rather than bit shifting.
 1.5 03-Nov-1994  mycroft Rename pciprobe() to pcimatch(), and move it to pci_machdep.c.
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 06-Sep-1994  mycroft branches: 1.3.2;
Remove bogus attempt to map the interrupt pins here. The BIOS is supposed to
do it anyway.
 1.2 10-Aug-1994  mycroft Update some comments.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.1 10-Aug-1994  mycroft update from trunk
 1.3.2.2 06-Sep-1994  mycroft Remove bogus attempt to map the interrupt pins here. The BIOS is supposed to
do it anyway.
 1.3.2.1 06-Sep-1994  mycroft file pci_machdep.c was added on branch netbsd-1-0 on 1994-09-06 01:25:23 +0000
 1.27.8.2 18-May-1997  thorpej Don't provide the pci dma tag in pci_attach_hook().
 1.27.8.1 13-May-1997  thorpej Provide a bus dma tag to children via pci_attach_hook().
 1.28.8.1 13-Aug-1998  mellon Pull up 1.32 and part of 1.29 (drochner)
 1.34.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.34.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.4.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.35.2.14 19-Aug-2002  sommerfeld merged with -current as of today.
rearranged gdt init to deal with KVM86 changes; however, KVM86 has no
chance of working yet; good thing it's not part of GENERIC
 1.35.2.13 25-Jun-2002  sommerfeld Resynch with -current.
 1.35.2.12 18-May-2002  sommerfeld Use pa_rawintrpin instead of swizzled interrupt pin.
 1.35.2.11 27-Apr-2002  sommerfeld Merge with current as of today
 1.35.2.10 29-Dec-2001  sommerfeld Yet another mergeup.

New work:
- Frank van der Linden's tlb shootdown fix.
Mainline functionality merged:
- IrDA
- Kernel RCSID's
- Transmeta CPU support
- ACPI
- XMM register access through procfs
 1.35.2.9 11-Dec-2001  sommerfeld Enhance debug messages when mapping not found.
 1.35.2.8 19-Jul-2001  sommerfeld catch up with -current
 1.35.2.7 23-May-2001  sommerfeld Merge branch with tonight's current.
boots multiuser.
 1.35.2.6 07-Jan-2001  sommerfeld Snapshot of merge-in-progress with -current.

[Not expected to build]. Catch up with the last N months worth of
changes to -current.
 1.35.2.5 29-Dec-2000  sommerfeld Adapt to pci_intr_map API change.

Use pa->pa_tag rather than pa->pa_intrtag to find the interrupt
mapping since the MP tables use the real device id and pin rather than
the device id of the bridge and the swizzled pin.
 1.35.2.4 26-Aug-2000  sommerfeld Statically initialize pci_conf_slock at compile time rather than in
pci_mode_detect(), since pcibios may want to do pci_conf_read() calls
before pci_mode_detect() is invoked.
 1.35.2.3 07-Aug-2000  sommerfeld Merge sommerfeld_i386mp_1 branch forward to 20000806 sources
 1.35.2.2 25-Jun-2000  sommerfeld Merge up to just-post-1.5 -current
 1.35.2.1 20-Feb-2000  sommerfeld when IO APIC is in use, and we have an APIC wiring for the pin, use it
rather than using the ISA interrupt mapping for the PCI interrupt pin.
 1.36.2.2 09-Sep-2002  itojun sys/arch/i386/pci/pci_machdep.c 1.46
Add quirk for Connectix Virtual PC 5 (for Windows at least) emulated
PCI bridge (440BX).
Note that there's still a problem that emulated 21140 cannot be driven
by if_tlp. Workaround is to use if_de.

(minoura)
 1.36.2.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCI_INTERRUPT_PIN_MAX and use it instead of magic number.
- define I386_PCI_INTERRUPT_LINE_NO_CONNECTION and use it instead of
magic number.

Revisions pulled up:
> cvs rdiff -r1.28 -r1.29 syssrc/sys/dev/pci/pcireg.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/pci_machdep.h
> cvs rdiff -r1.38 -r1.39 syssrc/sys/arch/i386/pci/pci_machdep.c
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c558.c \
> syssrc/sys/arch/i386/pci/sis85c503.c \
> syssrc/sys/arch/i386/pci/via82c586.c
 1.40.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.40.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.40.2.6 13-Aug-2002  nathanw Catch up to -current.
 1.40.2.5 01-Aug-2002  nathanw Catch up to -current.
 1.40.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.40.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.40.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.40.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.42.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.42.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.42.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.10.1 07-Dec-2002  he Pull up revision 1.46 (requested by minoura in ticket #944):
Add a quirk for Connectix Virtual PC 5 (for Windows, at
least) emulated PCI bridge (440BX).
 1.44.8.2 31-Aug-2002  gehenna catch up with -current.
 1.44.8.1 16-Jul-2002  gehenna catch up with -current.
 1.12 19-Mar-1999  cgd Moved to arch/i386/include/pci_machdep.h,v
 1.11 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.10 13-Aug-1998  thorpej vm_offset_t -> {vaddr_t,paddr_t}, vm_size_t -> vsize_t
 1.9 04-May-1998  thorpej Add a function, pci_bus_flags(), that determines which flags (for memory
and i/o enabled) should be passed to the primary PCI bus's autconfiguration
node. Use this function to detect broken PCI-Host bridges, which have
problems with memory-mapped access. Add the SIS 85C496 to this list.
 1.8 26-Aug-1997  thorpej Notify drivers that we "prefer" I/O mapped space, per discussion with
Chris Demetriou and Matt Thomas, some two or three months ago. (This hint
is used by the latest "de" driver.)
 1.7 06-Jun-1997  thorpej branches: 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 17-Dec-1996  thorpej branches: 1.6.8;
Implement pci_decompose_tag().
 1.5 27-Mar-1996  cgd modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) deprecate the pci_map_* functions, and provide them only
as compatibility interfaces (in pci_compat.c) which will
eventually go away, implemented as wrappers around
the functions described above.
(5) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
 1.4 14-Mar-1996  cgd (1) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(2) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)
 1.3 17-Apr-1995  cgd clean up several ISA device interfaces: autoconfiguration, header
inclusion, and interrupt configuration. more work still needs to be done,
but it's getting better...
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.2 09-Aug-1994  mycroft Add PCI autoconfiguration support.
 1.1.2.1 09-Aug-1994  mycroft file pci_machdep.h was added on branch netbsd-1-0 on 1994-08-09 00:47:53 +0000
 1.6.8.1 18-May-1997  thorpej Add an external declaration for the pci dma tag.
 1.7.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.43 26-Oct-2007  xtraeme Share pcib(4) and amdpcib(4) between i386 and amd64; one copy is enough.
 1.42 16-Nov-2006  christos branches: 1.42.26; 1.42.28; 1.42.32;
__unused removal on arguments; approved by core.
 1.41 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.40 19-Feb-2006  thorpej branches: 1.40.14; 1.40.16;
Use aprint_*().
 1.39 17-Feb-2006  wiz Fix typo.
 1.38 16-Feb-2006  rpaulo PR 32848: Nicolas Joly: typo
 1.37 11-Dec-2005  christos branches: 1.37.2; 1.37.4; 1.37.6;
merge ktrace-lwp.
 1.36 26-Jun-2005  fair branches: 1.36.2;
The Cyrix cs5530 PCI host bridge does not have a broken latch on the i8254
clock core, unlike its predecessors the cs5510 and cs5520.

This reverses the setting from i386/1386/identcpu.c where it argueably should
not have been set in the first place, as argued in PR kern/25261

XXX One other thing: the i8254 latch compensation code is only found in
i386/isa/clock.c and NOT in i386/i386/microtime.S where it should also be.
 1.35 03-Feb-2005  perry branches: 1.35.4;
de-__P, partially ANSIfy
 1.34 30-Aug-2004  drochner branches: 1.34.4; 1.34.6;
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.33 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.32 26-Feb-2003  fvdl branches: 1.32.2;
Adapt for i386/x86 change.
 1.31 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.30 02-Oct-2002  thorpej Tidy up CFATTACH_DECL() formatting.
 1.29 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.28 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.27 15-Nov-2001  lukem branches: 1.27.2;
add RCSID
 1.26 12-May-2000  bouyer branches: 1.26.8; 1.26.10;
The VIA Technologies VT82C686A SMBus Controller claims to be a PCI/ISA
bridge, ignore it. Should fix kern/10093 by Mark Dohring.
 1.25 20-Sep-1999  drochner branches: 1.25.2;
add missing break, spotted by Wolfgang Solfrank
 1.24 14-Jul-1999  drochner recognize SIS 85C503 as PCI-ISA bridge, from Gregory McGarry per PR
port-i386/7972
 1.23 26-Oct-1998  enami branches: 1.23.6; 1.23.8;
Explicitly test Intel 82371AB PCI-ISA bridge since *some* of them
identify themselves as miscellaneous bridge rather than isa bridge.
 1.22 26-Oct-1998  enami Cosmetic change; use tab for basic indentation rather than four space.
 1.21 18-Sep-1998  drochner Remove the chips which are known to identify properly out of the
old "match" function - more or less for documentation.
Proposed by "Soren S. Jorvang" <soren@t.dk>.
 1.20 18-Sep-1998  drochner Take the Intel SIO into the special case list - it identifies itself
as "prehistoric". From John Kohl.
 1.19 24-Aug-1998  drochner The Intel 82371MX identifies itself erroneously as a miscellaneous bridge.
(from "Johnny C. Lam" <lamj@stat.cmu.edu> per PR kern/6021)
 1.18 07-Aug-1998  drochner Match PCI-ISA bridges on class/subclass instead of vendor/device.
2 reasons:
-no need to keep a list of all known parts
-there is at least 1 bridge (ACC micro 2051) which reports the same
device ID for its various subfunctions; this would require an additional
check in the match function
(keep the old list inside #if 0 in case one of the historical bridges
doesn't report the right class/subclass - I can't check them all)
 1.17 05-Aug-1998  perry bzero->memset
 1.16 13-Jul-1998  mark Recognise the ALI M1543 in order to support ALI Aladdin V chipset
motherboards.
 1.15 15-Jun-1998  bouyer PCI_PRODUCT_VIATECH_VT82C586 is now PCI_PRODUCT_VIATECH_VT82C586_ISA.
 1.14 09-Jun-1998  thorpej Use config_defer().
 1.13 08-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.12 28-Mar-1998  cgd cope with name fixup in pcidevs
 1.11 06-Feb-1998  thorpej Use __BROKEN_INDIRECT_CONFIG where appropriate.
 1.10 12-Jan-1998  thorpej Update for changes to config.
 1.9 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.8 01-Oct-1997  drochner adapt to changed device names
 1.7 03-Aug-1997  fvdl Recognize some more chipsets.
 1.6 30-Jul-1997  perry Add another bridge ID, from pr 3926 submitted by Soren S. Jorvang
 1.5 24-Jun-1997  thorpej branches: 1.5.4;
Update for repaired Triton MX PCI ID.
 1.4 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.3 18-May-1997  thorpej branches: 1.3.2;
Remove comment about bus dma tag. I've been convinced otherwise.
 1.2 18-May-1997  thorpej Add a comment about why the bus dma tag is not provided to the child
bus attaching to the bridge.
 1.1 28-Nov-1996  thorpej Implement a simple generic PCI-ISA bridge driver. This driver exists
primarily to nicely print version information about your PCI chipset
(try with "options PCIVERBOSE"). Eventually, it may be used to
enable/disable features/bugs of a given PCI chipset. In addition, this
driver uses the PCI-ISA bridge callback mechanism to logically attach the
ISA bus to the PCI-ISA bridge.
 1.3.2.2 18-May-1997  thorpej Provide the isa dma tag to children.
 1.3.2.1 18-May-1997  thorpej file pcib.c was added on branch thorpej-bus-dma on 1997-05-18 23:45:51 +0000
 1.5.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.8.1 02-Aug-1999  thorpej Update from trunk.
 1.23.6.1 22-May-2000  he Pull up revision 1.26 (requested by bouyer):
Do not handle the VIA Technologies VT82C688A SMBus Controller
as a PCI/ISA bridge. Fixes PR#10093.
 1.25.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.26.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.8.3 03-Jan-2003  thorpej Sync with HEAD.
 1.26.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.26.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.27.2.2 15-Nov-2001  lukem add RCSID
 1.27.2.1 15-Nov-2001  lukem file pcib.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:35 +0000
 1.32.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.32.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.32.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.32.2.2 03-Sep-2004  skrll Sync with HEAD
 1.32.2.1 03-Aug-2004  skrll Sync with HEAD
 1.34.6.1 12-Feb-2005  yamt sync with head.
 1.34.4.1 29-Apr-2005  kent sync with -current
 1.35.4.1 12-Jul-2005  tron Pull up revision 1.36 (requested by fair in ticket #557):
The Cyrix cs5530 PCI host bridge does not have a broken latch on the i8254
clock core, unlike its predecessors the cs5510 and cs5520.
This reverses the setting from i386/1386/identcpu.c where it argueably should
not have been set in the first place, as argued in PR kern/25261
XXX One other thing: the i8254 latch compensation code is only found in
i386/isa/clock.c and NOT in i386/i386/microtime.S where it should also be.
 1.36.2.3 27-Oct-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.37.2.2 01-Mar-2006  yamt sync with head.
 1.37.2.1 18-Feb-2006  yamt sync with head.
 1.40.16.2 10-Dec-2006  yamt sync with head.
 1.40.16.1 22-Oct-2006  yamt sync with head
 1.40.14.1 18-Nov-2006  ad Sync with head.
 1.42.32.1 13-Nov-2007  bouyer Sync with HEAD
 1.42.28.1 06-Nov-2007  matt sync with HEAD
 1.42.26.3 28-Oct-2007  joerg Sync with HEAD.
 1.42.26.2 05-Aug-2007  jmcneill Since ichlpcib calls pcibattach, we need to ensure that pcibattach doesn't
try to overwrite a power handler that has already been registered.
 1.42.26.1 05-Aug-2007  jmcneill Add minimal power management support for the generic pcib driver.
 1.40 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.39 26-Jul-2010  jym branches: 1.39.60;
Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.
 1.38 28-Apr-2010  dyoung On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag. For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM. In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem. Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.
 1.37 16-Feb-2010  dyoung branches: 1.37.2;
Get rid of all PCI_CONF_MODE #ifdef'age except for the little bit
that initializes pci_mode, which I have moved to the top.

Make pci_mode private to pci_machdep.c.

Provide pci_mode_set() for pcibios.c to configure the PCI Configuration
Mechanism. KASSERT() in pci_mode_set() that the mechanism is not
changing from anything but the "don't know" value, -1.
 1.36 28-Apr-2008  martin branches: 1.36.14; 1.36.20;
Remove clause 3 and 4 from TNF licenses
 1.35 25-Dec-2007  perry branches: 1.35.6; 1.35.8; 1.35.10;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.34 04-Mar-2007  christos branches: 1.34.20; 1.34.26; 1.34.28; 1.34.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.33 05-Feb-2007  dyoung branches: 1.33.2;
Cosmetic: use the name PCI_INTERRUPT_REG instead of the number
0x3c.
 1.32 19-Feb-2006  thorpej branches: 1.32.14;
Use aprint_*().
 1.31 26-Dec-2005  perry branches: 1.31.2; 1.31.4; 1.31.6;
u_intN_t -> uintN_t
 1.30 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.29 11-Dec-2005  christos merge ktrace-lwp.
 1.28 22-Jun-2005  sekiya branches: 1.28.2;
Remove unnecessary #includes.
 1.27 22-Jun-2005  sekiya It turns out that pci_addr_fixup() doesn't require PCIBIOS either. Decouple,
run it from mainbus_attach().
 1.26 21-Jun-2005  sekiya Error out if obsolete fixup config directives are used.

Pointed out by wiz@
 1.25 21-Jun-2005  sekiya Rework the configuration scheme for PCI fixups:

* bus enumeration fixups are not PCIBIOS-specific, interrupt fixups are done
by both PCIBIOS and ACPI. The redundancy is very redundant. Therefore,
rename PCIBIOS_*_FIXUP to PCI_*_FIXUP, use PCI_INTR_FIXUP in place of
ACPI_PCI_FIXUP, and change code refences to match.

* move the fixup defines from opt_pcibios.h to opt_pcifixup.h to reflect
the above.

* fix up the PCI bus numbering in mainbus_attach(), right after we detect the
configuration mode. This probably renders the fixup in pcibios.c
redundant -- but it should be harmless.

These changes make cardbus work in ACPI-only machines, when PCI_BUS_FIXUP
and PCI_INTR_FIXUP are defined.
 1.24 21-Jun-2005  sekiya Fix uninitialized pointer problem in rbus code ... just because the kernel is
compiled with PCIBIOS_ADDR_FIXUP doesn't necessarily mean that
pcibios_addr_fixup() succeeded ...
 1.23 20-Jun-2005  sekiya pci_device_foreach(), pci_device_foreach_min(), pci_bridge_foreach(), and
pci_bridge_hook don't actually have any dependancies on PCIBIOS-specific code,
and they can be used to fixup PCI bus numbering in the absence of the BIOS.

To that end, decouple them from PCIBIOS.
 1.22 03-Feb-2005  perry de-__P, partially ANSIfy
 1.21 21-Nov-2004  augustss branches: 1.21.4; 1.21.6;
Some more Sharp MM20 fixup code that I forgot to commit in the first round.
 1.20 21-Oct-2004  augustss Add a gross hack to route the ECHI interrupt on the Sharp MM20.
You can read the long and sad story about the BIOS in a comment.
 1.19 03-May-2004  kochi don't use large stuff on stack.
(char devinfo[256] -> char *devinfo)
 1.18 30-Apr-2004  christos Add code to deal with the losing Libretto L2/L3 pcibios. From Masanori
Kanaoka. I've been sitting on this code for 3 years, and have not done
anything better with it. It is ugly, it needs to be handled better, but
it is better to have it #ifdef'ed out rather than nothing.
 1.17 24-Apr-2004  uwe Adapt to pci_devinfo signature change.
 1.16 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.15 04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.14 27-Oct-2003  christos branches: 1.14.2;
Back out the libretto related hacks I accidentally committed. They are
in CVS in case one wants them :-)
 1.13 25-Oct-2003  christos Fix uninitialized variable warnings
 1.12 17-Sep-2003  drochner syntax error in comment
 1.11 26-Feb-2003  fvdl branches: 1.11.2;
Adapt for i386/x86 change.
 1.10 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.9 28-Jan-2002  christos branches: 1.9.2;
Look for _PIR in addition to $PIR. My libretto L2 now works without
any other kludges.
 1.8 22-Jan-2002  uch Add pci_bridge_foreach ().
 1.7 15-Nov-2001  lukem add RCSID
 1.6 06-Jul-2001  mcr branches: 1.6.2;
context argument added to pci_device_foreach().
 1.5 01-Aug-2000  uch branches: 1.5.4; 1.5.6;
reserve AGP space to avoid resource conflict.
 1.4 18-Jul-2000  soda - define pcibiosverbose here, instead of each C source.
- use PIR_DEVFUNC_{DEVICE,FUNCTION}.
 1.3 28-Apr-2000  uch branches: 1.3.6;
PCIBIOS_IRQS changed to PCIBIOS_IRQS_HINT. PCIBIOS_IRQS_HINT is
used when no IRQ guess. when at least 1 PCI device configured
correctly, unused.
 1.2 17-Nov-1999  thorpej branches: 1.2.2;
Fix up the PCI bus numbering after fixing up interrupts.
 1.1 17-Nov-1999  thorpej Basic interface to the PCI BIOS and PCI Interrupt Routing table, separated
out from UCHIYAMA Yasushi's PCI BIOS patches, and fairly heavily reworked
by me.

Main differences:
- Only use the PCI BIOS to get the config mechanism and interrupt routing
info for now. No need to use the BIOS for PCI config access right now,
since the old mechanism works fine, and this keeps the code smaller.
- PCI BIOS initialization code path is much different.
- Always use the $PIR table if it exists, and only fallback to the
PCI BIOS 2.1 GetInterruptRouting call if it's not there.

This module does not include any of the fixup code; that is coming
in separate commits.
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.6.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCIBIOS_PRINTV() as pcibiosverbose printf(),
instead of DPRINTF() in each C source.

- define PIR_DEVFUNC_{DEVICE,FUNCTION}.

- fix oversight introduced in pci_addr_fixup.c revision 1.4,
pointed out by Michael Shalayeff <mickey@openbsd.org>.

- reserve AGP space to avoid resource conflict.

by UCHIYAMA Yasushi <uch@netbsd.org>

- Fix a problem uncovered by rev 1.5 of pcibios.c:

Avoid interpreting the upper 32 bits of 64-bit BARs as a 32-bit BAR.
Otherwise, the code would assume that the value 0 was incorrect and either:
(a) [on bus 0] "fix up" the address to some nonzero value, thus placing
the decoded address range outside of 32-bit address space, or
(b) [elsewhere] completely disable the device.

The fact that this behaviour depends on the bus number of the device is
already XXX'd.

XXX: This will need revisiting if and when we ever want to handle a PCI bus
XXX: with more than 32 bits of address space on an i386.

The onboard Adaptec 7890 on my Dell Precision Workstation 410 works again.

by Nathan J Williams <nathanw@netbsd.org>

Revisions pulled up:
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/i386/pci/pcibios.h
> cvs rdiff -r1.3 -r1.5 syssrc/sys/arch/i386/pci/pcibios.c
> cvs rdiff -r1.3 -r1.7 syssrc/sys/arch/i386/pci/pci_addr_fixup.c
 1.5.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.5.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.5.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.6.1 24-Aug-2001  nathanw Catch up with -current.
 1.5.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.4.1 01-Aug-2000  bouyer file pcibios.c was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.6.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.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.2 24-Feb-2002  sommerfeld squish some more assembler warnings.
 1.9.2.1 28-Jan-2002  sommerfeld file pcibios.c was added on branch sommerfeld_i386mp_1 on 2002-02-24 01:55:12 +0000
 1.11.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.11.2.5 29-Nov-2004  skrll Sync with HEAD.
 1.11.2.4 02-Nov-2004  skrll Sync with HEAD.
 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-Aug-2004  skrll Sync with HEAD
 1.14.2.1 28-Apr-2004  jmc Pullup rev 1.15 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.21.6.1 12-Feb-2005  yamt sync with head.
 1.21.4.1 29-Apr-2005  kent sync with -current
 1.28.2.4 21-Jan-2008  yamt sync with head
 1.28.2.3 03-Sep-2007  yamt sync with head.
 1.28.2.2 26-Feb-2007  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.31.6.1 22-Apr-2006  simonb Sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.31.2.1 01-Mar-2006  yamt sync with head.
 1.32.14.1 09-Feb-2007  ad Sync with HEAD.
 1.33.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.34.28.1 26-Dec-2007  ad Sync with head.
 1.34.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.34.20.1 09-Jan-2008  matt sync with HEAD
 1.35.10.3 11-Aug-2010  yamt sync with head.
 1.35.10.2 11-Mar-2010  yamt sync with head
 1.35.10.1 16-May-2008  yamt sync with head.
 1.35.8.1 18-May-2008  yamt sync with head.
 1.35.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.20.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.36.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.14.1 24-Oct-2010  jym Sync with HEAD
 1.37.2.2 05-Mar-2011  rmind sync with head
 1.37.2.1 30-May-2010  rmind sync with head
 1.39.60.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12 25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.11 10-Dec-2006  uwe branches: 1.11.24; 1.11.30; 1.11.32; 1.11.36;
Use aprint_normal for PCIBIOS_PRINTV
 1.10 26-Dec-2005  perry branches: 1.10.20; 1.10.22;
u_intN_t -> uintN_t
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 20-Jun-2005  sekiya branches: 1.8.2;
pci_device_foreach(), pci_device_foreach_min(), pci_bridge_foreach(), and
pci_bridge_hook don't actually have any dependancies on PCIBIOS-specific code,
and they can be used to fixup PCI bus numbering in the absence of the BIOS.

To that end, decouple them from PCIBIOS.
 1.7 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.6 19-Feb-2004  uebayasi Update some URLs.
 1.5 22-Jan-2002  uch branches: 1.5.2; 1.5.18;
Add pci_bridge_foreach ().
 1.4 06-Jul-2001  mcr branches: 1.4.2;
context argument added to pci_device_foreach().
 1.3 18-Jul-2000  soda branches: 1.3.4; 1.3.6;
- define PCIBIOS_PRINTV() as pcibiosverbose printf() here,
instead of DPRINTF() in each C source.
- define PIR_DEVFUNC_{DEVICE,FUNCTION}
 1.2 28-Apr-2000  uch branches: 1.2.6;
PCIBIOS_IRQS changed to PCIBIOS_IRQS_HINT. PCIBIOS_IRQS_HINT is
used when no IRQ guess. when at least 1 PCI device configured
correctly, unused.
 1.1 17-Nov-1999  thorpej branches: 1.1.2;
Basic interface to the PCI BIOS and PCI Interrupt Routing table, separated
out from UCHIYAMA Yasushi's PCI BIOS patches, and fairly heavily reworked
by me.

Main differences:
- Only use the PCI BIOS to get the config mechanism and interrupt routing
info for now. No need to use the BIOS for PCI config access right now,
since the old mechanism works fine, and this keeps the code smaller.
- PCI BIOS initialization code path is much different.
- Always use the $PIR table if it exists, and only fallback to the
PCI BIOS 2.1 GetInterruptRouting call if it's not there.

This module does not include any of the fixup code; that is coming
in separate commits.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.6.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCIBIOS_PRINTV() as pcibiosverbose printf(),
instead of DPRINTF() in each C source.

- define PIR_DEVFUNC_{DEVICE,FUNCTION}.

- fix oversight introduced in pci_addr_fixup.c revision 1.4,
pointed out by Michael Shalayeff <mickey@openbsd.org>.

- reserve AGP space to avoid resource conflict.

by UCHIYAMA Yasushi <uch@netbsd.org>

- Fix a problem uncovered by rev 1.5 of pcibios.c:

Avoid interpreting the upper 32 bits of 64-bit BARs as a 32-bit BAR.
Otherwise, the code would assume that the value 0 was incorrect and either:
(a) [on bus 0] "fix up" the address to some nonzero value, thus placing
the decoded address range outside of 32-bit address space, or
(b) [elsewhere] completely disable the device.

The fact that this behaviour depends on the bus number of the device is
already XXX'd.

XXX: This will need revisiting if and when we ever want to handle a PCI bus
XXX: with more than 32 bits of address space on an i386.

The onboard Adaptec 7890 on my Dell Precision Workstation 410 works again.

by Nathan J Williams <nathanw@netbsd.org>

Revisions pulled up:
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/i386/pci/pcibios.h
> cvs rdiff -r1.3 -r1.5 syssrc/sys/arch/i386/pci/pcibios.c
> cvs rdiff -r1.3 -r1.7 syssrc/sys/arch/i386/pci/pci_addr_fixup.c
 1.3.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.6.1 24-Aug-2001  nathanw Catch up with -current.
 1.3.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.1 18-Jul-2000  bouyer file pcibios.h was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.4.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.18.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.18.1 03-Aug-2004  skrll Sync with HEAD
 1.5.2.2 22-Jan-2002  uch Add pci_bridge_foreach ().
 1.5.2.1 22-Jan-2002  uch file pcibios.h was added on branch sommerfeld_i386mp_1 on 2002-01-22 15:07:28 +0000
 1.8.2.3 21-Jan-2008  yamt sync with head
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.10.22.1 10-Dec-2006  yamt sync with head.
 1.10.20.1 12-Jan-2007  ad Sync with head.
 1.11.36.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.32.1 26-Dec-2007  ad Sync with head.
 1.11.30.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.24.1 09-Jan-2008  matt sync with HEAD
 1.10 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.9 28-Apr-2008  martin branches: 1.9.34; 1.9.44;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Apr-2008  cegger branches: 1.8.2; 1.8.4;
use aprint_*_dev and device_xname
OK joerg
 1.7 16-Nov-2006  christos branches: 1.7.52;
__unused removal on arguments; approved by core.
 1.6 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.5 19-Feb-2006  thorpej branches: 1.5.14; 1.5.16;
Use aprint_*().
 1.4 11-Dec-2005  christos branches: 1.4.2; 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3 03-Feb-2005  perry branches: 1.3.6;
de-__P, partially ANSIfy
 1.2 15-Nov-2001  lukem branches: 1.2.2; 1.2.18; 1.2.26; 1.2.28;
add RCSID
 1.1 20-Dec-1998  nathanw branches: 1.1.22; 1.1.24;
Fix up support for PCI attachments of pcic devices on i386 in general,
and the Cirrus Logic CL-PD6729 in particular.

From danw@mit.edu in PR port-i386/6436.
 1.1.24.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.22.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.28.1 12-Feb-2005  yamt sync with head.
 1.2.26.1 29-Apr-2005  kent sync with -current
 1.2.18.1 04-Feb-2005  skrll Sync with HEAD.
 1.2.2.2 15-Nov-2001  lukem add RCSID
 1.2.2.1 15-Nov-2001  lukem file pcic_pci_machdep.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.3.6.1 21-Jun-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 01-Mar-2006  yamt sync with head.
 1.5.16.2 10-Dec-2006  yamt sync with head.
 1.5.16.1 22-Oct-2006  yamt sync with head
 1.5.14.1 18-Nov-2006  ad Sync with head.
 1.7.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.9.44.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.9.34.1 30-Oct-2012  yamt sync with head
 1.5 06-Sep-2003  fvdl Move the bulk of pci_intr_string into a seperate intr_string function. Use
that new function to print the pciide compat interrupt in pciide_machdep.c.
Share pciide_machdep.c between amd64 and i386.
 1.4 15-Nov-2001  lukem branches: 1.4.2; 1.4.18;
add RCSID
 1.3 09-Mar-2000  soren branches: 1.3.8; 1.3.10;
Move PCIIDE_CHANNEL_NAME macro to pciidereg.h.
 1.2 19-Feb-1999  mycroft branches: 1.2.8;
Indicate which IRQ is being used for compatibility interrupts.
 1.1 04-Mar-1998  cgd machine-dependent bits (for compat interrupt mapping) of PCI IDE driver.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.18.1 03-Aug-2004  skrll Sync with HEAD
 1.4.2.2 15-Nov-2001  lukem add RCSID
 1.4.2.1 15-Nov-2001  lukem file pciide_machdep.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.3 27-Jan-1995  mycroft Clean up deleted files.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.2 09-Aug-1994  mycroft Add PCI autoconfiguration support.
 1.1.2.1 09-Aug-1994  mycroft file pcireg.h was added on branch netbsd-1-0 on 1994-08-09 00:47:54 +0000
 1.4 27-Jan-1995  mycroft Clean up deleted files.
 1.3 04-Nov-1994  mycroft Make a wrapper match function to check the bus and device numbers, rather
than insisting that every driver do it.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 09-Aug-1994  mycroft branches: 1.1.2;
Add PCI autoconfiguration support.
 1.1.2.2 09-Aug-1994  mycroft Add PCI autoconfiguration support.
 1.1.2.1 09-Aug-1994  mycroft file pcivar.h was added on branch netbsd-1-0 on 1994-08-09 00:47:55 +0000
 1.23 19-Oct-2025  thorpej Encapsulate MCA bus attach logic into mcabus_attach().
 1.22 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.21 24-Apr-2021  thorpej branches: 1.21.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.20 01-Jul-2011  dyoung branches: 1.20.68;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.19 28-Apr-2010  dyoung On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag. For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM. In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem. Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.
 1.18 05-May-2008  xtraeme branches: 1.18.14; 1.18.20; 1.18.22;
device_t/softc split and other related cosmetic changes.
 1.17 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.16 04-Apr-2008  cegger branches: 1.16.2; 1.16.4;
use aprint_*_dev and device_xname
OK joerg
 1.15 16-Nov-2006  christos branches: 1.15.52;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 19-Feb-2006  thorpej branches: 1.13.14; 1.13.16;
Use aprint_*().
 1.12 11-Dec-2005  christos branches: 1.12.2; 1.12.4; 1.12.6;
merge ktrace-lwp.
 1.11 03-Feb-2005  perry branches: 1.11.6;
de-__P, partially ANSIfy
 1.10 30-Aug-2004  drochner branches: 1.10.4; 1.10.6;
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.9 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.8 26-Feb-2003  fvdl branches: 1.8.2;
Adapt for i386/x86 change.
 1.7 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.6 02-Oct-2002  thorpej Tidy up CFATTACH_DECL() formatting.
 1.5 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 21-Apr-2001  jdolecek branches: 1.2.4;
Match any device with class bridge and subclass BRIDGE_MC, instead
of matching individual products. Pointed out by Jason Thorpe.
 1.1 25-Mar-2001  jdolecek branches: 1.1.2; 1.1.4; 1.1.6;
Add an autoconfig node for PCI-MCA bridges. Configures MCA bridges
via callback. This beast is very rare, present only on some IBM PCs.
Code was copied off pceb.
 1.1.6.1 21-Apr-2001  thorpej Add files to sommerfeld_i386mp_1 branch that have recently
appeared on the trunk.
 1.1.4.6 03-Jan-2003  thorpej Sync with HEAD.
 1.1.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.3 21-Jun-2001  nathanw Catch up to -current.
 1.1.4.2 09-Apr-2001  nathanw Catch up with -current.
 1.1.4.1 25-Mar-2001  nathanw file pcmb.c was added on branch nathanw_sa on 2001-04-09 01:53:37 +0000
 1.1.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.1.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.1 25-Mar-2001  bouyer file pcmb.c was added on branch thorpej_scsipi on 2001-03-27 15:31:05 +0000
 1.2.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.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file pcmb.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.8.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.8.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.2 03-Sep-2004  skrll Sync with HEAD
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.1 12-Feb-2005  yamt sync with head.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.6.2 30-Dec-2006  yamt sync with head.
 1.11.6.1 21-Jun-2006  yamt sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.1 01-Mar-2006  yamt sync with head.
 1.13.16.2 10-Dec-2006  yamt sync with head.
 1.13.16.1 22-Oct-2006  yamt sync with head
 1.13.14.1 18-Nov-2006  ad Sync with head.
 1.15.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.4.2 11-Aug-2010  yamt sync with head.
 1.16.4.1 16-May-2008  yamt sync with head.
 1.16.2.1 18-May-2008  yamt sync with head.
 1.18.22.1 30-May-2010  rmind sync with head
 1.18.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.14.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.18.14.1 24-Oct-2010  jym Sync with HEAD
 1.20.68.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.21.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.15 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.14 28-Apr-2008  martin branches: 1.14.14;
Remove clause 3 and 4 from TNF licenses
 1.13 16-Nov-2006  christos branches: 1.13.52; 1.13.54; 1.13.56;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 22-Jun-2006  jmcneill branches: 1.11.4; 1.11.6;
Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.10 26-Dec-2005  perry branches: 1.10.4; 1.10.8; 1.10.16;
u_intN_t -> uintN_t
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 01-May-2004  kochi branches: 1.8.12;
Enhance debug output for ICHx (with PIIX_DEBUG)
from Masanori Kanaoka
 1.7 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.6 04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.5 26-Feb-2003  fvdl branches: 1.5.2; 1.5.4;
Adapt for i386/x86 change.
 1.4 30-Dec-2002  explorer fix for my sony laptop, which doesn't quite follow spec
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 18-Jul-2000  soda branches: 1.2.4; 1.2.6; 1.2.8;
add several debug printf which can be enabled by PIIX_DEBUG.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

add several debug printf which can be enabled by PIIX_DEBUG.

Revision pulled up:
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/piix.c
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.2 03-Jan-2003  thorpej Sync with HEAD.
 1.2.6.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file piix.c was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file piix.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.5.4.1 28-Apr-2004  jmc Pullup rev 1.6 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.12.2 30-Dec-2006  yamt sync with head.
 1.8.12.1 21-Jun-2006  yamt sync with head.
 1.10.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.10.8.1 26-Jun-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.6.2 10-Dec-2006  yamt sync with head.
 1.11.6.1 22-Oct-2006  yamt sync with head
 1.11.4.1 18-Nov-2006  ad Sync with head.
 1.13.56.1 16-May-2008  yamt sync with head.
 1.13.54.1 18-May-2008  yamt sync with head.
 1.13.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.24 18-Oct-2019  hannken Add missing include -- kernel ALL/i386 compiles.
 1.23 18-Oct-2019  manu Make sure no bioscall is issued when booting off UEFI system
 1.22 11-Jul-2016  msaitoh branches: 1.22.18;
KNF. No functional change.
 1.21 01-Jul-2011  dyoung branches: 1.21.12; 1.21.30;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.20 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.19 26-Jul-2010  jym branches: 1.19.2;
Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.
 1.18 24-Feb-2010  dyoung branches: 1.18.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.17 08-Jan-2010  dyoung branches: 1.17.2;
Expand PMF_FN_* macros.
 1.16 20-Jul-2008  martin branches: 1.16.8;
Rearange softc so it starts with a struct pcib. We reuse the x86 pcib code
which assumes this.
 1.15 05-May-2008  xtraeme branches: 1.15.2; 1.15.4; 1.15.6;
device_t/softc split and other related cosmetic changes.
 1.14 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13 04-Apr-2008  cegger branches: 1.13.2; 1.13.4;
use aprint_*_dev and device_xname
OK joerg
 1.12 29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.11 09-Dec-2007  jmcneill branches: 1.11.6; 1.11.10;
Merge jmcneill-pm branch.
 1.10 16-Nov-2006  christos branches: 1.10.26; 1.10.28; 1.10.38; 1.10.40;
__unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.7 22-Jun-2006  jmcneill branches: 1.7.4; 1.7.6; 1.7.8;
Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.6 19-Jun-2006  jmcneill branches: 1.6.2;
cube@ says that acpi_pci_fixup() only writes in devices interrupt line
registers, so restore the PCI-ISA bridge IRQ routing here again.
 1.5 19-Jun-2006  jmcneill Don't try to fixup PCI interrupt routing here; we're going to use ACPI to
do this for us instead. This prevents us from having to write chipset
specific support -- yay!
 1.4 17-Jun-2006  mrg add another GCC4 uninitialised variable warning. it only shows with -O3.
 1.3 16-Jun-2006  jmcneill Restore standard PCI configuration registers as well as PIRQX route control
registers on the PIIX4. This fixes up interrupt routing, and makes ACPI S3
suspend/resume work on my Sony Vaio.
 1.2 06-May-2006  jdc branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
Match on subclass bridge/miscellaneous too.
Makes this work on an IBM Thinkpad T20.
OK'd jmcneill.
 1.1 06-May-2006  jmcneill Add SpeedStep SMI support for Intel PIIX4 based Pentium III processors.
 1.2.12.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.10.2 01-Jun-2006  kardel Sync with head.
 1.2.10.1 06-May-2006  kardel file piixpcib.c was added on branch simonb-timecounters on 2006-06-01 22:34:53 +0000
 1.2.8.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.8.1 06-May-2006  tron file piixpcib.c was added on branch peter-altq on 2006-05-24 15:47:58 +0000
 1.2.6.3 26-Jun-2006  yamt sync with head.
 1.2.6.2 24-May-2006  yamt sync with head.
 1.2.6.1 06-May-2006  yamt file piixpcib.c was added on branch yamt-pdpolicy on 2006-05-24 10:56:52 +0000
 1.2.4.1 19-Jun-2006  chap Sync with head.
 1.2.2.2 11-May-2006  elad sync with head
 1.2.2.1 06-May-2006  elad file piixpcib.c was added on branch elad-kernelauth on 2006-05-11 23:26:47 +0000
 1.6.2.5 17-Mar-2008  yamt sync with head.
 1.6.2.4 21-Jan-2008  yamt sync with head
 1.6.2.3 30-Dec-2006  yamt sync with head.
 1.6.2.2 21-Jun-2006  yamt sync with head.
 1.6.2.1 19-Jun-2006  yamt file piixpcib.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:31 +0000
 1.7.8.2 10-Dec-2006  yamt sync with head.
 1.7.8.1 22-Oct-2006  yamt sync with head
 1.7.6.2 09-Sep-2006  rpaulo sync with head
 1.7.6.1 22-Jun-2006  rpaulo file piixpcib.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:14 +0000
 1.7.4.1 18-Nov-2006  ad Sync with head.
 1.10.40.1 11-Dec-2007  yamt sync with head.
 1.10.38.1 26-Dec-2007  ad Sync with head.
 1.10.28.2 23-Mar-2008  matt sync with HEAD
 1.10.28.1 09-Jan-2008  matt sync with HEAD
 1.10.26.3 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.10.26.2 12-Nov-2007  joerg Convert to new PM API.
 1.10.26.1 05-Sep-2007  jmcneill XXX because of pcibattach, we need to keep our softcs in sync with pcib(4)
 1.11.10.3 28-Sep-2008  mjf Sync with HEAD.
 1.11.10.2 02-Jun-2008  mjf Sync with HEAD.
 1.11.10.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.6.1 24-Mar-2008  keiichi sync with head.
 1.13.4.4 11-Aug-2010  yamt sync with head.
 1.13.4.3 11-Mar-2010  yamt sync with head
 1.13.4.2 04-May-2009  yamt sync with head.
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.15.6.1 19-Oct-2008  haad Sync with HEAD.
 1.15.4.1 28-Jul-2008  simonb Sync with head.
 1.15.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.16.8.3 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.16.8.2 02-May-2011  jym Sync with head.
 1.16.8.1 24-Oct-2010  jym Sync with HEAD
 1.17.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.17.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.2.2 21-Apr-2011  rmind sync with head
 1.18.2.1 05-Mar-2011  rmind sync with head
 1.19.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.21.30.1 05-Oct-2016  skrll Sync with HEAD
 1.21.12.1 03-Dec-2017  jdolecek update from HEAD
 1.22.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Apr-2004  kochi Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later), which fixes PR/23700.
The changes are from Hiroyuki Bessho and Masanori Kanaoka in PR/23700
with a little modification of interrupt router lookup from mine.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10; 1.1.34; 1.1.36;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.36.1 28-Apr-2004  jmc Pullup rev 1.2 (requested by kochi in ticket #188)

Support for PIRQ[E-H], found in recent intel south bridges
(ICH2 and later). PR#23700
 1.1.34.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.34.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.34.1 03-Aug-2004  skrll Sync with HEAD
 1.1.10.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.10.1 17-Nov-1999  bouyer file piixreg.h was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.74; 1.3.76; 1.3.78;
merge ktrace-lwp.
 1.2 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10; 1.1.34;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.34.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.34.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.34.1 03-Aug-2004  skrll Sync with HEAD
 1.1.10.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.10.1 17-Nov-1999  bouyer file piixvar.h was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.78.1 16-May-2008  yamt sync with head.
 1.3.76.1 18-May-2008  yamt sync with head.
 1.3.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.10 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin branches: 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 16-Nov-2006  christos branches: 1.8.52; 1.8.54; 1.8.56;
__unused removal on arguments; approved by core.
 1.7 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 11-Dec-2005  christos branches: 1.6.20; 1.6.22;
merge ktrace-lwp.
 1.5 11-Apr-2004  kochi de __P, ANSIfy PCIBIOS related files.
 1.4 26-Feb-2003  fvdl branches: 1.4.2;
Adapt for i386/x86 change.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
add RCSID
 1.2 18-Jul-2000  soda branches: 1.2.4; 1.2.6; 1.2.8;
use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCI_INTERRUPT_PIN_MAX and use it instead of magic number.
- define I386_PCI_INTERRUPT_LINE_NO_CONNECTION and use it instead of
magic number.

Revisions pulled up:
> cvs rdiff -r1.28 -r1.29 syssrc/sys/dev/pci/pcireg.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/pci_machdep.h
> cvs rdiff -r1.38 -r1.39 syssrc/sys/arch/i386/pci/pci_machdep.c
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c558.c \
> syssrc/sys/arch/i386/pci/sis85c503.c \
> syssrc/sys/arch/i386/pci/via82c586.c
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file sis85c503.c was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.3.2.2 15-Nov-2001  lukem add RCSID
 1.3.2.1 15-Nov-2001  lukem file sis85c503.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.22.2 10-Dec-2006  yamt sync with head.
 1.6.22.1 22-Oct-2006  yamt sync with head
 1.6.20.1 18-Nov-2006  ad Sync with head.
 1.8.56.1 16-May-2008  yamt sync with head.
 1.8.54.1 18-May-2008  yamt sync with head.
 1.8.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.10;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.10.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.10.1 17-Nov-1999  bouyer file sis85c503reg.h was added on branch thorpej_scsipi on 2000-11-20 20:09:35 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5 25-Jan-2014  christos remove unused
 1.4 01-Jul-2011  dyoung branches: 1.4.2; 1.4.12; 1.4.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.3 28-Apr-2008  martin branches: 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 15-May-2006  christos branches: 1.2.6; 1.2.64; 1.2.66; 1.2.68;
XXX: GCC uninitialized
 1.1 01-Jan-2006  xtraeme branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12;
PCI Interrupt router support for VIA VT823[1357] Southbridges.
From OpenBSD.
 1.1.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.8.1 24-May-2006  yamt sync with head.
 1.1.6.1 01-Jun-2006  kardel Sync with head.
 1.1.4.1 09-Sep-2006  rpaulo sync with head
 1.1.2.2 15-Jan-2006  yamt sync with head.
 1.1.2.1 01-Jan-2006  yamt file via8231.c was added on branch yamt-uio_vmspace on 2006-01-15 10:02:38 +0000
 1.2.68.1 16-May-2008  yamt sync with head.
 1.2.66.1 18-May-2008  yamt sync with head.
 1.2.64.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.6.2 21-Jun-2006  yamt sync with head.
 1.2.6.1 15-May-2006  yamt file via8231.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:31 +0000
 1.3.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.4.16.1 18-May-2014  rmind sync with head
 1.4.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.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.1 01-Jan-2006  xtraeme branches: 1.1.2; 1.1.18;
PCI Interrupt router support for VIA VT823[1357] Southbridges.
From OpenBSD.
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 01-Jan-2006  yamt file via8231reg.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:31 +0000
 1.1.2.2 15-Jan-2006  yamt sync with head.
 1.1.2.1 01-Jan-2006  yamt file via8231reg.h was added on branch yamt-uio_vmspace on 2006-01-15 10:02:38 +0000
 1.12 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.11 28-Apr-2008  martin branches: 1.11.14;
Remove clause 3 and 4 from TNF licenses
 1.10 16-Nov-2006  christos branches: 1.10.52; 1.10.54; 1.10.56;
__unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 18-Jun-2006  xtraeme branches: 1.8.4; 1.8.6;
Sync with openbsd and apply fix from mickey@openbsd rev 1.5:

"It seems that via has 7, not 4 pci interrupt lines.
this fixes unmapped interrupts on some via-based boards."
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.14; 1.7.16;
merge ktrace-lwp.
 1.6 11-Apr-2004  kochi branches: 1.6.12;
de __P, ANSIfy PCIBIOS related files.
 1.5 26-Feb-2003  fvdl branches: 1.5.2;
Adapt for i386/x86 change.
 1.4 15-Nov-2001  lukem branches: 1.4.2;
add RCSID
 1.3 05-Jan-2001  tsutsui branches: 1.3.4; 1.3.6;
Fix typo (s/req/reg/).
 1.2 18-Jul-2000  soda branches: 1.2.4;
use I386_PCI_INTERRUPT_LINE_NO_CONNECTION instead of magic number.
 1.1 17-Nov-1999  thorpej branches: 1.1.2; 1.1.8;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.8.1 10-Aug-2000  soda Pull up to netbsd-1-5 branch
Approved by: thorpej

- define PCI_INTERRUPT_PIN_MAX and use it instead of magic number.
- define I386_PCI_INTERRUPT_LINE_NO_CONNECTION and use it instead of
magic number.

Revisions pulled up:
> cvs rdiff -r1.28 -r1.29 syssrc/sys/dev/pci/pcireg.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/pci_machdep.h
> cvs rdiff -r1.38 -r1.39 syssrc/sys/arch/i386/pci/pci_machdep.c
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/i386/pci/opti82c558.c \
> syssrc/sys/arch/i386/pci/sis85c503.c \
> syssrc/sys/arch/i386/pci/via82c586.c
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 18-Jul-2000  bouyer file via82c586.c was added on branch thorpej_scsipi on 2000-11-20 20:09:36 +0000
 1.3.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.2 15-Nov-2001  lukem add RCSID
 1.4.2.1 15-Nov-2001  lukem file via82c586.c was added on branch sommerfeld_i386mp_1 on 2001-11-15 07:03:36 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.7.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.7.14.1 19-Jun-2006  chap Sync with head.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.6.2 10-Dec-2006  yamt sync with head.
 1.8.6.1 22-Oct-2006  yamt sync with head
 1.8.4.1 18-Nov-2006  ad Sync with head.
 1.10.56.1 16-May-2008  yamt sync with head.
 1.10.54.1 18-May-2008  yamt sync with head.
 1.10.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.14.1 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.3 18-Jun-2006  xtraeme Sync with openbsd and apply fix from mickey@openbsd rev 1.5:

"It seems that via has 7, not 4 pci interrupt lines.
this fixes unmapped interrupts on some via-based boards."
 1.2 22-Apr-2000  uch branches: 1.2.2; 1.2.8; 1.2.48; 1.2.62; 1.2.66; 1.2.72; 1.2.74;
fix VP3_CFG_INTR_MASK
 1.1 17-Nov-1999  thorpej branches: 1.1.2;
Interrupt router drivers from UCHIYAMA Yasushi's PCI BIOS patches,
cleaned up and reworked a bit be me.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.74.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.72.1 19-Jun-2006  chap Sync with head.
 1.2.66.1 26-Jun-2006  yamt sync with head.
 1.2.62.1 09-Sep-2006  rpaulo sync with head
 1.2.48.1 21-Jun-2006  yamt sync with head.
 1.2.8.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.8.1 22-Apr-2000  bouyer file via82c586reg.h was added on branch thorpej_scsipi on 2000-11-20 20:09:36 +0000
 1.2.2.2 22-Apr-2000  uch fix VP3_CFG_INTR_MASK
 1.2.2.1 22-Apr-2000  uch file via82c586reg.h was added on branch sommerfeld_i386mp_1 on 2000-04-22 15:00:42 +0000
 1.20 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.19 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.18 24-Apr-2021  thorpej branches: 1.18.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.17 22-Dec-2019  thorpej branches: 1.17.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.16 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

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

HOWEVER! Some subsystems have

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

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

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

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

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

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

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.15 14-Feb-2016  chs branches: 1.15.16; 1.15.18;
zero the i2c_attach_args structure before filling it in.
fixes occasional crashes in iic_attach().
 1.14 05-Jul-2011  mrg branches: 1.14.12; 1.14.30;
avoid an uninitialised variable warning GCC 4.5 -O3 picks up.
 1.13 08-Jun-2011  rmind Convert simple_lock to mutex.
 1.12 02-Oct-2009  jmcneill branches: 1.12.4; 1.12.10;
match VT8237A
 1.11 20-Jul-2008  martin branches: 1.11.8;
Explicitly add struct pcib_softc to the softc since the pcib functions
we call expect this.
 1.10 05-May-2008  xtraeme branches: 1.10.2; 1.10.4; 1.10.6;
device_t/softc split and other related cosmetic changes.
 1.9 04-Apr-2008  cegger branches: 1.9.2; 1.9.4;
use aprint_*_dev and device_xname
OK joerg
 1.8 09-Mar-2008  joerg Fix unaligned pci_conf_read/pci_conf_write.
 1.7 04-Jan-2008  ad branches: 1.7.2; 1.7.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.6 16-Nov-2006  christos branches: 1.6.28; 1.6.34; 1.6.42;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  xtraeme Use __unused in function arguments where appropiate. (hi christos)
 1.4 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.3 26-Jun-2006  drochner branches: 1.3.4; 1.3.6; 1.3.8;
use the "i2cbus" interface attribute rather than putting a string name
into the i2cbus attach args
 1.2 17-Mar-2006  xtraeme branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.12; 1.2.14;
Match the VIA VT8237 chipset, too. ok'ed by jmcneill
 1.1 17-Mar-2006  jmcneill Add support for the VIA SMBus controller found on the VT8235 PCI-ISA
bridge.
 1.2.14.5 17-Mar-2008  yamt sync with head.
 1.2.14.4 21-Jan-2008  yamt sync with head
 1.2.14.3 30-Dec-2006  yamt sync with head.
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 17-Mar-2006  yamt file viapcib.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:31 +0000
 1.2.12.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.8.2 22-Apr-2006  simonb Sync with head.
 1.2.8.1 17-Mar-2006  simonb file viapcib.c was added on branch simonb-timecounters on 2006-04-22 11:37:34 +0000
 1.2.6.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.6.1 17-Mar-2006  elad file viapcib.c was added on branch elad-kernelauth on 2006-04-19 02:32:50 +0000
 1.2.4.3 11-Aug-2006  yamt sync with head
 1.2.4.2 11-Apr-2006  yamt sync files somehow mis-tagged by yamt-pdpolicy-base2.
 1.2.4.1 17-Mar-2006  yamt file viapcib.c was added on branch yamt-pdpolicy on 2006-04-11 12:20:51 +0000
 1.2.2.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.3.8.2 10-Dec-2006  yamt sync with head.
 1.3.8.1 22-Oct-2006  yamt sync with head
 1.3.6.2 09-Sep-2006  rpaulo sync with head
 1.3.6.1 26-Jun-2006  rpaulo file viapcib.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:15 +0000
 1.3.4.1 18-Nov-2006  ad Sync with head.
 1.6.42.1 08-Jan-2008  bouyer Sync with HEAD
 1.6.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.28.2 23-Mar-2008  matt sync with HEAD
 1.6.28.1 09-Jan-2008  matt sync with HEAD
 1.7.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.7.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.7.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.2.1 24-Mar-2008  keiichi sync with head.
 1.9.4.3 11-Mar-2010  yamt sync with head
 1.9.4.2 04-May-2009  yamt sync with head.
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.10.6.1 19-Oct-2008  haad Sync with HEAD.
 1.10.4.1 28-Jul-2008  simonb Sync with head.
 1.10.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.11.8.2 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.11.8.1 01-Nov-2009  jym Sync with HEAD.
 1.12.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.12.4.1 12-Jun-2011  rmind sync with head
 1.14.30.1 19-Mar-2016  skrll Sync with HEAD
 1.14.12.1 03-Dec-2017  jdolecek update from HEAD
 1.15.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.18.1 10-Jun-2019  christos Sync with HEAD
 1.15.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.17.10.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.18.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 09-Mar-2008  joerg Fix unaligned pci_conf_read/pci_conf_write.
 1.1 17-Mar-2006  jmcneill branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.20; 1.1.50; 1.1.70; 1.1.74;
Add support for the VIA SMBus controller found on the VT8235 PCI-ISA
bridge.
 1.1.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.70.1 24-Mar-2008  keiichi sync with head.
 1.1.50.1 23-Mar-2008  matt sync with HEAD
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 17-Mar-2006  rpaulo file viapcibreg.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:40:15 +0000
 1.1.14.3 17-Mar-2008  yamt sync with head.
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 17-Mar-2006  yamt file viapcibreg.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:31 +0000
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 17-Mar-2006  simonb file viapcibreg.h was added on branch simonb-timecounters on 2006-04-22 11:37:34 +0000
 1.1.6.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.1.6.1 17-Mar-2006  elad file viapcibreg.h was added on branch elad-kernelauth on 2006-04-19 02:32:50 +0000
 1.1.4.2 11-Apr-2006  yamt sync files somehow mis-tagged by yamt-pdpolicy-base2.
 1.1.4.1 17-Mar-2006  yamt file viapcibreg.h was added on branch yamt-pdpolicy on 2006-04-11 12:20:51 +0000
 1.1.2.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.

RSS XML Feed