Home | History | Annotate | only in /src/sys/dev/cardbus
History log of /src/sys/dev/cardbus
RevisionDateAuthorComments
 1.3 02-Aug-2004  mycroft Remove.
 1.2 15-Oct-1999  haya branches: 1.2.8; 1.2.36;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.36.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.30 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.29 27-Oct-2012  chs branches: 1.29.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.28 01-Aug-2011  drochner branches: 1.28.2; 1.28.12;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.27 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.26 26-Feb-2010  dyoung branches: 1.26.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.25 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.24 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.23 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.22 12-May-2009  cegger branches: 1.22.2;
struct device * -> device_t, no functional changes intended.
 1.21 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 24-Jun-2008  drochner branches: 1.19.4; 1.19.10;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.18 28-Apr-2008  martin branches: 1.18.2; 1.18.4;
Remove clause 3 and 4 from TNF licenses
 1.17 06-Apr-2008  cegger branches: 1.17.2; 1.17.4;
use aprint_*_dev and device_xname
 1.16 19-Oct-2007  ad branches: 1.16.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__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 29-Mar-2006  thorpej branches: 1.13.8; 1.13.10;
Use device_private().
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 04-Feb-2005  perry de-__P
 1.9 02-Aug-2004  mycroft branches: 1.9.4; 1.9.6;
cardbusdevs -> pcidevs
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Add trailing ; to CFATTACH_DECL.
 1.7 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 29-Sep-2001  yamt remove a debug printf committed mistakenly.
 1.3 29-Sep-2001  yamt - fix wrong ca_devsize.
- change #if 0 to meaningful name.
- enable memio.
 1.2 18-Sep-2001  wiz Give initiali[sz]e all the "i"s it deserves.
 1.1 08-Mar-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Add a CardBus front-end for the Advansys SCSI driver.
Provided by takashi.yamamoto@bigfoot.com, kern/12341.
 1.1.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.5 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.4 08-Oct-2001  nathanw Catch up to -current.
 1.1.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.1.4.2 09-Apr-2001  nathanw Catch up with -current.
 1.1.4.1 08-Mar-2001  nathanw file adv_cardbus.c was added on branch nathanw_sa on 2001-04-09 01:55:53 +0000
 1.1.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Mar-2001  bouyer file adv_cardbus.c was added on branch thorpej_scsipi on 2001-03-12 13:30:01 +0000
 1.8.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.6.1 12-Feb-2005  yamt sync with head.
 1.9.4.1 29-Apr-2005  kent sync with -current
 1.11.4.3 27-Oct-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 19-Apr-2006  elad sync with head.
 1.12.8.1 01-Apr-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.13.10.2 10-Dec-2006  yamt sync with head.
 1.13.10.1 22-Oct-2006  yamt sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.16.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.5 11-Aug-2010  yamt sync with head.
 1.17.4.4 11-Mar-2010  yamt sync with head
 1.17.4.3 16-May-2009  yamt sync with head
 1.17.4.2 04-May-2009  yamt sync with head.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.4.1 27-Jun-2008  simonb Sync with head.
 1.18.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.22.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.2.1 30-May-2010  rmind sync with head
 1.28.12.2 03-Dec-2017  jdolecek update from HEAD
 1.28.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.28.2.1 30-Oct-2012  yamt sync with head
 1.29.14.1 05-Oct-2016  skrll Sync with HEAD
 1.38 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.37 02-Apr-2018  rin branches: 1.37.2;
Remove extra printf duplicate with MI codes.
 1.36 14-Jul-2016  msaitoh branches: 1.36.16;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.35 01-Aug-2011  drochner branches: 1.35.12; 1.35.30;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.34 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.33 26-Feb-2010  dyoung branches: 1.33.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.32 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.31 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.30 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.29 12-Nov-2009  dyoung branches: 1.29.2;
Remove superfluous activation hook.
 1.28 16-May-2009  tsutsui Make ahc_detach() take struct ahc_softc * as well as ahc_attach()
and remove bogus casts around ahc_detach().

XXX: There is a pmf_device_deregister(9) call in ahc_detach()
XXX: while there is no pmf_device_register(9) in ahc_attach().
XXX: It looks more pmf(9) stuff is required for cardbus detach.
 1.27 05-May-2009  cegger device_t/softc split
 1.26 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.25 24-Jun-2008  drochner branches: 1.25.4; 1.25.10;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.24 28-Apr-2008  martin branches: 1.24.2; 1.24.4;
Remove clause 3 and 4 from TNF licenses
 1.23 18-Feb-2008  dyoung branches: 1.23.6; 1.23.8; 1.23.10;
Use device_xname().
 1.22 19-Oct-2007  ad branches: 1.22.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 16-Nov-2006  christos branches: 1.21.8; 1.21.22; 1.21.24; 1.21.28;
__unused removal on arguments; approved by core.
 1.20 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.19 29-Mar-2006  thorpej branches: 1.19.8; 1.19.10;
Use device_private().
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10; 1.18.12;
merge ktrace-lwp.
 1.17 12-May-2005  augustss branches: 1.17.2;
Make the Adaptec 1480 cardbus Slim SCSI card work.
From a person wishing to remain anonymous.
 1.16 27-Feb-2005  perry nuke trailing whitespace
 1.15 04-Feb-2005  perry de-__P
 1.14 02-Aug-2004  mycroft branches: 1.14.4; 1.14.6;
cardbusdevs -> pcidevs
 1.13 19-Jan-2004  jdolecek adapt to latest ahc(4) changes, so that this wouldn't panic kernel on boot
problem reported by Hilmar Both on current-users
 1.12 20-Apr-2003  fvdl branches: 1.12.2;
Initialize name and dma tag.
 1.11 20-Apr-2003  fvdl Call ahc_softc_init in attach function.
 1.10 19-Apr-2003  fvdl Fix this to compile with the new driver. Needs testing.
 1.9 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.8 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 16-Jan-2002  ichiro add detach/activate routine
 1.5 13-Nov-2001  lukem add RCSID
 1.4 29-Sep-2001  yamt fix wrong ca_devsize.
 1.3 16-Mar-2000  enami branches: 1.3.6; 1.3.8; 1.3.10; 1.3.12;
Make this file just compiles again.
XXX Don't expect to work yet. It fails even to link depending on your
XXX kernel config file.
 1.2 15-Mar-2000  fvdl Update cardbus frontend for new ahc driver.
 1.1 26-Jan-2000  thorpej First attempt at a CardBus front-end for the `ahc' driver. This will
support the Adaptec ADP-1480 CardBus SCSI cards, which are a stright
AIC-7860 implementation.
 1.3.12.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.10.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.10.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.8.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.8.1 08-Oct-2001  nathanw Catch up to -current.
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 16-Mar-2000  bouyer file ahc_cardbus.c was added on branch thorpej_scsipi on 2000-11-20 11:39:52 +0000
 1.12.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.6.1 12-Feb-2005  yamt sync with head.
 1.14.4.1 29-Apr-2005  kent sync with -current
 1.17.2.4 27-Feb-2008  yamt sync with head.
 1.17.2.3 27-Oct-2007  yamt sync with head.
 1.17.2.2 30-Dec-2006  yamt sync with head.
 1.17.2.1 21-Jun-2006  yamt sync with head.
 1.18.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.18.10.1 19-Apr-2006  elad sync with head.
 1.18.8.1 01-Apr-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.10.2 10-Dec-2006  yamt sync with head.
 1.19.10.1 22-Oct-2006  yamt sync with head
 1.19.8.1 18-Nov-2006  ad Sync with head.
 1.21.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.24.2 23-Mar-2008  matt sync with HEAD
 1.21.24.1 06-Nov-2007  matt sync with HEAD
 1.21.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.21.8.1 23-Oct-2007  ad Sync with head.
 1.22.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.23.10.5 11-Aug-2010  yamt sync with head.
 1.23.10.4 11-Mar-2010  yamt sync with head
 1.23.10.3 16-May-2009  yamt sync with head
 1.23.10.2 04-May-2009  yamt sync with head.
 1.23.10.1 16-May-2008  yamt sync with head.
 1.23.8.1 18-May-2008  yamt sync with head.
 1.23.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.23.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.4.1 27-Jun-2008  simonb Sync with head.
 1.24.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.10.2 23-Jul-2009  jym Sync with HEAD.
 1.25.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.33.2.1 30-May-2010  rmind sync with head
 1.35.30.1 05-Oct-2016  skrll Sync with HEAD
 1.35.12.1 03-Dec-2017  jdolecek update from HEAD
 1.36.16.1 07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.37.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.116 04-Oct-2025  thorpej Use device_{get,set}prop_bool() for "pmf-no-powerdown".
 1.115 24-Aug-2022  riastradh pmf(9): *_child_register never fails. Make it return void.

No kernel bump because this isn't documented or used in any modules,
only in dev/pci/pci.c and dev/cardbus/cardbus.c which are as far as I
know always statically linked into the kernel.

The next change, however, will require a revbump -- to make
pmf_device_register return void so we can prune vast swaths of dead
error branches.
 1.114 26-Mar-2022  martin When reading CIS tuples from a BAR, do not blindly copy 2k of data (or
to the end of the BAR space), but instead follow the tuples and stop
reading once we reach the end of the list.
I have a card

bwi0 at cardbus0 function 0: Broadcom Wireless
bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0

where the BAR claims 8k space but seems to only implement 6k (but that
is impossible to report as the spec only allows 2^n sizes) and the CIS
starts at a bit over 4k (so the old code tried reading beyound the 6k
limit and caused pci bus errors).

An alternative would be to avoid reporting bus errors during this access,
but since we are only interested in the CIS chain anyway (and that ends
way earlier) this is a simpler solution.
 1.113 01-Nov-2021  andvar fix typos, mainly in words minimum and maximum, but also few others.
 1.112 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.111 24-Apr-2021  thorpej branches: 1.111.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.110 12-Jun-2020  thorpej branches: 1.110.4;
pmf-powerdown == false --> pmf-no-powerdown == true
 1.109 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.108 01-Aug-2011  drochner branches: 1.108.54;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.107 04-Mar-2010  dyoung Get rid of the #if 1 surrounding #include <dev/cardbus/rbus.h>.

This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

ath, atw, and rtw work fine after this change.
 1.106 26-Feb-2010  dyoung Introduce Cardbus_intr_establish(cardbus_devfunc_t, ...) and
Cardbus_intr_disestablish(cardbus_devfunc_t, ...) and start using them.
 1.105 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.104 25-Feb-2010  dyoung Phase out some CardBus constants and types. Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG -> PCI_CLASS_REG
CARDBUS_ID_REG -> PCI_ID_REG
cardbus_product_id_t -> pci_product_id_t
cardbus_vendor_id_t -> pci_vendor_id_t
 1.103 25-Feb-2010  dyoung Cardbus_free_tag() and cardbus_free_tag() are no-ops, so get rid of them
to simplify the code a bit.
 1.102 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.101 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.100 23-Feb-2010  dyoung Remove unused functions pci_disable_retry() and cardbus_disable_retry().
 1.99 08-Jan-2010  dyoung branches: 1.99.2;
Expand PMF_FN_* macros.
 1.98 15-Dec-2009  snj Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.97 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.96 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.95 25-Jun-2008  drochner branches: 1.95.4; 1.95.10;
split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
 1.94 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.93 24-Jun-2008  drochner clean up some useless code and variables in cardbus attachment
 1.92 11-Jun-2008  dyoung *Always* update the desired power status of each CardBus function,
even if we cannot remove power from the function because its device
property 'pmf-powerdown' is present and equal to false.

Because we were not tracking the power status properly before, we
were not taking cards out of reset after a suspend/resume cycle on
their CardBus bridge. We would lose the use of the card that way.
 1.91 12-Mar-2008  dyoung branches: 1.91.2; 1.91.4; 1.91.6; 1.91.8;
Use device_t and its accessors throughout. Use aprint_*_dev().

Improve PMF-ability.

Add a 'flags' argument to suspend/resume handlers and
callers such as pmf_system_suspend().

Define a flag, PMF_F_SELF, which indicates to PMF that a
device is suspending/resuming itself. Add helper routines,
pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
that call pmf_device_suspend(dev, PMF_F_SELF) and
pmf_device_resume(dev, PMF_F_SELF), respectively. Use
PMF_F_SELF to suspend/resume self in ath(4), audio(4),
rtw(4), and sip(4).

In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
callbacks, provided by the bus front-end, with
self-suspension/resumption. Also, clean up the bus
front-ends. Make sure that the interrupt handler is
disestablished during suspension. Get rid of driver-private
flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
device_is_active()/device_has_power() calls, instead.

In the network-class suspend handler, call if_stop(, 0)
instead of if_stop(, 1), because the latter is superfluous
(bus- and driver-suspension hooks will 'disable' the NIC),
and it may cause recursion.

In the network-class resume handler, prevent infinite
recursion through if_init() by getting out early if we are
self-suspending (PMF_F_SELF).

rtw(4) improvements:

Destroy rtw(4) callouts when we detach it. Make rtw at
pci detachable. Print some more information with the "rx
frame too long" warning.

Remove activate() methods:

Get rid of rtw_activate() and ath_activate(). The device
activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

Introduce a boolean device property, "pmf-powerdown". If
pmf-powerdown is present and false, it indicates that a
bus back-end should not remove power from a device.

Honor this property in cardbus_child_suspend().

Set this property to 'false' in ath_attach(), since removing
power from an ath at cardbus seems to lobotomize the WPA
crypto engine. XXX Should the pmf-powerdown property
propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

Warn if ath(4) tries to write crypto keys to suspended
hardware.

Reduce differences between FreeBSD and NetBSD in ath(4)
multicast filter setup.

Make ath_printrxbuf() print an rx descriptor's status &
key index, to help debug crypto errors.

Shorten a staircase in ath_ioctl(). Don't check for
ieee80211_ioctl() return code ERESTART, it never happens.
 1.90 28-Feb-2008  drochner Extend the pmf suspend/resume hooks by a shutdown method, so drivers
can register a shutdown handler explicitely.
Install a pci bus shutdown handler which disables bus master accesses
for all childs, so the drivers don't need to care.
This will hopefully be sufficient to replace the shutdownhooks
(together with the powerhooks). (It has been suggested to use some
general event notification framework for shutdown handlers, but there
might be cases where shutdown handlers must be run in an order following
the device hierarchy, which wouldn't be easy with event handlers
not tied to drivers.)
approved by David Young
 1.89 23-Feb-2008  dyoung Reduce diffs between cardbus_set_powerstate_int() and
pci_set_powerstate_int().
 1.88 22-Feb-2008  dyoung Make the CardBus D2/D3 power-handling more alike to PCI's, but
without the typos. :-)

Use device_t and accessors. Use aprint_*_dev(). Use PMF_FN_*.
 1.87 06-Feb-2008  dyoung branches: 1.87.2; 1.87.6;
Assert that 'offset' is divisible by four, since we're using it to
index a PCI configuration register.
 1.86 03-Jan-2008  dyoung Disable pci_disable_retry() and cardbus_disable_retry(), with a
long comment on pci_disable_retry() (cross-referenced at
cardbus_disable_retry()) that explains why.
 1.85 02-Jan-2008  dyoung Don't assign a cardbus function tag to a cardbus chipset tag.
Michael Lorenz, macallan@, actually found this bug.

(I will change cardbus_chipset_tag_t to a struct * from void *, so
that the compiler will detect similar typos in the future.)
 1.84 02-Jan-2008  dyoung Do not read past the CIS region. Stops an MCHK exception on macppc
(reported by macallan@).

I originally detected this bug by activating 'PCI master target
abort' interrupts on the AMD Elan SC520 processor. Lo and behold,
several interrupts occurred before the system had finished booting!
NetBSD should probably activate PCI exception reporting whenever
it is available.
 1.83 02-Jan-2008  dyoung Add a debug message with aprint_debug_dev(). Use the right bus
tag.
 1.82 16-Dec-2007  dyoung Improve pci, cbb, cardslot, cardbus, and pcmcia to support detachment
of this entire device tree:

pci0 at mainbus0
elansc0 at pci0
gpio0 at elansc0
cbb0 at pci0
cardslot0 at cbb0
cardbus0 at cardslot0
pcmcia0 at cardslot0
cbb1 at pci0
cardslot1 at cbb1
cardbus1 at cardslot1
rtw0 at cardbus1
pcmcia1 at cardslot1
sip0 at pci0
nsphyter0 at sip0
sip1 at pci0
nsphyter1 at sip1

Whew!
 1.81 09-Dec-2007  jmcneill branches: 1.81.2;
Merge jmcneill-pm branch.
 1.80 01-Dec-2007  jmcneill branches: 1.80.2; 1.80.4;
One of these aprint_normals should have been aprint_naive
 1.79 01-Dec-2007  jmcneill aprintify
 1.78 16-Nov-2007  dyoung Take out some debug messages that accidentally slipped in. Thanks,
Bernd Ernesti, for letting me know! :-)
 1.77 16-Nov-2007  dyoung Improve Cardbus performance, error handling, and error reporting.

Let the TI1420 PCI-Cardbus bridge do burst reads from the primary
(PCI) bus. This ought to improve Tx performance on Cardbus NICs.
This optimization may apply to other TI bridges, but I only have
a datasheet for the TI1420. :-/

Activate PCI Parity Error and System Error reporting on PCI-Cardbus
bridges.

To avoid data destruction, set the Master Abort mode to 1. Stops
the bridge from silently discarding writes from the secondary bus
to the primary bus (Cardbus writes to PCI). Also, stops the bridge
from fulfilling a read by a bus master on the secondary bus that
failed on the primary bus with 0xffffffff (Cardbus reads from PCI).
Now the bus will indicate an error condition (SERR) instead of
silently destroying/corrupting data.

Forward system error indications from the secondary to the primary
bus. Detect parity errors on the secondary.

Set a Cardbus card's Latency Timer to something reasonable, according
to the Cardbus card's Minimum Grant and the bandwidth available on
the PCI bus. Restore the Latency Timer when re-enabling a card
(e.g., after power reactivation).
 1.76 19-Oct-2007  ad branches: 1.76.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.75 17-Feb-2007  dyoung branches: 1.75.4; 1.75.16; 1.75.18; 1.75.22;
Use the ("%s: ...", __func__) idiom to correct function names and
help them stay correct.
 1.74 16-Nov-2006  christos branches: 1.74.4;
__unused removal on arguments; approved by core.
 1.73 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.72 04-Jun-2006  christos branches: 1.72.6; 1.72.8;
Don't allocate 2K on the stack...
 1.71 29-Mar-2006  thorpej branches: 1.71.2;
Use device_private().
 1.70 29-Mar-2006  thorpej Replace device_locators() with device_locator(), and use it.
 1.69 28-Mar-2006  thorpej Use device_unit().
 1.68 11-Dec-2005  christos branches: 1.68.4; 1.68.6; 1.68.8; 1.68.10; 1.68.12;
merge ktrace-lwp.
 1.67 25-Oct-2005  drochner finally nuke the useless cardbus "dev" locator
 1.66 09-Sep-2005  drochner branches: 1.66.2;
remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.65 08-Sep-2005  drochner fix parsing of some informational CIS tuples: correct length and handle
the case correctly where a string is terminated with 0x00 0xff
 1.64 26-Aug-2005  drochner use XXXCF_NLOCS constants instead of magic numbers
 1.63 25-Aug-2005  drochner kill a number of autoconf submatch functions which follow the
standard scheme:
if (<configured> != <wildcard> && <configured> != <real>)
then fail
else
ask device match function

This is handled by config_stdsubmatch() now.
 1.62 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.61 27-Feb-2005  perry branches: 1.61.2; 1.61.4;
nuke trailing whitespace
 1.60 14-Oct-2004  enami branches: 1.60.4; 1.60.6;
Redo previous two commit a bit different way;
- Just read as much as we can.
- Handle some special tuples.
 1.59 10-Oct-2004  enami Terminate the search loop when something is found rather than when
first iteration is done.
 1.58 10-Oct-2004  enami One more obvious test.
 1.57 10-Oct-2004  enami Don't overrun when decoding tuples.
 1.56 10-Oct-2004  enami Cosmetic changes.
 1.55 23-Aug-2004  drochner it is sufficient to include "locators.h" in cardbus.c
 1.54 23-Aug-2004  drochner kick out the error-prone handcrafted single-linked list of cardbus
functions; replace by a simple *array[8]
 1.53 23-Aug-2004  drochner make the "selective probing" work, and minor cleanup
(avoid using the macros which hide cfdata members, this doesn't help
for anything)
 1.52 19-Aug-2004  drochner support rescan / manual detach
This code needs cleanup, at least a reasonable linked list
implementation (fixed a bug in detach_card() in the process which
left a dangling pointer around).
Also removed a questionable and undocumented use of the parent's
device unit number as locator value.
(As with the pcmcia code: someone please review wrt powerup/down etc.)
 1.51 02-Aug-2004  mycroft cardbusdevs -> pcidevs
 1.50 22-Jul-2004  mycroft If the CIS pointer in all-0s, don't try to read the CIS.
 1.49 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.48 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.47 01-Jan-2003  thorpej branches: 1.47.2; 1.47.4;
Use aprint_normal() in cfprint routines.
 1.46 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.45 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.44 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.43 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.42 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.41 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.40 23-Nov-2001  enami branches: 1.40.8;
Use __func__ instead of __FUNCTION__.
 1.39 21-Nov-2001  enami Don't use __func__ as variable. It prevents compilation.
Use __FUNCTION__ instead.
 1.38 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.37 13-Nov-2001  lukem add RCSID
 1.36 06-Nov-2001  augustss Make some messages only appear with bootverbose.
Add bus number to attach args.
 1.35 06-Jul-2001  mcr branches: 1.35.2; 1.35.6;
record handles for memory and io spaces
 1.34 09-May-2001  thorpej Make sure `bhlc' is initialzed before we consult it to determine
the number of functions on the card.
 1.33 09-May-2001  augustss Fix grammaer in error message.
 1.32 25-Apr-2001  haya Initialise all function's latency timer and cacheline size.
 1.31 25-Apr-2001  haya Set function-in-use flag before calling power control function in
order to prevent turn on power twice. This change does not prevent
power-off/power-on conflicts.
 1.30 28-Mar-2001  enami - Unmap space used to read tuple.
- No need to zero clear temporary storage twice.
 1.29 28-Mar-2001  enami Cosmetic changes; mostly knf.
 1.28 12-Oct-2000  wiz branches: 1.28.2;
typo in comment (consifuration -> configuration)
 1.27 02-Jul-2000  cgd nuke some final __BROKEN_INDIRECT_CONFIG bits that weren't caught by
