aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2002-04-01 21:34:01 +0000
committerJosef Karthauser <joe@FreeBSD.org>2002-04-01 21:34:01 +0000
commit8be36692c39581d36526679c1e91e2a9bffdad5c (patch)
treeff1f5fd46d7a589f06bfe013341f1605847c95e5 /sys
parent44731cab3b9966b7ca67f3fe50e7f3c711533730 (diff)
downloadsrc-8be36692c39581d36526679c1e91e2a9bffdad5c.tar.gz
src-8be36692c39581d36526679c1e91e2a9bffdad5c.zip
MFNetBSD: ohci.c (1.99), uhci.c (1.133), usb.c (1.49), usb_port.h
(1.39), usbdi.c (1.79), usbdi.h (1.47), usbdivar.h (1.62) date: 2001/01/21 02:39:52; author: augustss; Add code to use soft interrupt to handle USB interrupt processing. Don't enable the code since it doesn't work with the kludgy Ethernet drivers.
Notes
Notes: svn path=/head/; revision=93594
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/ohci.c8
-rw-r--r--sys/dev/usb/uhci.c8
-rw-r--r--sys/dev/usb/usb.c43
-rw-r--r--sys/dev/usb/usb_port.h2
-rw-r--r--sys/dev/usb/usbdi.c6
-rw-r--r--sys/dev/usb/usbdi.h15
-rw-r--r--sys/dev/usb/usbdivar.h14
7 files changed, 73 insertions, 23 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 7412ea2163dd..5b7b55f5ca68 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.96 2000/12/29 01:24:55 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.99 2001/01/21 02:39:52 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -124,7 +124,7 @@ Static void ohci_power(int, void *);
#endif
Static usbd_status ohci_open(usbd_pipe_handle);
Static void ohci_poll(struct usbd_bus *);
-Static void ohci_softintr (struct usbd_bus *);
+Static void ohci_softintr (void *);
Static void ohci_waitintr(ohci_softc_t *, usbd_xfer_handle);
Static void ohci_add_done(ohci_softc_t *, ohci_physaddr_t);
Static void ohci_rhsc(ohci_softc_t *, usbd_xfer_handle);
@@ -1181,9 +1181,9 @@ ohci_add_done(ohci_softc_t *sc, ohci_physaddr_t done)
}
void
-ohci_softintr(struct usbd_bus *bus)
+ohci_softintr(void *v)
{
- ohci_softc_t *sc = (ohci_softc_t *)bus;
+ ohci_softc_t *sc = v;
ohci_soft_itd_t *sitd, *sidone, *sitdnext;
ohci_soft_td_t *std, *sdone, *stdnext;
usbd_xfer_handle xfer;
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 715d92b53941..dad6c56f0935 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.132 2001/01/20 23:36:02 augustss Exp $ */
+/* $NetBSD: uhci.c,v 1.133 2001/01/21 02:39:52 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -237,7 +237,7 @@ Static void uhci_root_intr_done(usbd_xfer_handle);
Static usbd_status uhci_open(usbd_pipe_handle);
Static void uhci_poll(struct usbd_bus *);
-Static void uhci_softintr(struct usbd_bus *);
+Static void uhci_softintr(void *);
Static usbd_status uhci_device_request(usbd_xfer_handle xfer);
@@ -1228,9 +1228,9 @@ uhci_intr(void *arg)
}
void
-uhci_softintr(struct usbd_bus *bus)
+uhci_softintr(void *v)
{
- uhci_softc_t *sc = (uhci_softc_t *)bus;
+ uhci_softc_t *sc = v;
uhci_intr_info_t *ii;
DPRINTFN(10,("%s: uhci_softintr\n", USBDEVNAME(sc->sc_bus.bdev)));
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 1e59ec42456d..d7cfcd5af25e 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.48 2000/12/13 04:05:14 augustss Exp $ */
+/* $NetBSD: usb.c,v 1.49 2001/01/21 02:39:53 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -229,6 +229,20 @@ USB_ATTACH(usb)
ue.u.ue_ctrlr.ue_bus = USBDEVUNIT(sc->sc_dev);
usb_add_event(USB_EVENT_CTRLR_ATTACH, &ue);
+#ifdef USB_USE_SOFTINTR
+#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
+ /* XXX we should have our own level */
+ sc->sc_bus->soft = softintr_establish(IPL_SOFTNET,
+ sc->sc_bus->methods->soft_intr, sc->sc_bus);
+ if (sc->sc_bus->soft == NULL) {
+ printf("%s: can't register softintr\n", USBDEVNAME(sc->sc_dev));
+ sc->sc_dying = 1;
+ }
+#else
+ callout_init(&sc->sc_bus->softi);
+#endif
+#endif
+
err = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0, 0, 0,
&sc->sc_port);
if (!err) {
@@ -703,9 +717,23 @@ usb_add_event(int type, struct usb_event *uep)
}
void
-usb_schedsoftintr(struct usbd_bus *bus)
+usb_schedsoftintr(usbd_bus_handle bus)
{
+#ifdef USB_USE_SOFTINTR
+ if (bus->use_polling) {
+ bus->methods->soft_intr(bus);
+ } else {
+#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
+ softintr_schedule(bus->soft);
+#else
+ if (!callout_pending(&bus->softi))
+ callout_reset(&bus->softi, 0, bus->methods->soft_intr,
+ bus);
+#endif /* __HAVE_GENERIC_SOFT_INTERRUPTS */
+ }
+#else
bus->methods->soft_intr(bus);
+#endif
}
#if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -757,6 +785,17 @@ usb_detach(device_ptr_t self, int flags)
usbd_finish();
+#ifdef USB_USE_SOFTINTR
+#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
+ if (sc->sc_bus->soft != NULL) {
+ softintr_disestablish(sc->sc_bus->soft);
+ sc->sc_bus->soft = NULL;
+ }
+#else
+ callout_stop(&sc->sc_bus->softi);
+#endif
+#endif
+
ue.u.ue_ctrlr.ue_bus = USBDEVUNIT(sc->sc_dev);
usb_add_event(USB_EVENT_CTRLR_DETACH, &ue);
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index d78b3d5b82d4..20ff88cd2860 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -52,6 +52,8 @@
#include "opt_usbverbose.h"
+/*#define USB_USE_SOFTINTR */
+
#ifdef USB_DEBUG
#define UHID_DEBUG 1
#define OHCI_DEBUG 1
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 3fad24150d79..4bf3a13c5ecb 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb/usbdi.c,v 1.78 2001/01/19 04:01:10 augustss Exp $ */
+/* $NetBSD: usbdi.c,v 1.79 2001/01/21 02:39:53 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -299,12 +299,16 @@ usbd_transfer(usbd_xfer_handle xfer)
int i;
usbd_bus_handle bus = pipe->device->bus;
int to = xfer->timeout * 1000;
+ DPRINTFN(2,("usbd_transfer: polling\n"));
for (i = 0; i < to; i += 10) {
delay(10);
bus->methods->do_poll(bus);
if (xfer->done)
break;
}
+ DPRINTFN(2,("usbd_transfer: polling done =\n",
+ xfer->done));
+ /* XXX Is this right, what about the HC timeout? */
if (!xfer->done) {
pipe->methods->abort(xfer);
xfer->status = USBD_TIMEOUT;
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index 799849714214..64f46443d256 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.h,v 1.46 2001/01/18 20:28:23 jdolecek Exp $ */
+/* $NetBSD: usbdi.h,v 1.47 2001/01/21 02:39:53 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -249,14 +249,11 @@ struct usb_attach_arg {
int usbd_driver_load(module_t mod, int what, void *arg);
#endif
-/*
- * XXX
- * splusb MUST be the lowest level interrupt so that within USB callbacks
- * the level can be raised the appropriate level.
- * XXX Should probably use a softsplusb.
- */
-/* XXX */
+/* XXX Perhaps USB should have its own levels? */
+#ifdef USB_USE_SOFTINTR
+#define splusb splsoftnet
+#else
#define splusb splbio
+#endif
#define splhardusb splbio
#define IPL_USB IPL_BIO
-/* XXX */
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h
index 8d51a3d515ef..0fe761b30b9c 100644
--- a/sys/dev/usb/usbdivar.h
+++ b/sys/dev/usb/usbdivar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.61 2001/01/18 20:28:23 jdolecek Exp $ */
+/* $NetBSD: usbdivar.h,v 1.62 2001/01/21 02:39:53 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -53,7 +53,7 @@ struct usbd_endpoint {
struct usbd_bus_methods {
usbd_status (*open_pipe)(struct usbd_pipe *pipe);
- void (*soft_intr)(struct usbd_bus *);
+ void (*soft_intr)(void *);
void (*do_poll)(struct usbd_bus *);
usbd_status (*allocm)(struct usbd_bus *, usb_dma_t *,
u_int32_t bufsize);
@@ -113,7 +113,15 @@ struct usbd_bus {
#define USBREV_1_0 2
#define USBREV_1_1 3
#define USBREV_2_0 4
-#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1" }
+#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0" }
+
+#ifdef USB_USE_SOFTINTR
+#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
+ void *soft; /* soft interrupt cookie */
+#else
+ struct callout softi;
+#endif
+#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
bus_dma_tag_t dmatag; /* DMA tag */