Commit Graph

55 Commits

Author SHA1 Message Date
christos 11beb626a3 Pass the device name in, so we can debug what deferred drivers did not work. 2013-10-12 16:49:00 +00:00
chs cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
joerg 5345cc0b23 Kill redundant () 2011-05-24 16:37:04 +00:00
dyoung d2f2daad71 Remove superfluous cast (device_t to device_t). 2010-03-19 01:44:05 +00:00
snj be360188fc Move to 2-clause license. Approved by HAYAKAWA Koichi (copyright holder). 2009-12-15 22:17:12 +00:00
dyoung a0d0f249f9 Let us detach pcmcia0 and cardbus0 at cardslot0, and cardslot0 at
cardbus0.
2009-05-21 17:32:32 +00:00
cegger 529e91fca1 struct device * -> device_t, no functional changes intended. 2009-05-12 14:16:35 +00:00
cegger 32c4940900 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 12:10:29 +00:00
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
dsl 454af1c0e8 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.)
2009-03-14 15:35:58 +00:00
drochner 53afd93cba minor cleanup so that it can cope with a futute split pcmcia device/softc 2008-07-03 18:57:52 +00:00
dogcow 78ff31a2cf fix type 2008-06-29 09:09:09 +00:00
drochner 2b26f69613 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...
2008-06-25 15:29:23 +00:00
drochner dbc8757839 split device/softc for pccbb, the cardbus half of cardslot and cardbus
(not yet pcmcia, there is a lot of md code involved)
2008-06-25 11:42:32 +00:00
drochner 52b8fec3cf clean up some useless code and variables in cardbus attachment 2008-06-24 17:32:09 +00:00
cegger c0d1e7cb9e use aprint_*_dev and device_xname 2008-04-06 07:54:17 +00:00
dyoung cf784f4497 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!
2007-12-16 21:28:30 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
jmcneill 4fbe23fdd0 aprintify 2007-12-01 04:50:50 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
dyoung 4620d7566c Cosmetic: KNF. In debug messages, use "%s: ...", __func__ idiom
to print subroutine names instead of hard-coding names.
2007-02-04 23:39:02 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
thorpej 0bb0418280 Use device_private(). 2006-03-29 06:22:38 +00:00
thorpej f5bd442003 Use device_unit(). 2006-03-29 04:41:56 +00:00
thorpej 2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
drochner 46ed4b50c4 s/locdesc_t/int/g 2005-08-26 12:42:11 +00:00
perry 18db93c7f6 de-__P 2005-02-04 02:10:35 +00:00
drochner 96b589fc18 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"
2004-09-13 12:55:47 +00:00
wiz c0177219fe Fix some typos. From Tom Cosgrove via jmc@openbsd. 2003-11-02 09:52:33 +00:00
christos 8bfd5e3292 Fix uninitialized variable warnings 2003-10-25 18:34:14 +00:00
thorpej 72a7af27b0 Use aprint_normal() in cfprint routines. 2003-01-01 00:10:15 +00:00
thorpej c9b3657ce9 Add trailing ; to CFATTACH_DECL. 2002-10-02 16:33:28 +00:00
thorpej bacf3a10fa Use CFATTACH_DECL(). 2002-09-30 20:43:55 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
thorpej 6c88de3b53 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.
2002-09-27 03:17:40 +00:00
lukem 06de426449 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
2002-06-01 23:50:52 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem f61cbe7489 add RCSID 2001-11-13 12:51:12 +00:00
haya d610c23da4 Cosmetic changes. 2001-03-27 10:34:05 +00:00
nathanw eb65359d14 The card_attach_now flag hasn't been necessary or useful for some time.
Garbage collect the code and corresponding documentation.
2001-02-12 04:52:48 +00:00
nathanw d460e9b43e Minor grammar/spelling fixes in comments. 2001-01-28 01:49:54 +00:00
cgd 1ce8331ad9 nuke some final __BROKEN_INDIRECT_CONFIG bits that weren't caught by
unifdef last time.  (bloody things just won't stay dead!)
2000-07-02 06:25:46 +00:00
cgd eee18e1f6c beat back the undead: __BROKEN_INDIRECT_CONFIG had risen, and was
terrorizing innocent hackers...
2000-06-16 23:41:33 +00:00
haya ddd36bd41a 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.
2000-03-22 09:35:06 +00:00
haya 2e9b49c888 Force power off when a CardBus card is detached.
Use tsleep when kernel thread works.
2000-01-31 08:49:07 +00:00
haya 653eefc8f4 Add cardbus detach functionality. Add a function
cardbus_detach_card() in cardbus.c and enable detach code in cardslot.c
2000-01-26 09:04:59 +00:00
thorpej 0c93dded4a Use config_pending. Addresses kern/9247. 2000-01-24 18:34:44 +00:00