unifdef last time. (bloody things just won't stay dead!)
 1.26 16-Jun-2000  cgd beat back the undead: __BROKEN_INDIRECT_CONFIG had risen, and was
terrorizing innocent hackers...
 1.25 17-Apr-2000  joda branches: 1.25.2;
extract serial funce
 1.24 02-Apr-2000  mycroft Add a flag to tell whether a MAC address was actually found in the CIS.
XXX This whole piece of code should go away ASAP. We should use a callback
as in the PCMCIA code. In fact, we should use the PCMCIA code...
 1.23 22-Mar-2000  haya 1. Do not apply 5 V on a CardBus card.
2. Do not avoid ISA hole when a device requires more than
256-byte io space.
3. Remove sending CardBus bridge's function number to
cardbus stack. This number is not needed for anyone.
 1.22 07-Mar-2000  haya Fix CardBus device number. Though CardBus device number should be 0,
the value of bridge's function number was assigned to the device
number.
 1.21 07-Mar-2000  mycroft Called the power function even for 5V cards. This at least gives the power
a chance to stabilize before we frob the card.
 1.20 18-Feb-2000  soren Remove redundant CIS definitions.
 1.19 31-Jan-2000  haya Force power off when a CardBus card is detached.
Use tsleep when kernel thread works.
 1.18 26-Jan-2000  haya Add cardbus detach functionality. Add a function
cardbus_detach_card() in cardbus.c and enable detach code in cardslot.c
 1.17 13-Jan-2000  joda (cardbus_attach_card): zero out ca
 1.16 11-Dec-1999  thorpej branches: 1.16.2;
Add cardbus_get_capability(), cloned from pci_get_capability().
 1.15 18-Nov-1999  joda include dev/cardbus/cardbusdevs.h
 1.14 18-Nov-1999  joda use CARDBUS_VENDOR_INVALID
 1.13 15-Nov-1999  haya Fill 0 into CardBus base address registers before a card is
configured.
 1.12 12-Nov-1999  joda (cardbus_attach_card): don't free cc
 1.11 09-Nov-1999  joda make this compile with CARDBUS_DEBUG
 1.10 08-Nov-1999  joda Let decode_tuples take function to call for each tuple, and use this
to get some vital information from the CIS (some network cards need
this to get the mac-address). This should be merged with the related
code for PCMCIA cards, but that requires more thought.
 1.9 01-Nov-1999  haya Change the interface of cardbus_function_enable() and
cardbus_function_disable().
 1.8 29-Oct-1999  joda handle multi function cards
 1.7 29-Oct-1999  joda add support for reading memory mapped CIS via BAR or EXROM register
 1.6 29-Oct-1999  haya Remove unnecessary check in cardbusmatch.
 1.5 27-Oct-1999  joda (cardbus_attach_card): don't mask everything *but* the latency timer
 1.4 27-Oct-1999  haya Use opt_cardbus.h for cardbus.c and opt_cardslot.h for cardslot.c.
Remove unnecessary include from cardbus.c.
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Comment out some debug settings.
Change attach printing so it looks more standard.
 1.2 15-Oct-1999  haya add NetBSD ID tag
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.28.2.8 03-Jan-2003  thorpej Sync with HEAD.
 1.28.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.28.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.28.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.28.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.28.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.28.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.28.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.35.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.35.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.35.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.8.1 20-Jun-2002  gehenna catch up with -current.
 1.47.4.1 23-Jul-2004  he Pull up revision 1.50 (requested by mycroft in ticket #692):
If the CIS pointer is all-0s, don't try to read the CIS.
 1.47.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.5 19-Oct-2004  skrll Sync with HEAD
 1.47.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.2 25-Aug-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.60.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.60.4.1 29-Apr-2005  kent sync with -current
 1.61.4.9 17-Mar-2008  yamt sync with head.
 1.61.4.8 27-Feb-2008  yamt sync with head.
 1.61.4.7 11-Feb-2008  yamt sync with head.
 1.61.4.6 21-Jan-2008  yamt sync with head
 1.61.4.5 07-Dec-2007  yamt sync with head
 1.61.4.4 27-Oct-2007  yamt sync with head.
 1.61.4.3 26-Feb-2007  yamt sync with head.
 1.61.4.2 30-Dec-2006  yamt sync with head.
 1.61.4.1 21-Jun-2006  yamt sync with head.
 1.61.2.1 24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #1214):
sys/dev/cardbus/cardbus.c: revision 1.65
fix parsing of some informational CIS tuples: correct length and handle
the case correctly where a string is terminated with 0x00 0xff
 1.66.2.1 26-Oct-2005  yamt sync with head
 1.68.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.68.10.1 19-Apr-2006  elad sync with head.
 1.68.8.2 26-Jun-2006  yamt sync with head.
 1.68.8.1 01-Apr-2006  yamt sync with head.
 1.68.6.2 07-Jun-2006  kardel Sync with head.
 1.68.6.1 22-Apr-2006  simonb Sync with head.
 1.68.4.1 09-Sep-2006  rpaulo sync with head
 1.71.2.1 19-Jun-2006  chap Sync with head.
 1.72.8.2 10-Dec-2006  yamt sync with head.
 1.72.8.1 22-Oct-2006  yamt sync with head
 1.72.6.1 18-Nov-2006  ad Sync with head.
 1.74.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.75.22.2 18-Nov-2007  bouyer Sync with HEAD
 1.75.22.1 25-Oct-2007  bouyer Sync with HEAD.
 1.75.18.3 23-Mar-2008  matt sync with HEAD
 1.75.18.2 09-Jan-2008  matt sync with HEAD
 1.75.18.1 06-Nov-2007  matt sync with HEAD
 1.75.16.9 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.75.16.8 01-Dec-2007  jmcneill Sync with HEAD.
 1.75.16.7 01-Dec-2007  jmcneill Sync with HEAD.
 1.75.16.6 21-Nov-2007  joerg Sync with HEAD.
 1.75.16.5 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.75.16.4 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.75.16.3 04-Oct-2007  joerg Port generic PCI power handlers to cardbus.
 1.75.16.2 11-Sep-2007  jmcneill Missing break after PNP_REQUEST_SET_STATE case in cardbus_net_generic_power
 1.75.16.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.75.4.1 23-Oct-2007  ad Sync with head.
 1.76.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.76.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.76.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.76.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.80.4.1 11-Dec-2007  yamt sync with head.
 1.80.2.1 26-Dec-2007  ad Sync with head.
 1.81.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.81.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.87.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.87.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.87.2.1 24-Mar-2008  keiichi sync with head.
 1.91.8.2 27-Jun-2008  simonb Sync with head.
 1.91.8.1 18-Jun-2008  simonb Sync with head.
 1.91.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.91.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.91.4.3 11-Mar-2010  yamt sync with head
 1.91.4.2 16-May-2009  yamt sync with head
 1.91.4.1 04-May-2009  yamt sync with head.
 1.91.2.1 17-Jun-2008  yamt sync with head.
 1.95.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.95.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.99.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.108.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.110.4.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.110.4.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.111.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.14 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.13 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.12 24-Feb-2010  dyoung branches: 1.12.60; 1.12.62;
Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.11 29-Apr-2008  martin branches: 1.11.20;
Convert to new 2 clause license
 1.10 19-Oct-2007  ad branches: 1.10.16; 1.10.18; 1.10.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 11-Dec-2005  christos branches: 1.9.30; 1.9.44; 1.9.46; 1.9.50;
merge ktrace-lwp.
 1.8 27-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 10-Oct-2004  enami branches: 1.7.4; 1.7.6;
Cosmetic changes.
 1.6 13-Nov-2001  lukem branches: 1.6.16;
add RCSID
 1.5 08-May-2000  thorpej branches: 1.5.6; 1.5.8; 1.5.10;
Don't use not-in-user-namespace variable names that newer versions of
GCC doesn't like very much.
 1.4 03-Feb-2000  thorpej If we read a bad header signature, report what we read.
 1.3 08-Dec-1999  joda branches: 1.3.2;
check for NULL from malloc
 1.2 12-Nov-1999  joda branches: 1.2.2;
if the image size is zero, assume it really means one block
 1.1 28-Oct-1999  joda code to read PCI expansion ROM
 1.2.2.2 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 12-Nov-1999  fvdl file cardbus_exrom.c was added on branch fvdl-softdep on 1999-11-15 00:40:17 +0000
 1.3.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.8.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.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.5.6.1 08-May-2000  bouyer file cardbus_exrom.c was added on branch thorpej_scsipi on 2000-11-20 11:39:52 +0000
 1.6.16.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.16.1 19-Oct-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.1 27-Oct-2007  yamt sync with head.
 1.9.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.46.1 06-Nov-2007  matt sync with HEAD
 1.9.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.30.1 23-Oct-2007  ad Sync with head.
 1.10.20.2 11-Mar-2010  yamt sync with head
 1.10.20.1 16-May-2008  yamt sync with head.
 1.10.18.1 18-May-2008  yamt sync with head.
 1.10.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.12.62.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.62.1 10-Jun-2019  christos Sync with HEAD
 1.12.60.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.6 29-Apr-2008  martin Convert to new 2 clause license
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 10-Oct-2004  enami branches: 1.3.4; 1.3.6;
Cosmetic changes.
 1.2 15-Dec-1999  kleink branches: 1.2.2; 1.2.8; 1.2.32;
Normalize symbol names used for multiple inclusion protection.
 1.1 28-Oct-1999  joda branches: 1.1.4;
code to read PCI expansion ROM
 1.1.4.2 15-Nov-1999  fvdl Sync with -current
 1.1.4.1 28-Oct-1999  fvdl file cardbus_exrom.h was added on branch fvdl-softdep on 1999-11-15 00:40:17 +0000
 1.2.32.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.32.1 19-Oct-2004  skrll 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 15-Dec-1999  bouyer file cardbus_exrom.h was added on branch thorpej_scsipi on 2000-11-20 11:39:53 +0000
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.36 15-Mar-2010  dyoung Delete unused functions cardbus_save_bar() and cardbus_restore_bar().
 1.35 04-Mar-2010  dyoung branches: 1.35.2;
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.
 1.34 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.33 25-Feb-2010  dyoung Cardbus_free_tag() and cardbus_free_tag() are no-ops, so get rid of them
to simplify the code a bit.
 1.32 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.31 15-Dec-2009  snj branches: 1.31.2;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.30 15-Mar-2009  cegger ansify function definitions
 1.29 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.28 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.27 25-Jun-2008  drochner branches: 1.27.4; 1.27.10;
split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
 1.26 06-Apr-2008  cegger branches: 1.26.4; 1.26.6; 1.26.8;
use aprint_*_dev and device_xname
 1.25 19-Oct-2007  ad branches: 1.25.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.24 16-Nov-2006  christos branches: 1.24.8; 1.24.22; 1.24.24; 1.24.28;
__unused removal on arguments; approved by core.
 1.23 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.22 04-Jun-2006  itohy branches: 1.22.6; 1.22.8;
Make compile by gcc 2.
 1.21 11-May-2006  mrg branches: 1.21.2;
quell GCC 4.1 uninitialised variable warnings.
 1.20 21-Apr-2006  martin Backout previous: bus_space_handle_t is an opaque type and can not be
initialized savely.
 1.19 14-Apr-2006  christos Coverity CID 2465: Fix uninitialized variable. XXX: cardbus_mapreg_map()
never fails (even when it does not find memory). Perhaps it should?
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10; 1.18.12;
merge ktrace-lwp.
 1.17 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.16 27-Feb-2005  perry branches: 1.16.4;
nuke trailing whitespace
 1.15 04-Feb-2005  perry de-__P
 1.14 15-Nov-2001  lukem branches: 1.14.16; 1.14.24; 1.14.26;
don't need <sys/types.h> when including <sys/param.h>
 1.13 13-Nov-2001  lukem add RCSID
 1.12 30-Apr-2001  jmc branches: 1.12.2;
Cast base correctly for format string.
 1.11 12-Oct-2000  wiz branches: 1.11.2;
typo fix in comment (stallen -> stolen)
 1.10 07-Mar-2000  mycroft Fix an obvious bug that caused I/O space to never be freed.
Also, don't use rbus_space_free() directly.
 1.9 09-Feb-2000  itohy Make it compile with options DEBUG.
Reported by Kawamoto Yosihisa (PR #9379).
 1.8 04-Feb-2000  haya Now cardbus_mapreg_unmap() has been implemented in
sys/dev/cardbus/cardbus_map.c. The detech function in
sys/dev/cardbus/if_tlp_cardbus.c uses cardbus_mapreg_unmap().
 1.7 25-Jan-2000  drochner use BUS_SPACE_MAP_PREFETCHABLE instead BUS_SPACE_MAP_CACHEABLE where the
PCI BAR bit is referred to
 1.6 09-Nov-1999  haya branches: 1.6.2;
Maintenance CardBus/PCI extension ROM mapping routine.
1. Make Extension ROM not to be mapped on I/O space.
2. Do not check the bus-space indicator in ROM register.
 1.5 27-Oct-1999  joda allow mapping of the expansion rom
 1.4 27-Oct-1999  haya Change cardbus API. The first argument of cardbus_mapreg_map() is
changed to struct cardbus_softc * from cardbus_devfunc_t. The old
function is renamed to Cardbus_mapreg_map().
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Comment out some debug settings.
Change attach printing so it looks more standard.
 1.2 15-Oct-1999  haya add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.11.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.26.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.26.1 12-Feb-2005  yamt sync with head.
 1.14.24.1 29-Apr-2005  kent sync with -current
 1.14.16.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.16.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.16.1 04-Feb-2005  skrll Sync with HEAD.
 1.16.4.3 27-Oct-2007  yamt sync with head.
 1.16.4.2 30-Dec-2006  yamt sync with head.
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.18.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.18.10.2 11-May-2006  elad sync with head
 1.18.10.1 19-Apr-2006  elad sync with head.
 1.18.8.2 26-Jun-2006  yamt sync with head.
 1.18.8.1 24-May-2006  yamt sync with head.
 1.18.6.3 07-Jun-2006  kardel Sync with head.
 1.18.6.2 01-Jun-2006  kardel Sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 19-Jun-2006  chap Sync with head.
 1.22.8.2 10-Dec-2006  yamt sync with head.
 1.22.8.1 22-Oct-2006  yamt sync with head
 1.22.6.1 18-Nov-2006  ad Sync with head.
 1.24.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.24.1 06-Nov-2007  matt sync with HEAD
 1.24.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.24.8.1 23-Oct-2007  ad Sync with head.
 1.25.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.25.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.8.1 27-Jun-2008  simonb Sync with head.
 1.26.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.26.4.3 11-Aug-2010  yamt sync with head.
 1.26.4.2 11-Mar-2010  yamt sync with head
 1.26.4.1 04-May-2009  yamt sync with head.
 1.27.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.31.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.2.1 30-May-2010  rmind sync with head
 1.29 02-Aug-2004  mycroft Remove.
 1.28 22-Jul-2004  mycroft Add 3c656 modem IDs.
 1.27 24-Oct-2003  mycroft branches: 1.27.2;
+ NetGear FA511
 1.26 14-Oct-2003  ichiro add ATHEROS AR5001 WirelessLAN 802.11a/b/g CardBus
 1.25 26-Jun-2003  ichiro branches: 1.25.2;
add products
Planex 10/100BaseTX FNW-3800-TX
kern/20175
Corega FEther II CB-TXD 10/100BaseTX
kern/21497
 1.24 01-Feb-2003  ichiro add product IO-DATA CBET100-CL 10/100 Ethernet
(OEM AboCom FE2000VX )
 1.23 11-Nov-2002  kanaoka Add support for "Planex FNW-3603 cardbus ethernet".
by kern/18961: From: prlw1@cam.ac.uk.
 1.22 11-Nov-2002  onoe Add AboCom FE2500MX 10/100 Ethernet (Lanneed LD-CBL/TX)
 1.21 17-Feb-2002  augustss branches: 1.21.10;
Add a 10/100 Ethertnet card from Hawking.
 1.20 04-Jan-2002  kanaoka Add product "D-Link DFE-690TXD 10/100".
by kern/15100: From: John Nemeth <jnemeth@access.victoria.bc.ca>
 1.19 20-Jun-2001  ichiro branches: 1.19.2;
add product RealTek 8139

by kern/13252: RealTek 8139-based Cardbus support
 1.18 15-May-2001  kanaoka Add product "Corega FEther CB-TXD". Modified from kern/12709.
from Yamashiro Jun <j99060@ie.u-ryukyu.ac.jp>.
 1.17 14-Mar-2001  christos PR/12405: Wolfgang Rupprecht: Add another abocom card (linksys pcm200)
 1.16 08-Mar-2001  thorpej Add Advansys Ultra SCSI. Modified from kern/12341, from
takashi.yamamoto@bigfoot.com.
 1.15 07-Feb-2001  haya branches: 1.15.2;
Add IO Data IDE Controller and Hitachi video capture cards.
 1.14 07-Feb-2001  haya Cosmetic change: re-ordered by vendor id.
 1.13 16-Jan-2001  thorpej Add some ACCTON and AboCom AN985 Ethernet devices.
 1.12 28-Aug-2000  haya Correct wrong keyword.
 1.11 28-Aug-2000  haya Add 3Com 3C656 LAN + MODEM CardBus cards.
 1.10 06-Jun-2000  soren branches: 1.10.2;
Make 3Com names a little more consistent.
 1.9 13-Apr-2000  joda branches: 1.9.2;
add entry for a Xircom modem (as reported by Darren Reed)
 1.8 10-Apr-2000  haya Incorporate the changes of RL81x9 driver provided by M. Kanaoka
<kanaoka@ann.hi-ho.ne.jp>. He separated the driver into IC specific
portion and bus attachment portion and added cardbus attachent.
 1.7 11-Dec-1999  explorer branches: 1.7.2;
add 3com 575CT, which Dell (at least) seems to be shipping
 1.6 18-Nov-1999  joda fix bogus comment
 1.5 18-Nov-1999  joda add INVALID vendor, and an Intel modem
 1.4 08-Nov-1999  joda copy xircom entries from pcidevs
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Correct a spelling mistake.
 1.2 15-Oct-1999  haya add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.3.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.4 15-Dec-2002  he Pull up revision 1.23 (via patch, requested by kanaoka):
Add support for Planex FNW-3603 cardbus ethernet. Fixes
PR#18961.
 1.10.2.3 05-Feb-2002  he Apply patch (requested by he):
Correct inadvertent omission in pull-up of rtk driver.
 1.10.2.2 29-Jan-2002  he Pull up revisions 1.13,1.17 (requested by dillo):
Add support for AN985-based CardBus network interfaces.
 1.10.2.1 05-Jan-2002  he Pull up revisions 1.18-1.20 (via patch, requested by kanaoka):
Add support for the following cards:
o D-Link DFE-690TXD 10/100
o Realtek 8139 based cards
o Corega FEther CB-TXD
 1.15.2.6 11-Nov-2002  nathanw Catch up to -current
 1.15.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.15.2.4 11-Jan-2002  nathanw More catchup.
 1.15.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.15.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.15.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.19.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.10.2 11-Nov-2004  he Apply patch (via patch, from pcidevs 1.647, requested by itohy in ticket #1741):
Add support for the Workbit NinjaSCSI-32 PCI/Cardbus
SCSI driver, njs(4).
 1.21.10.1 11-Dec-2002  he Pull up revision 1.23 (requested by kanaoka in ticket #979):
Add support for ``Planex FNW-3603 cardbus ethernet''.
Fixes PR#18961.
 1.25.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.2.2 30-Aug-2004  tron Apply patch (requested by itohy in ticket #800):
Add Workbit NinjaSCSI-32 PCI/CardBus products.
 1.27.2.1 23-Jul-2004  he Pull up revision 1.28 (requested by mycroft in ticket #691):
Add 3c656 modem IDs, part of fix for PR#23710.
 1.27 02-Aug-2004  mycroft Remove.
 1.26 22-Jul-2004  mycroft Regen.
 1.25 24-Oct-2003  mycroft branches: 1.25.2;
+ NetGear FA511
 1.24 14-Oct-2003  ichiro regen
 1.23 06-Jul-2003  dyoung Add driver atw for PCI/Mini-PCI/Cardbus 802.11b NICs based on the
ADMtek ADM8211. Read the man page for bugs and other outstanding
issues.
 1.22 26-Jun-2003  ichiro branches: 1.22.2;
regen.
 1.21 01-Feb-2003  ichiro regen
 1.20 11-Nov-2002  kanaoka Regen:
Add support for "Planex FNW-3603 cardbus ethernet".
by kern/18961: From: prlw1@cam.ac.uk.
 1.19 11-Nov-2002  onoe Regen: Add AboCom FE2500MX 10/100 Ethernet (Lanneed LD-CBL/TX)
 1.18 17-Feb-2002  augustss branches: 1.18.10;
Regen.
 1.17 04-Jan-2002  kanaoka Regen.
 1.16 20-Jun-2001  ichiro branches: 1.16.2;
regen
 1.15 15-May-2001  kanaoka Regen.
 1.14 14-Mar-2001  christos regen
 1.13 08-Mar-2001  thorpej Regen; added Advansys Ultra SCSI.
 1.12 07-Feb-2001  haya branches: 1.12.2;
Regen.
 1.11 16-Jan-2001  thorpej Regen; ACCTON and AboCom AN985 Ethernet devices.
 1.10 28-Aug-2000  haya Regen to correct wrong keyword.
 1.9 28-Aug-2000  haya Regen.
 1.8 13-Jun-2000  soren branches: 1.8.2;
Regen.
 1.7 13-Apr-2000  joda branches: 1.7.2;
regen
 1.6 10-Apr-2000  haya Regen.
 1.5 11-Dec-1999  explorer branches: 1.5.2;
add 3com 575CT, which Dell (at least) seems to be shipping
 1.4 18-Nov-1999  joda regen
 1.3 18-Nov-1999  joda regen
 1.2 08-Nov-1999  joda regen
 1.1 15-Oct-1999  haya branches: 1.1.2; 1.1.4;
This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.4 15-Dec-2002  he Pull up regenerated files (requested by kanaoka):
Add support for Planex FNW-3603 cardbus ethernet. Fixes
PR#18961.
 1.8.2.3 05-Feb-2002  he Pull up regenerated files (requested by he):
Correct inadvertent omission on pull-up of rtk driver.
 1.8.2.2 29-Jan-2002  he Pull up regenerated files (requested by dillo):
Add support for AN985-based CardBus network interfaces.
 1.8.2.1 05-Jan-2002  he Pull up regenerated files (requested by kanaoka):
Add support for the following cards:
o D-Link DFE-690TXD 10/100
o Realtek 8139 based cards
o Corega FEther CB-TXD
 1.12.2.6 11-Nov-2002  nathanw Catch up to -current
 1.12.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.12.2.4 11-Jan-2002  nathanw More catchup.
 1.12.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.12.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.10.2 11-Nov-2004  he Pull up regenerated files (requested by itohy in ticket #1741):
Add support for the Workbit NinjaSCSI-32 PCI/Cardbus
SCSI driver, njs(4).
 1.18.10.1 11-Dec-2002  he Pull up regenerated files (requested by kanaoka in ticket #969):
Add support for ``Planex FNW-3603 cardbus ethernet''.
Fixes PR#18961.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.2.2 30-Aug-2004  tron Regen for ticket 800.
 1.25.2.1 23-Jul-2004  he Pull up regenerated files (requested by mycroft in ticket #691):
Add 3c656 modem IDs, part of fix for PR#23710.
 1.26 02-Aug-2004  mycroft Remove.
 1.25 22-Jul-2004  mycroft Regen.
 1.24 24-Oct-2003  mycroft branches: 1.24.2;
+ NetGear FA511
 1.23 14-Oct-2003  ichiro regen
 1.22 26-Jun-2003  ichiro branches: 1.22.2;
regen.
 1.21 01-Feb-2003  ichiro regen
 1.20 11-Nov-2002  kanaoka Regen:
Add support for "Planex FNW-3603 cardbus ethernet".
by kern/18961: From: prlw1@cam.ac.uk.
 1.19 11-Nov-2002  onoe Regen: Add AboCom FE2500MX 10/100 Ethernet (Lanneed LD-CBL/TX)
 1.18 17-Feb-2002  augustss branches: 1.18.10;
Regen.
 1.17 04-Jan-2002  kanaoka Regen.
 1.16 20-Jun-2001  ichiro branches: 1.16.2;
regen
 1.15 15-May-2001  kanaoka Regen.
 1.14 14-Mar-2001  christos regen
 1.13 08-Mar-2001  thorpej Regen; added Advansys Ultra SCSI.
 1.12 07-Feb-2001  haya branches: 1.12.2;
Regen.
 1.11 16-Jan-2001  thorpej Regen; ACCTON and AboCom AN985 Ethernet devices.
 1.10 28-Aug-2000  haya Regen to correct wrong keyword.
 1.9 28-Aug-2000  haya Regen.
 1.8 13-Jun-2000  soren branches: 1.8.2;
Regen.
 1.7 13-Apr-2000  joda branches: 1.7.2;
regen
 1.6 10-Apr-2000  haya Regen.
 1.5 11-Dec-1999  explorer branches: 1.5.2;
add 3com 575CT, which Dell (at least) seems to be shipping
 1.4 18-Nov-1999  joda regen
 1.3 18-Nov-1999  joda regen
 1.2 08-Nov-1999  joda regen
 1.1 15-Oct-1999  haya branches: 1.1.2; 1.1.4;
This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.4 15-Dec-2002  he Pull up regenerated files (requested by kanaoka):
Add support for Planex FNW-3603 cardbus ethernet. Fixes
PR#18961.
 1.8.2.3 05-Feb-2002  he Pull up regenerated files (requested by he):
Correct inadvertent omission on pull-up of rtk driver.
 1.8.2.2 29-Jan-2002  he Pull up regenerated files (requested by dillo):
Add support for AN985-based CardBus network interfaces.
 1.8.2.1 05-Jan-2002  he Pull up regenerated files (requested by kanaoka):
Add support for the following cards:
o D-Link DFE-690TXD 10/100
o Realtek 8139 based cards
o Corega FEther CB-TXD
 1.12.2.6 11-Nov-2002  nathanw Catch up to -current
 1.12.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.12.2.4 11-Jan-2002  nathanw More catchup.
 1.12.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.12.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.10.2 11-Nov-2004  he Pull up regenerated files (requested by itohy in ticket #1741):
Add support for the Workbit NinjaSCSI-32 PCI/Cardbus
SCSI driver, njs(4).
 1.18.10.1 11-Dec-2002  he Pull up regenerated files (requested by kanaoka in ticket #969):
Add support for ``Planex FNW-3603 cardbus ethernet''.
Fixes PR#18961.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.2 30-Aug-2004  tron Regen for ticket 800.
 1.24.2.1 23-Jul-2004  he Pull up regenerated files (requested by mycroft in ticket #691):
Add 3c656 modem IDs, part of fix for PR#23710.
 1.8 06-May-2023  andvar few more typos in the word "register", mainly s/resister/register/.
In one comment I assume that it was meant to be pull-up resistor.
 1.7 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.6 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.5 25-Feb-2010  dyoung Phase out some CardBus constants and types. Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG -> PCI_CLASS_REG
CARDBUS_ID_REG -> PCI_ID_REG
cardbus_product_id_t -> pci_product_id_t
cardbus_vendor_id_t -> pci_vendor_id_t
 1.4 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.3 15-Dec-2009  snj branches: 1.3.2;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.2 30-Aug-2007  dyoung branches: 1.2.24;
Cosmetic: use a name instead of a number for BAR0.
 1.1 01-Jun-2001  haya branches: 1.1.2; 1.1.40; 1.1.82; 1.1.92; 1.1.96; 1.1.98;
cardbusvar.h is divided into two files: cardbusvar.h and cardbusreg.h.
 1.1.98.1 06-Nov-2007  matt sync with HEAD
 1.1.96.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.1.92.1 03-Sep-2007  skrll Sync with HEAD.
 1.1.82.1 09-Oct-2007  ad Sync with head.
 1.1.40.1 03-Sep-2007  yamt sync with head.
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 01-Jun-2001  nathanw file cardbusreg.h was added on branch nathanw_sa on 2001-06-21 20:01:24 +0000
 1.2.24.1 11-Mar-2010  yamt sync with head
 1.3.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.56 18-Feb-2012  matt Remove uneeded and unused structure.
 1.55 01-Aug-2011  drochner branches: 1.55.2; 1.55.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.54 15-Mar-2010  dyoung Delete unused member ct_bar[] from struct cardbus_devfunc.
 1.53 15-Mar-2010  dyoung Delete unused functions cardbus_save_bar() and cardbus_restore_bar().
 1.52 15-Mar-2010  dyoung Delete unused members ct_rbus_iot and ct_rbus_memt from struct
cardbus_devfunc.
 1.51 04-Mar-2010  dyoung branches: 1.51.2;
Get rid of the #if 1 surrounding #include <dev/cardbus/rbus.h>.

This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

ath, atw, and rtw work fine after this change.
 1.50 26-Feb-2010  dyoung Cosmetic: re-wrap some line.
 1.49 26-Feb-2010  dyoung Cosmetic: join a line.
 1.48 26-Feb-2010  dyoung Introduce Cardbus_intr_establish(cardbus_devfunc_t, ...) and
Cardbus_intr_disestablish(cardbus_devfunc_t, ...) and start using them.
 1.47 25-Feb-2010  dyoung Cardbus_free_tag() and cardbus_free_tag() are no-ops, so get rid of them
to simplify the code a bit.
 1.46 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.45 23-Feb-2010  dyoung Remove unused functions pci_disable_retry() and cardbus_disable_retry().
 1.44 15-Dec-2009  snj branches: 1.44.2;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.43 26-Jun-2008  drochner constify the pcmcia/cardbus method tables
 1.42 25-Jun-2008  drochner split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
 1.41 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.40 24-Jun-2008  drochner clean up some useless code and variables in cardbus attachment
 1.39 11-Jun-2008  dyoung Use device_t.
 1.38 02-Jan-2008  dyoung branches: 1.38.6; 1.38.8; 1.38.10; 1.38.12; 1.38.14;
Introduce a struct cardbus_chipset_tag, and make cardbus_chipset_tag_t
a pointer to that struct, so that we cannot assign pointers of
arbitrary type to cardbus_chipset_tag_t. Tweak cbb(4) to accomodate
this change.

Make Cardbus_conf_read() and Carbus_conf_write() pass the right
arguments to cardbus_functions->cardbus_conf_{read,write}() for a
change.

Let's hope this stops the crash in cardbus_function_enable() that
macallan@ reported to me.
 1.37 09-Dec-2007  jmcneill branches: 1.37.2;
Merge jmcneill-pm branch.
 1.36 16-Nov-2007  dyoung branches: 1.36.2; 1.36.4;
Improve Cardbus performance, error handling, and error reporting.

Let the TI1420 PCI-Cardbus bridge do burst reads from the primary
(PCI) bus. This ought to improve Tx performance on Cardbus NICs.
This optimization may apply to other TI bridges, but I only have
a datasheet for the TI1420. :-/

Activate PCI Parity Error and System Error reporting on PCI-Cardbus
bridges.

To avoid data destruction, set the Master Abort mode to 1. Stops
the bridge from silently discarding writes from the secondary bus
to the primary bus (Cardbus writes to PCI). Also, stops the bridge
from fulfilling a read by a bus master on the secondary bus that
failed on the primary bus with 0xffffffff (Cardbus reads from PCI).
Now the bus will indicate an error condition (SERR) instead of
silently destroying/corrupting data.

Forward system error indications from the secondary to the primary
bus. Detect parity errors on the secondary.

Set a Cardbus card's Latency Timer to something reasonable, according
to the Cardbus card's Minimum Grant and the bandwidth available on
the PCI bus. Restore the Latency Timer when re-enabling a card
(e.g., after power reactivation).
 1.35 11-Dec-2005  christos branches: 1.35.44; 1.35.46; 1.35.50; 1.35.52;
merge ktrace-lwp.
 1.34 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.33 30-May-2005  christos branches: 1.33.2;
add a missing const
 1.32 27-Feb-2005  perry nuke trailing whitespace
 1.31 04-Feb-2005  perry de-__P
 1.30 14-Dec-2004  chs branches: 1.30.2; 1.30.4;
remove some defines that aren't used anywhere (and shouldn't exist anyway,
since they hard-code information that should come from locators.h).
 1.29 23-Aug-2004  drochner it is sufficient to include "locators.h" in cardbus.c
 1.28 23-Aug-2004  drochner kick out the error-prone handcrafted single-linked list of cardbus
functions; replace by a simple *array[8]
 1.27 19-Aug-2004  drochner support rescan / manual detach
This code needs cleanup, at least a reasonable linked list
implementation (fixed a bug in detach_card() in the process which
left a dangling pointer around).
Also removed a questionable and undocumented use of the parent's
device unit number as locator value.
(As with the pcmcia code: someone please review wrt powerup/down etc.)
 1.26 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.25 08-Jul-2003  itojun function prototype must not have variable name
 1.24 06-Nov-2001  augustss branches: 1.24.16;
Add ca_bus field.
 1.23 19-Jul-2001  wiz branches: 1.23.4;
Fix comment (device has a 'c').
 1.22 01-Jun-2001  haya branches: 1.22.2;
cardbusvar.h is divided into two files: cardbusvar.h and cardbusreg.h.
 1.21 31-May-2001  haya Cosmetic change.
 1.20 19-Apr-2000  haya branches: 1.20.6;
Maintenace: add definitions for command status register.
 1.19 17-Apr-2000  joda add serial funce entry
 1.18 13-Apr-2000  joda add CARDBUS_SUBCLASS_COMMUNICATIONS_SERIAL
 1.17 02-Apr-2000  mycroft Add a flag to tell whether a MAC address was actually found in the CIS.
XXX This whole piece of code should go away ASAP. We should use a callback
as in the PCMCIA code. In fact, we should use the PCMCIA code...
 1.16 22-Mar-2000  haya 1. Do not apply 5 V on a CardBus card.
2. Do not avoid ISA hole when a device requires more than
256-byte io space.
3. Remove sending CardBus bridge's function number to
cardbus stack. This number is not needed for anyone.
 1.15 04-Feb-2000  haya Now cardbus_mapreg_unmap() has been implemented in
sys/dev/cardbus/cardbus_map.c. The detech function in
sys/dev/cardbus/if_tlp_cardbus.c uses cardbus_mapreg_unmap().
 1.14 26-Jan-2000  haya Add cardbus detach functionality. Add a function
cardbus_detach_card() in cardbus.c and enable detach code in cardslot.c
 1.13 17-Dec-1999  augustss branches: 1.13.2;
Remove extra #endif so we can compile again.
 1.12 16-Dec-1999  abs Add back cut Cardbus_conf_write/cardbus_conf_write lines.
 1.11 15-Dec-1999  kleink Normalize symbol names used for multiple inclusion protection.
 1.10 11-Dec-1999  thorpej Add cardbus_get_capability(), cloned from pci_get_capability().
 1.9 08-Nov-1999  joda correct number of BAR:s in cardbus_cis_info
 1.8 08-Nov-1999  joda add some bare-bones CIS information to the attach_args struct
 1.7 01-Nov-1999  haya Change the interface of cardbus_function_enable() and
cardbus_function_disable().
 1.6 28-Oct-1999  joda add macro to get ROM image number, given a CIS pointer
 1.5 27-Oct-1999  joda add Expasion ROM register (0x30);
fix typo in Cardbus_conf_write
 1.4 27-Oct-1999  haya Change cardbus API. The first argument of cardbus_mapreg_map() is
changed to struct cardbus_softc * from cardbus_devfunc_t. The old
function is renamed to Cardbus_mapreg_map().
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Add a number of CARDBUS_CLASS defines. Copied from PCI_CLASS.
 1.2 15-Oct-1999  haya add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.6.3 14-Nov-2001  nathanw Catch up to -current.
 1.20.6.2 24-Aug-2001  nathanw Catch up with -current.
 1.20.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.2.1 03-Aug-2001  lukem update to -current
 1.23.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.24.16.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.16.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.24.16.6 04-Feb-2005  skrll Sync with HEAD.
 1.24.16.5 18-Dec-2004  skrll Sync with HEAD.
 1.24.16.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.16.3 18-Sep-2004  skrll Sync with HEAD.
 1.24.16.2 25-Aug-2004  skrll Sync with HEAD.
 1.24.16.1 03-Aug-2004  skrll Sync with HEAD
 1.30.4.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.30.4.1 12-Feb-2005  yamt sync with head.
 1.30.2.1 29-Apr-2005  kent sync with -current
 1.33.2.3 21-Jan-2008  yamt sync with head
 1.33.2.2 07-Dec-2007  yamt sync with head
 1.33.2.1 21-Jun-2006  yamt sync with head.
 1.35.52.3 18-Feb-2008  mjf Sync with HEAD.
 1.35.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.35.52.1 19-Nov-2007  mjf Sync with HEAD.
 1.35.50.1 18-Nov-2007  bouyer Sync with HEAD
 1.35.46.1 09-Jan-2008  matt sync with HEAD
 1.35.44.4 21-Nov-2007  joerg Sync with HEAD.
 1.35.44.3 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.35.44.2 04-Oct-2007  joerg Port generic PCI power handlers to cardbus.
 1.35.44.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.36.4.1 11-Dec-2007  yamt sync with head.
 1.36.2.1 26-Dec-2007  ad Sync with head.
 1.37.2.1 08-Jan-2008  bouyer Sync with HEAD
 1.38.14.2 27-Jun-2008  simonb Sync with head.
 1.38.14.1 18-Jun-2008  simonb Sync with head.
 1.38.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.10.3 11-Aug-2010  yamt sync with head.
 1.38.10.2 11-Mar-2010  yamt sync with head
 1.38.10.1 04-May-2009  yamt sync with head.
 1.38.8.1 17-Jun-2008  yamt sync with head.
 1.38.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.44.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.2.1 30-May-2010  rmind sync with head
 1.55.6.1 18-Feb-2012  mrg merge to -current.
 1.55.2.1 17-Apr-2012  yamt sync with head
 1.60 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.59 24-Apr-2021  thorpej branches: 1.59.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.58 17-Apr-2021  mrg convert cardslot event thread from wakeup/tsleep to mutex/condvar.
this avoids a strange hang at reboot i am seeing on an old pentium4-m
laptop, that was introduced with kern_mutex.c 1.91/92, though i can
not really explain why that matters (in the waiting thread, a pointer
that should be NULL remains non NULL.) thanks to jmcneill@ for some
helpful review commentary here.

don't panic() if either "cardbus" or "pcmcia" didn't attach and a
card is inserted. this can happen for various reasons, including
some regression in netbsd (-current, and -9, at least) that suggests
using PCI_BUS_FIXUP (though it still fails to attach the card i have.)

both found with GCC 10 testing, though both also occur with GCC 7 in
the netbsd-9 tree as well.
 1.57 04-Oct-2020  nat branches: 1.57.4;
Ensure event_thread stays in event loop upon creation.
 1.56 24-Sep-2016  mrg weak alias some pcmcia functions (to an returns error function) so this
links when pcmcia isn't in the kernel. PR#7253.
 1.55 12-Oct-2013  christos branches: 1.55.6; 1.55.10;
Pass the device name in, so we can debug what deferred drivers did not work.
 1.54 27-Oct-2012  chs branches: 1.54.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.53 24-May-2011  joerg branches: 1.53.4; 1.53.14;
Kill redundant ()
 1.52 19-Mar-2010  dyoung branches: 1.52.2;
Remove superfluous cast (device_t to device_t).
 1.51 15-Dec-2009  snj branches: 1.51.2; 1.51.4;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.50 21-May-2009  dyoung Let us detach pcmcia0 and cardbus0 at cardslot0, and cardslot0 at
cardbus0.
 1.49 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.48 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.47 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.46 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.45 03-Jul-2008  drochner branches: 1.45.4; 1.45.10;
minor cleanup so that it can cope with a futute split pcmcia device/softc
 1.44 29-Jun-2008  dogcow fix type
 1.43 25-Jun-2008  drochner Avoid the use of i82365var.h - we don't use any functions from there.
Extract some data structures for ressource management into our private
header instead. This allows to use a typed pointer instead of a
generic one which saves a lot of typecasts.
Also remove something marked as "dirty hack" which I admittedly don't
understand, but it doesn't look useful...
 1.42 25-Jun-2008  drochner split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
 1.41 24-Jun-2008  drochner clean up some useless code and variables in cardbus attachment
 1.40 06-Apr-2008  cegger branches: 1.40.4; 1.40.6; 1.40.8;
use aprint_*_dev and device_xname
 1.39 16-Dec-2007  dyoung branches: 1.39.6;
Improve pci, cbb, cardslot, cardbus, and pcmcia to support detachment
of this entire device tree:

pci0 at mainbus0
elansc0 at pci0
gpio0 at elansc0
cbb0 at pci0
cardslot0 at cbb0
cardbus0 at cardslot0
pcmcia0 at cardslot0
cbb1 at pci0
cardslot1 at cbb1
cardbus1 at cardslot1
rtw0 at cardbus1
pcmcia1 at cardslot1
sip0 at pci0
nsphyter0 at sip0
sip1 at pci0
nsphyter1 at sip1

Whew!
 1.38 09-Dec-2007  jmcneill branches: 1.38.2;
Merge jmcneill-pm branch.
 1.37 01-Dec-2007  jmcneill branches: 1.37.2; 1.37.4;
aprintify
 1.36 19-Oct-2007  ad branches: 1.36.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.35 09-Jul-2007  ad branches: 1.35.6; 1.35.8; 1.35.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.34 04-Feb-2007  dyoung branches: 1.34.6; 1.34.8;
Cosmetic: KNF. In debug messages, use "%s: ...", __func__ idiom
to print subroutine names instead of hard-coding names.
 1.33 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.32 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.31 29-Mar-2006  thorpej branches: 1.31.8; 1.31.10;
Use device_private().
 1.30 29-Mar-2006  thorpej Use device_unit().
 1.29 29-Mar-2006  thorpej Use device_cfdata().
 1.28 11-Dec-2005  christos branches: 1.28.4; 1.28.6; 1.28.8; 1.28.10; 1.28.12;
merge ktrace-lwp.
 1.27 26-Aug-2005  drochner s/locdesc_t/int/g
 1.26 04-Feb-2005  perry branches: 1.26.6;
de-__P
 1.25 13-Sep-2004  drochner branches: 1.25.4; 1.25.6;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.24 02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.23 25-Oct-2003  christos Fix uninitialized variable warnings
 1.22 01-Jan-2003  thorpej branches: 1.22.2;
Use aprint_normal() in cfprint routines.
 1.21 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.20 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.19 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.18 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.17 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.16 15-Nov-2001  lukem branches: 1.16.8;
don't need <sys/types.h> when including <sys/param.h>
 1.15 13-Nov-2001  lukem add RCSID
 1.14 27-Mar-2001  haya branches: 1.14.2;
Cosmetic changes.
 1.13 12-Feb-2001  nathanw branches: 1.13.2;
The card_attach_now flag hasn't been necessary or useful for some time.
Garbage collect the code and corresponding documentation.
 1.12 28-Jan-2001  nathanw Minor grammar/spelling fixes in comments.
 1.11 02-Jul-2000  cgd nuke some final __BROKEN_INDIRECT_CONFIG bits that weren't caught by
unifdef last time. (bloody things just won't stay dead!)
 1.10 16-Jun-2000  cgd beat back the undead: __BROKEN_INDIRECT_CONFIG had risen, and was
terrorizing innocent hackers...
 1.9 22-Mar-2000  haya branches: 1.9.2;
1. Do not apply 5 V on a CardBus card.
2. Do not avoid ISA hole when a device requires more than
256-byte io space.
3. Remove sending CardBus bridge's function number to
cardbus stack. This number is not needed for anyone.
 1.8 31-Jan-2000  haya Force power off when a CardBus card is detached.
Use tsleep when kernel thread works.
 1.7 26-Jan-2000  haya Add cardbus detach functionality. Add a function
cardbus_detach_card() in cardbus.c and enable detach code in cardslot.c
 1.6 24-Jan-2000  thorpej Use config_pending. Addresses kern/9247.
 1.5 15-Nov-1999  haya branches: 1.5.2;
Handle insertion and removal events more strictly.
 1.4 29-Oct-1999  haya Change cardbus messages when cardbus does not configured.
 1.3 27-Oct-1999  haya Use opt_cardbus.h for cardbus.c and opt_cardslot.h for cardslot.c.
Remove unnecessary include from cardbus.c.
 1.2 15-Oct-1999  haya branches: 1.2.2; 1.2.4;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.2.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.6 03-Jan-2003  thorpej Sync with HEAD.
 1.13.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.13.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.13.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.13.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.14.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.14.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.8.1 20-Jun-2002  gehenna catch up with -current.
 1.22.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.6.1 12-Feb-2005  yamt sync with head.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.26.6.7 21-Jan-2008  yamt sync with head
 1.26.6.6 07-Dec-2007  yamt sync with head
 1.26.6.5 27-Oct-2007  yamt sync with head.
 1.26.6.4 03-Sep-2007  yamt sync with head.
 1.26.6.3 26-Feb-2007  yamt sync with head.
 1.26.6.2 30-Dec-2006  yamt sync with head.
 1.26.6.1 21-Jun-2006  yamt sync with head.
 1.28.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.28.10.1 19-Apr-2006  elad sync with head.
 1.28.8.1 01-Apr-2006  yamt sync with head.
 1.28.6.1 22-Apr-2006  simonb Sync with head.
 1.28.4.1 09-Sep-2006  rpaulo sync with head
 1.31.10.2 10-Dec-2006  yamt sync with head.
 1.31.10.1 22-Oct-2006  yamt sync with head
 1.31.8.2 09-Feb-2007  ad Sync with HEAD.
 1.31.8.1 18-Nov-2006  ad Sync with head.
 1.34.8.1 11-Jul-2007  mjf Sync with head.
 1.34.6.4 23-Oct-2007  ad Sync with head.
 1.34.6.3 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.34.6.2 10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.34.6.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.35.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.35.8.2 09-Jan-2008  matt sync with HEAD
 1.35.8.1 06-Nov-2007  matt sync with HEAD
 1.35.6.4 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.35.6.3 01-Dec-2007  jmcneill Sync with HEAD.
 1.35.6.2 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.35.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.36.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.36.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.37.4.1 11-Dec-2007  yamt sync with head.
 1.37.2.1 26-Dec-2007  ad Sync with head.
 1.38.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.39.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.39.6.3 02-Jul-2008  mjf Sync with HEAD.
 1.39.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.39.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.40.8.3 18-Jul-2008  simonb Sync with head.
 1.40.8.2 03-Jul-2008  simonb Sync with head.
 1.40.8.1 27-Jun-2008  simonb Sync with head.
 1.40.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.40.4.5 11-Aug-2010  yamt sync with head.
 1.40.4.4 11-Mar-2010  yamt sync with head
 1.40.4.3 20-Jun-2009  yamt sync with head
 1.40.4.2 16-May-2009  yamt sync with head
 1.40.4.1 04-May-2009  yamt sync with head.
 1.45.10.2 23-Jul-2009  jym Sync with HEAD.
 1.45.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.45.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.51.4.2 31-May-2011  rmind sync with head
 1.51.4.1 30-May-2010  rmind sync with head
 1.51.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.53.14.3 03-Dec-2017  jdolecek update from HEAD
 1.53.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.53.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.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.53.4.1 30-Oct-2012  yamt sync with head
 1.54.2.1 18-May-2014  rmind sync with head
 1.55.10.1 04-Nov-2016  pgoyette Sync with HEAD
 1.55.6.1 05-Oct-2016  skrll Sync with HEAD
 1.57.4.3 17-Apr-2021  thorpej Sync with HEAD.
 1.57.4.2 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.57.4.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.59.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.17 17-Apr-2021  mrg convert cardslot event thread from wakeup/tsleep to mutex/condvar.
this avoids a strange hang at reboot i am seeing on an old pentium4-m
laptop, that was introduced with kern_mutex.c 1.91/92, though i can
not really explain why that matters (in the waiting thread, a pointer
that should be NULL remains non NULL.) thanks to jmcneill@ for some
helpful review commentary here.

don't panic() if either "cardbus" or "pcmcia" didn't attach and a
card is inserted. this can happen for various reasons, including
some regression in netbsd (-current, and -9, at least) that suggests
using PCI_BUS_FIXUP (though it still fails to attach the card i have.)

both found with GCC 10 testing, though both also occur with GCC 7 in
the netbsd-9 tree as well.
 1.16 15-Dec-2009  snj branches: 1.16.80;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.15 03-Jul-2008  drochner minor cleanup so that it can cope with a futute split pcmcia device/softc
 1.14 25-Jun-2008  drochner Avoid the use of i82365var.h - we don't use any functions from there.
Extract some data structures for ressource management into our private
header instead. This allows to use a typed pointer instead of a
generic one which saves a lot of typecasts.
Also remove something marked as "dirty hack" which I admittedly don't
understand, but it doesn't look useful...
 1.13 25-Jun-2008  drochner split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
 1.12 24-Jun-2008  drochner clean up some useless code and variables in cardbus attachment
 1.11 09-Jul-2007  ad branches: 1.11.28; 1.11.32; 1.11.34; 1.11.36;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.10 11-Dec-2005  christos branches: 1.10.30; 1.10.32;
merge ktrace-lwp.
 1.9 04-Feb-2005  perry branches: 1.9.6;
de-__P
 1.8 13-Sep-2004  drochner branches: 1.8.4; 1.8.6;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.7 08-Jul-2003  itojun function prototype must not have variable name
 1.6 30-May-2001  haya branches: 1.6.22;
Cosmetic change.
 1.5 13-Mar-2000  soren branches: 1.5.6;
Fix doubled 'the's in comments.
 1.4 15-Dec-1999  kleink branches: 1.4.2;
Normalize symbol names used for multiple inclusion protection.
 1.3 15-Nov-1999  haya Handle insertion and removal events more strictly.
 1.2 15-Oct-1999  haya branches: 1.2.2;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.22.4 04-Feb-2005  skrll Sync with HEAD.
 1.6.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.22.1 03-Aug-2004  skrll Sync with HEAD
 1.8.6.1 12-Feb-2005  yamt sync with head.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.9.6.1 03-Sep-2007  yamt sync with head.
 1.10.32.1 11-Jul-2007  mjf Sync with head.
 1.10.30.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.11.36.2 18-Jul-2008  simonb Sync with head.
 1.11.36.1 27-Jun-2008  simonb Sync with head.
 1.11.34.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.11.32.2 11-Mar-2010  yamt sync with head
 1.11.32.1 04-May-2009  yamt sync with head.
 1.11.28.2 28-Sep-2008  mjf Sync with HEAD.
 1.11.28.1 29-Jun-2008  mjf Sync with HEAD.
 1.16.80.1 17-Apr-2021  thorpej Sync with HEAD.
 1.31 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.30 01-Aug-2011  drochner branches: 1.30.52; 1.30.54;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.29 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.28 26-Feb-2010  dyoung branches: 1.28.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.27 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.26 25-Feb-2010  dyoung Don't use the cardbus_softc. Compile-tested, only.
 1.25 25-Feb-2010  dyoung Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args. Compile-tested, only.
 1.24 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.23 12-Nov-2009  dyoung branches: 1.23.2;
Don't use com_activate(), it's going away.
 1.22 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.21 14-Mar-2008  cube branches: 1.21.4; 1.21.6; 1.21.8;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.20 16-Nov-2006  christos branches: 1.20.24; 1.20.44; 1.20.48;
__unused removal on arguments; approved by core.
 1.19 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18 13-Jul-2006  gdamore branches: 1.18.4; 1.18.6;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.17 29-Mar-2006  thorpej branches: 1.17.4;
Use device_private().
 1.16 25-Mar-2006  thorpej Use device_parent().CVS: ----------------------------------------------------------------------
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6; 1.15.8; 1.15.10; 1.15.12;
merge ktrace-lwp.
 1.14 27-Feb-2005  perry branches: 1.14.4;
nuke trailing whitespace
 1.13 02-Aug-2004  mycroft branches: 1.13.4; 1.13.6;
cardbusdevs -> pcidevs
 1.12 22-Jul-2004  mycroft Add 3C656 modem portion, per PR 23710.
 1.11 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.10 11-Mar-2004  kanaoka branches: 1.10.2;
- Add (missed)"csc->cc_ih = NULL;" in com_cardbus_disable().
- Check "csc->cc_ih != NULL" before cardbus_intr_disestablish()
in com_cardbus_detach().

This fixed panic when the card removed.
The card is a "Xircom RealPort Cardbus Ethernet 10/100+Modem 56".

Reported & Tested by Peter Postma <peter.postma@chello.nl>
on current-users.
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Add trailing ; to CFATTACH_DECL.
 1.8 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 13-Nov-2001  lukem add RCSID
 1.5 22-Aug-2000  joda branches: 1.5.2; 1.5.4; 1.5.6;
update description
 1.4 17-Apr-2000  joda rewrite match function to use CIS information
 1.3 15-Apr-2000  veego Also add the Intel ID for the LAN+MODEM56 card to the csdevs list to get
it working.
 1.2 13-Apr-2000  joda disable function after attach
 1.1 13-Apr-2000  joda cardbus attachment for com devices (thanks to Chris Demetriou and
Darren Reed for constructive criticism and help with testing)
 1.5.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 22-Aug-2000  bouyer file com_cardbus.c was added on branch thorpej_scsipi on 2000-11-20 11:39:53 +0000
 1.9.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.2.1 23-Jul-2004  he Pull up revision 1.28 (requested by mycroft in ticket #691):
Add 3c656 entries in order to support modem portion. Fixes PR#23710.
 1.13.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.14.4.3 17-Mar-2008  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.1 21-Jun-2006  yamt sync with head.
 1.15.12.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.15.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.15.10.1 19-Apr-2006  elad sync with head.
 1.15.8.2 11-Aug-2006  yamt sync with head
 1.15.8.1 01-Apr-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.17.4.4 17-Jun-2006  gdamore Undo the undo. Restore COM_INIT_REGS.
 1.17.4.3 17-Jun-2006  gdamore Revert COM_INIT_REGS.
 1.17.4.2 16-Jun-2006  gdamore Remove pointless redundant assignment and fix KNF.
 1.17.4.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.18.6.2 10-Dec-2006  yamt sync with head.
 1.18.6.1 22-Oct-2006  yamt sync with head
 1.18.4.1 18-Nov-2006  ad Sync with head.
 1.20.48.2 29-Jun-2008  mjf Sync with HEAD.
 1.20.48.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.44.1 24-Mar-2008  keiichi sync with head.
 1.20.24.1 23-Mar-2008  matt sync with HEAD
 1.21.8.1 27-Jun-2008  simonb Sync with head.
 1.21.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.4.3 11-Aug-2010  yamt sync with head.
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 04-May-2009  yamt sync with head.
 1.23.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.2.1 30-May-2010  rmind sync with head
 1.30.54.1 10-Jun-2019  christos Sync with HEAD
 1.30.52.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 04-Mar-2005  mycroft Not used any more.
 1.4 15-Dec-2003  jmc branches: 1.4.8; 1.4.10;
Fixes from PR#23177. Various lint/logic fixes:
Fix some non-initialized variables
close the output files when done
Redo the printing for RCS strings so they don't expand in the awk script too
Do proper tests for variables existance before accessing

Verified output from all scripts is identical to original versions
 1.3 24-Oct-2003  mycroft Fix awk warnings.
 1.2 07-Feb-2001  haya branches: 1.2.24;
Add code to insert struct definition in cardbusdevs_data.h to make
it correct C code.
 1.1 15-Oct-1999  haya branches: 1.1.2; 1.1.8;
This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.1.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.2.1 11-Feb-2001  bouyer Sync with HEAD.
 1.2.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.39 31-Mar-2025  riastradh ehci(4): Make usb_*_rem work as noop on zero-initialized input.

This way, if some *hci_attach function fails before usb_*_add, the
caller need not maintain boolean state to decide whether to call
usb_*_rem on detach -- it'll just work without extra effort.

Cleanup in preparation for:

PR port-amd64/59180: System reboots instead of shutting down
 1.38 31-Mar-2025  riastradh ehci(4): Sprinkle KERNEL_LOCKED_P and KNF on usb_*_add/rem.

Mark with XXXSMP comments to be fixed later without the kernel lock.

No functional change intended: callers generally do this from
autoconf *_attach/detach routines, which run kernel-locked anyway
(for the moment).

Cleanup in preparation for:

PR port-amd64/59180: System reboots instead of shutting down
 1.37 07-Aug-2021  thorpej branches: 1.37.12;
Merge thorpej-cfargs2.
 1.36 24-Apr-2021  thorpej branches: 1.36.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.35 09-Apr-2018  jakllsch branches: 1.35.18;
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.34 14-Jul-2016  msaitoh branches: 1.34.16;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.33 23-Apr-2016  skrll 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.32 21-Sep-2014  christos branches: 1.32.2;
remove more old pci_findvendor code
 1.31 01-Aug-2011  drochner branches: 1.31.12; 1.31.28; 1.31.32;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.30 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.29 24-May-2010  pgoyette Update all callers of the pci_find{vendor,product} routines to now call
these routines through their global pointers.
 1.28 10-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.
 1.27 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.26 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.25 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.24 08-Jan-2010  dyoung branches: 1.24.2;
Expand PMF_FN_* macros.
 1.23 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.22 24-Jun-2008  drochner branches: 1.22.10;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.21 28-Apr-2008  martin branches: 1.21.2; 1.21.4;
Remove clause 3 and 4 from TNF licenses
 1.20 09-Apr-2008  skd branches: 1.20.2; 1.20.4;
Fix small error in device/sc splitup.
 1.19 28-Mar-2008  drochner 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.18 07-Mar-2008  dyoung Use device_t and accessors. Setup power management in the PCI
front-end (XXX needs to look more alike the Cardbus front-end).
Establish the shutdown hook using PMF.
 1.17 19-Oct-2007  ad branches: 1.17.12; 1.17.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.16 16-Nov-2006  christos branches: 1.16.8; 1.16.18; 1.16.24; 1.16.26; 1.16.30;
__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 29-Mar-2006  thorpej branches: 1.14.8; 1.14.10;
Use device_private().
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 02-Aug-2004  mycroft branches: 1.10.4; 1.10.6;
cardbusdevs -> pcidevs
 1.9 02-Aug-2004  mycroft Adapt to pci_findvendor() change.
 1.8 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.7 22-Apr-2004  itojun sprintf -> snprintf
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 13-Nov-2001  lukem branches: 1.3.2; 1.3.4;
add RCSID
 1.2 10-Nov-2001  augustss branches: 1.2.2;
Fill the companion controller array.
 1.1 06-Nov-2001  augustss ehci can attach to cardbus too.
 1.2.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.2.1 10-Nov-2001  thorpej file ehci_cardbus.c was added on branch thorpej-mips-cache on 2001-11-12 21:17:58 +0000
 1.3.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 13-Nov-2001  thorpej file ehci_cardbus.c was added on branch kqueue on 2002-01-10 19:53:45 +0000
 1.3.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 13-Nov-2001  nathanw file ehci_cardbus.c was added on branch nathanw_sa on 2001-11-14 19:14:01 +0000
 1.6.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.4.4 17-Mar-2008  yamt sync with head.
 1.11.4.3 27-Oct-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 19-Apr-2006  elad sync with head.
 1.13.8.1 01-Apr-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.14.10.2 10-Dec-2006  yamt sync with head.
 1.14.10.1 22-Oct-2006  yamt sync with head
 1.14.8.1 18-Nov-2006  ad Sync with head.
 1.16.30.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.26.2 23-Mar-2008  matt sync with HEAD
 1.16.26.1 06-Nov-2007  matt sync with HEAD
 1.16.24.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.16.18.1 22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.16.8.1 23-Oct-2007  ad Sync with head.
 1.17.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.17.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.17.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.12.1 24-Mar-2008  keiichi sync with head.
 1.20.4.4 11-Mar-2010  yamt sync with head
 1.20.4.3 16-May-2009  yamt sync with head
 1.20.4.2 04-May-2009  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.21.4.1 27-Jun-2008  simonb Sync with head.
 1.21.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.22.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.32.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.31.28.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.31.12.1 03-Dec-2017  jdolecek update from HEAD
 1.32.2.4 05-Oct-2016  skrll Sync with HEAD
 1.32.2.3 05-Dec-2014  skrll Use int for return type for [eou]chi_init and motg_init.
 1.32.2.2 05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.32.2.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.34.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.35.18.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.36.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.37.12.1 02-Aug-2025  perseant Sync with HEAD
 1.39 14-Dec-2018  jakllsch add cardbus attachment for malo(4), from OpenBSD
 1.38 30-Mar-2013  christos branches: 1.38.34; 1.38.36;
patches for new wifi devices.
 1.37 08-Apr-2012  christos branches: 1.37.2;
PR/46310: Ryo ONODERA: Add support for cardbus bwi(4)
 1.36 27-Mar-2010  nonaka branches: 1.36.8; 1.36.12;
Added sdhc at cardbus support.
 1.35 19-Jul-2009  kiyohara branches: 1.35.2; 1.35.4;
Support siisata@cardbus.
It tested on amd64 and i386 only.
 1.34 07-Sep-2006  itohy branches: 1.34.56; 1.34.72;
Workbit NinjaATA-32 busmastering PIO IDE controller driver (njata)

This driver supports NinjaATA-32Bi and NPATA-32 chips,
which are used for CardBus ATA interface cards and
CardBus CompactFlash adapters.
 1.33 06-Jun-2006  rpaulo Attachment framework for the rt2561.c and rt2661.c drivers.

From OpenBSD.
 1.32 11-Dec-2005  christos branches: 1.32.4; 1.32.6; 1.32.8; 1.32.14;
merge ktrace-lwp.
 1.31 25-Oct-2005  drochner finally nuke the useless cardbus "dev" locator
 1.30 24-Jul-2005  augustss branches: 1.30.2;
Add file for 'uhci at cardbus'. From FUKAUMI Naoki in kern/30814.
 1.29 01-Jul-2005  drochner branches: 1.29.2;
add autoconf glue for the ralink wireless drivers, basically from
PR kern/30449, but changed so that pci/cardbus and usb devices
are all called "ral" to the user, so that code can be shared eventually
 1.28 12-May-2005  augustss Make the Adaptec 1480 cardbus Slim SCSI card work.
From a person wishing to remain anonymous.
 1.27 29-Jan-2005  jonathan Remove duplicate stanza for re(4) at cardbus. When I added an entry
here and enabled it in i386 GENERIC_LAPTOP, I missed that yamt@ had
already added an entry here.
 1.26 29-Jan-2005  jonathan Now that we've switched to the split re(4) for PCI, add the cardbus
frontend for the split re(4) to files.cardbus, and to the generic x86
laptop config (sys/i386/conf/GENERIC_LAPTOP).

NB: as best I know, there are still unresolved issues in attach and
powersave, with the NetGear cardbus cards and re(4).
 1.25 21-Jan-2005  yamt branches: 1.25.2;
- switch to dev/rtl8169.c from pci/if_re.c.
- enable re@cardbus.
both of re@pci and re@cardbus seem to work for me.
 1.24 26-Sep-2004  dyoung branches: 1.24.4;
Add rtw(4).
 1.23 26-Aug-2004  itohy Workbit NinjaSCSI-32 PCI/CardBus SCSI driver (njs)
 1.22 13-Feb-2004  wiz branches: 1.22.2;
RealTek -> Realtek.
 1.21 14-Oct-2003  ichiro add support ath on cardbus
- implement power management
 1.20 06-Jul-2003  dyoung Add driver atw for PCI/Mini-PCI/Cardbus 802.11b NICs based on the
ADMtek ADM8211. Read the man page for bugs and other outstanding
issues.
 1.19 11-Mar-2003  drochner branches: 1.19.2;
make a kernel with the combination ohci@cardbus + ehci@pci link
 1.18 28-Nov-2001  lukem branches: 1.18.10;
- convert usage of "defopt" to "defflag" where the relevant option does
not support a value (e.g., it's to be used as "options FOO" instead of
"options FOO=xxx"). options that take a value were converted to
defparam recently.
- minor whitespace & formatting cleanups
 1.17 06-Nov-2001  augustss ehci can attach to cardbus too.
 1.16 06-Jul-2001  mcr branches: 1.16.2; 1.16.6;
cardbus attachment for PCI-PCI bridges
 1.15 09-May-2001  augustss Add FireWire OHCI controller on Cardbus.
 1.14 08-Mar-2001  thorpej Config glue for the CardBus front-end for the Advansys SCSI driver.
kern/12431, takashi.yamamoto@bigfoot.com.
 1.13 24-Feb-2001  lukem branches: 1.13.2;
whitespace police
 1.12 10-May-2000  haya Move if_rl_cardbus.c:1.8 to if_rtk_cardbus.c.
 1.11 19-Apr-2000  haya Changes the name of RealTek driver. The new name is `rtk'. This used
to be called `rl' and it conflict with RL vax disks, canonical and
historical unix driver name.

This changes are minimal: it only changes the name of RealTek driver.
The filename of source code and a lot of the letter `rl' in source
files should be changed shortly.
 1.10 13-Apr-2000  joda enable com at cardbus
 1.9 10-Apr-2000  haya Incorporate the changes of RL81x9 driver provided by M. Kanaoka
<kanaoka@ann.hi-ho.ne.jp>. He separated the driver into IC specific
portion and bus attachment portion and added cardbus attachent.
 1.8 26-Jan-2000  thorpej First attempt at a CardBus front-end for the `ahc' driver. This will
support the Adaptec ADP-1480 CardBus SCSI cards, which are a stright
AIC-7860 implementation.
 1.7 19-Nov-1999  thorpej branches: 1.7.2;
Add a basic CardBus front-end for the `tlp' driver. Still more work to do.
 1.6 31-Oct-1999  joda uncomment fxp_cardbus
 1.5 29-Oct-1999  joda add cardbus_exrom.c to cardbus device
 1.4 27-Oct-1999  haya Use opt_cardbus.h for cardbus.c and opt_cardslot.h for cardslot.c.
Remove unnecessary include from cardbus.c.
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Add USB OHCI attachment to cardbus.
XXX There seems to be some interrupt problem.
 1.2 15-Oct-1999  haya add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.13.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.13.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.10.1 11-Nov-2004  he Pull up revision 1.23 (via patch, requested by itohy in ticket #1741):
Add support for the Workbit NinjaSCSI-32 PCI/Cardbus
SCSI driver, njs(4).
 1.19.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.19.2.6 24-Jan-2005  skrll Sync with HEAD.
 1.19.2.5 19-Oct-2004  skrll Sync with HEAD
 1.19.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.2 03-Sep-2004  skrll Sync with HEAD
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.2.1 30-Aug-2004  tron Pull up revision 1.23 (requested by itohy in ticket #800):
Workbit NinjaSCSI-32 PCI/CardBus SCSI driver (njs)
 1.24.4.1 29-Apr-2005  kent sync with -current
 1.25.2.1 12-Feb-2005  yamt sync with head.
 1.29.2.2 30-Dec-2006  yamt sync with head.
 1.29.2.1 21-Jun-2006  yamt sync with head.
 1.30.2.1 26-Oct-2005  yamt sync with head
 1.32.14.1 19-Jun-2006  chap Sync with head.
 1.32.8.2 14-Sep-2006  yamt sync with head.
 1.32.8.1 26-Jun-2006  yamt sync with head.
 1.32.6.1 07-Jun-2006  kardel Sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.34.72.1 23-Jul-2009  jym Sync with HEAD.
 1.34.56.2 11-Aug-2010  yamt sync with head.
 1.34.56.1 19-Aug-2009  yamt sync with head.
 1.35.4.1 30-May-2010  rmind sync with head
 1.35.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.12.1 29-Apr-2012  mrg sync to latest -current.
 1.36.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.8.1 17-Apr-2012  yamt sync with head
 1.37.2.1 23-Jun-2013  tls resync from head
 1.38.36.1 10-Jun-2019  christos Sync with HEAD
 1.38.34.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.37 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.36 14-Jul-2016  msaitoh branches: 1.36.36;
KNF. No functional change.
 1.35 04-Aug-2012  riastradh branches: 1.35.2; 1.35.16;
Fix error branches and config pending races in firewire init.

This way, if anything fails, it just fails; you don't panic. This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
 1.34 01-Aug-2011  drochner branches: 1.34.2;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.33 19-Apr-2010  kiyohara Not necessary '\n'.
 1.32 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.31 05-Mar-2010  dyoung branches: 1.31.2;
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Make a few changes of this kind:

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

Tested by plugging a Syba CardBus to FireWire adapter into an HP
Pavilion N3270, adding an address (169.254.0.7/16) to fwip0, attaching
and pinging a MacBook Pro.
 1.30 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.29 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.28 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.27 12-May-2009  cegger branches: 1.27.2;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.26 11-Jul-2008  kiyohara branches: 1.26.8;
Apply changes missed in "cardbus interrupt stuff cleanup" by drochner@:
http://mail-index.netbsd.org/source-changes/2008/06/24/msg207339.html
 1.25 26-Jun-2008  kiyohara branches: 1.25.2;
Fix split device_t/softc.
And reorder.
 1.24 28-Apr-2008  martin branches: 1.24.2; 1.24.4;
Remove clause 3 and 4 from TNF licenses
 1.23 29-Mar-2008  kiyohara branches: 1.23.2; 1.23.4;
Sorry forgot.
Split device_t/softc, and cosmetic change.
 1.22 29-Mar-2008  ad Make it compile again.
 1.21 06-Nov-2007  kiyohara branches: 1.21.14;
The argument of *_intr_establish() is changed to fwohci_flit.
Our ieee1394 coordinates from FreeBSD implementation.
Add fwohci_pci_shutdown() and fwohci_pci_power().
Move __KERNEL_RCSID to ahead.
 1.20 19-Oct-2007  ad branches: 1.20.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 29-Sep-2007  kiyohara branches: 1.19.2;
We must not call bus_space_unmap() here.
 1.18 16-Nov-2006  christos branches: 1.18.8; 1.18.22; 1.18.24; 1.18.26;
__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 29-Mar-2006  thorpej branches: 1.16.8; 1.16.10;
Use device_private().
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6; 1.15.8; 1.15.10; 1.15.12;
merge ktrace-lwp.
 1.14 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.13 27-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 02-Aug-2004  mycroft branches: 1.12.4; 1.12.6;
cardbusdevs -> pcidevs
 1.11 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.10 22-Mar-2003  nakayama branches: 1.10.2;
Make it compile in big endian.
 1.9 05-Dec-2002  ichiro make compile
 1.8 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.7 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 26-Jan-2002  ichiro OCHI -> OHCI
 1.4 29-Dec-2001  ichiro implement fwohci detach routine.
 1.3 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.2 13-Nov-2001  lukem add RCSID
 1.1 09-May-2001  augustss branches: 1.1.2; 1.1.4;
Add FireWire OHCI controller on Cardbus.
 1.1.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 09-May-2001  nathanw file fwohci_cardbus.c was added on branch nathanw_sa on 2001-06-21 20:01:25 +0000
 1.10.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.13.4.4 15-Nov-2007  yamt sync with head.
 1.13.4.3 27-Oct-2007  yamt sync with head.
 1.13.4.2 30-Dec-2006  yamt sync with head.
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.15.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.15.10.1 19-Apr-2006  elad sync with head.
 1.15.8.1 01-Apr-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.16.10.2 10-Dec-2006  yamt sync with head.
 1.16.10.1 22-Oct-2006  yamt sync with head
 1.16.8.1 18-Nov-2006  ad Sync with head.
 1.18.26.1 06-Oct-2007  yamt sync with head.
 1.18.24.2 08-Nov-2007  matt sync with -HEAD
 1.18.24.1 06-Nov-2007  matt sync with HEAD
 1.18.22.3 06-Nov-2007  joerg Sync with HEAD.
 1.18.22.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.18.22.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.8.2 23-Oct-2007  ad Sync with head.
 1.18.8.1 09-Oct-2007  ad Sync with head.
 1.19.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.19.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.21.14.4 28-Sep-2008  mjf Sync with HEAD.
 1.21.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.21.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.21.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.4.5 11-Aug-2010  yamt sync with head.
 1.23.4.4 11-Mar-2010  yamt sync with head
 1.23.4.3 16-May-2009  yamt sync with head
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.4.2 18-Jul-2008  simonb Sync with head.
 1.24.4.1 27-Jun-2008  simonb Sync with head.
 1.24.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.2.1 19-Oct-2008  haad Sync with HEAD.
 1.26.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.1 30-May-2010  rmind sync with head
 1.34.2.1 30-Oct-2012  yamt sync with head
 1.35.16.1 05-Oct-2016  skrll Sync with HEAD
 1.35.2.1 03-Dec-2017  jdolecek update from HEAD
 1.36.36.1 01-Aug-2021  thorpej Sync with HEAD.
 1.46 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.45 07-Oct-2011  dyoung Stop calling ATH_LOCK_{INIT,DESTROY}(), they don't exist any more.
 1.44 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.43 26-Jul-2011  dyoung Replace anonymous constants, 0x10, 0x14, ..., with PCI_BAR(0),
PCI_BAR(1), .... There was no change in the generated assembly. I used
this semantic patch:

@ mapsit @
identifier bar;
expression pact;
@@

(
pci_mapreg_map
|
Cardbus_mapreg_map
)(pact, bar, ...)

@ depends on mapsit @
identifier mapsit.bar;
@@
(
- #define bar 0x10
+ #define bar PCI_BAR(0)
|
- #define bar 0x14
+ #define bar PCI_BAR(1)
|
- #define bar 0x18
+ #define bar PCI_BAR(2)
|
- #define bar 0x1C
+ #define bar PCI_BAR(3)
|
- #define bar 0x20
+ #define bar PCI_BAR(4)
)
 1.42 04-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.
 1.41 02-Mar-2010  dyoung Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested with ath & atw units on a Soekris net4521.
 1.40 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.39 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.38 18-Jan-2010  pooka branches: 1.38.2;
Remove conditional inclusion of unused bpf.h
 1.37 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.36 21-Oct-2009  rmind Drop 3rd and 4th clauses from Ichiro FUKUHARA's license.
Reviewed and approved by ichiro@ (copyright holder).
 1.35 16-Sep-2009  dyoung In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together. Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
#include it from <sys/pmf.h> instead of <sys/device.h> to break the
circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
suspend/resume call. Start to replace instances of PMF_FN_PROTO,
PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
device in suspension. More than one suspensor may hold a device
at once. A device stays suspended as long as at least one
suspensor holds it. A device resumes when the last suspensor
releases it.

Currently, the kernel defines three suspensors,

3a the system-suspensor: for system suspension, initiated
by 'sysctl -w machdep.sleep_state=3', by lid closure, by
power-button press, et cetera,

3b the drvctl-suspensor: for device suspension by /dev/drvctl
ioctl, e.g., drvctl -S sip0.

3c the system self-suspensor: for device drivers that suspend
themselves and their children. Several drivers for network
interfaces put the network device to sleep while it is not
administratively up, that is, after the kernel calls if_stop(,
1). The self-suspensor should not be used directly. See
the description of suspensor delegates, below.

A suspensor can have one or more "delegates". A suspensor can
release devices that its delegates hold suspended. Right now,
only the system self-suspensor has delegates. For each device
that a self-suspending driver attaches, it creates the device's
self-suspensor, a delegate of the system self-suspensor.

Suspensors stop a system-wide suspend/resume cycle from waking
devices that the operator put to sleep with drvctl before the cycle.
They also help self-suspension to work more simply, safely, and in
accord with expectations.

4. Add the notion of device activation level, devact_level_t,
and a routine for checking the current activation level,
device_activation(). Current activation levels are DEVACT_LEVEL_BUS,
DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
indicate that the device's bus is active, that the bus and device are
active, and that the bus, device, and the functions of the device's
class (network, audio) are active.

Suspend/resume calls can be qualified with a devact_level_t.
The power-management framework treats a devact_level_t that
qualifies a device suspension as the device's current activation
level; it only runs hooks to reduce the activation level from
the presumed current level to the fully suspended state. The
framework treats a devact_level_t qualifying device resumption
as the target activation level; it only runs hooks to raise the
activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
drivers.

6. Temporarily add an unused power-management workqueue that I will
remove or replace, soon.
 1.34 05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.33 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.32 11-Dec-2008  alc branches: 1.32.2;
Sync ath(4) with the new HAL, mostly based on <jmcneill>'s patches.

Everything should be fine again !
 1.31 10-Jul-2008  cegger branches: 1.31.2; 1.31.4; 1.31.10;
make this compile with DIAGNOSTIC
 1.30 09-Jul-2008  joerg - device/softc split for ath(4)
 1.29 24-Jun-2008  drochner branches: 1.29.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.28 11-Jun-2008  dyoung Remove code that is redundant with cardbus_child_resume(), which
restores PCI configuration space and restores the power state to
D0.
 1.27 06-Apr-2008  cegger branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
use aprint_*_dev and device_xname
 1.26 12-Mar-2008  dyoung Use device_t and its accessors throughout. Use aprint_*_dev().

Improve PMF-ability.

Add a 'flags' argument to suspend/resume handlers and
callers such as pmf_system_suspend().

Define a flag, PMF_F_SELF, which indicates to PMF that a
device is suspending/resuming itself. Add helper routines,
pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
that call pmf_device_suspend(dev, PMF_F_SELF) and
pmf_device_resume(dev, PMF_F_SELF), respectively. Use
PMF_F_SELF to suspend/resume self in ath(4), audio(4),
rtw(4), and sip(4).

In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
callbacks, provided by the bus front-end, with
self-suspension/resumption. Also, clean up the bus
front-ends. Make sure that the interrupt handler is
disestablished during suspension. Get rid of driver-private
flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
device_is_active()/device_has_power() calls, instead.

In the network-class suspend handler, call if_stop(, 0)
instead of if_stop(, 1), because the latter is superfluous
(bus- and driver-suspension hooks will 'disable' the NIC),
and it may cause recursion.

In the network-class resume handler, prevent infinite
recursion through if_init() by getting out early if we are
self-suspending (PMF_F_SELF).

rtw(4) improvements:

Destroy rtw(4) callouts when we detach it. Make rtw at
pci detachable. Print some more information with the "rx
frame too long" warning.

Remove activate() methods:

Get rid of rtw_activate() and ath_activate(). The device
activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

Introduce a boolean device property, "pmf-powerdown". If
pmf-powerdown is present and false, it indicates that a
bus back-end should not remove power from a device.

Honor this property in cardbus_child_suspend().

Set this property to 'false' in ath_attach(), since removing
power from an ath at cardbus seems to lobotomize the WPA
crypto engine. XXX Should the pmf-powerdown property
propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

Warn if ath(4) tries to write crypto keys to suspended
hardware.

Reduce differences between FreeBSD and NetBSD in ath(4)
multicast filter setup.

Make ath_printrxbuf() print an rx descriptor's status &
key index, to help debug crypto errors.

Shorten a staircase in ath_ioctl(). Don't check for
ieee80211_ioctl() return code ERESTART, it never happens.
 1.25 22-Dec-2007  dyoung branches: 1.25.2; 1.25.6;
It makes practically no functional difference, but add curly braces
where they were intended.
 1.24 21-Dec-2007  dyoung Initialize and destroy the ATH_LOCK.
 1.23 14-Dec-2007  dyoung Oops, make last change compile.
 1.22 14-Dec-2007  dyoung Comment-out calls to pci_disable_retry() and cardbus_disable_retry().
They do not seem well-justified according to anyone's understanding
of what they really do, and it seems especially inappropriate to
call them at attach- and resume-time.
 1.21 09-Dec-2007  jmcneill branches: 1.21.2;
Merge jmcneill-pm branch.
 1.20 21-Nov-2007  dyoung branches: 1.20.2; 1.20.4;
Detect cardbus_setpowerstate() errors and aprint_debug() a warning.

Leave alone the Latency Timer set by the Cardbus bridge.

With version 1.152 of dev/pci/pccbb.c, we can power down the card
when it is not in-use, so do that.
 1.19 19-Oct-2007  ad branches: 1.19.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.18 16-Nov-2006  christos branches: 1.18.8; 1.18.22; 1.18.24; 1.18.28;
__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 07-Sep-2006  dogcow branches: 1.16.2; 1.16.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.15 14-Jul-2006  seanb Consistently establish / disestablish shutdown hook
in the bus layer and remove from common ath_attach().
Having it in both layers (on some bus architectures)
was causing a double call to ath_stop() on shutdown
which in turn was tickling the bus lockup described
therin on slower machines.
 1.14 07-Jun-2006  nakayama Make it compile on sparc64.
 1.13 05-Jun-2006  gdamore Import new HAL 0.9.17.2. Approved by sam@

New HAL includes some driver changes to register accesses.
Adds support for WLAN devices on AR5312 family devices.
Adds support 32-bit SPARC ath devices (untested).
ath enabled in SPARC64 GENERIC builds.
This HAL is tested and known to work for i386 PCI devices, SPARC64 PCI devices,
and AR5312 WiSoC devices. MIPS PCI devices appear to be busted (possibly only
on Alchemy hardware, unconfirmed), and cardbus support is untested due to
lack of test hardware.

Please report any new problems with this import to garrett@.
 1.12 14-May-2006  elad branches: 1.12.2;
integrate kauth.
 1.11 02-Apr-2006  gdamore Reorganize ath layout as requested by sam@ and suggested by dyoung@ in
http://mail-index.netbsd.org/tech-net/2006/03/15/0000.html.

The new layout almost precisely matches FreeBSD, and should make
future imports much easier.

At the same time, import the current 0.9.16.16 HAL from FreeBSD. According
to sam@, this is the proper version we should be using.
 1.10 29-Mar-2006  thorpej Use device_private().
 1.9 02-Mar-2006  dyoung branches: 1.9.2; 1.9.4; 1.9.6;
Stop-gap solution to Atheros Cardbus cards losing (crypto?) hardware
state: after the device attaches, do not ever remove power from
the cardslot. Without this patch, ath@cardbus does not work reliably
in WPA/WPA2 networks.

XXX A better solution is to restore the hardware state that gets
XXX scrambled by removing and re-applying power, but I haven't
XXX found out precisely what state is scrambled, yet.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 22-Jun-2005  dyoung branches: 1.7.2;
Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
 1.6 27-Feb-2005  perry nuke trailing whitespace
 1.5 09-Sep-2004  enami branches: 1.5.4; 1.5.6;
Print missing newline on attach.
 1.4 02-Aug-2004  mycroft branches: 1.4.2;
cardbusdevs -> pcidevs
 1.3 22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.2 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.1 14-Oct-2003  ichiro add support ath on cardbus
- implement power management
 1.4.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.3 12-Aug-2004  skrll Sync with HEAD.
 1.4.2.2 03-Aug-2004  skrll Sync with HEAD
 1.4.2.1 02-Aug-2004  skrll file if_ath_cardbus.c was added on branch ktrace-lwp on 2004-08-03 10:45:47 +0000
 1.5.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.7.2.6 17-Mar-2008  yamt sync with head.
 1.7.2.5 21-Jan-2008  yamt sync with head
 1.7.2.4 07-Dec-2007  yamt sync with head
 1.7.2.3 27-Oct-2007  yamt sync with head.
 1.7.2.2 30-Dec-2006  yamt sync with head.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.8.6.3 07-Jun-2006  kardel Sync with head.
 1.8.6.2 07-Jun-2006  kardel 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.9.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.9.4.1 19-Apr-2006  elad sync with head.
 1.9.2.5 14-Sep-2006  yamt sync with head.
 1.9.2.4 11-Aug-2006  yamt sync with head
 1.9.2.3 26-Jun-2006  yamt sync with head.
 1.9.2.2 11-Apr-2006  yamt sync with head
 1.9.2.1 01-Apr-2006  yamt sync with head.
 1.12.2.1 19-Jun-2006  chap Sync with head.
 1.16.4.2 10-Dec-2006  yamt sync with head.
 1.16.4.1 22-Oct-2006  yamt sync with head
 1.16.2.1 18-Nov-2006  ad Sync with head.
 1.18.28.2 21-Nov-2007  bouyer Sync with HEAD
 1.18.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.24.3 23-Mar-2008  matt sync with HEAD
 1.18.24.2 09-Jan-2008  matt sync with HEAD
 1.18.24.1 06-Nov-2007  matt sync with HEAD
 1.18.22.7 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.18.22.6 21-Nov-2007  joerg Sync with HEAD.
 1.18.22.5 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.18.22.4 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.18.22.3 04-Oct-2007  joerg Port generic PCI power handlers to cardbus.
 1.18.22.2 23-Aug-2007  joerg Convert ath(4) to new style power management.
Remove the resetting of the PCI retry register on resume,
the restored configuration should have it already.
 1.18.22.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.18.8.1 23-Oct-2007  ad Sync with head.
 1.19.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.19.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.4.1 11-Dec-2007  yamt sync with head.
 1.20.2.1 26-Dec-2007  ad Sync with head.
 1.21.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.25.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.2.1 24-Mar-2008  keiichi sync with head.
 1.27.8.3 18-Jul-2008  simonb Sync with head.
 1.27.8.2 27-Jun-2008  simonb Sync with head.
 1.27.8.1 18-Jun-2008  simonb Sync with head.
 1.27.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.27.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.4.4 11-Mar-2010  yamt sync with head
 1.27.4.3 16-Sep-2009  yamt sync with head
 1.27.4.2 16-May-2009  yamt sync with head
 1.27.4.1 04-May-2009  yamt sync with head.
 1.27.2.1 17-Jun-2008  yamt sync with head.
 1.29.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.2.1 19-Oct-2008  haad Sync with HEAD.
 1.31.10.1 21-Apr-2010  matt sync to netbsd-5
 1.31.4.1 07-Aug-2009  snj Pull up following revision(s) (requested by sborrill in ticket #903):
sys/dev/cardbus/if_ath_cardbus.c: revision 1.32
sys/dev/pci/if_ath_pci.c: revision 1.32
Sync ath(4) with the new HAL, mostly based on <jmcneill>'s patches.
Everything should be fine again !
 1.31.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.2 03-Apr-2013  christos branches: 1.2.4; 1.2.12; 1.2.40;
instead of ifnet use ethercom.
 1.1 30-Mar-2013  christos This is the initial port of OpenBSD's athn(4) driver. It supports
quite a few Atheros 802.11n devices. See the athn(4) manpage for a
list.

This port has only been tested with a TP-LINK TL-WN722N USB adapter
which has an AR9271 chipset (VENDOR: 0x0cf3, PRODUCT: 0x9271). The
BSS, Monitor, and HostAP modes all seem to work on that adapter,
though the later has not been tested much.

The driver also supports PCI and CardBUS devices, but those interfaces
are completely untested and probably won't work at this point.

If someone can provide me with other adapters that should be
supported, particularly PCI or CardBUS adapters, or tell me where I
can get one cheaply, I would be happy to try to get the driver working
on those devices as well.
 1.2.40.1 12-Jul-2018  phil State save. New kernel config for this brach only. TESTWIFI does
produce a kernel. It is not working. athn files not compiling yet
and commented out of the TESTWIFI kernel, which only has urtwn 802.11
driver enabled. ieee80211_alq.c and ieee80211_ddb.c not compiling yet.
 1.2.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.2.12.1 03-Apr-2013  yamt file if_athn_cardbus.c was added on branch yamt-pagecache on 2014-05-22 11:40:20 +0000
 1.2.4.2 23-Jun-2013  tls resync from head
 1.2.4.1 03-Apr-2013  tls file if_athn_cardbus.c was added on branch tls-maxphys on 2013-06-23 06:20:16 +0000
 1.37 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.36 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.35 26-Jul-2011  dyoung Replace anonymous constants, 0x10, 0x14, ..., with PCI_BAR(0),
PCI_BAR(1), .... There was no change in the generated assembly. I used
this semantic patch:

@ mapsit @
identifier bar;
expression pact;
@@

(
pci_mapreg_map
|
Cardbus_mapreg_map
)(pact, bar, ...)

@ depends on mapsit @
identifier mapsit.bar;
@@
(
- #define bar 0x10
+ #define bar PCI_BAR(0)
|
- #define bar 0x14
+ #define bar PCI_BAR(1)
|
- #define bar 0x18
+ #define bar PCI_BAR(2)
|
- #define bar 0x1C
+ #define bar PCI_BAR(3)
|
- #define bar 0x20
+ #define bar PCI_BAR(4)
)
 1.34 04-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.
 1.33 02-Mar-2010  dyoung Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested with ath & atw units on a Soekris net4521.
 1.32 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.31 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.30 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.29 18-Jan-2010  pooka branches: 1.29.2;
Remove conditional inclusion of unused bpf.h
 1.28 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.27 16-Sep-2009  dyoung In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together. Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
#include it from <sys/pmf.h> instead of <sys/device.h> to break the
circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
suspend/resume call. Start to replace instances of PMF_FN_PROTO,
PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
device in suspension. More than one suspensor may hold a device
at once. A device stays suspended as long as at least one
suspensor holds it. A device resumes when the last suspensor
releases it.

Currently, the kernel defines three suspensors,

3a the system-suspensor: for system suspension, initiated
by 'sysctl -w machdep.sleep_state=3', by lid closure, by
power-button press, et cetera,

3b the drvctl-suspensor: for device suspension by /dev/drvctl
ioctl, e.g., drvctl -S sip0.

3c the system self-suspensor: for device drivers that suspend
themselves and their children. Several drivers for network
interfaces put the network device to sleep while it is not
administratively up, that is, after the kernel calls if_stop(,
1). The self-suspensor should not be used directly. See
the description of suspensor delegates, below.

A suspensor can have one or more "delegates". A suspensor can
release devices that its delegates hold suspended. Right now,
only the system self-suspensor has delegates. For each device
that a self-suspending driver attaches, it creates the device's
self-suspensor, a delegate of the system self-suspensor.

Suspensors stop a system-wide suspend/resume cycle from waking
devices that the operator put to sleep with drvctl before the cycle.
They also help self-suspension to work more simply, safely, and in
accord with expectations.

4. Add the notion of device activation level, devact_level_t,
and a routine for checking the current activation level,
device_activation(). Current activation levels are DEVACT_LEVEL_BUS,
DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
indicate that the device's bus is active, that the bus and device are
active, and that the bus, device, and the functions of the device's
class (network, audio) are active.

Suspend/resume calls can be qualified with a devact_level_t.
The power-management framework treats a devact_level_t that
qualifies a device suspension as the device's current activation
level; it only runs hooks to reduce the activation level from
the presumed current level to the fully suspended state. The
framework treats a devact_level_t qualifying device resumption
as the target activation level; it only runs hooks to raise the
activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
drivers.

6. Temporarily add an unused power-management workqueue that I will
remove or replace, soon.
 1.26 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.25 06-Feb-2009  dyoung branches: 1.25.2;
Disable and acknowledge Function Events, and stop installing a
handler for them.

Don't override the latency timer set for us by the CardBus code.

Add a bit of debug code for the Function Event Registers, #if 0'd
out for now.

Cosmetic: remove gratuitous parenthesization of return statements.
Change the indentation of the struct atw_pci_softc definition.
Use a more meaningful variable name, et cetera.
 1.24 09-Jul-2008  joerg branches: 1.24.2;
- device/softc split
 1.23 24-Jun-2008  drochner branches: 1.23.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.22 28-Apr-2008  martin branches: 1.22.2; 1.22.4;
Remove clause 3 and 4 from TNF licenses
 1.21 06-Apr-2008  cegger branches: 1.21.2; 1.21.4;
use aprint_*_dev and device_xname
 1.20 07-Mar-2008  dyoung Use device_t and accessors. Use PMF instead of legacy power
management. Establish the shutdown hook using PMF.
 1.19 09-Dec-2007  jmcneill branches: 1.19.6; 1.19.10;
Merge jmcneill-pm branch.
 1.18 19-Oct-2007  ad branches: 1.18.4; 1.18.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 16-Nov-2006  christos branches: 1.17.8; 1.17.22; 1.17.24; 1.17.28;
__unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 07-Sep-2006  dogcow branches: 1.15.2; 1.15.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.14 29-Mar-2006  thorpej Use device_private().
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 22-Jun-2005  dyoung branches: 1.12.2;
Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
 1.11 27-Feb-2005  perry nuke trailing whitespace
 1.10 02-Aug-2004  mycroft branches: 1.10.2; 1.10.6; 1.10.8;
cardbusdevs -> pcidevs
 1.9 23-Jul-2004  dyoung Print and store Cardbus/PCI revision number.

Begin conditioning device configuration on revision number. Four
revisions are known:

1.1/1.5 -> ADM8211A,
2.0 -> ADM8211B,
3.0 -> ADM8211C.

The B and C parts, which are not supported yet, have AP capability.
 1.8 22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.7 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.6 17-Feb-2004  dyoung Move the RF Microdevices RF3000 & Silicon Laboratories SI4126/SI4136
register sets into their own header files for re-use by future
drivers.
 1.5 29-Jan-2004  dyoung Get rid of __P.
 1.4 29-Jan-2004  dyoung The MII headers are not necessary, so don't include them.
 1.3 16-Nov-2003  dyoung Add data-link type DLT_IEEE802_11_RADIO to wi and atw. DLT_IEEE802_11_RADIO
lets you monitor radio stats like received signal strength, which
diversity antenna was used, channel/frequency, modulation, and data
rate.
 1.2 13-Oct-2003  dyoung Adapt atw(4) to the new 802.11 layer.

Simplify atw_start, atw_newstate.

Synchronize access to atw_start by bracketing the call to
ieee80211_next_scan in atw_next_scan with splnet()/splx().
 1.1 06-Jul-2003  dyoung Oops. Add the atw(4) sources, too.
 1.10.8.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.6.1 29-Apr-2005  kent sync with -current
 1.10.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.3 12-Aug-2004  skrll Sync with HEAD.
 1.10.2.2 03-Aug-2004  skrll Sync with HEAD
 1.10.2.1 02-Aug-2004  skrll file if_atw_cardbus.c was added on branch ktrace-lwp on 2004-08-03 10:45:47 +0000
 1.12.2.5 17-Mar-2008  yamt sync with head.
 1.12.2.4 21-Jan-2008  yamt sync with head
 1.12.2.3 27-Oct-2007  yamt sync with head.
 1.12.2.2 30-Dec-2006  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 19-Apr-2006  elad sync with head.
 1.13.8.2 14-Sep-2006  yamt sync with head.
 1.13.8.1 01-Apr-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.15.4.2 10-Dec-2006  yamt sync with head.
 1.15.4.1 22-Oct-2006  yamt sync with head
 1.15.2.1 18-Nov-2006  ad Sync with head.
 1.17.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.24.3 23-Mar-2008  matt sync with HEAD
 1.17.24.2 09-Jan-2008  matt sync with HEAD
 1.17.24.1 06-Nov-2007  matt sync with HEAD
 1.17.22.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.17.22.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.17.8.1 23-Oct-2007  ad Sync with head.
 1.18.6.1 11-Dec-2007  yamt sync with head.
 1.18.4.1 26-Dec-2007  ad Sync with head.
 1.19.10.4 28-Sep-2008  mjf Sync with HEAD.
 1.19.10.3 29-Jun-2008  mjf Sync with HEAD.
 1.19.10.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.10.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.6.1 24-Mar-2008  keiichi sync with head.
 1.21.4.3 11-Mar-2010  yamt sync with head
 1.21.4.2 04-May-2009  yamt sync with head.
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.1 18-May-2008  yamt sync with head.
 1.22.4.2 18-Jul-2008  simonb Sync with head.
 1.22.4.1 27-Jun-2008  simonb Sync with head.
 1.22.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.23.2.1 19-Oct-2008  haad Sync with HEAD.
 1.24.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.24.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.25.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.2 12-Apr-2012  nakayama branches: 1.2.2; 1.2.4;
- Add pmf(9) suspend, resume to bwi(4) cardbus front end.
- Apply cardbus code cleanups.
 1.1 08-Apr-2012  christos PR/46310: Ryo ONODERA: Add support for cardbus bwi(4)
 1.2.4.2 29-Apr-2012  mrg sync to latest -current.
 1.2.4.1 12-Apr-2012  mrg file if_bwi_cardbus.c was added on branch jmcneill-usbmp on 2012-04-29 23:04:49 +0000
 1.2.2.2 17-Apr-2012  yamt sync with head
 1.2.2.1 12-Apr-2012  yamt file if_bwi_cardbus.c was added on branch yamt-pagecache on 2012-04-17 00:07:29 +0000
 1.56 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.55 01-Aug-2011  drochner branches: 1.55.12; 1.55.30;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.54 22-Mar-2010  dyoung ex_softc.ex_bustype is written but never read. Just get rid of it.
 1.53 22-Mar-2010  dyoung Detach at shutdown.
 1.52 19-Mar-2010  dyoung Use Cardbus_intr_disestablish() instead of cardbus_intr_disestablish().

Get rid of a (short) staircase in ex_cardbus_detach().
 1.51 10-Mar-2010  dyoung branches: 1.51.2;
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by me.
 1.50 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.49 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.48 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.47 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.46 15-Dec-2009  snj branches: 1.46.2;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.45 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.44 14-Apr-2008  cegger branches: 1.44.4; 1.44.6; 1.44.8;
- ansify
- use POSIX integers
 1.43 14-Apr-2008  spz pretty up if_ex: pmf'ify, device split, and improve printing a bit too.

Reviewed and function-tested on if_ex_cardbus by cube (thanks).
Function-tested on if_ex_pci by myself.
 1.42 06-Apr-2008  cegger use aprint_*_dev and device_xname
 1.41 09-Dec-2007  jmcneill branches: 1.41.10;
Merge jmcneill-pm branch.
 1.40 19-Oct-2007  ad branches: 1.40.4; 1.40.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.39 16-Nov-2006  christos branches: 1.39.8; 1.39.22; 1.39.24; 1.39.28;
__unused removal on arguments; approved by core.
 1.38 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.37 29-Mar-2006  thorpej branches: 1.37.8; 1.37.10;
Use device_private().
 1.36 11-Dec-2005  christos branches: 1.36.4; 1.36.6; 1.36.8; 1.36.10; 1.36.12;
merge ktrace-lwp.
 1.35 27-Feb-2005  perry branches: 1.35.4;
nuke trailing whitespace
 1.34 04-Feb-2005  perry de-__P
 1.33 02-Aug-2004  mycroft branches: 1.33.4; 1.33.6;
cardbusdevs -> pcidevs
 1.32 22-Jul-2004  mycroft Add EX_CONF_INV_LED_POLARITY to a couple of the aforementioned entries. See
PR 23710.
 1.31 22-Jul-2004  mycroft Add entries for the 3c656 line. Should fix PR 22880.
 1.30 22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.29 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.28 02-Nov-2003  wiz branches: 1.28.2;
Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.27 02-Oct-2002  thorpej branches: 1.27.6;
Add trailing ; to CFATTACH_DECL.
 1.26 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.25 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.24 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.23 13-Nov-2001  lukem add RCSID
 1.22 19-Jul-2001  wiz Fix typo (`information' has an 'r').
 1.21 17-Jul-2001  mrg properly use ANSI string concatenation.
 1.20 26-Apr-2001  kanaoka branches: 1.20.2;
- Fix typo in comment.
 1.19 30-Jan-2001  thorpej branches: 1.19.2;
Power management support for the CardBus Etherlink XL cards.
From Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>.
 1.18 19-Sep-2000  fvdl Add explicit config values for 8 bit and offset EEPROMS, since this
property is now shared with the PCI frontend.
 1.17 12-Sep-2000  haya Clean-up: Remove unnecessary global reset (for debug) and change the
name of some variables for the consistency of naming rule.
 1.16 05-Sep-2000  haya Clean-up card-type depend code.
 1.15 29-Aug-2000  haya Add support 3C[CX]FE575CT.
 1.14 19-May-2000  thorpej branches: 1.14.4;
Add missing field in static initialization.
 1.13 07-Mar-2000  mycroft Do a CARDBUS_BM_ENABLE to be sure.
 1.12 01-Mar-2000  thorpej When unmapping these on detach, pass the BAR to unmap (not the type of
the BAR!!)
 1.11 05-Feb-2000  augustss Support detach.
 1.10 26-Jan-2000  haya Add cardbus detach functionality. Add a function
cardbus_detach_card() in cardbus.c and enable detach code in cardslot.c
 1.9 17-Nov-1999  thorpej branches: 1.9.2;
Make this a lot more like the PCI front-end.
 1.8 17-Nov-1999  soren Also disable EX_CONF_INTPHY on the B model.
 1.7 17-Nov-1999  thorpej The 3c575-TX does *not* have an internal PHY.
 1.6 01-Nov-1999  haya Change the interface of cardbus_function_enable() and
cardbus_function_disable().
 1.5 27-Oct-1999  haya Change cardbus API. The first argument of cardbus_mapreg_map() is
changed to struct cardbus_softc * from cardbus_devfunc_t. The old
function is renamed to Cardbus_mapreg_map().
 1.4 25-Oct-1999  drochner defopt the XNS protocol (options NS), clean up the use of related
option headers / defines
 1.3 15-Oct-1999  augustss branches: 1.3.2; 1.3.4;
Comment out some debug settings.
Change attach printing so it looks more standard.
 1.2 15-Oct-1999  haya add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.4.3 01-Jan-2002  he Pull up revisions 1.17,1.19 (via patch, requested by kanaoka):
Add Power Management support for Cardbus Etherlink XL cards, and
some cleanup.
 1.14.4.2 05-Apr-2001  he Pull up revision 1.18 (via patch, requested by fvdl):
Add explicit config values for 8 bit and offset EEPROMS, since
this property is now shared with the PCI frontend.

Done in conjunction with adding support for the 3Com 3c555, 3c556
and 3c556B MiniPCI Ethernet cards.
 1.14.4.1 01-Sep-2000  haya Pull up rev 1.15: Support 3C[CX]FE575CT.
This pullup is approved by <thorpej@netbsd.org>.
 1.19.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.19.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.19.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.20.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.20.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.1 03-Aug-2001  lukem update to -current
 1.27.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.27.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.6.1 03-Aug-2004  skrll Sync with HEAD
 1.28.2.1 23-Jul-2004  he Pull up revisions 1.31-1.32 (requested by mycroft in ticket #691):
Add entries for the 3c656 line. Fixes PR#22880. Also add
EX_CONF_INV_LED_POLARITY to some of the entries, from PR#23710.
 1.33.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.6.1 12-Feb-2005  yamt sync with head.
 1.33.4.1 29-Apr-2005  kent sync with -current
 1.35.4.4 21-Jan-2008  yamt sync with head
 1.35.4.3 27-Oct-2007  yamt sync with head.
 1.35.4.2 30-Dec-2006  yamt sync with head.
 1.35.4.1 21-Jun-2006  yamt sync with head.
 1.36.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.36.10.1 19-Apr-2006  elad sync with head.
 1.36.8.1 01-Apr-2006  yamt sync with head.
 1.36.6.1 22-Apr-2006  simonb Sync with head.
 1.36.4.1 09-Sep-2006  rpaulo sync with head
 1.37.10.2 10-Dec-2006  yamt sync with head.
 1.37.10.1 22-Oct-2006  yamt sync with head
 1.37.8.1 18-Nov-2006  ad Sync with head.
 1.39.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.39.24.2 09-Jan-2008  matt sync with HEAD
 1.39.24.1 06-Nov-2007  matt sync with HEAD
 1.39.22.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.39.22.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.39.8.1 23-Oct-2007  ad Sync with head.
 1.40.6.1 11-Dec-2007  yamt sync with head.
 1.40.4.1 26-Dec-2007  ad Sync with head.
 1.41.10.2 29-Jun-2008  mjf Sync with HEAD.
 1.41.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.44.8.1 27-Jun-2008  simonb Sync with head.
 1.44.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.44.4.3 11-Aug-2010  yamt sync with head.
 1.44.4.2 11-Mar-2010  yamt sync with head
 1.44.4.1 04-May-2009  yamt sync with head.
 1.46.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.2.1 30-May-2010  rmind sync with head
 1.55.30.1 09-Jul-2016  skrll Sync with HEAD
 1.55.12.1 03-Dec-2017  jdolecek update from HEAD
 1.53 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.52 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.51 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.50 02-Feb-2012  tls branches: 1.50.6; 1.50.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.49 05-Sep-2011  msaitoh branches: 1.49.2; 1.49.6;
Change 0x1229's product name from 82557 to 8255x.
82550, 82551, 82558 and 82559 share the same product id.
This change makes "pcictl dump" happy.
 1.48 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.47 18-Mar-2010  dyoung Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.46 26-Feb-2010  dyoung branches: 1.46.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.45 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.44 25-Feb-2010  dyoung Don't use the cardbus_softc. Compile-tested, only.
 1.43 25-Feb-2010  dyoung Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args. Compile-tested, only.
 1.42 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.41 18-Jan-2010  pooka branches: 1.41.2;
Remove conditional inclusion of unused bpf.h
 1.40 05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.39 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.38 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.37 07-Mar-2009  tsutsui Add TCPv4/UDPv4 RX hardware checksum support for i82559 and later chips
which don't have EXT_RFA and IPCB support. From hme(4) driver and
FreeBSD's fxp(4). Tested on i82559.

XXX: Probably we should have a common function to parse RX packet headers
XXX: to handle a raw checksum value and share it among hme(4) and gem(4) etc.
 1.36 20-Feb-2009  mrg - remove FXPF_IPCB flag. it should always/only be used with the code
conditional on FXPF_EXT_TXCB, so, replace all uses with that
- for the pci frontend, reestablish some flags lost the the prior
changes and simplify one of the cases

this fixes PR 40677 and may fix PR 40431.
 1.35 18-Jan-2009  mrg branches: 1.35.2;
The PCI revision numbers are unique to a PCI vendor/product
ID pair. Misuse of the revision numbers was causing some of the chip
features to be disabled on some integrated Intel chips. So, move the
determination of the features into the bus frontend, where the
vendor/product ID is known. (Note: sc_rev should be removed. The
microcode patch stuff is also busted and needs to be fixed.) Also,
poll the actual flow control status in inphy, rather than making
assumptions.

contributed anonymously.
 1.34 09-Jul-2008  joerg branches: 1.34.2;
- device/softc split for fxp(4)
 1.33 09-Jul-2008  joerg Use device_private to access cardbus_softc.
 1.32 24-Jun-2008  drochner branches: 1.32.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.31 28-Apr-2008  martin branches: 1.31.2; 1.31.4;
Remove clause 3 and 4 from TNF licenses
 1.30 06-Apr-2008  cegger branches: 1.30.2; 1.30.4;
use aprint_*_dev and device_xname
 1.29 09-Dec-2007  jmcneill branches: 1.29.10;
pmf_driver_register -> pmf_device_register
 1.28 09-Dec-2007  jmcneill Register with power management framework.
 1.27 19-Oct-2007  ad branches: 1.27.4; 1.27.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.26 16-Nov-2006  christos branches: 1.26.8; 1.26.22; 1.26.24; 1.26.28;
__unused removal on arguments; approved by core.
 1.25 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.24 07-Sep-2006  dogcow branches: 1.24.2; 1.24.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.23 29-Mar-2006  thorpej Use device_private().
 1.22 25-Mar-2006  thorpej Use device_parent().CVS: ----------------------------------------------------------------------
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
merge ktrace-lwp.
 1.20 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.19 04-Feb-2005  perry branches: 1.19.6;
de-__P
 1.18 02-Aug-2004  mycroft branches: 1.18.4; 1.18.6;
cardbusdevs -> pcidevs
 1.17 02-Oct-2002  thorpej branches: 1.17.6;
Add trailing ; to CFATTACH_DECL.
 1.16 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.13 13-Nov-2001  lukem add RCSID
 1.12 08-May-2000  thorpej branches: 1.12.6; 1.12.8;
Don't use not-in-user-namespace variable names that newer versions of
GCC doesn't like very much.
 1.11 22-Mar-2000  thorpej Fix logic bug in fxp_cardbus_match().
 1.10 12-Mar-2000  veego Reverse the mapping of the control/status registers. Use I/O before MEM.
My card works now on a TI1220 chipset. Approved by Jason.
 1.9 10-Mar-2000  thorpej Normalize the copyright notice (TNF copyrights should *always* match
the appropriate template), and run through indent.
 1.8 07-Mar-2000  mycroft Do a CARDBUS_BM_ENABLE to be sure.
 1.7 12-Feb-2000  enami Add activate routine and check device active flag also in one second
tick handler.
 1.6 09-Feb-2000  joda add detach code
 1.5 12-Dec-1999  thorpej branches: 1.5.2;
Take a stab at making this work on big-endian systems.
 1.4 01-Nov-1999  haya Change the interface of cardbus_function_enable() and
cardbus_function_disable().
 1.3 31-Oct-1999  joda commit a more working version if this driver; so far only tested on an
Intel `PRO/100 LAN+Modem56 CardBus II'
 1.2 15-Oct-1999  haya branches: 1.2.2; 1.2.4;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.12.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.6.2 18-Oct-2002  nathanw Catch up to -current.
 1.12.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.17.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.6.1 12-Feb-2005  yamt sync with head.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.19.6.4 21-Jan-2008  yamt sync with head
 1.19.6.3 27-Oct-2007  yamt sync with head.
 1.19.6.2 30-Dec-2006  yamt sync with head.
 1.19.6.1 21-Jun-2006  yamt sync with head.
 1.21.12.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.21.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.21.10.1 19-Apr-2006  elad sync with head.
 1.21.8.2 14-Sep-2006  yamt sync with head.
 1.21.8.1 01-Apr-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.24.4.2 10-Dec-2006  yamt sync with head.
 1.24.4.1 22-Oct-2006  yamt sync with head
 1.24.2.1 18-Nov-2006  ad Sync with head.
 1.26.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.26.24.2 09-Jan-2008  matt sync with HEAD
 1.26.24.1 06-Nov-2007  matt sync with HEAD
 1.26.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.26.8.1 23-Oct-2007  ad Sync with head.
 1.27.6.1 11-Dec-2007  yamt sync with head.
 1.27.4.1 26-Dec-2007  ad Sync with head.
 1.29.10.3 28-Sep-2008  mjf Sync with HEAD.
 1.29.10.2 29-Jun-2008  mjf Sync with HEAD.
 1.29.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.30.4.6 11-Aug-2010  yamt sync with head.
 1.30.4.5 11-Mar-2010  yamt sync with head
 1.30.4.4 16-Sep-2009  yamt sync with head
 1.30.4.3 16-May-2009  yamt sync with head
 1.30.4.2 04-May-2009  yamt sync with head.
 1.30.4.1 16-May-2008  yamt sync with head.
 1.30.2.1 18-May-2008  yamt sync with head.
 1.31.4.2 18-Jul-2008  simonb Sync with head.
 1.31.4.1 27-Jun-2008  simonb Sync with head.
 1.31.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.2.1 19-Oct-2008  haad Sync with HEAD.
 1.34.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.34.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.34.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.35.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.41.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.46.2.1 30-May-2010  rmind sync with head
 1.49.6.1 18-Feb-2012  mrg merge to -current.
 1.49.2.1 17-Apr-2012  yamt sync with head
 1.50.24.2 09-Jul-2016  skrll Sync with HEAD
 1.50.24.1 06-Jun-2015  skrll Sync with HEAD
 1.50.6.1 03-Dec-2017  jdolecek update from HEAD
 1.1 14-Dec-2018  jakllsch branches: 1.1.2; 1.1.6;
add cardbus attachment for malo(4), from OpenBSD
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 14-Dec-2018  christos file if_malo_cardbus.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.1.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.1 14-Dec-2018  pgoyette file if_malo_cardbus.c was added on branch pgoyette-compat on 2018-12-26 14:01:48 +0000
 1.26 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.25 14-Dec-2018  jakllsch fix whitespace
 1.24 14-Jul-2016  msaitoh branches: 1.24.16; 1.24.18;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.23 18-Feb-2012  drochner branches: 1.23.2; 1.23.16;
split device_t/softc
 1.22 01-Aug-2011  drochner branches: 1.22.2; 1.22.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.21 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.20 26-Feb-2010  dyoung branches: 1.20.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.19 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.18 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.17 18-Jan-2010  pooka branches: 1.17.2;
Remove conditional inclusion of unused bpf.h
 1.16 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.15 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.14 12-Oct-2008  dholland branches: 1.14.8;
Fix mangled attach output. Noted by Jari Kuittinen.
 1.13 24-Jun-2008  drochner branches: 1.13.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.12 29-Apr-2008  scw branches: 1.12.2; 1.12.4;
Pull in some more changes from OpenBSD:

- replace rssadapt(9) with amrr for automatic rate control.
- don't blindly IFQ_DEQUEUE() then drop a Tx packet if there are no
available Tx resources.
- move default MAC/BBP/RF settings from rt2661.c to rt2661reg.h.
- enable packet bursting when operating as a STA.
- implement new ic_updateslot() callback.
- in hostap mode, we defer update of the slot time until all associated
STAs are notified with updated beacons.
- 802.11a uses a 16 microseconds short interframe space.
- Fix rt2661_set_macaddr() so that we don't override the "unicast to me"
flag in RT2661_MAC_CSR3 when setting the MAC address.
- fix index of ERP information element in beacons.

Add a couple of tweaks of my own:

- The RX/TX BUSY flag should be the last thing written to a descriptor.
- Check and service any additional h/w interrupts before returning
from the isr.

Tested in STA, AP, and Monitor modes. Tested with WEP, WPA, and WPA2 crypto.

Additional testing by xtraeme@
 1.11 06-Apr-2008  cegger branches: 1.11.2; 1.11.4;
use aprint_*_dev and device_xname
 1.10 09-Dec-2007  jmcneill branches: 1.10.10;
Merge jmcneill-pm branch.
 1.9 19-Oct-2007  ad branches: 1.9.4; 1.9.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 16-Nov-2006  christos branches: 1.8.8; 1.8.22; 1.8.24; 1.8.28;
__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 25-Sep-2006  jmcneill Add powerhook for RT2560-based cardbus wireless adapters.
 1.5 06-Jun-2006  rpaulo branches: 1.5.6; 1.5.8;
Attachment framework for the rt2561.c and rt2661.c drivers.

From OpenBSD.
 1.4 29-Mar-2006  thorpej branches: 1.4.2;
Use device_private().
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10; 1.3.12;
merge ktrace-lwp.
 1.2 04-Jul-2005  drochner branches: 1.2.2; 1.2.8;
update PCI/Cardbus ral wlan driver, and adapt to new FreeBSD/NetBSD
80211 framework, from FUKAUMI Naoki per mail to tech-net
 1.1 01-Jul-2005  drochner add drivers for Ralink RT2500-based wireless adapters, written by
Damien Bergamini, ported and submitted by FUKAUMI Naoki per PR kern/30449
I've modified the USB "ural" driver for recent changes to the NetBSD
ieee80211 framework, possibly not completely, but with an ASUS wireless
adapter I'm getting some signs of life.
Didn't care about pci/cardbus for now, hopefully someone with hardware
will do it.
 1.2.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.8.1 04-Jul-2005  skrll file if_ral_cardbus.c was added on branch ktrace-lwp on 2005-11-10 14:03:54 +0000
 1.2.2.4 21-Jan-2008  yamt sync with head
 1.2.2.3 27-Oct-2007  yamt sync with head.
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.3.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.3.10.1 19-Apr-2006  elad sync with head.
 1.3.8.2 26-Jun-2006  yamt sync with head.
 1.3.8.1 01-Apr-2006  yamt sync with head.
 1.3.6.2 07-Jun-2006  kardel 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.4.2.1 19-Jun-2006  chap Sync with head.
 1.5.8.2 10-Dec-2006  yamt sync with head.
 1.5.8.1 22-Oct-2006  yamt sync with head
 1.5.6.1 18-Nov-2006  ad Sync with head.
 1.8.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.24.2 09-Jan-2008  matt sync with HEAD
 1.8.24.1 06-Nov-2007  matt sync with HEAD
 1.8.22.2 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.8.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.8.8.1 23-Oct-2007  ad Sync with head.
 1.9.6.1 11-Dec-2007  yamt sync with head.
 1.9.4.1 26-Dec-2007  ad Sync with head.
 1.10.10.3 17-Jan-2009  mjf Sync with HEAD.
 1.10.10.2 29-Jun-2008  mjf Sync with HEAD.
 1.10.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.5 11-Aug-2010  yamt sync with head.
 1.11.4.4 11-Mar-2010  yamt sync with head
 1.11.4.3 16-May-2009  yamt sync with head
 1.11.4.2 04-May-2009  yamt sync with head.
 1.11.4.1 16-May-2008  yamt sync with head.
 1.11.2.1 18-May-2008  yamt sync with head.
 1.12.4.1 27-Jun-2008  simonb Sync with head.
 1.12.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.2.1 19-Oct-2008  haad 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.17.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.20.2.1 30-May-2010  rmind sync with head
 1.22.6.1 24-Feb-2012  mrg sync to -current.
 1.22.2.1 17-Apr-2012  yamt sync with head
 1.23.16.1 05-Oct-2016  skrll Sync with HEAD
 1.23.2.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.24.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.27 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.26 27-Jul-2010  jakllsch Make the Realtek PCI network interfaces detachable.
Use __arraycount to avoid null table entries.
Miscellaneous other touch-ups in bus front-ends.
 1.25 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.24 26-Feb-2010  dyoung branches: 1.24.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.23 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.22 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.21 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.20 02-Sep-2009  tsutsui branches: 1.20.2;
Move pmf(9) calls to MI re_attach() and re_detach() from each backend.
 1.19 29-Aug-2009  tsutsui Remove unnecessary #includes.
 1.18 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.17 25-Apr-2008  tsutsui branches: 1.17.2; 1.17.4; 1.17.6;
Split device_t/softc for re(4) and rtk(4).
 1.16 06-Apr-2008  cegger branches: 1.16.2;
use aprint_*_dev and device_xname
 1.15 09-Dec-2007  jmcneill branches: 1.15.10;
Merge jmcneill-pm branch.
 1.14 19-Oct-2007  ad branches: 1.14.4; 1.14.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 21-Mar-2007  tsutsui branches: 1.13.8; 1.13.10; 1.13.14;
Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.12 18-Nov-2006  tsutsui branches: 1.12.2; 1.12.4; 1.12.8; 1.12.10; 1.12.12; 1.12.14;
Unwrap some lines (after __unused removal).
 1.11 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.10 27-Oct-2006  dogcow Sync up with rtk 'common macro' changes.
 1.9 12-Oct-2006  xtraeme More -Wunused warnings.
 1.8 07-Sep-2006  dogcow branches: 1.8.2; 1.8.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.7 29-Mar-2006  thorpej Use device_private().
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.12;
merge ktrace-lwp.
 1.5 27-Feb-2005  perry branches: 1.5.2; 1.5.4;
nuke trailing whitespace
 1.4 15-Jan-2005  kanaoka branches: 1.4.2; 1.4.4; 1.4.6;
- Use aprint_*.
- Use ANSI decls.
- Change some cosmetic.
 1.3 13-Jan-2005  kanaoka - Add my tested device in a comment.
- Change minimum value of latency timer from 0x20 to 0x40.
 1.2 26-Dec-2004  kanaoka - Use ether_ioctl().
- Remove unnecessary re_init() in re_attach().
- Remove notyet compile option.
 1.1 23-Dec-2004  jonathan Snapshot of incomplete-but-working split of re(4) driver into a
bus-independent backend, with PCI and CardBus attachment code.
The committed code has two serious bugs:

1. The driver makes no attempt to recover resources when a (Cardbus)
instance is removed; bus resources are leaked.

2. In testing with a NetGear GA-511, the Cardbus card never responded
to a reset/wakeup if the card is powered down after attachment.
So for now, leave cardbus instances powered up at attachment
(insertion, or at boot if a card is already present).

That aside, it acutally works on my GA-511. Committed as-is despite
the bugs, after repeated requests to make the code available for
further testing. Also requires sys/dev/mii/miidevs rev 1.54 -> 1.55,
and consequent regen of miidevs{,_data}.h.
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.4.4.1 15-Jan-2005  skrll file if_re_cardbus.c was added on branch ktrace-lwp on 2005-01-17 19:30:39 +0000
 1.4.2.1 29-Apr-2005  kent sync with -current
 1.5.4.5 21-Jan-2008  yamt sync with head
 1.5.4.4 27-Oct-2007  yamt sync with head.
 1.5.4.3 03-Sep-2007  yamt sync with head.
 1.5.4.2 30-Dec-2006  yamt sync with head.
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.5.2.2 04-Oct-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1852):
sys/dev/ic/rtl81x9var.h: revision 1.39
sys/dev/cardbus/if_re_cardbus.c: revision 1.13
sys/dev/pci/if_re_pci.c: revision 1.27 via patch
sys/dev/pci/if_rtk_pci.c: revision 1.32
sys/dev/cardbus/if_rtk_cardbus.c: revision 1.32
sys/dev/ic/rtl8169.c: revision 1.84, 1.85
sys/dev/ic/rtl81x9reg.h: revision 1.27
sys/dev/ic/rtl81x9.c: revision 1.72
Cleanup handling of quikrs on each RealTek chip:
Pull a fix for PCIe variants from FreeBSD
 1.5.2.1 03-Mar-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1673):
distrib/sets/lists/man/mi 1.844, 1.871
share/man/man4/Makefile 1.372, 1.379 via patch
share/man/man4/re.4 1.8, 1.9, 1.11, 1.12
share/man/man4/rgephy.4 1.1
share/man/man4/rlphy.4 1.1, 1.2
sys/arch/amd64/conf/GENERIC 1.79, 1.89
sys/arch/amd64/conf/INSTALL 1.45, 1.49
sys/arch/i386/conf/GENERIC 1.717, 1.747
sys/arch/i386/conf/GENERIC_LAPTOP 1.164
sys/arch/i386/conf/INSTALL 1.277, 1.283
sys/arch/i386/conf/INSTALL_LAPTOP 1.96, 1.98
sys/arch/i386/conf/XEN2_DOM0 1.22 via patch
sys/arch/macppc/conf/GENERIC 1.220, 1.246
sys/arch/macppc/conf/INSTALL 1.96, 1.100
sys/dev/cardbus/if_re_cardbus.c 1.10
sys/dev/cardbus/if_rtk_cardbus.c 1.29-1.31
sys/dev/ic/rtl8169.c 1.14, 1.20, 1.24, 1.25, 1.28-1.61, 1.63, 1.64-1.81 via patch
sys/dev/ic/rtl81x9.c 1.52, 1.54-1.63, 1.65, 1.67-1.70
sys/dev/ic/rtl81x9reg.h 1.15-1.26
sys/dev/ic/rtl81x9var.h 1.19, 1.21-1.37
sys/dev/mii/files.mii 1.38
sys/dev/mii/miidevs 1.62, 1.64
sys/dev/mii/rgephy.c 1.10, 1.13-1.16
sys/dev/mii/rlphy.c 1.1, 1.6, 1.7, 1.11 via patch
sys/dev/pci/if_re_pci.c 1.13, 1.15-1.17, 1.19-1.23
sys/dev/pci/if_rtk_pci.c 1.25, 1.28, 1.29, 1.31
sys/dev/pci/pcidevs 1.851, 1.852

on re(4):
- improve stability (I believe ;-)
- add a workaround for hardware ip4csum-tx bug
- support newer chips (8169SB/SC, PCIe based 8168 etc.)
- fix 8139C+ support
- enable hardware VLAN
- misc bus_dma(9) fix (which makes re(4) work on mips ports)

on rtk(4):
- fix kern/31348
- fix possible panic on dreamcast
 1.6.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.6.10.1 19-Apr-2006  elad sync with head.
 1.6.8.2 14-Sep-2006  yamt sync with head.
 1.6.8.1 01-Apr-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.4.2 10-Dec-2006  yamt sync with head.
 1.8.4.1 22-Oct-2006  yamt sync with head
 1.8.2.2 12-Jan-2007  ad Sync with head.
 1.8.2.1 18-Nov-2006  ad Sync with head.
 1.12.14.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.12.12.1 29-Mar-2007  reinoud Pullup to -current
 1.12.10.1 11-Jul-2007  mjf Sync with head.
 1.12.8.2 23-Oct-2007  ad Sync with head.
 1.12.8.1 10-Apr-2007  ad Sync with head.
 1.12.4.1 24-Mar-2007  yamt sync with head.
 1.12.2.1 16-May-2007  jdc Pull up revision 1.13 (requested by tsutsui in ticket #640).

Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.13.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.10.2 09-Jan-2008  matt sync with HEAD
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.13.8.5 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.13.8.4 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.13.8.3 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.13.8.2 05-Oct-2007  joerg Fix compilation errors that slipped through because i386/ALL doesn't
have re* at cardbus.
 1.13.8.1 05-Oct-2007  joerg Remove the power management nonsense in the PCI versions of
rtk(4) and re(4). It is not really likely to work anyway.
Use PNP power management for the cardbus attachment as well and
remove the power management handlers from the chipset code.
 1.14.6.1 11-Dec-2007  yamt sync with head.
 1.14.4.1 26-Dec-2007  ad Sync with head.
 1.15.10.2 29-Jun-2008  mjf Sync with HEAD.
 1.15.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.2.1 18-May-2008  yamt sync with head.
 1.17.6.1 27-Jun-2008  simonb Sync with head.
 1.17.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.17.2.4 11-Aug-2010  yamt sync with head.
 1.17.2.3 11-Mar-2010  yamt sync with head
 1.17.2.2 16-Sep-2009  yamt sync with head
 1.17.2.1 04-May-2009  yamt sync with head.
 1.20.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.20.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.2.2 05-Mar-2011  rmind sync with head
 1.24.2.1 30-May-2010  rmind sync with head
 1.9 10-May-2000  haya Move if_rl_cardbus.c:1.8 to if_rtk_cardbus.c.
 1.8 01-May-2000  tsutsui - Move some initialization into MI rl_attach() from each bus attachment.
- Use proper CARDBUS_* macro in if_rl_cardbus.c
- Use product ID read from PCI configuration space rather than from EEPROM
in if_rl_pci.c.

Patch sent from Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp> and
some cosmetic changes by me.
 1.7 30-Apr-2000  tsutsui Modify EEPROM read functions and handle also 9356 EEPROM.
Fixes kern/9861.
 1.6 28-Apr-2000  tsutsui Fix copyright notice as per request from the author.
 1.5 26-Apr-2000  tsutsui - Allocate mbuf dynamically on Tx and use bus_dmamap_load_mbuf(9).
- Call bus_dmamap_sync(9) as appropriate.
- Leave only register declarations in rtl81x9reg.h and
split other stuff into rtl81x9var.h.

bus_dma(9) code mostly taken from thorpej's if_rtp.c.
 1.4 24-Apr-2000  tsutsui Merge changes of sys/pci/if_rl.c rev. 1.8->1.10. (from kern/9870)
Also remove unused pbase, vbase and PCI_CAP_PWRMGMT declarations.
 1.3 19-Apr-2000  haya Changes the name of RealTek driver. The new name is `rtk'. This used
to be called `rl' and it conflict with RL vax disks, canonical and
historical unix driver name.

This changes are minimal: it only changes the name of RealTek driver.
The filename of source code and a lot of the letter `rl' in source
files should be changed shortly.
 1.2 11-Apr-2000  haya Maintenace: add NetBSD tag and correct the name of the auther.
 1.1 10-Apr-2000  haya Incorporate the changes of RL81x9 driver provided by M. Kanaoka
<kanaoka@ann.hi-ho.ne.jp>. He separated the driver into IC specific
portion and bus attachment portion and added cardbus attachent.
 1.49 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.48 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.47 02-Feb-2012  tls branches: 1.47.6; 1.47.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.46 01-Aug-2011  drochner branches: 1.46.2; 1.46.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.45 27-Jul-2010  jakllsch No need to store map size locally now.
 1.44 11-Mar-2010  dyoung branches: 1.44.2;
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by Juraj Hercek.
 1.43 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.42 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.41 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.40 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.39 18-Jan-2010  pooka branches: 1.39.2;
Remove conditional inclusion of unused bpf.h
 1.38 05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.37 24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.36 25-Apr-2008  tsutsui branches: 1.36.2; 1.36.4; 1.36.6;
Split device_t/softc for re(4) and rtk(4).
 1.35 06-Apr-2008  cegger branches: 1.35.2;
use aprint_*_dev and device_xname
 1.34 09-Dec-2007  jmcneill branches: 1.34.10;
Merge jmcneill-pm branch.
 1.33 19-Oct-2007  ad branches: 1.33.4; 1.33.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.32 21-Mar-2007  tsutsui branches: 1.32.8; 1.32.10; 1.32.14;
Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.31 16-Nov-2006  christos branches: 1.31.2; 1.31.4; 1.31.8; 1.31.10; 1.31.12; 1.31.14;
__unused removal on arguments; approved by core.
 1.30 27-Oct-2006  dogcow Sync up with rtk 'common macro' changes.
 1.29 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.28 07-Sep-2006  dogcow branches: 1.28.2; 1.28.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.27 29-Mar-2006  thorpej Use device_private().
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25 27-Feb-2005  perry branches: 1.25.2; 1.25.4;
nuke trailing whitespace
 1.24 04-Feb-2005  perry de-__P
 1.23 02-Aug-2004  mycroft branches: 1.23.4; 1.23.6;
Minor name change to match other stuff in pcidevs.
 1.22 02-Aug-2004  mycroft cardbusdevs -> pcidevs
 1.21 22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.20 06-Jun-2004  dyoung Name some constants. Perhaps this deserves the cardbus_setpowerstate
treatment?
 1.19 11-Mar-2004  kanaoka Add (missed)"csc->sc_ih = NULL;" in rtk_cardbus_disable().

This fixed panic when card removed
after "ifconfig rtk0 up; ifconfig rtk0 down".
 1.18 13-Feb-2004  wiz RealTek -> Realtek.
 1.17 02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.16 25-Oct-2003  fvdl Add definitions for 8139C+ and 8169 chips. Not used yet. From FreeBSD.
 1.15 26-Jun-2003  ichiro branches: 1.15.2;
add products
Planex 10/100BaseTX FNW-3800-TX
kern/20175
Corega FEther II CB-TXD 10/100BaseTX
kern/21497
 1.14 01-Feb-2003  ichiro add product IO-DATA CBET100-CL 10/100 Ethernet
(OEM AboCom FE2000VX )
 1.13 23-Dec-2002  tsutsui Sync with if_rtk_pci.c:
- Fix typo in printf message.
- Don't use PCI_PRODUCT_DELTA_8139 (0x1360) for args of cardbus_conf_read()
and cardbus_conf_write(); use CARDBUS_INTERRUPT_REG (0x3c) instead.
 1.12 11-Nov-2002  kanaoka Add support for "Planex FNW-3603 cardbus ethernet".
by kern/18961: From: prlw1@cam.ac.uk.
 1.11 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.7 04-Jan-2002  kanaoka branches: 1.7.10;
Add support for "D-Link DFE-690TXD 10/100".
by kern/15100: From: John Nemeth <jnemeth@access.victoria.bc.ca>
 1.6 13-Nov-2001  lukem add RCSID
 1.5 20-Jun-2001  ichiro branches: 1.5.2;
support Raltek 8139-based Cardbus card
reported by Takayoshi Kochi(t-kouchi@mvf.biglobe.ne.jp)
kern/13252: RealTek 8139-based Cardbus support
 1.4 15-May-2001  kanaoka Add support for "Corega FEther CB-TXD".
kern/12709: from Yamashiro Jun <j99060@ie.u-ryukyu.ac.jp>.
 1.3 19-May-2000  tsutsui branches: 1.3.4; 1.3.6; 1.3.8;
- Change RL_* -> RTK_*
- Free bus_dma resources if attach fails
- Add detach and power management code

Patch from Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp> in kern/10156.
 1.2 15-May-2000  thorpej Symbol namespace cleanup: rl_ -> rtk_
 1.1 10-May-2000  haya Move if_rl_cardbus.c:1.8 to if_rtk_cardbus.c.
 1.3.8.8 29-Dec-2002  thorpej Sync with HEAD.
 1.3.8.7 11-Nov-2002  nathanw Catch up to -current
 1.3.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.5 28-Feb-2002  nathanw Catch up to -current.
 1.3.8.4 11-Jan-2002  nathanw More catchup.
 1.3.8.3 14-Nov-2001  nathanw Catch up to -current.
 1.3.8.2 24-Aug-2001  nathanw Catch up with -current.
 1.3.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 19-May-2000  bouyer file if_rtk_cardbus.c was added on branch thorpej_scsipi on 2000-11-20 11:39:54 +0000
 1.3.4.2 15-Dec-2002  he Pull up revision 1.12 (requested by kanaoka):
Add support for Planex FNW-3603 cardbus ethernet. Fixes
PR#18961.
 1.3.4.1 05-Jan-2002  he Pull up revisions 1.4-1.5,1.7 (requested by kanaoka):
Add support for the following cards:
o D-Link DFE-690TXD 10/100
o Realtek 8139 based cards
o Corega FEther CB-TXD
Fixes PR#15100, PR#13252 and PR#12709.
 1.5.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.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.10.1 11-Dec-2002  he Pull up revision 1.12 (requested by kanaoka in ticket #979):
Add support for ``Planex FNW-3603 cardbus ethernet''.
Fixes PR#18961.
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.6.1 12-Feb-2005  yamt sync with head.
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.25.4.5 21-Jan-2008  yamt sync with head
 1.25.4.4 27-Oct-2007  yamt sync with head.
 1.25.4.3 03-Sep-2007  yamt sync with head.
 1.25.4.2 30-Dec-2006  yamt sync with head.
 1.25.4.1 21-Jun-2006  yamt sync with head.
 1.25.2.2 04-Oct-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1852):
sys/dev/ic/rtl81x9var.h: revision 1.39
sys/dev/cardbus/if_re_cardbus.c: revision 1.13
sys/dev/pci/if_re_pci.c: revision 1.27 via patch
sys/dev/pci/if_rtk_pci.c: revision 1.32
sys/dev/cardbus/if_rtk_cardbus.c: revision 1.32
sys/dev/ic/rtl8169.c: revision 1.84, 1.85
sys/dev/ic/rtl81x9reg.h: revision 1.27
sys/dev/ic/rtl81x9.c: revision 1.72
Cleanup handling of quikrs on each RealTek chip:
Pull a fix for PCIe variants from FreeBSD
 1.25.2.1 03-Mar-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1673):
distrib/sets/lists/man/mi 1.844, 1.871
share/man/man4/Makefile 1.372, 1.379 via patch
share/man/man4/re.4 1.8, 1.9, 1.11, 1.12
share/man/man4/rgephy.4 1.1
share/man/man4/rlphy.4 1.1, 1.2
sys/arch/amd64/conf/GENERIC 1.79, 1.89
sys/arch/amd64/conf/INSTALL 1.45, 1.49
sys/arch/i386/conf/GENERIC 1.717, 1.747
sys/arch/i386/conf/GENERIC_LAPTOP 1.164
sys/arch/i386/conf/INSTALL 1.277, 1.283
sys/arch/i386/conf/INSTALL_LAPTOP 1.96, 1.98
sys/arch/i386/conf/XEN2_DOM0 1.22 via patch
sys/arch/macppc/conf/GENERIC 1.220, 1.246
sys/arch/macppc/conf/INSTALL 1.96, 1.100
sys/dev/cardbus/if_re_cardbus.c 1.10
sys/dev/cardbus/if_rtk_cardbus.c 1.29-1.31
sys/dev/ic/rtl8169.c 1.14, 1.20, 1.24, 1.25, 1.28-1.61, 1.63, 1.64-1.81 via patch
sys/dev/ic/rtl81x9.c 1.52, 1.54-1.63, 1.65, 1.67-1.70
sys/dev/ic/rtl81x9reg.h 1.15-1.26
sys/dev/ic/rtl81x9var.h 1.19, 1.21-1.37
sys/dev/mii/files.mii 1.38
sys/dev/mii/miidevs 1.62, 1.64
sys/dev/mii/rgephy.c 1.10, 1.13-1.16
sys/dev/mii/rlphy.c 1.1, 1.6, 1.7, 1.11 via patch
sys/dev/pci/if_re_pci.c 1.13, 1.15-1.17, 1.19-1.23
sys/dev/pci/if_rtk_pci.c 1.25, 1.28, 1.29, 1.31
sys/dev/pci/pcidevs 1.851, 1.852

on re(4):
- improve stability (I believe ;-)
- add a workaround for hardware ip4csum-tx bug
- support newer chips (8169SB/SC, PCIe based 8168 etc.)
- fix 8139C+ support
- enable hardware VLAN
- misc bus_dma(9) fix (which makes re(4) work on mips ports)

on rtk(4):
- fix kern/31348
- fix possible panic on dreamcast
 1.26.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.26.10.1 19-Apr-2006  elad sync with head.
 1.26.8.2 14-Sep-2006  yamt sync with head.
 1.26.8.1 01-Apr-2006  yamt sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.28.4.2 10-Dec-2006  yamt sync with head.
 1.28.4.1 22-Oct-2006  yamt sync with head
 1.28.2.1 18-Nov-2006  ad Sync with head.
 1.31.14.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.31.12.1 29-Mar-2007  reinoud Pullup to -current
 1.31.10.1 11-Jul-2007  mjf Sync with head.
 1.31.8.2 23-Oct-2007  ad Sync with head.
 1.31.8.1 10-Apr-2007  ad Sync with head.
 1.31.4.1 24-Mar-2007  yamt sync with head.
 1.31.2.1 16-May-2007  jdc Pull up revision 1.32 (requested by tsutsui in ticket #640).

Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.32.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.32.10.2 09-Jan-2008  matt sync with HEAD
 1.32.10.1 06-Nov-2007  matt sync with HEAD
 1.32.8.4 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.32.8.3 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.32.8.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.8.1 05-Oct-2007  joerg Remove the power management nonsense in the PCI versions of
rtk(4) and re(4). It is not really likely to work anyway.
Use PNP power management for the cardbus attachment as well and
remove the power management handlers from the chipset code.
 1.33.6.1 11-Dec-2007  yamt sync with head.
 1.33.4.1 26-Dec-2007  ad Sync with head.
 1.34.10.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.6.1 27-Jun-2008  simonb Sync with head.
 1.36.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.2.4 11-Aug-2010  yamt sync with head.
 1.36.2.3 11-Mar-2010  yamt sync with head
 1.36.2.2 16-Sep-2009  yamt sync with head
 1.36.2.1 04-May-2009  yamt sync with head.
 1.39.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.39.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.44.2.1 05-Mar-2011  rmind sync with head
 1.46.6.1 18-Feb-2012  mrg merge to -current.
 1.46.2.1 17-Apr-2012  yamt sync with head
 1.47.24.1 06-Jun-2015  skrll Sync with HEAD
 1.47.6.1 03-Dec-2017  jdolecek update from HEAD
 1.46 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.45 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.44 21-Nov-2013  riz branches: 1.44.6;
Expand "#ifdef notyet" section to encompass the use of the variable
declared within.
 1.43 17-Oct-2013  christos move notyet variable into notyet section
 1.42 01-Aug-2011  drochner branches: 1.42.2; 1.42.12; 1.42.16;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.41 26-Jul-2011  dyoung Replace anonymous constants, 0x10, 0x14, ..., with PCI_BAR(0),
PCI_BAR(1), .... There was no change in the generated assembly. I used
this semantic patch:

@ mapsit @
identifier bar;
expression pact;
@@

(
pci_mapreg_map
|
Cardbus_mapreg_map
)(pact, bar, ...)

@ depends on mapsit @
identifier mapsit.bar;
@@
(
- #define bar 0x10
+ #define bar PCI_BAR(0)
|
- #define bar 0x14
+ #define bar PCI_BAR(1)
|
- #define bar 0x18
+ #define bar PCI_BAR(2)
|
- #define bar 0x1C
+ #define bar PCI_BAR(3)
|
- #define bar 0x20
+ #define bar PCI_BAR(4)
)
 1.40 05-Mar-2010  dyoung Simplify this a bit (and reduce differences with if_rtw_pci.c): we
don't have to save the base address or write it to the BAR.
 1.39 04-Mar-2010  dyoung Remove unnecessary #ifdef INET-enclosed #includes.

This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.
 1.38 26-Feb-2010  dyoung Introduce Cardbus_intr_establish(cardbus_devfunc_t, ...) and
Cardbus_intr_disestablish(cardbus_devfunc_t, ...) and start using them.
 1.37 25-Feb-2010  dyoung Use PCI_ constants instead of CARDBUS_ constants. Use Cardbus_conf_*()
functions instead of cardbus_conf_*() functions to simplify some
code.
 1.36 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t are
interchangeable, so just use pcitag_t. Ditto pcireg_t and cardbusreg_t.

Poison new uses of cardbusreg_t and cardbustag_t by deleting the type
definitions.
 1.35 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.34 18-Jan-2010  pooka branches: 1.34.2;
Remove conditional inclusion of unused bpf.h
 1.33 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.32 19-Oct-2009  rmind Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
 1.31 16-Sep-2009  dyoung In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together. Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
#include it from <sys/pmf.h> instead of <sys/device.h> to break the
circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
suspend/resume call. Start to replace instances of PMF_FN_PROTO,
PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
device in suspension. More than one suspensor may hold a device
at once. A device stays suspended as long as at least one
suspensor holds it. A device resumes when the last suspensor
releases it.

Currently, the kernel defines three suspensors,

3a the system-suspensor: for system suspension, initiated
by 'sysctl -w machdep.sleep_state=3', by lid closure, by
power-button press, et cetera,

3b the drvctl-suspensor: for device suspension by /dev/drvctl
ioctl, e.g., drvctl -S sip0.

3c the system self-suspensor: for device drivers that suspend
themselves and their children. Several drivers for network
interfaces put the network device to sleep while it is not
administratively up, that is, after the kernel calls if_stop(,
1). The self-suspensor should not be used directly. See
the description of suspensor delegates, below.

A suspensor can have one or more "delegates". A suspensor can
release devices that its delegates hold suspended. Right now,
only the system self-suspensor has delegates. For each device
that a self-suspending driver attaches, it creates the device's
self-suspensor, a delegate of the system self-suspensor.

Suspensors stop a system-wide suspend/resume cycle from waking
devices that the operator put to sleep with drvctl before the cycle.
They also help self-suspension to work more simply, safely, and in
accord with expectations.

4. Add the notion of device activation level, devact_level_t,
and a routine for checking the current activation level,
device_activation(). Current activation levels are DEVACT_LEVEL_BUS,
DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
indicate that the device's bus is active, that the bus and device are
active, and that the bus, device, and the functions of the device's
class (network, audio) are active.

Suspend/resume calls can be qualified with a devact_level_t.
The power-management framework treats a devact_level_t that
qualifies a device suspension as the device's current activation
level; it only runs hooks to reduce the activation level from
the presumed current level to the fully suspended state. The
framework treats a devact_level_t qualifying device resumption
as the target activation level; it only runs hooks to raise the
activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
drivers.

6. Temporarily add an unused power-management workqueue that I will
remove or replace, soon.
 1.30 05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.29 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.28 06-Feb-2009  dyoung branches: 1.28.2;
Disable and acknowledge Function Events, and stop installing a
handler for them.
 1.27 24-Jun-2008  drochner branches: 1.27.4;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.26 14-May-2008  dyoung branches: 1.26.2;
Match printf argument type (uintmax_t) to format string (PRIuMAX).
 1.25 30-Apr-2008  ad branches: 1.25.2;
Make various bits of debug code compile again.
 1.24 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.23 12-Mar-2008  dyoung branches: 1.23.2; 1.23.4;
Use device_t and its accessors throughout. Use aprint_*_dev().

Improve PMF-ability.

Add a 'flags' argument to suspend/resume handlers and
callers such as pmf_system_suspend().

Define a flag, PMF_F_SELF, which indicates to PMF that a
device is suspending/resuming itself. Add helper routines,
pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
that call pmf_device_suspend(dev, PMF_F_SELF) and
pmf_device_resume(dev, PMF_F_SELF), respectively. Use
PMF_F_SELF to suspend/resume self in ath(4), audio(4),
rtw(4), and sip(4).

In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
callbacks, provided by the bus front-end, with
self-suspension/resumption. Also, clean up the bus
front-ends. Make sure that the interrupt handler is
disestablished during suspension. Get rid of driver-private
flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
device_is_active()/device_has_power() calls, instead.

In the network-class suspend handler, call if_stop(, 0)
instead of if_stop(, 1), because the latter is superfluous
(bus- and driver-suspension hooks will 'disable' the NIC),
and it may cause recursion.

In the network-class resume handler, prevent infinite
recursion through if_init() by getting out early if we are
self-suspending (PMF_F_SELF).

rtw(4) improvements:

Destroy rtw(4) callouts when we detach it. Make rtw at
pci detachable. Print some more information with the "rx
frame too long" warning.

Remove activate() methods:

Get rid of rtw_activate() and ath_activate(). The device
activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

Introduce a boolean device property, "pmf-powerdown". If
pmf-powerdown is present and false, it indicates that a
bus back-end should not remove power from a device.

Honor this property in cardbus_child_suspend().

Set this property to 'false' in ath_attach(), since removing
power from an ath at cardbus seems to lobotomize the WPA
crypto engine. XXX Should the pmf-powerdown property
propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

Warn if ath(4) tries to write crypto keys to suspended
hardware.

Reduce differences between FreeBSD and NetBSD in ath(4)
multicast filter setup.

Make ath_printrxbuf() print an rx descriptor's status &
key index, to help debug crypto errors.

Shorten a staircase in ath_ioctl(). Don't check for
ieee80211_ioctl() return code ERESTART, it never happens.
 1.22 08-Jan-2008  dyoung branches: 1.22.2; 1.22.6;
After rtw_attach() is called, the hardware has been powered down,
so don't fiddle with the Function Event Registers.
 1.21 21-Dec-2007  dyoung Do not embed a struct device in rtw_softc any longer. Register
both pci and cardbus attachments with CFATTACH_DECL_NEW(). Access
the softc through the device_t using device_private().

While I'm here, change a couple of KASSERT()s about the Rx buffer
length to a warning.
 1.20 16-Dec-2007  dyoung Synchronize device detachment with network interrupts. Use the
pmf network class instead of powerhooks.
 1.19 09-Dec-2007  jmcneill branches: 1.19.2;
Merge jmcneill-pm branch.
 1.18 16-Nov-2007  dyoung branches: 1.18.2; 1.18.4;
Cosmetic changes: Join some lines. Remove superfluous parentheses
and braces. Change a variable name. Add #if 0'd cardbus_conf_capture()
and cardbus_conf_restore() calls for future reference.
 1.17 16-Nov-2007  dyoung Use cardbus_setpowerstate() instead of rolling our own.

Let the Cardbus bridge driver set our Latency Timer, but round down
to the nearest multiple of 0x10, since the RTL8180 datasheet may
be trying to tell us that is necessary.

Activate Parity & System Error reporting.

Use a more meaningful variable name, reg -> csr.
 1.16 19-Oct-2007  ad branches: 1.16.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__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 07-Sep-2006  dogcow branches: 1.13.2; 1.13.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.12 05-Jun-2006  martin Add D-Link DWL-610
 1.11 28-Apr-2006  rpaulo branches: 1.11.2;
ANSIfy.
 1.10 29-Mar-2006  thorpej Use device_private().
 1.9 29-Dec-2005  dyoung branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
The RTL8180L works better with a PCI Latency Timer of 0x50 than
with 0x20. Derived from a reference driver, IIRC.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 22-Jun-2005  dyoung branches: 1.7.2;
Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD. Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]). Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
 1.6 27-Feb-2005  perry nuke trailing whitespace
 1.5 25-Dec-2004  dyoung branches: 1.5.2; 1.5.4;
Change rtw_debug from a debug level to a debug mask. Add a lot of
debug flags.

From Linux: handle an RTL8180 bug. Sometimes the NIC skips from
the middle of the ring to the 0th rx descriptor. Now the driver
resynchronizes.

Handle a receive descriptor underrun or Rx FIFO overflow condition
in the way that the Linux driver does. This kind of seems like
overkill, but whatever.

Protect rtw_ioctl with splnet().

Do not load a tx descriptor with a buffer shorter than 4 bytes.

Handle a transmit timeout less disruptively.
 1.4 20-Dec-2004  dyoung Don't be so noisy at boot unless debugging is enabled.
 1.3 07-Dec-2004  jdarrow Add the Belkin F5D6020v3 to the match array for rtw.

My card now probes as:
rtw0 at cardbus1 dev 0 function 0: Belkin F5D5020v3 802.11b (RTL8180 MAC/BBP)
rtw0: rtw_cardbus_attach mapped 512 bytes mem space
rtw0: interrupting at 10
rtw0: hardware version D
rtw0: SROM version 1.2
rtw0: RF: Philips SA2400A, PA: Philips SA2411
rtw0: Geographic Location USA
rtw0: 802.11 address 00:30:bd:4d:ed:de
rtw0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mb

XXX The driver still doesn't actually _work_...
 1.2 09-Oct-2004  mycroft branches: 1.2.2;
Fix printf() warnings.
 1.1 26-Sep-2004  dyoung Add Cardbus, PCI bus front-ends for RTL8180 802.11b MAC/baseband.
 1.2.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.2.2.3 18-Dec-2004  skrll Sync with HEAD.
 1.2.2.2 19-Oct-2004  skrll Sync with HEAD
 1.2.2.1 09-Oct-2004  skrll file if_rtw_cardbus.c was added on branch ktrace-lwp on 2004-10-19 15:56:45 +0000
 1.5.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.2.1 29-Apr-2005  kent sync with -current
 1.7.2.6 17-Mar-2008  yamt sync with head.
 1.7.2.5 21-Jan-2008  yamt sync with head
 1.7.2.4 07-Dec-2007  yamt sync with head
 1.7.2.3 27-Oct-2007  yamt sync with head.
 1.7.2.2 30-Dec-2006  yamt sync with head.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.9.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.9.10.2 11-May-2006  elad sync with head
 1.9.10.1 19-Apr-2006  elad sync with head.
 1.9.8.4 14-Sep-2006  yamt sync with head.
 1.9.8.3 26-Jun-2006  yamt sync with head.
 1.9.8.2 24-May-2006  yamt sync with head.
 1.9.8.1 01-Apr-2006  yamt sync with head.
 1.9.6.3 07-Jun-2006  kardel Sync with head.
 1.9.6.2 01-Jun-2006  kardel Sync with head.
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.11.2.1 19-Jun-2006  chap Sync with head.
 1.13.4.2 10-Dec-2006  yamt sync with head.
 1.13.4.1 22-Oct-2006  yamt sync with head
 1.13.2.1 18-Nov-2006  ad Sync with head.
 1.15.28.2 18-Nov-2007  bouyer Sync with HEAD
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.3 23-Mar-2008  matt sync with HEAD
 1.15.24.2 09-Jan-2008  matt sync with HEAD
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.2 21-Nov-2007  joerg Sync with HEAD.
 1.15.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.16.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.16.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.4.1 11-Dec-2007  yamt sync with head.
 1.18.2.1 26-Dec-2007  ad Sync with head.
 1.19.2.2 08-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.22.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.22.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.22.2.1 24-Mar-2008  keiichi sync with head.
 1.23.4.5 11-Mar-2010  yamt sync with head
 1.23.4.4 16-Sep-2009  yamt sync with head
 1.23.4.3 16-May-2009  yamt sync with head
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.25.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.2.1 27-Jun-2008  simonb Sync with head.
 1.27.4.1 03-Mar-2009  skrll Sync with HEAD.
 1.28.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.42.16.1 18-May-2014  rmind sync with head
 1.42.12.2 03-Dec-2017  jdolecek update from HEAD
 1.42.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.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.44.6.1 09-Jul-2016  skrll Sync with HEAD
 1.72 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.71 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.70 01-Aug-2011  drochner branches: 1.70.12; 1.70.30;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.69 26-Jul-2011  dyoung Replace anonymous constants, 0x10, 0x14, ..., with PCI_BAR(0),
PCI_BAR(1), .... There was no change in the generated assembly. I used
this semantic patch:

@ mapsit @
identifier bar;
expression pact;
@@

(
pci_mapreg_map
|
Cardbus_mapreg_map
)(pact, bar, ...)

@ depends on mapsit @
identifier mapsit.bar;
@@
(
- #define bar 0x10
+ #define bar PCI_BAR(0)
|
- #define bar 0x14
+ #define bar PCI_BAR(1)
|
- #define bar 0x18
+ #define bar PCI_BAR(2)
|
- #define bar 0x1C
+ #define bar PCI_BAR(3)
|
- #define bar 0x20
+ #define bar PCI_BAR(4)
)
 1.68 09-Jul-2011  christos - add a routine to get the name of the card.
 1.67 10-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.
 1.66 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.65 26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.64 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.63 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.62 18-Jan-2010  pooka branches: 1.62.2;
Remove conditional inclusion of unused bpf.h
 1.61 17-Apr-2009  cegger device_t/softc split. Tested with tlp at pci
 1.60 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.59 24-Jun-2008  drochner branches: 1.59.4; 1.59.10;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.58 28-Apr-2008  martin branches: 1.58.2; 1.58.4;
Remove clause 3 and 4 from TNF licenses
 1.57 06-Apr-2008  cegger branches: 1.57.2; 1.57.4;
use aprint_*_dev and device_xname
 1.56 06-Feb-2008  dyoung branches: 1.56.6;
On a tlp@cardbus, don't set the Tx FIFO threshold to "store &
forward" mode, but let the driver automatically adjust.

Cardbus is not actually so slow that it cannot keep up with the
NIC. It may sometimes have appeared so because we had not enabled
PCI read bursts. These days, though, we enable read bursts on at
least one TI PCI-Cardbus bridge.
 1.55 09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.54 19-Oct-2007  ad branches: 1.54.2; 1.54.4; 1.54.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.53 16-Nov-2006  christos branches: 1.53.8; 1.53.22; 1.53.24; 1.53.28;
__unused removal on arguments; approved by core.
 1.52 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.51 07-Sep-2006  dogcow branches: 1.51.2; 1.51.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.50 21-Jul-2006  gdamore Update ADMtek pci device ids to match data sheets. While here, add the 9513
device (although I've never seen one, I have a datasheet for it. :-)
 1.49 29-Mar-2006  thorpej Use device_private().
 1.48 11-Dec-2005  christos branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
merge ktrace-lwp.
 1.47 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.46 13-Jun-2005  tron branches: 1.46.2;
Add support for the LinkSys PCMPC200 Cardbus ethernet card.
 1.45 27-Feb-2005  perry branches: 1.45.2;
nuke trailing whitespace
 1.44 04-Feb-2005  perry de-__P
 1.43 02-Aug-2004  mycroft branches: 1.43.4; 1.43.6;
3 things:
* cardbusdevs -> pcidevs
* Add a Microsoft product.
* Use tlp_cardbus_{disable,enable}() in the powerhook. This is an experiment
and may need more work.
 1.42 22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.41 09-May-2004  jonathan Remove now-unused 'int pmreg'.
 1.40 08-May-2004  christos Cleanup and remove suplicate copies of the incorrect power setup code.
Thanks to mycroft for suggesting this.
XXX: This is a copy of the pci code; another reason cardbus needs to die.
 1.39 24-Oct-2003  mycroft + NetGear FA511
 1.38 11-Nov-2002  onoe branches: 1.38.6;
Add support of AboCom FE2500MX 10/100 Ethernet (Lanneed LD-CBL/TX).
 1.37 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.36 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.35 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.34 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.33 14-Apr-2002  mycroft Snarf-and-barf the `quirk' code from if_tlp_pci.c, and use it to set the right
mediasw (MII-over-SIO) on the Level One FPC-0101TX 10/100 card.
XXX This should probably key off subsystem IDs, not OUIs...
 1.32 17-Feb-2002  augustss Add another tlp card (found by trial and error).
 1.31 13-Nov-2001  lukem add RCSID
 1.30 18-Jul-2001  thorpej Slight tweak to previous; C requires a statement after a label.
 1.29 18-Jul-2001  onoe revert 2 of 3 in previous commit.
empty default is needed to make gcc happy.
 1.28 17-Jul-2001  mrg remove empty default: cases.
 1.27 13-Apr-2001  kanaoka branches: 1.27.2;
Add support for ADMtek AN985.
 1.26 14-Mar-2001  christos PR/12405: Wolfgang Rupprecht: Add another abocom card (linksys pcm200)
 1.25 16-Jan-2001  thorpej branches: 1.25.2;
Add support for AN985-based CardBus network interfaces.
From Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>.
 1.24 04-Apr-2000  thorpej branches: 1.24.4; 1.24.6;
Rearrange the 21142/21143 SROM/CIS handling code to give it a chance
of working, and last-ditch default to MII-over-SIO with no reset routine
if we don't find an ISV SROM or quirk.
 1.23 04-Apr-2000  thorpej - if_tlp_cardbus.c: Use the `pmreg' pointer passed by by
cardbus_get_capability() [mirror change already made to if_tlp_pci.c]
- if_tlp_cardbus.c: If we don't find an ISV SROM, try to grab the
Ethernet address from the CIS.
- if_tlp_cardbus.c: set CardBus cards to store-and-forward mode from
the get-go.
- Put the TxThresh tables in tulipvar.h, and use them in the CardBus
and PCI front-ends to go to store-and-forward mode.
- Document the Xircom X3201-3 clone a little more.
 1.22 22-Mar-2000  thorpej In tlp_cardbus_detach(), only unmap the bus space if we were able to
map it in the first place. Pointed out by enami@netbsd.org.
 1.21 19-Mar-2000  thorpej Add suspend/resume hooks to ensure that the chip doesn't scramble memory
after an APM suspend and is unsnoozed after an APM resume.
 1.20 15-Mar-2000  thorpej Add power management support to the `tlp' driver. The battery on my
laptop lasts a whole lot longer now.
 1.19 14-Mar-2000  thorpej Pick I/O before Memory space.
 1.18 10-Mar-2000  thorpej Move pretty much all of the PCI configuration goo into a separate
function.
 1.17 10-Mar-2000  thorpej Pull the code that take the Tulip out of powersave mode into a separate
function.
 1.16 07-Mar-2000  thorpej Reenable the code that clears SLEEP and SNOOZE from the CFDA register.
 1.15 07-Mar-2000  mycroft A few things:
* Take advantage of the tulip_read_srom() changes.
* Don't frob the so-called `CFDA' register. We're really looking for the
PMCSR, which is in a different location anyway.
* Don't panic if we detach an interface for which we never called tlp_attach().
 1.14 01-Mar-2000  thorpej Cosmetic change.
 1.13 04-Feb-2000  augustss Make the driver work even if DIAGNOSTIC is not set.
 1.12 04-Feb-2000  haya Now cardbus_mapreg_unmap() has been implemented in
sys/dev/cardbus/cardbus_map.c. The detech function in
sys/dev/cardbus/if_tlp_cardbus.c uses cardbus_mapreg_unmap().
 1.11 01-Feb-2000  thorpej First cut at detach support; doens't fully work yet.
 1.10 25-Jan-2000  thorpej Add support for the Xircom X3201-3 in 21143 emulation mode. This chip
appears on some Xircom and Intel RealPort(tm) cards.

From Rafal Boni, with some slight modifications from me.
 1.9 25-Jan-2000  thorpej Add a chip type for the Xircom X3201-3, and centralize the declaration
of the chip names array.
 1.8 25-Jan-2000  mycroft Do a CARDBUS_BM_ENABLE just to be sure.
 1.7 25-Jan-2000  thorpej Make sure the latency timer is set to a reasonable value.

From Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>.
 1.6 11-Dec-1999  thorpej branches: 1.6.2;
Handle the 21143 PMCSR, like we do in the PCI front-end.
 1.5 11-Dec-1999  thorpej - Don't try to run the chip in big-endian mode. Not all chips support
this consistently, and it doesn't always work even when the chip
supports it.
- Make sure things DMA'd to the chip that the chip interprets are in
little-endian mode.
 1.4 07-Dec-1999  thorpej After reading the 21143 manual again, make sure SNOOZE is cleared in
the CFDA register, too.
 1.3 07-Dec-1999  thorpej Add the 21143 PMCSR offset, from Masanori Kanaoka.
 1.2 07-Dec-1999  thorpej Make sure to bring the chip out of sleep mode. From Masanori Kanaoka.
 1.1 19-Nov-1999  thorpej Add a basic CardBus front-end for the `tlp' driver. Still more work to do.
 1.6.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.6.5 21-Apr-2001  bouyer Sync with HEAD
 1.24.6.4 27-Mar-2001  bouyer Sync with HEAD.
 1.24.6.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.24.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.24.6.1 04-Apr-2000  bouyer file if_tlp_cardbus.c was added on branch thorpej_scsipi on 2000-11-20 11:39:54 +0000
 1.24.4.1 29-Jan-2002  he Pull up revisions 1.25-1.27 (requested by dillo):
Add support for AN985-based CardBus network interfaces.
 1.25.2.8 11-Nov-2002  nathanw Catch up to -current
 1.25.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.25.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.25.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.25.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.25.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.25.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.25.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.27.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.27.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.27.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.27.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.1 03-Aug-2001  lukem update to -current
 1.38.6.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.38.6.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.38.6.5 04-Feb-2005  skrll Sync with HEAD.
 1.38.6.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.38.6.3 18-Sep-2004  skrll Sync with HEAD.
 1.38.6.2 12-Aug-2004  skrll Sync with HEAD.
 1.38.6.1 03-Aug-2004  skrll Sync with HEAD
 1.43.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.43.6.1 12-Feb-2005  yamt sync with head.
 1.43.4.1 29-Apr-2005  kent sync with -current
 1.45.2.1 18-Jun-2005  riz Pull up revision 1.46 (requested by tron in ticket #450):
Add support for the LinkSys PCMPC200 Cardbus ethernet card.
 1.46.2.5 11-Feb-2008  yamt sync with head.
 1.46.2.4 21-Jan-2008  yamt sync with head
 1.46.2.3 27-Oct-2007  yamt sync with head.
 1.46.2.2 30-Dec-2006  yamt sync with head.
 1.46.2.1 21-Jun-2006  yamt sync with head.
 1.48.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.48.10.1 19-Apr-2006  elad sync with head.
 1.48.8.3 14-Sep-2006  yamt sync with head.
 1.48.8.2 11-Aug-2006  yamt sync with head
 1.48.8.1 01-Apr-2006  yamt sync with head.
 1.48.6.1 22-Apr-2006  simonb Sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.51.4.2 10-Dec-2006  yamt sync with head.
 1.51.4.1 22-Oct-2006  yamt sync with head
 1.51.2.1 18-Nov-2006  ad Sync with head.
 1.53.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.53.24.3 23-Mar-2008  matt sync with HEAD
 1.53.24.2 09-Jan-2008  matt sync with HEAD
 1.53.24.1 06-Nov-2007  matt sync with HEAD
 1.53.22.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.53.22.1 23-Aug-2007  joerg Provide cardbus_{set,get}_powerstate instead of the former
cardbus_powerstate / cardbus_setpowerstate.
Provide cardbus_conf_{capture,restore} and cardbus_net_generic_power.

In general: reduce diff to PCI.
 1.53.8.1 23-Oct-2007  ad Sync with head.
 1.54.6.1 11-Dec-2007  yamt sync with head.
 1.54.4.1 26-Dec-2007  ad Sync with head.
 1.54.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.56.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.56.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.4.3 11-Mar-2010  yamt sync with head
 1.57.4.2 04-May-2009  yamt sync with head.
 1.57.4.1 16-May-2008  yamt sync with head.
 1.57.2.1 18-May-2008  yamt sync with head.
 1.58.4.1 27-Jun-2008  simonb Sync with head.
 1.58.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.59.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.59.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.62.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.70.30.1 05-Oct-2016  skrll Sync with HEAD
 1.70.12.1 03-Dec-2017  jdolecek update from HEAD
 1.15 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.14 21-Feb-2011  itohy Cleanup my copyright notice.
 1.13 11-Mar-2010  dyoung branches: 1.13.2; 1.13.4; 1.13.6;
Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by ITOH Yasufumi. Results: njs(4) works, njata(4) hangs.
njata(4) also hangs in 5.0.1 and in 5.99.24 prior to this patch, so
there is no regression.
 1.12 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.11 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.10 25-Feb-2010  dyoung Phase out some CardBus constants and types. Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG -> PCI_CLASS_REG
CARDBUS_ID_REG -> PCI_ID_REG
cardbus_product_id_t -> pci_product_id_t
cardbus_vendor_id_t -> pci_vendor_id_t
 1.9 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.8 12-May-2009  cegger branches: 1.8.2;
struct device * -> device_t, no functional changes intended.
 1.7 24-Jun-2008  drochner branches: 1.7.10;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.6 18-Mar-2008  cube branches: 1.6.4; 1.6.6; 1.6.8;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.5 19-Oct-2007  ad branches: 1.5.12; 1.5.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.4 31-Dec-2006  ichiro branches: 1.4.6; 1.4.18; 1.4.20; 1.4.24;
add entry CF32A CF Adapter (BUFFALO RCF-CBA2)
 1.3 16-Nov-2006  christos branches: 1.3.4;
__unused removal on arguments; approved by core.
 1.2 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.1 07-Sep-2006  itohy branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Workbit NinjaATA-32 busmastering PIO IDE controller driver (njata)

This driver supports NinjaATA-32Bi and NPATA-32 chips,
which are used for CardBus ATA interface cards and
CardBus CompactFlash adapters.
 1.1.8.2 10-Dec-2006  yamt sync with head.
 1.1.8.1 22-Oct-2006  yamt sync with head
 1.1.6.2 14-Sep-2006  yamt sync with head.
 1.1.6.1 07-Sep-2006  yamt file njata_cardbus.c was added on branch yamt-pdpolicy on 2006-09-14 12:31:27 +0000
 1.1.4.2 09-Sep-2006  rpaulo sync with head
 1.1.4.1 07-Sep-2006  rpaulo file njata_cardbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:44 +0000
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 18-Nov-2006  ad Sync with head.
 1.3.4.5 24-Mar-2008  yamt sync with head.
 1.3.4.4 27-Oct-2007  yamt sync with head.
 1.3.4.3 26-Feb-2007  yamt sync with head.
 1.3.4.2 30-Dec-2006  yamt sync with head.
 1.3.4.1 16-Nov-2006  yamt file njata_cardbus.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:57 +0000
 1.4.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.20.2 23-Mar-2008  matt sync with HEAD
 1.4.20.1 06-Nov-2007  matt sync with HEAD
 1.4.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.4.6.1 23-Oct-2007  ad Sync with head.
 1.5.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.5.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.12.1 24-Mar-2008  keiichi sync with head.
 1.6.8.1 27-Jun-2008  simonb Sync with head.
 1.6.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.4.4 11-Aug-2010  yamt sync with head.
 1.6.4.3 11-Mar-2010  yamt sync with head
 1.6.4.2 16-May-2009  yamt sync with head
 1.6.4.1 04-May-2009  yamt sync with head.
 1.7.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.6.1 05-Mar-2011  bouyer Sync with HEAD
 1.13.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.2.1 05-Mar-2011  rmind sync with head
 1.18 11-Jul-2016  msaitoh KNF. No functional change.
 1.17 01-Aug-2011  drochner branches: 1.17.12; 1.17.30;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.16 11-Mar-2010  dyoung Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by ITOH Yasufumi. Results: njs(4) works, njata(4) hangs.
njata(4) also hangs in 5.0.1 and in 5.99.24 prior to this patch, so
there is no regression.
 1.15 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.14 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.13 25-Feb-2010  dyoung Phase out some CardBus constants and types. Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG -> PCI_CLASS_REG
CARDBUS_ID_REG -> PCI_ID_REG
cardbus_product_id_t -> pci_product_id_t
cardbus_vendor_id_t -> pci_vendor_id_t
 1.12 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.11 12-May-2009  cegger branches: 1.11.2;
struct device * -> device_t, no functional changes intended.
 1.10 09-Jul-2008  joerg branches: 1.10.8;
- device/softc split
 1.9 24-Jun-2008  drochner branches: 1.9.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.8 28-Apr-2008  martin branches: 1.8.2; 1.8.4;
Remove clause 3 and 4 from TNF licenses
 1.7 06-Apr-2008  cegger branches: 1.7.2; 1.7.4;
use aprint_*_dev and device_xname
 1.6 19-Oct-2007  ad branches: 1.6.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.5 16-Nov-2006  christos branches: 1.5.8; 1.5.22; 1.5.24; 1.5.28;
__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 11-Dec-2005  christos branches: 1.3.20; 1.3.22;
merge ktrace-lwp.
 1.2 26-Aug-2004  thorpej branches: 1.2.2; 1.2.4; 1.2.6; 1.2.18;
Use ANSI function decls, more static.
 1.1 26-Aug-2004  itohy Workbit NinjaSCSI-32 PCI/CardBus SCSI driver (njs)
 1.2.18.2 27-Oct-2007  yamt sync with head.
 1.2.18.1 30-Dec-2006  yamt sync with head.
 1.2.6.2 11-Nov-2004  he Pull up revisions 1.1-1.2 (new, via patch, requested by itohy in ticket #1741):
Add support for the Workbit NinjaSCSI-32 PCI/Cardbus
SCSI driver, njs(4).
 1.2.6.1 26-Aug-2004  he file njs_cardbus.c was added on branch netbsd-1-6 on 2004-11-11 23:17:29 +0000
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Sep-2004  skrll Sync with HEAD
 1.2.4.1 26-Aug-2004  skrll file njs_cardbus.c was added on branch ktrace-lwp on 2004-09-03 12:45:17 +0000
 1.2.2.4 30-Aug-2004  tron Apply patch (requested by itohy in ticket #800):
Undo the unification of pcidevs and cardbusdevs done in NetBSD-current.
 1.2.2.3 30-Aug-2004  tron Pull up revision 1.2 (requested by itohy in ticket #800):
Use ANSI function decls, more static.
 1.2.2.2 30-Aug-2004  tron Pull up revision 1.1 (requested by itohy in ticket #800):
Workbit NinjaSCSI-32 PCI/CardBus SCSI driver (njs)
 1.2.2.1 26-Aug-2004  tron file njs_cardbus.c was added on branch netbsd-2-0 on 2004-08-30 09:24:58 +0000
 1.3.22.2 10-Dec-2006  yamt sync with head.
 1.3.22.1 22-Oct-2006  yamt sync with head
 1.3.20.1 18-Nov-2006  ad Sync with head.
 1.5.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.5.24.1 06-Nov-2007  matt sync with HEAD
 1.5.22.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.5.8.1 23-Oct-2007  ad Sync with head.
 1.6.16.3 28-Sep-2008  mjf Sync with HEAD.
 1.6.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.4.5 11-Aug-2010  yamt sync with head.
 1.7.4.4 11-Mar-2010  yamt sync with head
 1.7.4.3 16-May-2009  yamt sync with head
 1.7.4.2 04-May-2009  yamt sync with head.
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.8.4.2 18-Jul-2008  simonb Sync with head.
 1.8.4.1 27-Jun-2008  simonb Sync with head.
 1.8.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.2.1 19-Oct-2008  haad Sync with HEAD.
 1.10.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.30.1 05-Oct-2016  skrll Sync with HEAD
 1.17.12.1 03-Dec-2017  jdolecek update from HEAD
 1.47 31-Mar-2025  riastradh ohci(4): Rework detach logic and justify the ordering.

Handle failed attach when we detach.

This changes the signature of the ohci_detach function, but it is
only ever used by statically linked ohci bus attachments, never by
modules so far, so no kernel revbump.

PR port-amd64/59180: System reboots instead of shutting down
 1.46 07-Aug-2021  thorpej branches: 1.46.12;
Merge thorpej-cfargs2.
 1.45 24-Apr-2021  thorpej branches: 1.45.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.44 09-Apr-2018  jakllsch branches: 1.44.18;
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.43 14-Jul-2016  msaitoh branches: 1.43.16;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.42 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.41 23-Apr-2016  skrll 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.40 21-Sep-2014  christos branches: 1.40.2;
remove more old pci_findvendor code
 1.39 01-Aug-2011  drochner branches: 1.39.12; 1.39.28; 1.39.32;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.38 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.37 24-May-2010  pgoyette Update all callers of the pci_find{vendor,product} routines to now call
these routines through their global pointers.
 1.36 10-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.
 1.35 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.34 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.33 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.32 12-May-2009  cegger branches: 1.32.2;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.31 11-Jul-2008  dyoung branches: 1.31.8;
Don't write a memory-mapped register on the device until PCI memory
access has been enabled on both the bus bridge and on the device.
 1.30 24-Jun-2008  drochner branches: 1.30.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.29 28-Apr-2008  martin branches: 1.29.2; 1.29.4;
Remove clause 3 and 4 from TNF licenses
 1.28 09-Apr-2008  skd branches: 1.28.2; 1.28.4;
Fix small error in device/sc splitup.
 1.27 28-Mar-2008  drochner 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.26 07-Mar-2008  dyoung Use device_t and accessors.

In ohci_{pci,cardbus}_attach, do not get the device_t by casting
the softc to void *, but use `self' instead.
 1.25 07-Mar-2008  dyoung Register the shutdown hook using pmf_device_register1().
 1.24 19-Oct-2007  ad branches: 1.24.12; 1.24.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 16-Nov-2006  christos branches: 1.23.8; 1.23.18; 1.23.24; 1.23.26; 1.23.30;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 11-Dec-2005  christos branches: 1.21.20; 1.21.22;
merge ktrace-lwp.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 02-Aug-2004  mycroft branches: 1.19.4; 1.19.6;
cardbusdevs -> pcidevs
 1.18 02-Aug-2004  mycroft Adapt to pci_findvendor() change.
 1.17 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.16 22-Apr-2004  itojun sprintf -> snprintf
 1.15 11-Mar-2003  drochner branches: 1.15.2;
make a kernel with the combination ohci@cardbus + ehci@pci link
 1.14 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.13 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 13-Nov-2001  lukem add RCSID
 1.10 06-Nov-2001  augustss ehci can attach to cardbus too.
 1.9 09-May-2001  augustss branches: 1.9.2; 1.9.6;
Ansify a function I forgot last time.
 1.8 09-May-2001  augustss Ansify.
 1.7 27-Apr-2000  augustss branches: 1.7.6;
Change my email address.
 1.6 25-Apr-2000  augustss Move the size of the mapped bus_space region into the bus independent softc.
 1.5 07-Mar-2000  mycroft Do a CARDBUS_BM_ENABLE to be sure.
 1.4 01-Mar-2000  thorpej When unmapping these on detach, pass the BAR to unmap (not the type of
the BAR!!)
 1.3 04-Feb-2000  augustss Update for cardbus unmap changes.
 1.2 27-Oct-1999  haya branches: 1.2.4;
Change cardbus API. The first argument of cardbus_mapreg_map() is
changed to struct cardbus_softc * from cardbus_devfunc_t. The old
function is renamed to Cardbus_mapreg_map().
 1.1 15-Oct-1999  augustss branches: 1.1.2; 1.1.4;
Add USB OHCI attachment to cardbus.
XXX There seems to be some interrupt problem.
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.7.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.7.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.9.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.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.20.4.3 17-Mar-2008  yamt sync with head.
 1.20.4.2 27-Oct-2007  yamt sync with head.
 1.20.4.1 30-Dec-2006  yamt sync with head.
 1.21.22.2 10-Dec-2006  yamt sync with head.
 1.21.22.1 22-Oct-2006  yamt sync with head
 1.21.20.1 18-Nov-2006  ad Sync with head.
 1.23.30.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.26.2 23-Mar-2008  matt sync with HEAD
 1.23.26.1 06-Nov-2007  matt sync with HEAD
 1.23.24.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.23.18.1 22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.23.8.1 23-Oct-2007  ad Sync with head.
 1.24.16.4 28-Sep-2008  mjf Sync with HEAD.
 1.24.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.24.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.24.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.24.12.1 24-Mar-2008  keiichi sync with head.
 1.28.4.4 11-Mar-2010  yamt sync with head
 1.28.4.3 16-May-2009  yamt sync with head
 1.28.4.2 04-May-2009  yamt sync with head.
 1.28.4.1 16-May-2008  yamt sync with head.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.29.4.2 18-Jul-2008  simonb Sync with head.
 1.29.4.1 27-Jun-2008  simonb Sync with head.
 1.29.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.2.1 19-Oct-2008  haad Sync with HEAD.
 1.31.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.39.32.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.39.28.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.39.12.1 03-Dec-2017  jdolecek update from HEAD
 1.40.2.5 05-Oct-2016  skrll Sync with HEAD
 1.40.2.4 09-Jul-2016  skrll Sync with HEAD
 1.40.2.3 05-Dec-2014  skrll Use int for return type for [eou]chi_init and motg_init.
 1.40.2.2 05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.40.2.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.43.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.44.18.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.45.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.46.12.1 02-Aug-2025  perseant Sync with HEAD
 1.4 18-Feb-2000  soren Remove redundant CIS definitions.
 1.3 15-Dec-1999  kleink branches: 1.3.2;
Normalize symbol names used for multiple inclusion protection.
 1.2 15-Oct-1999  haya branches: 1.2.2;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.3.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.28 15-Dec-2009  snj branches: 1.28.12; 1.28.16;
Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.27 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.26 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.25 19-Oct-2007  ad branches: 1.25.20; 1.25.28; 1.25.34;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.24 14-Apr-2006  christos branches: 1.24.18; 1.24.32; 1.24.34; 1.24.38;
Coverity CID 2467: Check that we actually initialized addr before returning it.
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.10; 1.23.12;
merge ktrace-lwp.
 1.22 27-Feb-2005  perry branches: 1.22.4;
nuke trailing whitespace
 1.21 04-Feb-2005  perry de-__P
 1.20 16-May-2004  skd branches: 1.20.4; 1.20.6;
fix typo in comment: resister -> register.
 1.19 02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.18 13-Sep-2003  simonb Remove an unreachable return statement (and fix a whitespace nit).
 1.17 17-May-2003  scw branches: 1.17.2;
Fix some DPRINTF statements to deal with bus_addr_t and bus_size_t types
defined in terms if 'int' instead of 'long'.
 1.16 22-Mar-2003  nakayama PCI-CardBus bridge support for sparc64:
- use u_long for extent_alloc_subregion result instead of bus_addr_t.
(sizeof u_long != sizeof bus_addr_t on 32bit kernels of sparc64)
 1.15 25-Nov-2002  thorpej Avoid strict-alias warnings.
 1.14 22-Apr-2002  matt Let's not free an uninitialized variable.
 1.13 10-Mar-2002  christos Undo my previous change that worked around a problem attaching a 3c562d.
This is handled correctly now in the driver itself. From Hayakawa Koichi
<haya@netbsd.org>, thanks.
 1.12 24-Dec-2001  christos make sure that we adjust the end of the subrange if we adjusted the beginning
of it, but the offset of the card. Fixes 'cannot map i/o space' on 3c562d
 1.11 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.10 13-Nov-2001  lukem add RCSID
 1.9 10-Jul-2001  haya Bug fix: call extent_subregion() with alignment = 1 instead of 0.
 1.8 30-May-2000  haya branches: 1.8.4; 1.8.6;
Call extent_alloc_subregion() with EX_MALLOCOK in
rbus.c::rbus_space_alloc_subregion().
 1.7 26-May-2000  haya branches: 1.7.2;
KNFfied those files.
 1.6 08-May-2000  augustss Fix the most glaring bug in the old rbus code. This way your machine won't
panic with a 3c562, but it won't work either.
 1.5 08-May-2000  augustss Back out my rbus change since it seems to break things.
 1.4 08-May-2000  augustss KNF the code and fix three bugs:
* If a non-zero addr was given to rbus_space_alloc_subregion() it would
claim to have allocated region when in fact it just failed.
* If a non-zero addr was given to rbus_space_alloc_subregion() allocation
often (always?) failed when it shouldn't.
* One part of rbus_space_alloc_subregion() used an alignment that always
made the kernel panic.
I'm not sure if my change is correct, because I don't know what this code
is supposed to do. But now I can use a 3c562 card.
 1.3 06-Nov-1999  soren branches: 1.3.2; 1.3.4;
It's okay for a memory region to be larger than it's alignment.
 1.2 15-Oct-1999  haya branches: 1.2.2; 1.2.4;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.2 06-Nov-1999  soren It's okay for a memory region to be larger than it's alignment.
 1.3.2.1 06-Nov-1999  soren file rbus.c was added on branch comdex-fall-1999 on 1999-11-06 06:20:54 +0000
 1.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.6.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.6.3 16-Mar-2002  jdolecek Catch up with -current.
 1.8.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.6.1 03-Aug-2001  lukem update to -current
 1.8.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.8.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.17.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.6.1 12-Feb-2005  yamt sync with head.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.22.4.2 27-Oct-2007  yamt sync with head.
 1.22.4.1 21-Jun-2006  yamt sync with head.
 1.23.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.23.10.1 19-Apr-2006  elad sync with head.
 1.23.8.1 24-May-2006  yamt sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.24.38.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.34.1 06-Nov-2007  matt sync with HEAD
 1.24.32.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.24.18.1 23-Oct-2007  ad Sync with head.
 1.25.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.20.2 11-Mar-2010  yamt sync with head
 1.25.20.1 04-May-2009  yamt sync with head.
 1.28.16.1 18-Feb-2012  mrg merge to -current.
 1.28.12.1 17-Apr-2012  yamt sync with head
 1.11 15-Dec-2009  snj Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder).
 1.10 19-Oct-2007  ad branches: 1.10.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 11-Dec-2005  christos branches: 1.9.30; 1.9.44; 1.9.46; 1.9.50;
merge ktrace-lwp.
 1.8 27-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 04-Feb-2005  perry de-__P
 1.6 08-Jul-2003  itojun branches: 1.6.8; 1.6.10;
function prototype must not have variable name
 1.5 02-Jun-2002  wiz branches: 1.5.6;
Typo fixes and grammar improvements in a comment.
 1.4 26-May-2000  haya branches: 1.4.6; 1.4.8; 1.4.20;
KNFfied those files.
 1.3 15-Dec-1999  kleink branches: 1.3.2;
Normalize symbol names used for multiple inclusion protection.
 1.2 15-Oct-1999  haya branches: 1.2.2;
add NetBSD ID tag.
 1.1 15-Oct-1999  haya This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.20.1 20-Jun-2002  gehenna catch up with -current.
 1.4.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.6.1 20-Jun-2002  nathanw Catch up to -current.
 1.5.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.10.1 12-Feb-2005  yamt sync with head.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.8.4.1 27-Oct-2007  yamt sync with head.
 1.9.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.46.1 06-Nov-2007  matt sync with HEAD
 1.9.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.30.1 23-Oct-2007  ad Sync with head.
 1.10.20.1 11-Mar-2010  yamt sync with head
 1.50 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.49 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.48 24-Apr-2021  thorpej branches: 1.48.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.47 05-Mar-2019  msaitoh branches: 1.47.14;
Catch up with MI pci changes to fix compile error.
 1.46 01-Mar-2019  msaitoh - Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.
 1.45 01-Jun-2017  chs branches: 1.45.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.44 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.43 17-Oct-2014  uebayasi branches: 1.43.2;
Fix i386 CARDBUS build.
 1.42 02-Feb-2012  tls branches: 1.42.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.41 01-Aug-2011  drochner branches: 1.41.2; 1.41.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.40 17-May-2011  dyoung PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.39 05-Mar-2010  dyoung branches: 1.39.2; 1.39.4;
Remove dead code (it is commented out).

Delete the detach routine, it's obviously not finished.
 1.38 04-Mar-2010  dyoung It turns out that ppb at cardbus was not even in ALL. It has probably
not been compiled in a very long time. With some minor changes, it was
possible to make it compile:

Use kmem_zalloc()/kmem_free() instead of alloca()/memset().

Use %zu and %zx for printf'ing bus_size_t.

Delete the declaration of an unused local variable.
 1.37 04-Mar-2010  dyoung Delete unfinished and unreachable code: ppb_cardbus_setup(),
ppb_cardbus_enable(), ppb_cardbus_disable().
 1.36 03-Mar-2010  dyoung Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Compiles. Untested. Let me know if you use this hardware with NetBSD
any longer.
 1.35 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.34 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.33 25-Feb-2010  dyoung Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args. Compile-tested, only.
 1.32 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.31 12-May-2009  cegger branches: 1.31.2;
struct device * -> device_t, no functional changes intended.
 1.30 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.29 18-Mar-2009  cegger bzero -> memset
 1.28 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.27 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.26 21-Jul-2008  drochner branches: 1.26.2; 1.26.8;
don't include i82365var.h, fixes build error, from Robert Swindells
 1.25 09-Jul-2008  joerg - device/softc split
 1.24 09-Jul-2008  joerg Use device_private to access cardbus_softc.
 1.23 18-May-2008  jmcneill branches: 1.23.2; 1.23.4;
Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64.
 1.22 28-Apr-2008  martin branches: 1.22.2;
Remove clause 3 and 4 from TNF licenses
 1.21 06-Apr-2008  cegger branches: 1.21.2; 1.21.4;
use aprint_*_dev and device_xname
 1.20 19-Oct-2007  ad branches: 1.20.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 29-Mar-2006  thorpej branches: 1.19.18; 1.19.32; 1.19.34; 1.19.38;
Use device_private().
 1.18 25-Mar-2006  thorpej Use device_parent().CVS: ----------------------------------------------------------------------
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16 09-Sep-2005  drochner make this compile again (shadow and const warnings)
I doubt this serves any useful purpose.
 1.15 27-Feb-2005  perry branches: 1.15.4;
nuke trailing whitespace
 1.14 04-Feb-2005  perry de-__P
 1.13 30-Aug-2004  drochner branches: 1.13.4; 1.13.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.12 02-Aug-2004  mycroft cardbusdevs -> pcidevs
 1.11 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.10 24-Nov-2003  lukem fix uninitialised variable warning. XXX: not sure if this is correct
 1.9 01-Jan-2003  thorpej branches: 1.9.2;
Use aprint_normal() in cfprint routines.
 1.8 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.7 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.4 02-Jun-2002  lukem make this compile again
 1.3 16-May-2002  thorpej branches: 1.3.2; 1.3.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.2 13-Nov-2001  lukem add RCSID
 1.1 06-Jul-2001  mcr branches: 1.1.2; 1.1.4;
cardbus attachment for PCI-PCI bridges
 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 20-Jun-2002  nathanw Catch up to -current.
 1.1.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.1.4.1 06-Jul-2001  nathanw file rbus_ppb.c was added on branch nathanw_sa on 2001-08-24 00:09:07 +0000
 1.1.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.1.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 04-Jun-2002  lukem Pull up revision 1.4 (requested by lukem in ticket #144):
make this compile again
 1.3.2.2 20-Jun-2002  gehenna catch up with -current.
 1.3.2.1 16-May-2002  gehenna file rbus_ppb.c was added on branch gehenna-devsw on 2002-06-20 16:32:59 +0000
 1.9.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.9.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.2 03-Sep-2004  skrll Sync with HEAD
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.6.1 12-Feb-2005  yamt sync with head.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.15.4.2 27-Oct-2007  yamt sync with head.
 1.15.4.1 21-Jun-2006  yamt sync with head.
 1.17.12.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.17.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 19-Apr-2006  elad sync with head.
 1.17.8.1 01-Apr-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.19.38.1 25-Oct-2007  bouyer Sync with HEAD.
 1.19.34.1 06-Nov-2007  matt sync with HEAD
 1.19.32.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.19.18.1 23-Oct-2007  ad Sync with head.
 1.20.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.20.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.4.4 11-Mar-2010  yamt sync with head
 1.21.4.3 16-May-2009  yamt sync with head
 1.21.4.2 04-May-2009  yamt sync with head.
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.1 18-May-2008  yamt sync with head.
 1.22.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.22.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.4.1 19-Oct-2008  haad Sync with HEAD.
 1.23.2.2 28-Jul-2008  simonb Sync with head.
 1.23.2.1 18-Jul-2008  simonb Sync with head.
 1.26.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.31.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.39.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.2.1 31-May-2011  rmind sync with head
 1.41.6.1 18-Feb-2012  mrg merge to -current.
 1.41.2.1 17-Apr-2012  yamt sync with head
 1.42.6.1 03-Dec-2017  jdolecek update from HEAD
 1.43.2.2 28-Aug-2017  skrll Sync with HEAD
 1.43.2.1 06-Jun-2015  skrll Sync with HEAD
 1.45.10.1 10-Jun-2019  christos Sync with HEAD
 1.47.14.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.48.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6 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.5 20-Dec-2012  jakllsch branches: 1.5.38;
Change sdhc_detach so that it detaches all host controllers at once.
This should make multiple slot controllers, for example those with
a controller on more than one PCI/CardBus BAR, detach with fewer bugs.
Tested with as-of-yet-uncommited sdhc_pci changes on a single-host
ExpressCard JMicron JMB38[89].
 1.4 02-Feb-2012  nonaka branches: 1.4.6;
Use "opt_sdmmc.h" for SDHC_DEBUG.
 1.3 01-Aug-2011  drochner branches: 1.3.2; 1.3.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.2 04-Jun-2010  dyoung branches: 1.2.2;
Collect garbage: sc_rbus_{iot,memt} are not used.
 1.1 27-Mar-2010  nonaka branches: 1.1.2; 1.1.4;
Added sdhc at cardbus support.
 1.1.4.3 03-Jul-2010  rmind sync with head
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 27-Mar-2010  rmind file sdhc_cardbus.c was added on branch rmind-uvmplock on 2010-05-30 05:17:19 +0000
 1.1.2.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 27-Mar-2010  uebayasi file sdhc_cardbus.c was added on branch uebayasi-xip on 2010-04-30 14:43:10 +0000
 1.2.2.2 11-Aug-2010  yamt sync with head.
 1.2.2.1 04-Jun-2010  yamt file sdhc_cardbus.c was added on branch yamt-nfs-mp on 2010-08-11 22:53:20 +0000
 1.3.6.1 18-Feb-2012  mrg merge to -current.
 1.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 17-Apr-2012  yamt sync with head
 1.4.6.1 25-Feb-2013  tls resync with head
 1.5.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.16 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.15 01-Aug-2011  drochner remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.14 13-Nov-2010  uebayasi Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.13 01-Apr-2010  dyoung Cosmetic: join a couple of lines. Stop storing the value of a BAR in a
temporary variable with the name 'csr'.
 1.12 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.11 04-Mar-2010  dyoung branches: 1.11.2;
Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by kiyohara@.
 1.10 26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.9 25-Feb-2010  dyoung Copy values from the cardbus_attach_args and use them instead of values
from the cardbus_softc.
 1.8 25-Feb-2010  dyoung Phase out some CardBus constants and types. Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG -> PCI_CLASS_REG
CARDBUS_ID_REG -> PCI_ID_REG
cardbus_product_id_t -> pci_product_id_t
cardbus_vendor_id_t -> pci_vendor_id_t
 1.7 25-Feb-2010  dyoung Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args. Compile-tested, only.
 1.6 25-Feb-2010  dyoung Cardbus_free_tag() and cardbus_free_tag() are no-ops, so get rid of them
to simplify the code a bit.
 1.5 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.4 30-Jan-2010  jakllsch branches: 1.4.2;
Sprinkle __KERNEL_RCSID() into siisata(4).
Slightly adjust some comment styling.
 1.3 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.2 19-Oct-2009  bouyer Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.1 19-Jul-2009  kiyohara branches: 1.1.2; 1.1.4;
Support siisata@cardbus.
It tested on amd64 and i386 only.
 1.1.4.4 11-Aug-2010  yamt sync with head.
 1.1.4.3 11-Mar-2010  yamt sync with head
 1.1.4.2 19-Aug-2009  yamt sync with head.
 1.1.4.1 19-Jul-2009  yamt file siisata_cardbus.c was added on branch yamt-nfs-mp on 2009-08-19 18:47:04 +0000
 1.1.2.2 23-Jul-2009  jym Sync with HEAD.
 1.1.2.1 19-Jul-2009  jym file siisata_cardbus.c was added on branch jym-xensuspend on 2009-07-23 23:31:46 +0000
 1.4.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.2.2 05-Mar-2011  rmind sync with head
 1.11.2.1 30-May-2010  rmind sync with head
 1.27 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.26 24-Apr-2021  thorpej branches: 1.26.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.25 09-Apr-2018  jakllsch branches: 1.25.18;
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.24 14-Jul-2016  msaitoh branches: 1.24.16;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.23 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.22 23-Apr-2016  skrll 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.21 21-Sep-2014  christos branches: 1.21.2;
remove more old pci_findvendor code
 1.20 01-Aug-2011  drochner branches: 1.20.12; 1.20.28; 1.20.32;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.19 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.18 24-May-2010  pgoyette Update all callers of the pci_find{vendor,product} routines to now call
these routines through their global pointers.
 1.17 18-Mar-2010  dyoung This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.16 26-Feb-2010  dyoung branches: 1.16.2;
Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.15 25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.14 24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.13 12-May-2009  cegger branches: 1.13.2;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.12 11-Jul-2008  dyoung branches: 1.12.8;
Don't write a register on the device until PCI I/O access has been
enabled on both the bus bridge and on the device.
 1.11 24-Jun-2008  drochner branches: 1.11.2;
clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.10 28-Apr-2008  martin branches: 1.10.2; 1.10.4;
Remove clause 3 and 4 from TNF licenses
 1.9 09-Apr-2008  skd branches: 1.9.2; 1.9.4;
Fix small error in device/sc splitup.
 1.8 28-Mar-2008  drochner 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.7 07-Mar-2008  dyoung Use device_t and its accessors. In uhci_{pci,cardbus}_attach, use
`self' instead of casting the softc to void *.
 1.6 19-Oct-2007  ad branches: 1.6.12; 1.6.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.5 16-Nov-2006  christos branches: 1.5.8; 1.5.18; 1.5.24; 1.5.26; 1.5.30;
__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 29-Mar-2006  thorpej branches: 1.3.6; 1.3.10; 1.3.12;
Use device_private().
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 24-Jul-2005  augustss branches: 1.1.6;
Add file for 'uhci at cardbus'. From FUKAUMI Naoki in kern/30814.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 24-Jul-2005  skrll file uhci_cardbus.c was added on branch ktrace-lwp on 2005-11-10 14:03:54 +0000
 1.2.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 19-Apr-2006  elad sync with head.
 1.2.8.1 01-Apr-2006  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.12.2 10-Dec-2006  yamt sync with head.
 1.3.12.1 22-Oct-2006  yamt sync with head
 1.3.10.1 18-Nov-2006  ad Sync with head.
 1.3.6.5 17-Mar-2008  yamt sync with head.
 1.3.6.4 27-Oct-2007  yamt sync with head.
 1.3.6.3 30-Dec-2006  yamt sync with head.
 1.3.6.2 21-Jun-2006  yamt sync with head.
 1.3.6.1 29-Mar-2006  yamt file uhci_cardbus.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:45 +0000
 1.5.30.1 25-Oct-2007  bouyer Sync with HEAD.
 1.5.26.2 23-Mar-2008  matt sync with HEAD
 1.5.26.1 06-Nov-2007  matt sync with HEAD
 1.5.24.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.5.18.1 22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.5.8.1 23-Oct-2007  ad Sync with head.
 1.6.16.4 28-Sep-2008  mjf Sync with HEAD.
 1.6.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.6.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.12.1 24-Mar-2008  keiichi sync with head.
 1.9.4.5 11-Aug-2010  yamt sync with head.
 1.9.4.4 11-Mar-2010  yamt sync with head
 1.9.4.3 16-May-2009  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.4.2 18-Jul-2008  simonb Sync with head.
 1.10.4.1 27-Jun-2008  simonb Sync with head.
 1.10.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.11.2.1 19-Oct-2008  haad Sync with HEAD.
 1.12.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.1 30-May-2010  rmind sync with head
 1.20.32.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.20.28.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.20.12.1 03-Dec-2017  jdolecek update from HEAD
 1.21.2.5 05-Oct-2016  skrll Sync with HEAD
 1.21.2.4 09-Jul-2016  skrll Sync with HEAD
 1.21.2.3 05-Dec-2014  skrll Use int for return type for [eou]chi_init and motg_init.
 1.21.2.2 05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.21.2.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.24.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.25.18.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.26.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6 09-Oct-2024  andvar s/compainion/companion/ in comments.
 1.5 28-Apr-2008  martin branches: 1.5.126;
Remove clause 3 and 4 from TNF licenses
 1.4 28-Mar-2008  drochner branches: 1.4.2; 1.4.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.3 11-Dec-2005  christos branches: 1.3.70;
merge ktrace-lwp.
 1.2 09-Sep-2005  drochner remove the useless (always 0) device number from cardbus driver state,
autoconf attach structures and configuration cycle functions
(just leave the kernel configuration attribute for now to avoid breaking
config(1) files)
 1.1 06-Nov-2001  augustss branches: 1.1.2; 1.1.4; 1.1.6; 1.1.22; 1.1.38;
ehci can attach to cardbus too.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.1.22.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 06-Nov-2001  thorpej file usb_cardbus.h was added on branch kqueue on 2002-01-10 19:53:47 +0000
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 06-Nov-2001  nathanw file usb_cardbus.h was added on branch nathanw_sa on 2001-11-14 19:14:02 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 06-Nov-2001  thorpej file usb_cardbus.h was added on branch thorpej-mips-cache on 2001-11-12 21:17:59 +0000
 1.3.70.2 02-Jun-2008  mjf Sync with HEAD.
 1.3.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.5.126.1 02-Aug-2025  perseant Sync with HEAD

RSS XML Feed