--- sys/dev/usb/controller/usb_controller.c 2009/09/28 07:05:14 +++ sys/dev/usb/controller/usb_controller.c 2009/10/02 21:07:21 @@ -67,6 +67,7 @@ static device_detach_t usb_detach; static void usb_attach_sub(device_t, struct usb_bus *); +static void usb_bus_config_hook(void *arg); /* static variables */ @@ -78,11 +79,6 @@ "Debug level"); #endif -static int usb_no_boot_wait = 0; -TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait); -SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0, - "No device enumerate waiting at boot."); - static devclass_t usb_devclass; static device_method_t usb_methods[] = { @@ -134,11 +130,6 @@ return (ENXIO); } - if (usb_no_boot_wait == 0) { - /* delay vfs_mountroot until the bus is explored */ - bus->bus_roothold = root_mount_hold(device_get_nameunit(dev)); - } - usb_attach_sub(dev, bus); return (0); /* return success */ @@ -161,12 +152,6 @@ /* Stop power watchdog */ usb_callout_drain(&bus->power_wdog); - /* Let the USB explore process detach all devices. */ - if (bus->bus_roothold != NULL) { - root_mount_rel(bus->bus_roothold); - bus->bus_roothold = NULL; - } - USB_BUS_LOCK(bus); if (usb_proc_msignal(&bus->explore_proc, &bus->detach_msg[0], &bus->detach_msg[1])) { @@ -239,9 +224,11 @@ (udev->hub->explore) (udev); USB_BUS_LOCK(bus); } - if (bus->bus_roothold != NULL) { - root_mount_rel(bus->bus_roothold); - bus->bus_roothold = NULL; + + if (bus->usb_config_hook != NULL) { + config_intrhook_disestablish(bus->usb_config_hook); + free(bus->usb_config_hook, M_TEMP); + bus->usb_config_hook = NULL; } } @@ -445,16 +432,31 @@ "process failed.\n"); } else { /* Get final attach going */ - USB_BUS_LOCK(bus); - if (usb_proc_msignal(&bus->explore_proc, - &bus->attach_msg[0], &bus->attach_msg[1])) { - /* ignore */ - } - USB_BUS_UNLOCK(bus); + bus->usb_config_hook = malloc(sizeof(struct intr_config_hook), + M_TEMP, M_ZERO); + bus->usb_config_hook->ich_func = usb_bus_config_hook; + bus->usb_config_hook->ich_arg = bus; + config_intrhook_establish(bus->usb_config_hook); + } +} + +static void +usb_bus_config_hook(void *arg) +{ + struct usb_bus *bus; + + bus = (struct usb_bus *)arg; - /* Do initial explore */ - usb_needs_explore(bus, 1); + USB_BUS_LOCK(bus); + bus->buses_to_explore = 0; + if (usb_proc_msignal(&bus->explore_proc, + &bus->attach_msg[0], &bus->attach_msg[1])) { + /* ignore */ } + USB_BUS_UNLOCK(bus); + + /* Do initial explore */ + usb_needs_explore(bus, 1); } SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL); --- sys/dev/usb/usb_bus.h 2009/09/28 07:45:13 +++ sys/dev/usb/usb_bus.h 2009/10/02 21:07:21 @@ -51,7 +51,7 @@ struct usb_bus { struct usb_bus_stat stats_err; struct usb_bus_stat stats_ok; - struct root_hold_token *bus_roothold; + struct intr_config_hook *usb_config_hook; /* * There are two callback processes. One for Giant locked * callbacks. One for non-Giant locked callbacks. This should