Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Try to avoid accessing the HC if it is dead. Su...



details:   https://anonhg.NetBSD.org/src/rev/31599a8b2c30
branches:  trunk
changeset: 481336:31599a8b2c30
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Jan 26 10:04:38 2000 +0000

description:
Try to avoid accessing the HC if it is dead.  Suggested by mycroft.

diffstat:

 sys/dev/usb/uhci.c    |  24 +++++++++++++++++++++++-
 sys/dev/usb/uhcivar.h |   3 ++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (104 lines):

diff -r 338530919b37 -r 31599a8b2c30 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Wed Jan 26 09:44:10 2000 +0000
+++ b/sys/dev/usb/uhci.c        Wed Jan 26 10:04:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.81 2000/01/25 17:31:05 augustss Exp $       */
+/*     $NetBSD: uhci.c,v 1.82 2000/01/26 10:04:38 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -983,6 +983,7 @@
                /* no acknowledge needed */
                printf("%s: host controller halted\n", 
                       USBDEVNAME(sc->sc_bus.bdev));
+               sc->sc_dying = 1;
        }
 
        if (ack)        /* acknowledge the ints */
@@ -1544,6 +1545,9 @@
        DPRINTFN(3, ("uhci_device_bulk_transfer: xfer=%p len=%d flags=%d\n",
                     xfer, xfer->length, xfer->flags));
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
 #ifdef DIAGNOSTIC
        if (xfer->rqflags & URQ_REQUEST)
                panic("uhci_device_bulk_transfer: a request\n");
@@ -1713,6 +1717,9 @@
        uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
        usbd_status err;
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
 #ifdef DIAGNOSTIC
        if (!(xfer->rqflags & URQ_REQUEST))
                panic("uhci_device_ctrl_transfer: not a request\n");
@@ -1757,6 +1764,9 @@
        usbd_status err;
        int i, s;
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
        DPRINTFN(3,("uhci_device_intr_transfer: xfer=%p len=%d flags=%d\n",
                    xfer, xfer->length, xfer->flags));
 
@@ -2056,6 +2066,9 @@
                    "nframes=%d\n",
                    iso->inuse, iso->next, xfer, xfer->nframes));
 
+       if (sc->sc_dying)
+               return;
+
        if (xfer->status == USBD_IN_PROGRESS) {
                /* This request has already been entered into the frame list */
                /* XXX */
@@ -2117,6 +2130,9 @@
        uhci_soft_td_t *end;
        int s, i;
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
 #ifdef DIAGNOSTIC
        if (xfer->status != USBD_IN_PROGRESS)
                printf("uhci_device_isoc_start: not in progress %p\n", xfer);
@@ -2706,6 +2722,9 @@
        usb_port_status_t ps;
        usbd_status err;
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
 #ifdef DIAGNOSTIC
        if (!(xfer->rqflags & URQ_REQUEST))
                panic("uhci_root_ctrl_transfer: not a request\n");
@@ -3085,6 +3104,9 @@
        DPRINTFN(3, ("uhci_root_intr_transfer: xfer=%p len=%d flags=%d\n",
                     xfer, xfer->length, xfer->flags));
 
+       if (sc->sc_dying)
+               return (USBD_IOERROR);
+
        sc->sc_ival = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
        usb_timeout(uhci_timo, xfer, sc->sc_ival, xfer->timo_handle);
        sc->sc_has_timo = xfer;
diff -r 338530919b37 -r 31599a8b2c30 sys/dev/usb/uhcivar.h
--- a/sys/dev/usb/uhcivar.h     Wed Jan 26 09:44:10 2000 +0000
+++ b/sys/dev/usb/uhcivar.h     Wed Jan 26 10:04:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhcivar.h,v 1.21 2000/01/18 20:11:01 augustss Exp $    */
+/*     $NetBSD: uhcivar.h,v 1.22 2000/01/26 10:04:39 augustss Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $    */
 
 /*
@@ -150,6 +150,7 @@
 
        char sc_isreset;
        char sc_suspend;
+       char sc_dying;
 
        LIST_HEAD(, uhci_intr_info) sc_intrhead;
 



Home | Main Index | Thread Index | Old Index