aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2002-01-24 20:21:17 +0000
committerJosef Karthauser <joe@FreeBSD.org>2002-01-24 20:21:17 +0000
commit46d0cbc2cd60a19a23ea41ecbb2f403b9878f727 (patch)
tree0b077d02ee9aeeb719297d2ce3249afe629deee6 /sys
parent0f14df92a14343dc06298cbe385932b38915022f (diff)
downloadsrc-46d0cbc2cd60a19a23ea41ecbb2f403b9878f727.tar.gz
src-46d0cbc2cd60a19a23ea41ecbb2f403b9878f727.zip
Merge from NetBSD:
usb.c: -r1.35 - 1.37 usb_port.h: tiny bit of -r1.26 + an extra bit in the FreeBSD config section. revision 1.37 date: 2000/01/24 18:35:51; author: thorpej; state: Exp; lines: +7 -1 Use config_pending. ---------------------------- revision 1.36 date: 1999/12/22 23:54:09; author: augustss; state: Exp; lines: +2 -2 Use the flags `locator' to govern if devices are detected early or late during cold boot. ---------------------------- revision 1.35 date: 1999/12/20 02:12:23; author: augustss; state: Exp; lines: +8 -5 Make sure tsleep() is not called during cold boot.
Notes
Notes: svn path=/head/; revision=89764
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/usb.c23
-rw-r--r--sys/dev/usb/usb_port.h6
2 files changed, 24 insertions, 5 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index c35d679012db..6c915e7fb0d7 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.33 1999/11/22 21:57:09 augustss Exp $ */
+/* $NetBSD: usb.c,v 1.37 2000/01/24 18:35:51 thorpej Exp $ */
/* $FreeBSD$ */
/*
@@ -222,6 +222,10 @@ USB_ATTACH(usb)
}
printf("\n");
+ /* Make sure not to use tsleep() if we are cold booting. */
+ if (cold)
+ sc->sc_bus->use_polling++;
+
err = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0, 0, 0,
&sc->sc_port);
if (!err) {
@@ -239,18 +243,22 @@ USB_ATTACH(usb)
* until the USB event thread is running, which means that
* the keyboard will not work until after cold boot.
*/
- if (cold) {
- sc->sc_bus->use_polling++;
+#if defined(__FreeBSD__)
+ if (cold)
+#else
+ if (cold && (sc->sc_dev.dv_cfdata->cf_flags & 1))
+#endif
dev->hub->explore(sc->sc_bus->root_hub);
- sc->sc_bus->use_polling--;
- }
#endif
} else {
printf("%s: root hub problem, error=%d\n",
USBDEVNAME(sc->sc_dev), err);
sc->sc_dying = 1;
}
+ if (cold)
+ sc->sc_bus->use_polling--;
+ config_pending_incr();
#if defined(__NetBSD__) || defined(__OpenBSD__)
kthread_create(usb_create_event_thread, sc);
#endif
@@ -290,6 +298,7 @@ usb_event_thread(void *arg)
{
struct usb_softc *sc = arg;
int to;
+ int first = 1;
#ifdef __FreeBSD__
mtx_lock(&Giant);
@@ -302,6 +311,10 @@ usb_event_thread(void *arg)
if (usb_noexplore < 2)
#endif
usb_discover(sc);
+ if (first) {
+ config_pending_decr();
+ first = 0;
+ }
to = hz * 60;
#ifdef USB_DEBUG
if (usb_noexplore)
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 21cb9868c465..3f7842250bc9 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -177,6 +177,9 @@ typedef struct proc *usb_proc_ptr;
#define kthread_create1 kthread_create
#define kthread_create kthread_create_deferred
+#define config_pending_incr()
+#define config_pending_decr()
+
#define usbpoll usbselect
#define uhidpoll uhidselect
#define ugenpoll ugenselect
@@ -303,6 +306,9 @@ typedef struct thread *usb_proc_ptr;
#define kthread_create1(f, s, p, a0, a1) \
kthread_create((f), (s), (p), RFHIGHPID, (a0), (a1))
+#define config_pending_incr()
+#define config_pending_decr()
+
#define usb_timeout(f, d, t, h) ((h) = timeout((f), (d), (t)))
#define usb_untimeout(f, d, h) untimeout((f), (d), (h))