2 * $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $
3 * $FreeBSD: src/sys/dev/usb/usb.c,v 1.106 2005/03/27 15:31:23 iedowse Exp $
6 /* Also already merged from NetBSD:
7 * $NetBSD: usb.c,v 1.70 2002/05/09 21:54:32 augustss Exp $
8 * $NetBSD: usb.c,v 1.71 2002/06/01 23:51:04 lukem Exp $
9 * $NetBSD: usb.c,v 1.73 2002/09/23 05:51:19 simonb Exp $
10 * $NetBSD: usb.c,v 1.80 2003/11/07 17:03:25 wiz Exp $
14 * Copyright (c) 1998 The NetBSD Foundation, Inc.
15 * All rights reserved.
17 * This code is derived from software contributed to The NetBSD Foundation
18 * by Lennart Augustsson (lennart@augustsson.net) at
19 * Carlstedt Research & Technology.
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions
24 * 1. Redistributions of source code must retain the above copyright
25 * notice, this list of conditions and the following disclaimer.
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in the
28 * documentation and/or other materials provided with the distribution.
29 * 3. All advertising materials mentioning features or use of this software
30 * must display the following acknowledgement:
31 * This product includes software developed by the NetBSD
32 * Foundation, Inc. and its contributors.
33 * 4. Neither the name of The NetBSD Foundation nor the names of its
34 * contributors may be used to endorse or promote products derived
35 * from this software without specific prior written permission.
37 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
38 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
39 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
41 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47 * POSSIBILITY OF SUCH DAMAGE.
51 * USB specifications and other documentation can be found at
52 * http://www.usb.org/developers/docs/ and
53 * http://www.usb.org/developers/devclass_docs/
56 #include <sys/param.h>
57 #include <sys/systm.h>
58 #include <sys/kernel.h>
60 #include <sys/malloc.h>
61 #include <sys/unistd.h>
62 #include <sys/module.h>
64 #include <sys/fcntl.h>
65 #include <sys/filio.h>
67 #include <sys/kthread.h>
70 #include <sys/device.h>
71 #include <sys/event.h>
72 #include <sys/vnode.h>
73 #include <sys/signalvar.h>
74 #include <sys/sysctl.h>
76 #include <sys/thread2.h>
77 #include <sys/mplock2.h>
79 #include <bus/usb/usb.h>
80 #include <bus/usb/usbdi.h>
81 #include <bus/usb/usbdi_util.h>
83 #define USBUNIT(d) (minor(d)) /* usb_discover device nodes, kthread */
84 #define USB_DEV_MINOR 255 /* event queue device */
86 MALLOC_DEFINE(M_USB, "USB", "USB");
87 MALLOC_DEFINE(M_USBDEV, "USBdev", "USB device");
88 MALLOC_DEFINE(M_USBHC, "USBHC", "USB host controller");
92 #include <bus/usb/usbdivar.h>
93 #include <bus/usb/usb_quirks.h>
95 /* Define this unconditionally in case a kernel module is loaded that
96 * has been compiled with debugging options.
98 SYSCTL_NODE(_hw, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging");
101 * XXX: This is a hack! If your USB keyboard doesn't work
102 * early at boot, try setting this tunable to 0 from
105 * set hw.usb.hack_defer_exploration=0
107 static int hack_defer_exploration = 1;
110 #define DPRINTF(x) if (usbdebug) kprintf x
111 #define DPRINTFN(n,x) if (usbdebug>(n)) kprintf x
113 SYSCTL_INT(_hw_usb, OID_AUTO, debug, CTLFLAG_RW,
114 &usbdebug, 0, "usb debug level");
117 * 0 - do usual exploration
118 * 1 - do not use timeout exploration
119 * >1 - do no exploration
121 int usb_noexplore = 0;
124 #define DPRINTFN(n,x)
129 TAILQ_ENTRY(usb_softc) sc_coldexplist; /* cold needs-explore list */
130 usbd_bus_handle sc_bus; /* USB controller */
131 struct usbd_port sc_port; /* dummy port for root hub */
133 struct thread *sc_event_thread;
139 TAILQ_HEAD(, usb_task) tasks;
140 struct thread *task_thread_proc;
142 int taskcreated; /* task thread exists. */
144 static struct usb_taskq usb_taskq[USB_NUM_TASKQS];
150 d_kqfilter_t usbkqfilter;
152 static void usbfilt_detach(struct knote *);
153 static int usbfilt(struct knote *, long);
155 static struct dev_ops usb_ops = {
161 .d_kqfilter = usbkqfilter
164 static void usb_discover(device_t);
165 static bus_child_detached_t usb_child_detached;
166 static void usb_create_event_thread(device_t);
167 static void usb_event_thread(void *);
168 static void usb_task_thread(void *);
170 static cdev_t usb_dev; /* The /dev/usb device. */
171 static int usb_ndevs; /* Number of /dev/usbN devices. */
172 /* Busses to explore at the end of boot-time device configuration */
173 static TAILQ_HEAD(, usb_softc) usb_coldexplist =
174 TAILQ_HEAD_INITIALIZER(usb_coldexplist);
176 #define USB_MAX_EVENTS 100
179 TAILQ_ENTRY(usb_event_q) next;
181 static TAILQ_HEAD(, usb_event_q) usb_events =
182 TAILQ_HEAD_INITIALIZER(usb_events);
183 static int usb_nevents = 0;
184 static struct kqinfo usb_kqevent;
185 static struct proc *usb_async_proc; /* process that wants USB SIGIO */
186 static int usb_dev_open = 0;
187 static void usb_add_event(int, struct usb_event *);
189 static int usb_get_next_event(struct usb_event *);
191 static const char *usbrev_str[] = USBREV_STR;
193 static device_probe_t usb_match;
194 static device_attach_t usb_attach;
195 static device_detach_t usb_detach;
197 static devclass_t usb_devclass;
199 static kobj_method_t usb_methods[] = {
200 DEVMETHOD(device_probe, usb_match),
201 DEVMETHOD(device_attach, usb_attach),
202 DEVMETHOD(device_detach, usb_detach),
203 DEVMETHOD(bus_child_detached, usb_child_detached),
204 DEVMETHOD(device_suspend, bus_generic_suspend),
205 DEVMETHOD(device_resume, bus_generic_resume),
206 DEVMETHOD(device_shutdown, bus_generic_shutdown),
210 static driver_t usb_driver = {
213 sizeof(struct usb_softc)
216 MODULE_DEPEND(usb, usb, 1, 1, 1);
217 MODULE_VERSION(usb, 1);
220 usb_match(device_t self)
222 DPRINTF(("usb_match\n"));
223 return (UMATCH_GENERIC);
227 usb_attach(device_t self)
229 struct usb_softc *sc = device_get_softc(self);
230 void *aux = device_get_ivars(self);
232 usbd_device_handle dev;
238 TUNABLE_INT_FETCH("hw.usb.hack_defer_exploration",
239 &hack_defer_exploration);
241 DPRINTF(("usb_attach\n"));
245 sc->sc_bus->usbctl = sc;
246 sc->sc_port.power = USB_MAX_POWER;
248 usbrev = sc->sc_bus->usbrev;
249 device_printf(self, "USB revision %s", usbrev_str[usbrev]);
253 speed = USB_SPEED_FULL;
256 speed = USB_SPEED_HIGH;
259 kprintf(", not supported\n");
265 /* Make sure not to use tsleep() if we are cold booting. */
266 if (hack_defer_exploration && cold)
267 sc->sc_bus->use_polling++;
269 ue.u.ue_ctrlr.ue_bus = device_get_unit(self);
270 usb_add_event(USB_EVENT_CTRLR_ATTACH, &ue);
272 #ifdef USB_USE_SOFTINTR
273 callout_init(&sc->sc_bus->softi);
276 err = usbd_new_device(self, sc->sc_bus, 0, speed, 0, &sc->sc_port);
278 dev = sc->sc_port.device;
279 if (dev->hub == NULL) {
282 "root device is not a hub\n");
285 sc->sc_bus->root_hub = dev;
288 * Turning this code off will delay attachment of USB devices
289 * until the USB event thread is running, which means that
290 * the keyboard will not work until after cold boot.
293 if (hack_defer_exploration) {
294 /* Explore high-speed busses before others. */
295 if (speed == USB_SPEED_HIGH)
296 dev->hub->explore(sc->sc_bus->root_hub);
298 TAILQ_INSERT_TAIL(&usb_coldexplist, sc,
302 * XXX Exploring high speed devices here will
305 if (speed != USB_SPEED_HIGH)
306 dev->hub->explore(sc->sc_bus->root_hub);
312 "root hub problem, error=%d\n", err);
315 if (hack_defer_exploration && cold)
316 sc->sc_bus->use_polling--;
318 usb_create_event_thread(self);
321 * The per controller devices (used for usb_discover)
322 * XXX This is redundant now, but old usbd's will want it
324 tmp_dev = make_dev(&usb_ops, device_get_unit(self),
325 UID_ROOT, GID_OPERATOR, 0660,
326 "usb%d", device_get_unit(self));
327 sc->sc_usbdev = reference_dev(tmp_dev);
328 if (usb_ndevs++ == 0) {
329 /* The device spitting out events */
330 tmp_dev = make_dev(&usb_ops, USB_DEV_MINOR,
331 UID_ROOT, GID_OPERATOR, 0660, "usb");
332 usb_dev = reference_dev(tmp_dev);
338 static const char *taskq_names[] = USB_TASKQ_NAMES;
341 usb_create_event_thread(device_t self)
343 struct usb_softc *sc = device_get_softc(self);
346 if (kthread_create(usb_event_thread, self, &sc->sc_event_thread,
347 "%s", device_get_nameunit(self))) {
349 "unable to create event thread for\n");
350 panic("usb_create_event_thread");
353 for (i = 0; i < USB_NUM_TASKQS; i++) {
354 struct usb_taskq *taskq = &usb_taskq[i];
356 if (taskq->taskcreated == 0) {
357 taskq->taskcreated = 1;
358 taskq->name = taskq_names[i];
359 TAILQ_INIT(&taskq->tasks);
360 if (kthread_create(usb_task_thread, taskq,
361 &taskq->task_thread_proc, "%s", taskq->name)) {
362 kprintf("unable to create task thread\n");
363 panic("usb_create_event_thread task");
370 * Add a task to be performed by the task thread. This function can be
371 * called from any context and the task will be executed in a process
375 usb_add_task(usbd_device_handle dev, struct usb_task *task, int queue)
377 struct usb_taskq *taskq;
381 taskq = &usb_taskq[queue];
382 if (task->queue == -1) {
383 DPRINTFN(2,("usb_add_task: task=%p\n", task));
384 TAILQ_INSERT_TAIL(&taskq->tasks, task, next);
387 DPRINTFN(3,("usb_add_task: task=%p on q\n", task));
389 wakeup(&taskq->tasks);
395 usb_do_task(usbd_device_handle dev, struct usb_task *task, int queue,
398 struct usb_taskq *taskq;
402 taskq = &usb_taskq[queue];
403 if (task->queue == -1) {
404 DPRINTFN(2,("usb_add_task: task=%p\n", task));
405 TAILQ_INSERT_TAIL(&taskq->tasks, task, next);
408 DPRINTFN(3,("usb_add_task: task=%p on q\n", task));
410 wakeup(&taskq->tasks);
412 /* Wait until task is finished */
413 tsleep((&taskq->tasks + 1), 0, "usbdotsk", time_out);
419 usb_rem_task(usbd_device_handle dev, struct usb_task *task)
422 if (task->queue != -1) {
423 TAILQ_REMOVE(&usb_taskq[task->queue].tasks, task, next);
430 usb_event_thread(void *arg)
433 struct usb_softc *sc = device_get_softc(self);
435 DPRINTF(("usb_event_thread: start\n"));
438 * In case this controller is a companion controller to an
439 * EHCI controller we need to wait until the EHCI controller
440 * has grabbed the port.
441 * XXX It would be nicer to do this with a tsleep(), but I don't
442 * know how to synchronize the creation of the threads so it
445 usb_delay_ms(sc->sc_bus, 500);
450 /* Make sure first discover does something. */
451 sc->sc_bus->needs_explore = 1;
454 while (!sc->sc_dying) {
456 if (usb_noexplore < 2)
460 tsleep(&sc->sc_bus->needs_explore, 0, "usbevt",
461 usb_noexplore ? 0 : hz * 60);
463 tsleep(&sc->sc_bus->needs_explore, 0, "usbevt", hz * 60);
465 DPRINTFN(2,("usb_event_thread: woke up\n"));
467 sc->sc_event_thread = NULL;
472 /* In case parent is waiting for us to exit. */
475 DPRINTF(("usb_event_thread: exit\n"));
479 usb_task_thread(void *arg)
481 struct usb_task *task;
482 struct usb_taskq *taskq;
488 DPRINTF(("usb_task_thread: start taskq %s\n", taskq->name));
490 while (usb_ndevs > 0) {
491 task = TAILQ_FIRST(&taskq->tasks);
493 tsleep(&taskq->tasks, 0, "usbtsk", 0);
494 task = TAILQ_FIRST(&taskq->tasks);
496 DPRINTFN(2,("usb_task_thread: woke up task=%p\n", task));
498 TAILQ_REMOVE(&taskq->tasks, task, next);
501 task->fun(task->arg);
503 wakeup((&taskq->tasks + 1));
510 taskq->taskcreated = 0;
511 wakeup(&taskq->taskcreated);
513 DPRINTF(("usb_event_thread: exit\n"));
517 usbopen(struct dev_open_args *ap)
519 cdev_t dev = ap->a_head.a_dev;
520 int unit = USBUNIT(dev);
521 struct usb_softc *sc;
523 if (unit == USB_DEV_MINOR) {
527 usb_async_proc = NULL;
531 sc = devclass_get_softc(usb_devclass, unit);
542 usbread(struct dev_read_args *ap)
544 cdev_t dev = ap->a_head.a_dev;
545 struct uio *uio = ap->a_uio;
547 int unit = USBUNIT(dev);
550 if (unit != USB_DEV_MINOR)
553 if (uio->uio_resid != sizeof(struct usb_event))
559 n = usb_get_next_event(&ue);
562 if (ap->a_ioflag & IO_NDELAY) {
566 error = tsleep(&usb_events, PCATCH, "usbrea", 0);
572 error = uiomove((void *)&ue, uio->uio_resid, uio);
578 usbclose(struct dev_close_args *ap)
580 cdev_t dev = ap->a_head.a_dev;
581 int unit = USBUNIT(dev);
583 if (unit == USB_DEV_MINOR) {
584 usb_async_proc = NULL;
592 usbioctl(struct dev_ioctl_args *ap)
594 cdev_t devt = ap->a_head.a_dev;
595 struct usb_softc *sc;
596 int unit = USBUNIT(devt);
598 if (unit == USB_DEV_MINOR) {
601 if (*(int *)ap->a_data)
602 usb_async_proc = curproc;
604 usb_async_proc = NULL;
612 sc = devclass_get_softc(usb_devclass, unit);
618 /* This part should be deleted */
623 struct usb_ctl_request *ur = (void *)ap->a_data;
624 size_t len = UGETW(ur->ucr_request.wLength);
628 int addr = ur->ucr_addr;
632 DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%zu\n", addr, len));
635 if (addr < 0 || addr >= USB_MAX_DEVICES ||
636 sc->sc_bus->devices[addr] == 0)
639 iov.iov_base = (caddr_t)ur->ucr_data;
645 uio.uio_segflg = UIO_USERSPACE;
647 ur->ucr_request.bmRequestType & UT_READ ?
648 UIO_READ : UIO_WRITE;
649 uio.uio_td = curthread;
650 ptr = kmalloc(len, M_TEMP, M_WAITOK);
651 if (uio.uio_rw == UIO_WRITE) {
652 error = uiomove(ptr, len, &uio);
657 err = usbd_do_request_flags(sc->sc_bus->devices[addr],
658 &ur->ucr_request, ptr, ur->ucr_flags, &ur->ucr_actlen,
659 USBD_DEFAULT_TIMEOUT);
665 if (uio.uio_rw == UIO_READ) {
666 error = uiomove(ptr, len, &uio);
679 struct usb_device_info *di = (void *)ap->a_data;
680 int addr = di->udi_addr;
681 usbd_device_handle dev;
683 if (addr < 1 || addr >= USB_MAX_DEVICES)
685 dev = sc->sc_bus->devices[addr];
688 usbd_fill_deviceinfo(dev, di, 1);
692 case USB_DEVICESTATS:
693 *(struct usb_device_stats *)ap->a_data = sc->sc_bus->stats;
702 static struct filterops usbfiltops =
703 { FILTEROP_ISFD, NULL, usbfilt_detach, usbfilt };
706 usbkqfilter(struct dev_kqfilter_args *ap)
708 cdev_t dev = ap->a_head.a_dev;
709 struct knote *kn = ap->a_kn;
714 switch (kn->kn_filter) {
716 kn->kn_fop = &usbfiltops;
717 kn->kn_hook = (caddr_t)dev;
720 ap->a_result = EOPNOTSUPP;
724 klist = &usb_kqevent.ki_note;
725 knote_insert(klist, kn);
731 usbfilt_detach(struct knote *kn)
735 klist = &usb_kqevent.ki_note;
736 knote_remove(klist, kn);
740 usbfilt(struct knote *kn, long hint)
742 cdev_t dev = (cdev_t)kn->kn_hook;
743 int unit = USBUNIT(dev);
746 if (unit == USB_DEV_MINOR) {
756 /* Explore device tree from the root. */
758 usb_discover(device_t self)
760 struct usb_softc *sc = device_get_softc(self);
762 DPRINTFN(2,("usb_discover\n"));
764 if (usb_noexplore > 1)
769 * We need mutual exclusion while traversing the device tree,
770 * but this is guaranteed since this function is only called
771 * from the event thread for the controller.
774 while (sc->sc_bus->needs_explore && !sc->sc_dying) {
775 sc->sc_bus->needs_explore = 0;
778 sc->sc_bus->root_hub->hub->explore(sc->sc_bus->root_hub);
786 usb_needs_explore(usbd_device_handle dev)
788 DPRINTFN(2,("usb_needs_explore\n"));
789 dev->bus->needs_explore = 1;
790 wakeup(&dev->bus->needs_explore);
793 /* Called from a critical section */
795 usb_get_next_event(struct usb_event *ue)
797 struct usb_event_q *ueq;
799 if (usb_nevents <= 0)
801 ueq = TAILQ_FIRST(&usb_events);
804 kprintf("usb: usb_nevents got out of sync! %d\n", usb_nevents);
811 TAILQ_REMOVE(&usb_events, ueq, next);
812 kfree(ueq, M_USBDEV);
818 usbd_add_dev_event(int type, usbd_device_handle udev)
822 usbd_fill_deviceinfo(udev, &ue.u.ue_device, USB_EVENT_IS_ATTACH(type));
823 usb_add_event(type, &ue);
827 usbd_add_drv_event(int type, usbd_device_handle udev, device_t dev)
831 ue.u.ue_driver.ue_cookie = udev->cookie;
832 strncpy(ue.u.ue_driver.ue_devname, device_get_nameunit(dev),
833 sizeof ue.u.ue_driver.ue_devname);
834 usb_add_event(type, &ue);
838 usb_add_event(int type, struct usb_event *uep)
840 struct usb_event_q *ueq;
841 struct timeval thetime;
843 ueq = kmalloc(sizeof *ueq, M_USBDEV, M_INTWAIT);
845 ueq->ue.ue_type = type;
847 TIMEVAL_TO_TIMESPEC(&thetime, &ueq->ue.ue_time);
850 if (USB_EVENT_IS_DETACH(type)) {
851 struct usb_event_q *ueqi, *ueqi_next;
853 for (ueqi = TAILQ_FIRST(&usb_events); ueqi; ueqi = ueqi_next) {
854 ueqi_next = TAILQ_NEXT(ueqi, next);
855 if (ueqi->ue.u.ue_driver.ue_cookie.cookie ==
856 uep->u.ue_device.udi_cookie.cookie) {
857 TAILQ_REMOVE(&usb_events, ueqi, next);
858 kfree(ueqi, M_USBDEV);
860 ueqi_next = TAILQ_FIRST(&usb_events);
864 if (usb_nevents >= USB_MAX_EVENTS) {
865 /* Too many queued events, drop an old one. */
866 DPRINTF(("usb: event dropped\n"));
867 usb_get_next_event(NULL);
869 TAILQ_INSERT_TAIL(&usb_events, ueq, next);
872 KNOTE(&usb_kqevent.ki_note, 0);
873 if (usb_async_proc != NULL) {
874 ksignal(usb_async_proc, SIGIO);
880 usb_schedsoftintr(usbd_bus_handle bus)
882 DPRINTFN(10,("usb_schedsoftintr: polling=%d\n", bus->use_polling));
883 #ifdef USB_USE_SOFTINTR
884 if (bus->use_polling) {
885 bus->methods->soft_intr(bus);
887 if (!callout_pending(&bus->softi))
888 callout_reset(&bus->softi, 0, bus->methods->soft_intr,
892 bus->methods->soft_intr(bus);
893 #endif /* USB_USE_SOFTINTR */
897 usb_detach(device_t self)
899 struct usb_softc *sc = device_get_softc(self);
902 DPRINTF(("usb_detach: start\n"));
906 /* Make all devices disconnect. */
907 if (sc->sc_port.device != NULL)
908 usb_disconnect_port(&sc->sc_port, self);
910 /* Kill off event thread. */
911 if (sc->sc_event_thread != NULL) {
912 wakeup(&sc->sc_bus->needs_explore);
913 if (tsleep(sc, 0, "usbdet", hz * 60))
915 "event thread didn't die\n");
916 DPRINTF(("usb_detach: event thread dead\n"));
919 release_dev(sc->sc_usbdev);
921 if (--usb_ndevs == 0) {
924 release_dev(usb_dev);
925 dev_ops_remove_minor(&usb_ops, USB_DEV_MINOR);
928 for (i = 0; i < USB_NUM_TASKQS; i++) {
929 struct usb_taskq *taskq = &usb_taskq[i];
930 wakeup(&taskq->tasks);
931 if (tsleep(&taskq->taskcreated, 0, "usbtdt",
933 kprintf("usb task thread %s didn't die\n",
941 #ifdef USB_USE_SOFTINTR
942 callout_stop(&sc->sc_bus->softi);
945 ue.u.ue_ctrlr.ue_bus = device_get_unit(self);
946 usb_add_event(USB_EVENT_CTRLR_DETACH, &ue);
952 usb_child_detached(device_t self, device_t child)
954 struct usb_softc *sc = device_get_softc(self);
956 /* XXX, should check it is the right device. */
957 sc->sc_port.device = NULL;
960 /* Explore USB busses at the end of device configuration */
962 usb_cold_explore(void *arg)
964 struct usb_softc *sc;
966 TUNABLE_INT_FETCH("hw.usb.hack_defer_exploration",
967 &hack_defer_exploration);
969 if (!hack_defer_exploration)
972 KASSERT(cold || TAILQ_EMPTY(&usb_coldexplist),
973 ("usb_cold_explore: busses to explore when !cold"));
974 while (!TAILQ_EMPTY(&usb_coldexplist)) {
975 sc = TAILQ_FIRST(&usb_coldexplist);
976 TAILQ_REMOVE(&usb_coldexplist, sc, sc_coldexplist);
978 sc->sc_bus->use_polling++;
979 sc->sc_port.device->hub->explore(sc->sc_bus->root_hub);
980 sc->sc_bus->use_polling--;
985 usb_getbushandle(struct usb_softc *sc)
991 SYSINIT(usb_cold_explore, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE,
992 usb_cold_explore, NULL);
994 DRIVER_MODULE(usb, ohci, usb_driver, usb_devclass, NULL, NULL);
995 DRIVER_MODULE(usb, uhci, usb_driver, usb_devclass, NULL, NULL);
996 DRIVER_MODULE(usb, ehci, usb_driver, usb_devclass, NULL, NULL);