NetBSD/sys/dev/pcmcia
dyoung 0d1ba3e899 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.
2009-04-02 00:09:32 +00:00
..
aic_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
bluecardreg.h
bt3c.c convert to use pmf(9) functions 2008-04-06 18:55:33 +00:00
btbc.c convert to use pmf(9) functions 2008-04-06 18:55:33 +00:00
com_pcmcia.c pmf_register. 2008-08-27 05:39:01 +00:00
devlist2h.awk Move TNF licenses to 2 clause form 2008-05-02 18:11:04 +00:00
esp_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
fdc_pcmcia.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
files.pcmcia Remove esl(4) 2008-09-30 16:51:45 +00:00
if_an_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
if_awi_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
if_cnw.c ANSIfy another 1261 function definitions. 2009-03-14 21:04:01 +00:00
if_cnwioctl.h
if_cnwreg.h Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
if_cs_pcmcia.c use aprint_*_dev and device_xname 2008-04-05 21:31:23 +00:00
if_ep_pcmcia.c device_t changes, pmf, minor knf. 2008-08-27 05:33:47 +00:00
if_mbe_pcmcia.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
if_ne_pcmcia.c added Corega LAPCCTXT FastEthernet 2008-05-16 20:27:20 +00:00
if_ray.c ANSIfy another 1261 function definitions. 2009-03-14 21:04:01 +00:00
if_rayreg.h Convert many of the uses of __attribute__ to equivalent 2007-12-25 18:33:32 +00:00
if_sm_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
if_tr_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
if_wi_pcmcia.c ANSIfy another 1261 function definitions. 2009-03-14 21:04:01 +00:00
if_xi.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
if_xireg.h
if_xivar.h
isic_pcmcia_avm_fritz.c machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
isic_pcmcia_elsa_isdnmc.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
isic_pcmcia_elsa_mcall.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
isic_pcmcia_sbspeedstar2.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
isic_pcmcia.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
isic_pcmcia.h Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
Makefile
Makefile.pcmciadevs Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands. 2008-10-19 22:05:19 +00:00
mhzc.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
nca_pcmcia.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
pcmcia_cis_quirks.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
pcmcia_cis.c ansify function definitions 2009-03-15 20:30:05 +00:00
pcmcia.c During shutdown, detach devices in an orderly fashion. 2009-04-02 00:09:32 +00:00
pcmciachip.h constify the pcmcia/cardbus method tables 2008-06-26 12:33:17 +00:00
pcmciadevs add a comment explaining how to regenerate pcmicadevs.h and pcmciadevs_data.h 2009-01-21 14:13:09 +00:00
pcmciadevs_data.h Regen. 2008-09-06 22:08:38 +00:00
pcmciadevs.h Regen. 2008-09-06 22:08:38 +00:00
pcmciareg.h
pcmciavar.h split device/softc 2008-07-03 19:07:43 +00:00
pcmcom.c Change about 4500 of the K&R function definitions to ANSI ones. 2009-03-14 15:35:58 +00:00
slhci_pcmcia.c split device/softc for USB host controllers and the usb (control) 2008-03-28 17:14:45 +00:00
spc_pcmcia.c Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
wdc_pcmcia.c Work around a problem with PCMCIA adapter drivers (eg for hpc*) which 2009-03-21 12:35:17 +00:00
xirc.c ANSIfy another 1261 function definitions. 2009-03-14 21:04:01 +00:00