Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Change where the has table for physical-to-virtu...



details:   https://anonhg.NetBSD.org/src/rev/d7ff8714c27b
branches:  trunk
changeset: 481479:d7ff8714c27b
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Jan 31 22:09:13 2000 +0000

description:
Change where the has table for physical-to-virtual address translation
is handled.  Partly from FreeBSD.

diffstat:

 sys/dev/usb/ohci.c |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (144 lines):

diff -r ae67b468186b -r d7ff8714c27b sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Mon Jan 31 22:01:52 2000 +0000
+++ b/sys/dev/usb/ohci.c        Mon Jan 31 22:09:13 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.68 2000/01/31 20:17:25 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.69 2000/01/31 22:09:13 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -415,6 +415,7 @@
        usbd_status err;
        int i, offs;
        usb_dma_t dma;
+       int s;
 
        if (sc->sc_freetds == NULL) {
                DPRINTFN(2, ("ohci_alloc_std: allocating chunk\n"));
@@ -422,6 +423,7 @@
                          OHCI_TD_ALIGN, &dma);
                if (err)
                        return (0);
+               s = splusb();
                for(i = 0; i < OHCI_STD_CHUNK; i++) {
                        offs = i * OHCI_STD_SIZE;
                        std = (ohci_soft_td_t *)((char *)KERNADDR(&dma) +offs);
@@ -429,11 +431,18 @@
                        std->nexttd = sc->sc_freetds;
                        sc->sc_freetds = std;
                }
+               splx(s);
        }
+
+       s = splusb();
        std = sc->sc_freetds;
        sc->sc_freetds = std->nexttd;
        memset(&std->td, 0, sizeof(ohci_td_t));
        std->nexttd = 0;
+
+       ohci_hash_add_td(sc, std);
+       splx(s);
+
        return (std);
 }
 
@@ -442,8 +451,14 @@
        ohci_softc_t *sc;
        ohci_soft_td_t *std;
 {
+       int s;
+
+       s = splusb();
+       ohci_hash_rem_td(sc, std);
+
        std->nexttd = sc->sc_freetds;
        sc->sc_freetds = std;
+       splx(s);
 }
 
 usbd_status
@@ -788,7 +803,6 @@
        sc->sc_bus.pipe_size = sizeof(struct ohci_pipe);
 
        sc->sc_powerhook = powerhook_establish(ohci_power, sc);
-
        sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
 
        return (USBD_NORMAL_COMPLETION);
@@ -1082,7 +1096,7 @@
        DPRINTFN(10,("ohci_process_done: done=0x%08lx\n", (u_long)done));
 
        /* Reverse the done list. */
-       for (sdone = 0; done; done = LE(std->td.td_nexttd)) {
+       for (sdone = NULL; done != 0; done = LE(std->td.td_nexttd)) {
                std = ohci_hash_find_td(sc, done);
                std->dnext = sdone;
                sdone = std;
@@ -1099,7 +1113,7 @@
                xfer = std->xfer;
                stdnext = std->dnext;
                DPRINTFN(10, ("ohci_process_done: std=%p xfer=%p hcpriv=%p\n",
-                               std, xfer, xfer->hcpriv));
+                               std, xfer, xfer ? xfer->hcpriv : 0));
                cc = OHCI_TD_GET_CC(LE(std->td.td_flags));
                usb_untimeout(ohci_timeout, xfer, xfer->timo_handle);
                if (xfer->status == USBD_CANCELLED ||
@@ -1118,7 +1132,6 @@
                                xfer->status = USBD_NORMAL_COMPLETION;
                                usb_transfer_complete(xfer);
                        }
-                       ohci_hash_rem_td(sc, std);
                        ohci_free_std(sc, std);
                } else {
                        /*
@@ -1137,7 +1150,6 @@
                        /* remove TDs */
                        for (p = std; p->xfer == xfer; p = n) {
                                n = p->nexttd;
-                               ohci_hash_rem_td(sc, p);
                                ohci_free_std(sc, p);
                        }
 
@@ -1207,7 +1219,6 @@
                xfer->hcpriv = data;
                xfer->actlen = 0;
 
-               ohci_hash_add_td(sc, data);
                sed->ed.ed_tailp = LE(tail->physaddr);
                opipe->tail.td = tail;
        }
@@ -1429,10 +1440,6 @@
 
        /* Insert ED in schedule */
        s = splusb();
-       ohci_hash_add_td(sc, setup);
-       if (len != 0)
-               ohci_hash_add_td(sc, data);
-       ohci_hash_add_td(sc, stat);
        sed->ed.ed_tailp = LE(tail->physaddr);
        opipe->tail.td = tail;
        OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
@@ -1822,7 +1829,6 @@
 #endif
        for (; p->xfer == xfer; p = n) {
                n = p->nexttd;
-               ohci_hash_rem_td(sc, p);
                ohci_free_std(sc, p);
        }
 
@@ -2466,7 +2472,6 @@
        s = splusb();
        for (tdp = data; tdp != tail; tdp = tdp->nexttd) {
                tdp->xfer = xfer;
-               ohci_hash_add_td(sc, tdp);
        }
        sed->ed.ed_tailp = LE(tail->physaddr);
        opipe->tail.td = tail;
@@ -2586,7 +2591,6 @@
 
        /* Insert ED in schedule */
        s = splusb();
-       ohci_hash_add_td(sc, data);
        sed->ed.ed_tailp = LE(tail->physaddr);
        opipe->tail.td = tail;
        sed->ed.ed_flags &= LE(~OHCI_ED_SKIP);



Home | Main Index | Thread Index | Old Index