Module Name: src
Committed By: snj
Date: Sun Oct 4 00:01:16 UTC 2009
Modified Files:
src/sys/dev/usb [netbsd-5]: uhci.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1054):
sys/dev/usb/uhci.c: revision 1.225
Make it safe to call uhci_init() from a kernel thread with interrupts
enabled:
- don't enable interrupts before calling uhci_run()
- check if the controller's interrupt is enabled in uhci_intr()
The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before
uhci_run() is complete and disable it because it found it halted.
Now a uhci controller can be successfully exported to a NetBSD Xen domU :)
To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.223.6.1 src/sys/dev/usb/uhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.223 src/sys/dev/usb/uhci.c:1.223.6.1
--- src/sys/dev/usb/uhci.c:1.223 Sat Jun 28 17:42:53 2008
+++ src/sys/dev/usb/uhci.c Sun Oct 4 00:01:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.223 2008/06/28 17:42:53 bouyer Exp $ */
+/* $NetBSD: uhci.c,v 1.223.6.1 2009/10/04 00:01:16 snj Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.223 2008/06/28 17:42:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.223.6.1 2009/10/04 00:01:16 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -563,10 +563,11 @@
UHCICMD(sc, UHCI_CMD_MAXP); /* Assume 64 byte packets at frame end */
DPRINTFN(1,("uhci_init: enabling\n"));
+
+ err = uhci_run(sc, 1); /* and here we go... */
UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE |
UHCI_INTR_IOCE | UHCI_INTR_SPIE); /* enable interrupts */
-
- return (uhci_run(sc, 1)); /* and here we go... */
+ return err;
}
#if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -1309,7 +1310,7 @@
if (sc->sc_dying || !device_has_power(sc->sc_dev))
return (0);
- if (sc->sc_bus.use_polling) {
+ if (sc->sc_bus.use_polling || UREAD2(sc, UHCI_INTR) == 0) {
#ifdef DIAGNOSTIC
DPRINTFN(16, ("uhci_intr: ignored interrupt while polling\n"));
#endif