From dbcd0c9b8a52c489e134c81386c900b1338da9e4 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 1 May 2007 00:05:18 +0000 Subject: [PATCH] Implement kern.do_async_attach. default disabled. To enable add kern.do_async_attach="1" to your /boot/loader.conf. This feature allows conforming drivers to attach in their own thread, allowing multiple drivers to attach in parallel. Implement a new device state, DS_INPROGRESS. Seems to work properly. Implement device_set_async_attach(), which allows a device's probe function to indicate that it is ok for its attach function to be run in its own thread. Split tsleep's enable out from the 'cold' variable. tsleep works earlier then when cold is cleared. Add a 'tsleep_now_works' variable to take over the functionality. Implement DRIVERSLEEP()... similar to DELAY(), this function works in any context and will call lwkt_switch() in its spin loop. It isn't perfect yet. ATA/NATA: * Uses the new async attach feature * Uses DRIVERSLEEP * No longer uses a configuration interrupt hook. Interrupts are now available during device config. NOTE: atapicam does not seem to be scanning the 'bus' (from cam's point of view), so 'cd0' is not found until CAM scans the bus itself in the interrupt config hook code. USB: * Uses the new async attach feature * Uses tsleep instead of DELAY MISC: * IF_EM, IF_NFE also use the async attach feature as a test, but it doesn't seem to have a huge effect. --- sys/bus/cam/scsi/scsi_low.c | 5 +- sys/bus/isa/isahint.c | 4 +- sys/bus/isa/pnp.c | 4 +- sys/bus/pci/i386/pcibus.c | 4 +- sys/bus/usb/ehci_pci.c | 3 +- sys/bus/usb/ohci_pci.c | 3 +- sys/bus/usb/usb.c | 6 +- sys/bus/usb/usb_subr.c | 4 +- sys/dev/disk/ata/ata-all.c | 74 +++++++------------ sys/dev/disk/ata/ata-pci.c | 7 +- sys/dev/disk/ata/atapi-cam.c | 8 +-- sys/dev/disk/nata/ata-all.c | 31 ++------ sys/dev/disk/nata/atapi-cam.c | 8 +-- sys/dev/disk/sbp/sbp.c | 12 +++- sys/dev/misc/psm/psm.c | 4 +- sys/dev/netif/em/if_em.c | 3 +- sys/dev/netif/nfe/if_nfe.c | 3 +- sys/kern/init_main.c | 25 ++++++- sys/kern/kern_synch.c | 10 +-- sys/kern/lwkt_thread.c | 4 +- sys/kern/subr_bus.c | 92 +++++++++++++++++++++++- sys/platform/pc32/i386/autoconf.c | 3 +- sys/platform/pc32/icu/icu_abi.c | 4 +- sys/platform/pc32/isa/clock.c | 33 +++++++-- sys/platform/vkernel/i386/autoconf.c | 3 +- sys/platform/vkernel/platform/systimer.c | 13 +++- sys/sys/bus.h | 4 +- sys/sys/bus_private.h | 3 +- sys/sys/kernel.h | 3 +- sys/sys/systm.h | 4 +- 30 files changed, 256 insertions(+), 128 deletions(-) diff --git a/sys/bus/cam/scsi/scsi_low.c b/sys/bus/cam/scsi/scsi_low.c index 7c9cce052a..99e3b912d2 100644 --- a/sys/bus/cam/scsi/scsi_low.c +++ b/sys/bus/cam/scsi/scsi_low.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.1.2.5 2003/08/09 06:18:30 non Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_low.c,v 1.18 2006/12/22 23:12:16 swildner Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_low.c,v 1.19 2007/05/01 00:05:12 dillon Exp $ * $NetBSD: scsi_low.c,v 1.24.10.8 2001/06/26 07:39:44 honda Exp $ */ @@ -873,8 +873,11 @@ scsi_low_attach_cam(struct scsi_low_softc *slp) static int scsi_low_world_start_cam(struct scsi_low_softc *slp) { +#if 0 if (!cold) scsi_low_rescan_bus_cam(slp); +#endif + scsi_low_rescan_bus_cam(slp); return 0; } diff --git a/sys/bus/isa/isahint.c b/sys/bus/isa/isahint.c index b471cdf234..afa3d46371 100644 --- a/sys/bus/isa/isahint.c +++ b/sys/bus/isa/isahint.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/isahint.c,v 1.8.2.1 2001/03/21 11:18:25 nyan Exp $ - * $DragonFly: src/sys/bus/isa/isahint.c,v 1.7 2006/12/20 18:14:37 dillon Exp $ + * $DragonFly: src/sys/bus/isa/isahint.c,v 1.8 2007/05/01 00:05:15 dillon Exp $ */ #include @@ -96,6 +96,8 @@ isahint_identify(driver_t *driver, device_t parent) */ if (device_get_state(parent) == DS_ATTACHED) return(0); + if (device_get_state(parent) == DS_INPROGRESS) + return(0); /* * Add all devices configured to be attached to parent. diff --git a/sys/bus/isa/pnp.c b/sys/bus/isa/pnp.c index 6831b2f3b1..3ddab5a68b 100644 --- a/sys/bus/isa/pnp.c +++ b/sys/bus/isa/pnp.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/pnp.c,v 1.5.2.1 2002/10/14 09:31:09 nyan Exp $ - * $DragonFly: src/sys/bus/isa/pnp.c,v 1.12 2006/12/22 23:12:16 swildner Exp $ + * $DragonFly: src/sys/bus/isa/pnp.c,v 1.13 2007/05/01 00:05:15 dillon Exp $ * from: pnp.c,v 1.11 1999/05/06 22:11:19 peter Exp */ @@ -774,6 +774,8 @@ pnp_identify(driver_t *driver, device_t parent) */ if (device_get_state(parent) == DS_ATTACHED) return (0); + if (device_get_state(parent) == DS_INPROGRESS) + return (0); #if 0 if (pnp_ldn_overrides[0].csn == 0) { diff --git a/sys/bus/pci/i386/pcibus.c b/sys/bus/pci/i386/pcibus.c index 4887718b2f..78bd7d5617 100644 --- a/sys/bus/pci/i386/pcibus.c +++ b/sys/bus/pci/i386/pcibus.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/pcibus.c,v 1.57.2.12 2003/08/07 06:19:26 imp Exp $ - * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.17 2006/12/31 20:34:04 dillon Exp $ + * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.18 2007/05/01 00:05:16 dillon Exp $ * */ @@ -281,6 +281,8 @@ nexus_legacypci_identify(driver_t *driver, device_t parent) */ if (device_get_state(parent) == DS_ATTACHED) return (0); + if (device_get_state(parent) == DS_INPROGRESS) + return (0); if (pci_cfgregopen() == 0) return (ENXIO); diff --git a/sys/bus/usb/ehci_pci.c b/sys/bus/usb/ehci_pci.c index 30ec37af7b..e34414ce74 100644 --- a/sys/bus/usb/ehci_pci.c +++ b/sys/bus/usb/ehci_pci.c @@ -35,7 +35,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/ehci_pci.c,v 1.18.2.1 2006/01/26 01:43:13 iedowse Exp $ - * $DragonFly: src/sys/bus/usb/ehci_pci.c,v 1.14 2006/12/22 23:12:17 swildner Exp $ + * $DragonFly: src/sys/bus/usb/ehci_pci.c,v 1.15 2007/05/01 00:05:16 dillon Exp $ */ /* @@ -258,6 +258,7 @@ ehci_pci_probe(device_t self) if (desc) { device_set_desc(self, desc); + device_set_async_attach(self, TRUE); return 0; } else { return ENXIO; diff --git a/sys/bus/usb/ohci_pci.c b/sys/bus/usb/ohci_pci.c index 22de8ed0ee..f7c9480c92 100644 --- a/sys/bus/usb/ohci_pci.c +++ b/sys/bus/usb/ohci_pci.c @@ -35,7 +35,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/ohci_pci.c,v 1.44.2.1 2006/01/29 01:26:46 iedowse Exp $ - * $DragonFly: src/sys/bus/usb/ohci_pci.c,v 1.7 2006/12/20 18:14:37 dillon Exp $ + * $DragonFly: src/sys/bus/usb/ohci_pci.c,v 1.8 2007/05/01 00:05:16 dillon Exp $ */ /* @@ -217,6 +217,7 @@ ohci_pci_probe(device_t self) if (desc) { device_set_desc(self, desc); + device_set_async_attach(self, TRUE); return 0; } else { return ENXIO; diff --git a/sys/bus/usb/usb.c b/sys/bus/usb/usb.c index 8f3f7a74b2..536067fb77 100644 --- a/sys/bus/usb/usb.c +++ b/sys/bus/usb/usb.c @@ -1,6 +1,6 @@ /* $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.c,v 1.106 2005/03/27 15:31:23 iedowse Exp $ */ -/* $DragonFly: src/sys/bus/usb/usb.c,v 1.25 2006/12/22 23:12:17 swildner Exp $ */ +/* $DragonFly: src/sys/bus/usb/usb.c,v 1.26 2007/05/01 00:05:16 dillon Exp $ */ /* Also already merged from NetBSD: * $NetBSD: usb.c,v 1.70 2002/05/09 21:54:32 augustss Exp $ @@ -256,9 +256,11 @@ USB_ATTACH(usb) } kprintf("\n"); +#if 0 /* Make sure not to use tsleep() if we are cold booting. */ if (cold) sc->sc_bus->use_polling++; +#endif ue.u.ue_ctrlr.ue_bus = USBDEVUNIT(sc->sc_dev); usb_add_event(USB_EVENT_CTRLR_ATTACH, &ue); @@ -314,8 +316,10 @@ USB_ATTACH(usb) USBDEVNAME(sc->sc_dev), err); sc->sc_dying = 1; } +#if 0 if (cold) sc->sc_bus->use_polling--; +#endif config_pending_incr(); #if defined(__NetBSD__) || defined(__OpenBSD__) diff --git a/sys/bus/usb/usb_subr.c b/sys/bus/usb/usb_subr.c index f88c14f6e0..015c564cb3 100644 --- a/sys/bus/usb/usb_subr.c +++ b/sys/bus/usb/usb_subr.c @@ -1,6 +1,6 @@ /* $NetBSD: usb_subr.c,v 1.99 2002/07/11 21:14:34 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.76.2.3 2006/03/01 01:59:05 iedowse Exp $ */ -/* $DragonFly: src/sys/bus/usb/usb_subr.c,v 1.17 2006/12/22 23:12:17 swildner Exp $ */ +/* $DragonFly: src/sys/bus/usb/usb_subr.c,v 1.18 2007/05/01 00:05:16 dillon Exp $ */ /* Also already have from NetBSD: * $NetBSD: usb_subr.c,v 1.102 2003/01/01 16:21:50 augustss Exp $ @@ -309,7 +309,7 @@ void usb_delay_ms(usbd_bus_handle bus, u_int ms) { /* Wait at least two clock ticks so we know the time has passed. */ - if (bus->use_polling || cold) + if (bus->use_polling) delay((ms+1) * 1000); else tsleep(&ms, 0, "usbdly", (ms*hz+999)/1000 + 1); diff --git a/sys/dev/disk/ata/ata-all.c b/sys/dev/disk/ata/ata-all.c index 3bea274ee0..3756ebde9c 100644 --- a/sys/dev/disk/ata/ata-all.c +++ b/sys/dev/disk/ata/ata-all.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.50.2.45 2003/03/12 14:47:12 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.35 2006/12/22 23:26:15 swildner Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.36 2007/05/01 00:05:16 dillon Exp $ */ #include "opt_ata.h" @@ -98,7 +98,6 @@ SYSCTL_INT(_hw_ata, OID_AUTO, mpipe_size, CTLFLAG_RW, &ata_mpipe_size, 0, devclass_t ata_devclass; /* local vars */ -static struct intr_config_hook *ata_delayed_attach = NULL; static MALLOC_DEFINE(M_ATA, "ATA generic", "ATA driver generic layer"); /* misc defines */ @@ -205,38 +204,35 @@ ata_attach(device_t dev) * when interrupts are enabled by a hook into the boot process. * otherwise attach what the probe has found in ch->devices. */ - if (!ata_delayed_attach) { - crit_enter(); + crit_enter(); - if (ch->devices & ATA_ATA_SLAVE) - if (ata_getparam(&ch->device[SLAVE], ATA_C_ATA_IDENTIFY)) - ch->devices &= ~ATA_ATA_SLAVE; - if (ch->devices & ATA_ATAPI_SLAVE) - if (ata_getparam(&ch->device[SLAVE], ATA_C_ATAPI_IDENTIFY)) - ch->devices &= ~ATA_ATAPI_SLAVE; - if (ch->devices & ATA_ATA_MASTER) - if (ata_getparam(&ch->device[MASTER], ATA_C_ATA_IDENTIFY)) - ch->devices &= ~ATA_ATA_MASTER; - if (ch->devices & ATA_ATAPI_MASTER) - if (ata_getparam(&ch->device[MASTER], ATA_C_ATAPI_IDENTIFY)) - ch->devices &= ~ATA_ATAPI_MASTER; + if (ch->devices & ATA_ATA_SLAVE) + if (ata_getparam(&ch->device[SLAVE], ATA_C_ATA_IDENTIFY)) + ch->devices &= ~ATA_ATA_SLAVE; + if (ch->devices & ATA_ATAPI_SLAVE) + if (ata_getparam(&ch->device[SLAVE], ATA_C_ATAPI_IDENTIFY)) + ch->devices &= ~ATA_ATAPI_SLAVE; + if (ch->devices & ATA_ATA_MASTER) + if (ata_getparam(&ch->device[MASTER], ATA_C_ATA_IDENTIFY)) + ch->devices &= ~ATA_ATA_MASTER; + if (ch->devices & ATA_ATAPI_MASTER) + if (ata_getparam(&ch->device[MASTER], ATA_C_ATAPI_IDENTIFY)) + ch->devices &= ~ATA_ATAPI_MASTER; #if NATADISK > 0 - if (ch->devices & ATA_ATA_MASTER) - ad_attach(&ch->device[MASTER], 0); - if (ch->devices & ATA_ATA_SLAVE) - ad_attach(&ch->device[SLAVE], 0); + if (ch->devices & ATA_ATA_MASTER) + ad_attach(&ch->device[MASTER], 0); + if (ch->devices & ATA_ATA_SLAVE) + ad_attach(&ch->device[SLAVE], 0); #endif #if DEV_ATAPIALL - if (ch->devices & ATA_ATAPI_MASTER) - atapi_attach(&ch->device[MASTER], 0); - if (ch->devices & ATA_ATAPI_SLAVE) - atapi_attach(&ch->device[SLAVE], 0); + if (ch->devices & ATA_ATAPI_MASTER) + atapi_attach(&ch->device[MASTER], 0); + if (ch->devices & ATA_ATAPI_SLAVE) + atapi_attach(&ch->device[SLAVE], 0); #endif #if NATAPICAM > 0 - atapi_cam_attach_bus(ch); + atapi_cam_attach_bus(ch); #endif - crit_exit(); - } return 0; } @@ -551,11 +547,6 @@ ata_boot_attach(void) struct ata_channel *ch; int ctlr; - if (ata_delayed_attach) { - config_intrhook_disestablish(ata_delayed_attach); - kfree(ata_delayed_attach, M_TEMP); - ata_delayed_attach = NULL; - } crit_enter(); /* @@ -789,9 +780,9 @@ ata_reset(struct ata_channel *ch) ATA_OUTB(ch->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER); DELAY(10); ATA_OUTB(ch->r_altio, ATA_ALTSTAT, ATA_A_IDS | ATA_A_RESET); - DELAY(10000); + DRIVERSLEEP(10000); ATA_OUTB(ch->r_altio, ATA_ALTSTAT, ATA_A_IDS); - DELAY(100000); + DRIVERSLEEP(100000); ATA_INB(ch->r_io, ATA_ERROR); /* wait for BUSY to go inactive */ @@ -835,14 +826,14 @@ ata_reset(struct ata_channel *ch) if (mask == 0x03) /* wait for both master & slave */ if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) break; - DELAY(10000); + DRIVERSLEEP(10000); } /* * some devices release BUSY before they are ready to accept commands. * We must wait at least 50ms before attempting to issue a command after * BUSY is released. */ - DELAY(50000); + DRIVERSLEEP(50000); ATA_OUTB(ch->r_altio, ATA_ALTSTAT, ATA_A_4BIT); if (stat0 & ATA_S_BUSY) @@ -1600,16 +1591,5 @@ ata_init(void) /* register controlling device */ dev_ops_add(&ata_ops, 0, 0); make_dev(&ata_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); - - /* register boot attach to be run when interrupts are enabled */ - ata_delayed_attach = kmalloc(sizeof(struct intr_config_hook), - M_TEMP, M_WAITOK | M_ZERO); - - ata_delayed_attach->ich_func = (void*)ata_boot_attach; - ata_delayed_attach->ich_desc = "ata"; - if (config_intrhook_establish(ata_delayed_attach) != 0) { - kprintf("ata: config_intrhook_establish failed\n"); - kfree(ata_delayed_attach, M_TEMP); - } } SYSINIT(atadev, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL) diff --git a/sys/dev/disk/ata/ata-pci.c b/sys/dev/disk/ata/ata-pci.c index b9815d22e5..085805f685 100644 --- a/sys/dev/disk/ata/ata-pci.c +++ b/sys/dev/disk/ata/ata-pci.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.32.2.15 2003/06/06 13:27:05 fjoe Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-pci.c,v 1.28 2006/12/22 23:26:15 swildner Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-pci.c,v 1.29 2007/05/01 00:05:16 dillon Exp $ */ #include @@ -412,10 +412,11 @@ ata_pci_probe(device_t dev) if (desc) { device_set_desc(dev, desc); + device_set_async_attach(dev, TRUE); return 0; - } - else + } else { return ENXIO; + } } static int diff --git a/sys/dev/disk/ata/atapi-cam.c b/sys/dev/disk/ata/atapi-cam.c index f8d0c53273..a9987d236a 100644 --- a/sys/dev/disk/ata/atapi-cam.c +++ b/sys/dev/disk/ata/atapi-cam.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cam.c,v 1.10.2.3 2003/05/21 09:24:55 thomas Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cam.c,v 1.11 2006/12/22 23:26:15 swildner Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cam.c,v 1.12 2007/05/01 00:05:17 dillon Exp $ */ #include @@ -78,7 +78,7 @@ struct atapi_xpt_softc { LIST_ENTRY(atapi_xpt_softc) chain; }; -enum reinit_reason { BOOT_ATTACH, ATTACH, RESET }; +enum reinit_reason { ATTACH, RESET }; static LIST_HEAD(,atapi_xpt_softc) all_buses = LIST_HEAD_INITIALIZER(all_buses); @@ -147,7 +147,7 @@ atapi_cam_attach_bus(struct ata_channel *ata_ch) CAM_DEBUG(path, CAM_DEBUG_TRACE, ("Registered SIM for ata%d\n", unit)); setup_async_cb(scp, AC_LOST_DEVICE); - reinit_bus(scp, cold ? BOOT_ATTACH : ATTACH); + reinit_bus(scp, ATTACH); return; error: @@ -182,8 +182,6 @@ reinit_bus(struct atapi_xpt_softc *scp, enum reinit_reason reason) { setup_dev(scp, &scp->ata_ch->device[SLAVE]); switch (reason) { - case BOOT_ATTACH: - break; case RESET: xpt_async(AC_BUS_RESET, scp->path, NULL); /*FALLTHROUGH*/ diff --git a/sys/dev/disk/nata/ata-all.c b/sys/dev/disk/nata/ata-all.c index ee8fba2e20..50b345db91 100644 --- a/sys/dev/disk/nata/ata-all.c +++ b/sys/dev/disk/nata/ata-all.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.273 2006/05/12 05:04:40 jhb Exp $ - * $DragonFly: src/sys/dev/disk/nata/ata-all.c,v 1.7 2007/01/09 21:17:00 tgen Exp $ + * $DragonFly: src/sys/dev/disk/nata/ata-all.c,v 1.8 2007/05/01 00:05:17 dillon Exp $ */ #include "opt_ata.h" @@ -71,7 +71,6 @@ static void bpack(int8_t *, int8_t *, int); /* global vars */ MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer"); int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data) = NULL; -struct intr_config_hook *ata_delayed_attach = NULL; devclass_t ata_devclass; struct objcache *ata_request_cache; struct objcache *ata_composite_cache; @@ -145,8 +144,7 @@ ata_attach(device_t dev) } /* probe and attach devices on this channel unless we are in early boot */ - if (!ata_delayed_attach) - ata_identify(dev); + ata_identify(dev); return 0; } @@ -551,13 +549,6 @@ ata_boot_attach(void) } } - /* release the hook that got us here, we are only needed once during boot */ - if (ata_delayed_attach) { - config_intrhook_disestablish(ata_delayed_attach); - kfree(ata_delayed_attach, M_TEMP); - ata_delayed_attach = NULL; - } - rel_mplock(); } @@ -838,7 +829,8 @@ void ata_udelay(int interval) { /* for now just use DELAY, the timer/sleep subsytems are not there yet */ - if (1 || interval < (1000000/hz) || ata_delayed_attach) + /* XXX use DRIVERSLEEP if possible */ + if (1 || interval < (1000000/hz)) DELAY(interval); else tsleep(&interval, 0, "ataslp", interval/(1000000/hz)); @@ -1015,21 +1007,6 @@ ata_module_event_handler(module_t mod, int what, void *arg) dev_ops_add(&ata_ops, 0, 0); atacdev = make_dev(&ata_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); reference_dev(atacdev); - - if (cold) { - /* register boot attach to be run when interrupts are enabled */ - if (!(ata_delayed_attach = (struct intr_config_hook *) - kmalloc(sizeof(struct intr_config_hook), - M_TEMP, M_NOWAIT | M_ZERO))) { - kprintf("ata: kmalloc of delayed attach hook failed\n"); - return EIO; - } - ata_delayed_attach->ich_func = (void*)ata_boot_attach; - if (config_intrhook_establish(ata_delayed_attach) != 0) { - kprintf("ata: config_intrhook_establish failed\n"); - kfree(ata_delayed_attach, M_TEMP); - } - } return 0; case MOD_UNLOAD: diff --git a/sys/dev/disk/nata/atapi-cam.c b/sys/dev/disk/nata/atapi-cam.c index 4007627f6a..f46e2ed7a0 100644 --- a/sys/dev/disk/nata/atapi-cam.c +++ b/sys/dev/disk/nata/atapi-cam.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cam.c,v 1.44 2006/03/31 08:09:05 sos Exp $ - * $DragonFly: src/sys/dev/disk/nata/atapi-cam.c,v 1.4 2006/12/22 23:26:16 swildner Exp $ + * $DragonFly: src/sys/dev/disk/nata/atapi-cam.c,v 1.5 2007/05/01 00:05:17 dillon Exp $ */ #include "opt_ata.h" @@ -89,7 +89,7 @@ struct atapi_hcb { TAILQ_ENTRY(atapi_hcb) chain; }; -enum reinit_reason { BOOT_ATTACH, ATTACH, RESET }; +enum reinit_reason { ATTACH, RESET }; /* Device methods */ static void atapi_cam_identify(device_t *dev, device_t parent); @@ -237,7 +237,7 @@ atapi_cam_attach(device_t dev) CAM_DEBUG(path, CAM_DEBUG_TRACE, ("Registered SIM for ata%d\n", unit)); setup_async_cb(scp, AC_LOST_DEVICE); - reinit_bus(scp, cold ? BOOT_ATTACH : ATTACH); + reinit_bus(scp, ATTACH); error = 0; out: @@ -307,8 +307,6 @@ reinit_bus(struct atapi_xpt_softc *scp, enum reinit_reason reason) { kfree(children, M_TEMP); switch (reason) { - case BOOT_ATTACH: - break; case RESET: xpt_async(AC_BUS_RESET, scp->path, NULL); /*FALLTHROUGH*/ diff --git a/sys/dev/disk/sbp/sbp.c b/sys/dev/disk/sbp/sbp.c index af2ebdb502..f998218e08 100644 --- a/sys/dev/disk/sbp/sbp.c +++ b/sys/dev/disk/sbp/sbp.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/sbp.c,v 1.74 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/dev/disk/sbp/sbp.c,v 1.22 2006/12/22 23:26:16 swildner Exp $ + * $DragonFly: src/sys/dev/disk/sbp/sbp.c,v 1.23 2007/05/01 00:05:17 dillon Exp $ * */ @@ -103,7 +103,9 @@ static char *orb_fun_name[] = { static int debug = 0; static int auto_login = 1; static int max_speed = -1; +#if 0 static int sbp_cold = 1; +#endif static int ex_login = 1; static int login_delay = 1000; /* msec */ static int scan_delay = 500; /* msec */ @@ -759,10 +761,12 @@ sbp_post_explore(void *arg) int i, alive; SBP_DEBUG(0) - kprintf("sbp_post_explore (sbp_cold=%d)\n", sbp_cold); + kprintf("sbp_post_explore\n"); END_DEBUG +#if 0 if (sbp_cold > 0) sbp_cold --; +#endif #if 0 /* @@ -1017,6 +1021,7 @@ END_DEBUG cam_sim_path(target->sbp->sim), target->target_id, sdev->lun_id); +#if 0 /* * Let CAM scan the bus if we are in the boot process. * XXX xpt_scan_bus cannot detect LUN larger than 0 @@ -1026,6 +1031,7 @@ END_DEBUG sdev->status = SBP_DEV_ATTACHED; return; } +#endif sbp_scan_dev(sdev); return; @@ -1835,8 +1841,10 @@ SBP_DEBUG(0) kprintf("sbp_attach (cold=%d)\n", cold); END_DEBUG +#if 0 if (cold) sbp_cold ++; +#endif sbp = ((struct sbp_softc *)device_get_softc(dev)); bzero(sbp, sizeof(struct sbp_softc)); sbp->fd.dev = dev; diff --git a/sys/dev/misc/psm/psm.c b/sys/dev/misc/psm/psm.c index 99463bb858..b676fa2a8e 100644 --- a/sys/dev/misc/psm/psm.c +++ b/sys/dev/misc/psm/psm.c @@ -21,7 +21,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/isa/psm.c,v 1.23.2.7 2003/11/12 04:26:26 mikeh Exp $ - * $DragonFly: src/sys/dev/misc/psm/psm.c,v 1.23 2007/01/08 12:21:50 swildner Exp $ + * $DragonFly: src/sys/dev/misc/psm/psm.c,v 1.24 2007/05/01 00:05:17 dillon Exp $ */ /* @@ -430,7 +430,7 @@ get_aux_id(KBDC kbdc) return (-1); /* 10ms delay */ - DELAY(10000); + DRIVERSLEEP(10000); id = read_aux_data(kbdc); if (verbose >= 2) diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 216bf7579f..f03f283560 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -64,7 +64,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/netif/em/if_em.c,v 1.57 2007/04/15 12:50:49 sephe Exp $ + * $DragonFly: src/sys/dev/netif/em/if_em.c,v 1.58 2007/05/01 00:05:17 dillon Exp $ * $FreeBSD$ */ /* @@ -432,6 +432,7 @@ em_probe(device_t dev) "%s, Version - %s", em_strings[ent->index], em_driver_version); device_set_desc_copy(dev, adapter_name); + device_set_async_attach(dev, TRUE); return (0); } ent++; diff --git a/sys/dev/netif/nfe/if_nfe.c b/sys/dev/netif/nfe/if_nfe.c index b73e9d032c..b0f57382f6 100644 --- a/sys/dev/netif/nfe/if_nfe.c +++ b/sys/dev/netif/nfe/if_nfe.c @@ -1,5 +1,5 @@ /* $OpenBSD: if_nfe.c,v 1.63 2006/06/17 18:00:43 brad Exp $ */ -/* $DragonFly: src/sys/dev/netif/nfe/if_nfe.c,v 1.7 2006/12/24 04:58:27 sephe Exp $ */ +/* $DragonFly: src/sys/dev/netif/nfe/if_nfe.c,v 1.8 2007/05/01 00:05:17 dillon Exp $ */ /* * Copyright (c) 2006 The DragonFly Project. All rights reserved. @@ -363,6 +363,7 @@ nfe_probe(device_t dev) sc->sc_flags |= NFE_USE_JUMBO; device_set_desc(dev, n->desc); + device_set_async_attach(dev, TRUE); return 0; } } diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 00f72929c6..b05b5bad38 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -40,7 +40,7 @@ * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.8 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/init_main.c,v 1.78 2007/04/30 16:45:53 dillon Exp $ + * $DragonFly: src/sys/kern/init_main.c,v 1.79 2007/05/01 00:05:17 dillon Exp $ */ #include "opt_init_path.h" @@ -279,11 +279,34 @@ leavecrit(void *dummy __unused) MachIntrABI.cleanup(); crit_exit(); KKASSERT(!IN_CRITICAL_SECT(curthread)); + if (bootverbose) kprintf("Leaving critical section, allowing interrupts\n"); } SYSINIT(leavecrit, SI_BOOT2_LEAVE_CRIT, SI_ORDER_ANY, leavecrit, NULL) +/* + * This is called after the threading system is up and running, + * including the softclock, clock interrupts, and SMP. + */ +static void +tsleepworks(void *dummy __unused) +{ + tsleep_now_works = 1; +} +SYSINIT(tsleepworks, SI_BOOT2_FINISH_SMP, SI_ORDER_SECOND, tsleepworks, NULL) + +/* + * This is called after devices have configured. Tell the kernel we are + * no longer in cold boot. + */ +static void +endofcoldboot(void *dummy __unused) +{ + cold = 0; +} +SYSINIT(endofcoldboot, SI_SUB_ISWARM, SI_ORDER_ANY, endofcoldboot, NULL) + /* *************************************************************************** **** diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 226276923b..b4acae4b26 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -37,7 +37,7 @@ * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 * $FreeBSD: src/sys/kern/kern_synch.c,v 1.87.2.6 2002/10/13 07:29:53 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_synch.c,v 1.83 2007/04/27 23:27:14 dillon Exp $ + * $DragonFly: src/sys/kern/kern_synch.c,v 1.84 2007/05/01 00:05:18 dillon Exp $ */ #include "opt_ktrace.h" @@ -78,6 +78,7 @@ int ncpus; int ncpus2, ncpus2_shift, ncpus2_mask; int ncpus_fit, ncpus_fit_mask; int safepri; +int tsleep_now_works; static struct callout loadav_callout; static struct callout schedcpu_callout; @@ -350,10 +351,11 @@ tsleep(void *ident, int flags, const char *wmesg, int timo) * NOTE: removed KTRPOINT, it could cause races due to blocking * even in stable. Just scrap it for now. */ - if (cold || panicstr) { + if (tsleep_now_works == 0 || panicstr) { /* - * After a panic, or during autoconfiguration, - * just give interrupts a chance, then just return; + * After a panic, or before we actually have an operational + * softclock, just give interrupts a chance, then just return; + * * don't run any other procs or panic below, * in case this is the idle process and already asleep. */ diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index d38625906b..e976a6a461 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.106 2007/02/18 16:16:11 corecode Exp $ + * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.107 2007/05/01 00:05:18 dillon Exp $ */ /* @@ -1266,7 +1266,7 @@ lwkt_create(void (*func)(void *), void *arg, __va_list ap; td = lwkt_alloc_thread(template, LWKT_THREAD_STACK, cpu, - tdflags | TDF_VERBOSE); + tdflags); if (tdp) *tdp = td; cpu_set_thread_handler(td, lwkt_exit, func, arg); diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 71b5f02a81..08a90ca5fa 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_bus.c,v 1.54.2.9 2002/10/10 15:13:32 jhb Exp $ - * $DragonFly: src/sys/kern/subr_bus.c,v 1.36 2007/04/30 07:18:54 dillon Exp $ + * $DragonFly: src/sys/kern/subr_bus.c,v 1.37 2007/05/01 00:05:18 dillon Exp $ */ #include "opt_bus.h" @@ -45,6 +45,8 @@ #include /* for device_printf() */ +#include + MALLOC_DEFINE(M_BUS, "bus", "Bus data structures"); #ifdef BUS_DEBUG @@ -94,6 +96,13 @@ void print_devclass_list(void); static void device_register_oids(device_t dev); static void device_unregister_oids(device_t dev); #endif +static void device_attach_async(device_t dev); +static void device_attach_thread(void *arg); +static int device_doattach(device_t dev); + +static int do_async_attach = 0; +static int numasyncthreads; +TUNABLE_INT("kern.do_async_attach", &do_async_attach); kobj_method_t null_methods[] = { { 0, 0 } @@ -891,6 +900,15 @@ device_set_softc(device_t dev, void *softc) dev->flags &= ~DF_EXTERNALSOFTC; } +void +device_set_async_attach(device_t dev, int enable) +{ + if (enable) + dev->flags |= DF_ASYNCPROBE; + else + dev->flags &= ~DF_ASYNCPROBE; +} + void * device_get_ivars(device_t dev) { @@ -1050,7 +1068,6 @@ device_probe_and_attach(device_t dev) { device_t bus = dev->parent; int error = 0; - int hasclass = (dev->devclass != 0); if (dev->state >= DS_ALIVE) return(0); @@ -1087,6 +1104,53 @@ device_probe_and_attach(device_t dev) } if (!device_is_quiet(dev)) device_print_child(bus, dev); + if ((dev->flags & DF_ASYNCPROBE) && do_async_attach) { + kprintf("%s: probing asynchronously\n", + device_get_nameunit(dev)); + dev->state = DS_INPROGRESS; + device_attach_async(dev); + error = 0; + } else { + error = device_doattach(dev); + } + return(error); +} + +/* + * Device is known to be alive, do the attach asynchronously. + * + * The MP lock is held by all threads. + */ +static void +device_attach_async(device_t dev) +{ + thread_t td; + + atomic_add_int(&numasyncthreads, 1); + lwkt_create(device_attach_thread, dev, &td, NULL, + 0, 0, (dev->desc ? dev->desc : "devattach")); +} + +static void +device_attach_thread(void *arg) +{ + device_t dev = arg; + + (void)device_doattach(dev); + atomic_subtract_int(&numasyncthreads, 1); + wakeup(&numasyncthreads); +} + +/* + * Device is known to be alive, do the attach (synchronous or asynchronous) + */ +static int +device_doattach(device_t dev) +{ + device_t bus = dev->parent; + int hasclass = (dev->devclass != 0); + int error; + error = DEVICE_ATTACH(dev); if (error == 0) { dev->state = DS_ATTACHED; @@ -1101,7 +1165,6 @@ device_probe_and_attach(device_t dev) device_set_driver(dev, NULL); dev->state = DS_NOTPRESENT; } - return(error); } @@ -1201,6 +1264,8 @@ sysctl_handle_state(SYSCTL_HANDLER_ARGS) return SYSCTL_OUT(req, "notpresent", sizeof("notpresent")); case DS_ALIVE: return SYSCTL_OUT(req, "alive", sizeof("alive")); + case DS_INPROGRESS: + return SYSCTL_OUT(req, "in-progress", sizeof("in-progress")); case DS_ATTACHED: return SYSCTL_OUT(req, "attached", sizeof("attached")); case DS_BUSY: @@ -2495,6 +2560,7 @@ DECLARE_MODULE(rootbus, root_bus_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); void root_bus_configure(void) { + int warncount; device_t dev; PDEBUG((".")); @@ -2511,6 +2577,26 @@ root_bus_configure(void) TAILQ_FOREACH(dev, &root_bus->children, link) { device_probe_and_attach(dev); } + + /* + * Wait for all asynchronous attaches to complete. If we don't + * our legacy ISA bus scan could steal device unit numbers or + * even I/O ports. + */ + warncount = 10; + if (numasyncthreads) + kprintf("Waiting for async drivers to attach\n"); + while (numasyncthreads > 0) { + if (tsleep(&numasyncthreads, 0, "rootbus", hz) == EWOULDBLOCK) + --warncount; + if (warncount == 0) { + kprintf("Warning: Still waiting for %d " + "drivers to attach\n", numasyncthreads); + } else if (warncount == -30) { + kprintf("Giving up on %d drivers\n", numasyncthreads); + break; + } + } root_bus->state = DS_ATTACHED; } diff --git a/sys/platform/pc32/i386/autoconf.c b/sys/platform/pc32/i386/autoconf.c index c16e64b64b..fee16d7fce 100644 --- a/sys/platform/pc32/i386/autoconf.c +++ b/sys/platform/pc32/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.35 2007/04/30 16:45:56 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.36 2007/05/01 00:05:18 dillon Exp $ */ /* @@ -193,7 +193,6 @@ configure_final(void *dummy) kprintf("Device configuration finished.\n"); } - cold = 0; } #ifdef BOOTP diff --git a/sys/platform/pc32/icu/icu_abi.c b/sys/platform/pc32/icu/icu_abi.c index be223c8968..9728755f30 100644 --- a/sys/platform/pc32/icu/icu_abi.c +++ b/sys/platform/pc32/icu/icu_abi.c @@ -36,7 +36,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/pc32/icu/icu_abi.c,v 1.12 2007/04/30 16:45:58 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/icu/icu_abi.c,v 1.13 2007/05/01 00:05:18 dillon Exp $ */ #include @@ -197,8 +197,6 @@ static void icu_cleanup(void) { - kprintf("fpending %08x ipending %08x\n", - mdcpu->gd_fpending, mdcpu->gd_ipending); mdcpu->gd_fpending = 0; mdcpu->gd_ipending = 0; } diff --git a/sys/platform/pc32/isa/clock.c b/sys/platform/pc32/isa/clock.c index 234075c82c..9a530b6640 100644 --- a/sys/platform/pc32/isa/clock.c +++ b/sys/platform/pc32/isa/clock.c @@ -35,7 +35,7 @@ * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 * $FreeBSD: src/sys/i386/isa/clock.c,v 1.149.2.6 2002/11/02 04:41:50 iwasaki Exp $ - * $DragonFly: src/sys/platform/pc32/isa/clock.c,v 1.51 2007/04/30 07:18:55 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/isa/clock.c,v 1.52 2007/05/01 00:05:18 dillon Exp $ */ /* @@ -363,12 +363,15 @@ cputimer_intr_reload(sysclock_t reload) } /* - * Wait "n" microseconds. + * DELAY(usec) - Spin for the specified number of microseconds. + * DRIVERSLEEP(usec) - Spin for the specified number of microseconds, + * but do a thread switch in the loop + * * Relies on timer 1 counting down from (cputimer_freq / hz) * Note: timer had better have been programmed before this is first used! */ -void -DELAY(int n) +static void +DODELAY(int n, int doswitch) { int delta, prev_tick, tick, ticks_left; @@ -416,6 +419,8 @@ DELAY(int n) if (delta < 0) delta = 0; ticks_left -= delta; + if (doswitch && ticks_left > 0) + lwkt_switch(); } #ifdef DELAYDEBUG if (state == 1) @@ -424,6 +429,26 @@ DELAY(int n) #endif } +void +DELAY(int n) +{ + DODELAY(n, 0); +} + +void +DRIVERSLEEP(int usec) +{ + globaldata_t gd = mycpu; + + if (gd->gd_intr_nesting_level || + gd->gd_spinlock_rd || + gd->gd_spinlocks_wr) { + DODELAY(usec, 0); + } else { + DODELAY(usec, 1); + } +} + static void sysbeepstop(void *chan) { diff --git a/sys/platform/vkernel/i386/autoconf.c b/sys/platform/vkernel/i386/autoconf.c index 545c4590be..e6e0bc1f64 100644 --- a/sys/platform/vkernel/i386/autoconf.c +++ b/sys/platform/vkernel/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/platform/vkernel/i386/autoconf.c,v 1.8 2007/04/30 07:18:55 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/autoconf.c,v 1.9 2007/05/01 00:05:18 dillon Exp $ */ /* @@ -243,7 +243,6 @@ configure_final(void *dummy) if (bootverbose) kprintf("Device configuration finished.\n"); - cold = 0; } #ifdef BOOTP diff --git a/sys/platform/vkernel/platform/systimer.c b/sys/platform/vkernel/platform/systimer.c index c266b3b844..7e45095aee 100644 --- a/sys/platform/vkernel/platform/systimer.c +++ b/sys/platform/vkernel/platform/systimer.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/systimer.c,v 1.12 2007/04/30 07:18:55 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/systimer.c,v 1.13 2007/05/01 00:05:18 dillon Exp $ */ #include @@ -214,3 +214,14 @@ DELAY(int usec) usleep(usec); } +void +DRIVERSLEEP(int usec) +{ + if (mycpu->gd_intr_nesting_level) + DELAY(usec); + else if (1000000 / usec >= hz) + tsleep(DRIVERSLEEP, 0, "DELAY", 1000000 / usec / hz + 1); + else + usleep(usec); +} + diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 743d09a03c..baed9b9944 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/bus.h,v 1.30.2.5 2004/03/17 17:54:25 njl Exp $ - * $DragonFly: src/sys/sys/bus.h,v 1.24 2007/01/04 21:47:03 corecode Exp $ + * $DragonFly: src/sys/sys/bus.h,v 1.25 2007/05/01 00:05:18 dillon Exp $ */ #ifndef _SYS_BUS_H_ @@ -90,6 +90,7 @@ typedef int (*devop_t)(void); typedef enum device_state { DS_NOTPRESENT, /* not probed or probe failed */ DS_ALIVE, /* probe succeeded */ + DS_INPROGRESS, /* attach in progress */ DS_ATTACHED, /* attach method called */ DS_BUSY /* device is open */ } device_state_t; @@ -323,6 +324,7 @@ int device_set_devclass(device_t dev, const char *classname); int device_set_driver(device_t dev, driver_t *driver); void device_set_flags(device_t dev, u_int32_t flags); void device_set_softc(device_t dev, void *softc); +void device_set_async_attach(device_t dev, int enable); int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */ int device_shutdown(device_t dev); void device_unbusy(device_t dev); diff --git a/sys/sys/bus_private.h b/sys/sys/bus_private.h index fd15799a17..c20be86b31 100644 --- a/sys/sys/bus_private.h +++ b/sys/sys/bus_private.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/bus_private.h,v 1.11.2.2 2000/08/03 00:25:22 peter Exp $ - * $DragonFly: src/sys/sys/bus_private.h,v 1.8 2006/05/21 03:43:47 dillon Exp $ + * $DragonFly: src/sys/sys/bus_private.h,v 1.9 2007/05/01 00:05:18 dillon Exp $ */ #ifndef _SYS_BUS_PRIVATE_H_ @@ -125,6 +125,7 @@ struct device { #define DF_QUIET 0x0010 /* don't print verbose attach message */ #define DF_DONENOMATCH 0x0020 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 0x0040 /* softc not allocated by us */ +#define DF_ASYNCPROBE 0x0080 /* can be probed with its own thread */ u_char order; /* order from device_add_child_ordered() */ u_char pad; #ifdef DEVICE_SYSCTLS diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 57c0d15835..b211c72334 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -40,7 +40,7 @@ * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/sys/kernel.h,v 1.63.2.9 2002/07/02 23:00:30 archie Exp $ - * $DragonFly: src/sys/sys/kernel.h,v 1.26 2007/04/30 07:18:56 dillon Exp $ + * $DragonFly: src/sys/sys/kernel.h,v 1.27 2007/05/01 00:05:18 dillon Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -151,6 +151,7 @@ enum sysinit_sub_id { SI_SUB_CREATE_INIT = 0x2300000, /* create the init process */ SI_SUB_DRIVERS = 0x2400000, /* Let Drivers initialize */ SI_SUB_CONFIGURE = 0x3800000, /* Configure devices */ + SI_SUB_ISWARM = 0x3c00000, /* No longer in cold boot */ SI_SUB_VFS = 0x4000000, /* virtual file system*/ SI_SUB_HELPER_THREADS = 0x5400000, /* misc helper threads */ SI_SUB_CLIST = 0x5800000, /* clists*/ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 650ca7a6af..8a0c7ed320 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -37,7 +37,7 @@ * * @(#)systm.h 8.7 (Berkeley) 3/29/95 * $FreeBSD: src/sys/sys/systm.h,v 1.111.2.18 2002/12/17 18:04:02 sam Exp $ - * $DragonFly: src/sys/sys/systm.h,v 1.68 2007/04/30 07:18:56 dillon Exp $ + * $DragonFly: src/sys/sys/systm.h,v 1.69 2007/05/01 00:05:18 dillon Exp $ */ #ifndef _SYS_SYSTM_H_ @@ -61,6 +61,7 @@ extern int securelevel; /* system security level (see init(8)) */ extern int kernel_mem_readonly; /* disable writes to kernel memory */ extern int cold; /* nonzero if we are doing a cold boot */ +extern int tsleep_now_works; /* tsleep won't just return any more */ extern const char *panicstr; /* panic message */ extern int dumping; /* system is dumping */ extern int safepri; /* safe ipl when cold or panicing */ @@ -215,6 +216,7 @@ int susword (void *base, int word); void realitexpire (void *); void DELAY(int usec); +void DRIVERSLEEP(int usec); void startprofclock (struct proc *); void stopprofclock (struct proc *); -- 2.41.0