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.
This commit is contained in:
Josef Karthauser 2002-01-24 20:21:17 +00:00
parent 0f14df92a1
commit 46d0cbc2cd
2 changed files with 24 additions and 5 deletions

View File

@ -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)

View File

@ -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))