Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb * Make sure an aborted pipe is marked as not run...



details:   https://anonhg.NetBSD.org/src/rev/af2d78213b65
branches:  trunk
changeset: 476337:af2d78213b65
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Sep 13 21:33:25 1999 +0000

description:
* Make sure an aborted pipe is marked as not running.
* Start queued request in the right order.
* Insert some more DIAGNOSTIC sanity checks.

diffstat:

 sys/dev/usb/ohci.c     |  45 +++++++++++++++++++++++++++++++++------------
 sys/dev/usb/uhci.c     |  47 ++++++++++++++++++++++++++++++++++-------------
 sys/dev/usb/usb.c      |   7 ++++++-
 sys/dev/usb/usbdi.c    |  29 +++++++++++++++++++++--------
 sys/dev/usb/usbdivar.h |  12 +++++++++++-
 5 files changed, 105 insertions(+), 35 deletions(-)

diffs (truncated from 452 to 300 lines):

diff -r f371fdb293d1 -r af2d78213b65 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Mon Sep 13 20:21:45 1999 +0000
+++ b/sys/dev/usb/ohci.c        Mon Sep 13 21:33:25 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.45 1999/09/13 19:49:41 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.46 1999/09/13 21:33:25 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1133,6 +1133,7 @@
        ohci_soft_ed_t *sed; 
        ohci_soft_ed_t *head; 
 {
+       SPLUSBCHECK;
        sed->next = head->next;
        sed->ed.ed_nexted = head->ed.ed_nexted;
        head->next = sed;
@@ -1149,6 +1150,8 @@
 {
        ohci_soft_ed_t *p; 
 
+       SPLUSBCHECK;
+
        /* XXX */
        for (p = head; p && p->next != sed; p = p->next)
                ;
@@ -1177,6 +1180,8 @@
 {
        int h = HASH(std->physaddr);
 
+       SPLUSBCHECK;
+
        LIST_INSERT_HEAD(&sc->sc_hash_tds[h], std, hnext);
 }
 
@@ -1186,6 +1191,8 @@
        ohci_softc_t *sc;
        ohci_soft_td_t *std;
 {
+       SPLUSBCHECK;
+
        LIST_REMOVE(std, hnext);
 }
 
@@ -1404,6 +1411,8 @@
        struct ohci_pipe *opipe = (struct ohci_pipe *)reqh->pipe;
        ohci_soft_ed_t *sed;
 
+       SPLUSBCHECK;
+
        DPRINTF(("ohci_abort_req: reqh=%p pipe=%p\n", reqh, opipe));
 
        reqh->status = status;
@@ -1549,11 +1558,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (ohci_root_ctrl_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (ohci_root_ctrl_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -1564,7 +1575,7 @@
        usb_device_request_t *req;
        void *buf;
        int port, i;
-       int len, value, index, l, totlen = 0;
+       int s, len, value, index, l, totlen = 0;
        usb_port_status_t ps;
        usb_hub_descriptor_t hubd;
        usbd_status r;
@@ -1853,7 +1864,9 @@
        r = USBD_NORMAL_COMPLETION;
  ret:
        reqh->status = r;
+       s = splusb();
        usb_transfer_complete(reqh);
+       splx(s);
        return (USBD_IN_PROGRESS);
 }
 
@@ -1880,11 +1893,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (ohci_root_intr_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (ohci_root_intr_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -1927,11 +1942,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (ohci_device_ctrl_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (ohci_device_ctrl_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -2001,11 +2018,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (ohci_device_bulk_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (ohci_device_bulk_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -2133,11 +2152,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (ohci_device_intr_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (ohci_device_intr_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
diff -r f371fdb293d1 -r af2d78213b65 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Mon Sep 13 20:21:45 1999 +0000
+++ b/sys/dev/usb/uhci.c        Mon Sep 13 21:33:25 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.51 1999/09/13 19:49:41 augustss Exp $       */
+/*     $NetBSD: uhci.c,v 1.52 1999/09/13 21:33:25 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -685,6 +685,8 @@
 {
        uhci_soft_qh_t *eqh;
 
+       SPLUSBCHECK;
+
        DPRINTFN(10, ("uhci_add_ctrl: sqh=%p\n", sqh));
        eqh = sc->sc_ctl_end;
        sqh->hlink       = eqh->hlink;
@@ -702,6 +704,8 @@
 {
        uhci_soft_qh_t *pqh;
 
+       SPLUSBCHECK;
+
        DPRINTFN(10, ("uhci_remove_ctrl: sqh=%p\n", sqh));
        for (pqh = sc->sc_ctl_start; pqh->hlink != sqh; pqh=pqh->hlink)
 #if defined(DIAGNOSTIC) || defined(USB_DEBUG)          
@@ -726,6 +730,8 @@
 {
        uhci_soft_qh_t *eqh;
 
+       SPLUSBCHECK;
+
        DPRINTFN(10, ("uhci_add_bulk: sqh=%p\n", sqh));
        eqh = sc->sc_bulk_end;
        sqh->hlink       = eqh->hlink;
@@ -743,6 +749,8 @@
 {
        uhci_soft_qh_t *pqh;
 
+       SPLUSBCHECK;
+
        DPRINTFN(10, ("uhci_remove_bulk: sqh=%p\n", sqh));
        for (pqh = sc->sc_bulk_start; pqh->hlink != sqh; pqh = pqh->hlink)
 #if defined(DIAGNOSTIC) || defined(USB_DEBUG)          
@@ -882,6 +890,7 @@
        uhci_idone(ii);
 }
 
+/* Called at splusb() */
 void
 uhci_idone(ii)
        uhci_intr_info_t *ii;
@@ -1316,11 +1325,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (uhci_device_bulk_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (uhci_device_bulk_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -1475,11 +1486,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (uhci_device_ctrl_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (uhci_device_ctrl_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -1509,11 +1522,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (uhci_device_intr_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (uhci_device_intr_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -1796,7 +1811,7 @@
 
        /* and put on interrupt list if the pipe wasn't running */
        if (r == USBD_NORMAL_COMPLETION)
-               uhci_device_isoc_start(reqh);
+               uhci_device_isoc_start(SIMPLEQ_FIRST(&reqh->pipe->queue));
 
        return (r);
 }
@@ -2428,11 +2443,13 @@
 {
        usbd_status r;
 
+       /* Insert last in queue. */
        r = usb_insert_transfer(reqh);
        if (r != USBD_NORMAL_COMPLETION)
                return (r);
-       else
-               return (uhci_root_ctrl_start(reqh));
+
+       /* Pipe isn't running, start first */
+       return (uhci_root_ctrl_start(SIMPLEQ_FIRST(&reqh->pipe->queue)));
 }
 
 usbd_status
@@ -2443,7 +2460,7 @@
        usb_device_request_t *req;
        void *buf;
        int port, x;
-       int len, value, index, status, change, l, totlen = 0;
+       int s, len, value, index, status, change, l, totlen = 0;
        usb_port_status_t ps;
        usbd_status r;
 
@@ -2762,7 +2779,9 @@
  ret:
        reqh->status = r;
        reqh->hcpriv = 0;
+       s = splusb();
        usb_transfer_complete(reqh);
+       splx(s);
        return (USBD_IN_PROGRESS);
 }
 
@@ -2802,11 +2821,13 @@
 {
        usbd_status r;



Home | Main Index | Thread Index | Old Index