NetBSD-Bugs archive

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

Re: kern/48237: NetBSD 6.1 failed to detect USB 1.x full-speed device (umodem)



Hi,

I've added the mentioned changes.
This means the usb_memsync call changes (and some other minor things like
USB_USE_SOFTINTR elimination etc.)
My base version is the 1.212 for uhci.c from the release tree.
So I've not added the switch to use the mutex-stuff and/or the MP-related changes. (remark: the system I'm trying to get it up again is a i386 Celeron system. But the problem is also present on amd64 architecture.)

Accedently patching ehci.c and uhci.c with the addresses changes does not change a lot.

For better explanation some debug-output I've added to the code.
(The "--- status" line is in uhci_idone() for each status extracted in the "non-ISO"-loop.)

With 64-Byte initial transfer and first setting Address (2) to the device:

ehci0: handing over full speed device on port 4 to uhci1
usbd_new_device bus=0xc168e00c port=2 depth=1 speed=2
usbd_new_device: myhsport = NULL
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x38000007
uhci_idone: actlen=8, status=0x0
usbd_new_device: addr=2, getting first desc done
usbd_new_device: adding unit addr=2, rev=100, class=2, subclass=0, protocol=0, maxpacket=8, len=18, speed=2
usbd_new_device: setting device address=2
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x190007ff
uhci_idone: actlen=0, status=0x0
usbd_get_device_desc:
usbd_get_desc: type=1, index=0, len=18
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x450007
uhci_idone: actlen=0, status=0x400000
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x450007
uhci_idone: actlen=0, status=0x400000
usbd_new_device: addr=2, getting full desc failed
usbd_remove_device: 0xc1fc6b8c
uhub1: device problem, disabling port 2

The initial retrieval of the description (8 Bytes) seems to work.
Setting Address = 2 seems to work too.
But trying to get the description (18 Bytes again) funs immediately int STALLED (0x500000 in the status)

Trying "the same with address setting and descrition retrival in the order as done in 5.1.2 (still with 64-Bytes initial request:)

ehci0: handing over full speed device on port 4 to uhci1
usbd_new_device bus=0xc168e00c port=2 depth=1 speed=2
usbd_new_device: myhsport = NULL
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x38000007
uhci_idone: actlen=8, status=0x0
ini-desc 0 actlen 8
usbd_new_device: addr=2, getting first desc done
usbd_new_device: adding unit addr=2, rev=100, class=2, subclass=0, protocol=0, maxpacket=8, len=18, speed=2
usbd_get_device_desc:
usbd_get_desc: type=1, index=0, len=18
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x18000007
 ---- status 0x18000007
 ---- status 0x18500001
uhci_idone: actlen=18, status=0x500000
usbd_new_device: addr=2, getting full desc failed
usbd_remove_device: 0xc1fbeb8c
uhub1: device problem, disabling port 2


It looks like the 18 Bytes are transfered, but then it still gets STALLED ?!?!?!?!? Why? Are more bytes expected?

And now with 8 Bytes initial request:

ehci0: handing over full speed device on port 4 to uhci1
usbd_new_device bus=0xc168e00c port=2 depth=1 speed=2
usbd_new_device: myhsport = NULL
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x38000007
 ---- status 0x38000007
 ---- status 0x38000001
uhci_idone: actlen=18, status=0x0
usbd_new_device: addr=2, getting first desc done
usbd_new_device: adding unit addr=2, rev=100, class=2, subclass=0, protocol=0, maxpacket=8, len=18, speed=2
usbd_get_device_desc:
usbd_get_desc: type=1, index=0, len=18
uhci_idone: ii=0xc1753e98
uhci_idone: ii=0xc1753e98, xfer=0xc1753e1c, pipe=0xc17254ec ready
 ---- status 0x18000007
 ---- status 0x180007ff
 ---- status 0x18000007
 ---- status 0x18500001
uhci_idone: actlen=10, status=0x500000
usbd_new_device: addr=2, getting full desc failed
usbd_remove_device: 0xc1fd858c
uhub1: device problem, disabling port 2

Here we already got 18 bytes the first time and then only 10 bytes - does the initial transfer size affect this transfer ??? Why do we get more data???



The sequence - with slitly different printf's in the code on a 5.1.2 system (amd64 this time - no additional i386 system for testing currently available.) Here we get the communication up and running with the same HW-device ...

usbd_get_desc: type=1, index=0, len=8
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff80000907b900 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x190007ff
uhci_idone: actlen=8, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=8
usbd_get_device_desc:
usbd_get_desc: type=1, index=0, len=18
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff80000907b900 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000001
 --- status 0x190007ff
uhci_idone: actlen=18, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=18
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff80000907b900 ready
 --- status 0x18000007
 --- status 0x190007ff
uhci_idone: actlen=0, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=0
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=2, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=2
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000005
 --- status 0x190007ff
uhci_idone: actlen=6, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=6
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=2, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=2
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000003
 --- status 0x190007ff
uhci_idone: actlen=52, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=52
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=2, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=2
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=34, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=34
usbd_get_config_desc: confidx=0
usbd_get_desc: type=2, index=0, len=9
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000000
 --- status 0x190007ff
uhci_idone: actlen=9, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=9
usbd_get_desc: type=2, index=0, len=41
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000000
 --- status 0x190007ff
uhci_idone: actlen=41, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=41
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x190007ff
uhci_idone: actlen=0, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=0
usbd_get_config_desc: confidx=1
usbd_get_desc: type=2, index=1, len=9
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000000
 --- status 0x190007ff
uhci_idone: actlen=9, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=9
usbd_get_desc: type=2, index=1, len=62
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000005
 --- status 0x190007ff
uhci_idone: actlen=62, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=62
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x190007ff
uhci_idone: actlen=0, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=0
usbd_get_config_desc: confidx=0
usbd_get_desc: type=2, index=0, len=9
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000000
 --- status 0x190007ff
uhci_idone: actlen=9, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=9
usbd_get_desc: type=2, index=0, len=41
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000007
 --- status 0x18000000
 --- status 0x190007ff
uhci_idone: actlen=41, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=41
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x190007ff
uhci_idone: actlen=0, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=0
ugen0 at uhub4 port 1ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=2, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=2
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000003
 --- status 0x190007ff
uhci_idone: actlen=52, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=52
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=2, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=2
ctrltrans - 0xffff800007f9ba00
 --- start timeout 5000
uhci_idone: ii=0xffff800007f9bae0
uhci_idone: ii=0xffff800007f9bae0, xfer=0xffff800007f9ba00, pipe=0xffff800008448e00 ready
 --- status 0x18000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000007
 --- status 0x38000001
 --- status 0x190007ff
uhci_idone: actlen=34, status=0x0
ctrl-done 0xffff800007f9ba00
uhci_device_ctrl_done: length=34

ugen0: Lucent Technologies, Inc. ELSA Modem Board, rev 1.00/1.00, addr 2

remark: on this system umodem is not configured, so the device dropped into ugen, but the problem happnes during the first transfers while getting the device description.




Help !!!
Any additional idea what may be wrong?

I add the applied diffs as attachments, but they look good for me.





Nick Hudson wrote:

The following reply was made to PR kern/48237; it has been noted by GNATS.

From: Nick Hudson <skrll%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Wolfgang.Stukenbrock%nagler-company.com@localhost, kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/48237: NetBSD 6.1 failed to detect USB 1.x full-speed device
 (umodem)
Date: Tue, 24 Sep 2013 16:32:12 +0100

 On 09/24/13 11:35, Wolfgang.Stukenbrock%nagler-company.com@localhost wrote:
 >> Number:         48237
 >> Category:       kern
 >> Synopsis:       NetBSD 6.1 failed to detect USB 1.x full-speed device 
(umodem)
 >>
Try applying the changes in http://releng.netbsd.org/cgi-bin/req-6.cgi?show=950 to your netbsd-6 tree. Nick

--- ehci.c      2013/09/25 07:04:36     1.1
+++ ehci.c      2013/09/25 08:05:41
@@ -709,12 +709,10 @@
                callout_reset(&(sc->sc_tmo_intrlist),
                    (hz), (ehci_intrlist_timeout), (sc));
 
-#ifdef USB_USE_SOFTINTR
        if (sc->sc_softwake) {
                sc->sc_softwake = 0;
                wakeup(&sc->sc_softwake);
        }
-#endif /* USB_USE_SOFTINTR */
 
        sc->sc_bus.intr_context--;
 }
@@ -763,7 +761,11 @@
            lsqtd->offs + offsetof(ehci_qtd_t, qtd_status),
            sizeof(lsqtd->qtd.qtd_status),
            BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-       if (le32toh(lsqtd->qtd.qtd_status) & EHCI_QTD_ACTIVE) {
+       status = le32toh(lsqtd->qtd.qtd_status);
+       usb_syncmem(&lsqtd->dma,
+           lsqtd->offs + offsetof(ehci_qtd_t, qtd_status),
+           sizeof(lsqtd->qtd.qtd_status), BUS_DMASYNC_PREREAD);
+       if (status & EHCI_QTD_ACTIVE) {
                DPRINTFN(12, ("ehci_check_intr: active ex=%p\n", ex));
                for (sqtd = ex->sqtdstart; sqtd != lsqtd; sqtd=sqtd->nextqtd) {
                        usb_syncmem(&sqtd->dma,
@@ -786,9 +788,6 @@
                }
                DPRINTFN(12, ("ehci_check_intr: ex=%p std=%p still active\n",
                              ex, ex->sqtdstart));
-               usb_syncmem(&lsqtd->dma,
-                   lsqtd->offs + offsetof(ehci_qtd_t, qtd_status),
-                   sizeof(lsqtd->qtd.qtd_status), BUS_DMASYNC_PREREAD);
                return;
        }
  done:
@@ -1730,8 +1729,6 @@
 Static void
 ehci_add_qh(ehci_soft_qh_t *sqh, ehci_soft_qh_t *head)
 {
-       SPLUSBCHECK;
-
        usb_syncmem(&head->dma, head->offs + offsetof(ehci_qh_t, qh_link),
            sizeof(head->qh.qh_link), BUS_DMASYNC_POSTWRITE);
        sqh->next = head->next;
@@ -1759,7 +1756,6 @@
 {
        ehci_soft_qh_t *p;
 
-       SPLUSBCHECK;
        /* XXX */
        for (p = head; p != NULL && p->next != sqh; p = p->next)
                ;
@@ -2723,14 +2719,14 @@
                        ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE;
                        if (i != 0) /* use offset only in first buffer */
                                a = EHCI_PAGE(a);
-                       cur->qtd.qtd_buffer[i] = htole32(a);
-                       cur->qtd.qtd_buffer_hi[i] = 0;
-#ifdef DIAGNOSTIC
                        if (i >= EHCI_QTD_NBUFFERS) {
+#ifdef DIAGNOSTIC
                                printf("ehci_alloc_sqtd_chain: i=%d\n", i);
+#endif
                                goto nomem;
                        }
-#endif
+                       cur->qtd.qtd_buffer[i] = htole32(a);
+                       cur->qtd.qtd_buffer_hi[i] = 0;
                }
                cur->nextqtd = next;
                cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys;
@@ -2982,13 +2978,9 @@
         */
        ehci_sync_hc(sc);
        s = splusb();
-#ifdef USB_USE_SOFTINTR
        sc->sc_softwake = 1;
-#endif /* USB_USE_SOFTINTR */
        usb_schedsoftintr(&sc->sc_bus);
-#ifdef USB_USE_SOFTINTR
        tsleep(&sc->sc_softwake, PZERO, "ehciab", 0);
-#endif /* USB_USE_SOFTINTR */
        splx(s);
 
        /*
@@ -3111,13 +3103,9 @@
        splx(s);
 
         s = splusb();
-#ifdef USB_USE_SOFTINTR
         sc->sc_softwake = 1;
-#endif /* USB_USE_SOFTINTR */
         usb_schedsoftintr(&sc->sc_bus);
-#ifdef USB_USE_SOFTINTR
         tsleep(&sc->sc_softwake, PZERO, "ehciab", 0);
-#endif /* USB_USE_SOFTINTR */
         splx(s);
 
 #ifdef DIAGNOSTIC
--- uhci.c      2013/09/25 07:38:39     1.1
+++ uhci.c      2013/09/25 08:07:25
@@ -1076,8 +1076,6 @@
 {
        uhci_soft_qh_t *eqh;
 
-       SPLUSBCHECK;
-
        DPRINTFN(10, ("uhci_add_ctrl: sqh=%p\n", sqh));
        eqh = sc->sc_hctl_end;
        usb_syncmem(&eqh->dma, eqh->offs + offsetof(uhci_qh_t, qh_hlink),
@@ -1103,8 +1101,6 @@
 {
        uhci_soft_qh_t *pqh;
 
-       SPLUSBCHECK;
-
        DPRINTFN(10, ("uhci_remove_hs_ctrl: sqh=%p\n", sqh));
 #ifdef UHCI_CTL_LOOP
        uhci_rem_loop(sc);
@@ -1153,8 +1149,6 @@
 {
        uhci_soft_qh_t *eqh;
 
-       SPLUSBCHECK;
-
        DPRINTFN(10, ("uhci_add_ls_ctrl: sqh=%p\n", sqh));
        eqh = sc->sc_lctl_end;
        usb_syncmem(&eqh->dma, eqh->offs + offsetof(uhci_qh_t, qh_hlink),
@@ -1175,15 +1169,17 @@
 uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
        uhci_soft_qh_t *pqh;
-
-       SPLUSBCHECK;
+       uint32_t elink;
 
        DPRINTFN(10, ("uhci_remove_ls_ctrl: sqh=%p\n", sqh));
        /* See comment in uhci_remove_hs_ctrl() */
        usb_syncmem(&sqh->dma, sqh->offs + offsetof(uhci_qh_t, qh_elink),
            sizeof(sqh->qh.qh_elink),
            BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-       if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) {
+       elink = le32toh(sqh->qh.qh_elink);
+       usb_syncmem(&sqh->dma, sqh->offs + offsetof(uhci_qh_t, qh_elink),
+           sizeof(sqh->qh.qh_elink), BUS_DMASYNC_PREREAD);
+       if (!(elink & UHCI_PTR_T)) {
                sqh->qh.qh_elink = htole32(UHCI_PTR_T);
                usb_syncmem(&sqh->dma,
                    sqh->offs + offsetof(uhci_qh_t, qh_elink),
@@ -1210,8 +1206,6 @@
 {
        uhci_soft_qh_t *eqh;
 
-       SPLUSBCHECK;
-
        DPRINTFN(10, ("uhci_add_bulk: sqh=%p\n", sqh));
        eqh = sc->sc_bulk_end;
        usb_syncmem(&eqh->dma, eqh->offs + offsetof(uhci_qh_t, qh_hlink),
@@ -1234,8 +1228,6 @@
 {
        uhci_soft_qh_t *pqh;
 
-       SPLUSBCHECK;
-
        DPRINTFN(10, ("uhci_remove_bulk: sqh=%p\n", sqh));
        uhci_rem_loop(sc);
        /* See comment in uhci_remove_hs_ctrl() */
@@ -1382,12 +1374,10 @@
                uhci_check_intr(sc, ii);
        }
 
-#ifdef USB_USE_SOFTINTR
        if (sc->sc_softwake) {
                sc->sc_softwake = 0;
                wakeup(&sc->sc_softwake);
        }
-#endif /* USB_USE_SOFTINTR */
 
        sc->sc_bus.intr_context--;
 }
@@ -1430,7 +1420,12 @@
            lstd->offs + offsetof(uhci_td_t, td_status),
            sizeof(lstd->td.td_status),
            BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-       if (le32toh(lstd->td.td_status) & UHCI_TD_ACTIVE) {
+       status = le32toh(lstd->td.td_status);
+       usb_syncmem(&lstd->dma,
+           lstd->offs + offsetof(uhci_td_t, td_status),
+           sizeof(lstd->td.td_status),
+           BUS_DMASYNC_PREREAD);
+       if (status & UHCI_TD_ACTIVE) {
                DPRINTFN(12, ("uhci_check_intr: active ii=%p\n", ii));
                for (std = ii->stdstart; std != lstd; std = std->link.std) {
                        usb_syncmem(&std->dma,
@@ -1459,10 +1454,6 @@
                }
                DPRINTFN(12, ("uhci_check_intr: ii=%p std=%p still active\n",
                              ii, ii->stdstart));
-               usb_syncmem(&lstd->dma,
-                   lstd->offs + offsetof(uhci_td_t, td_status),
-                   sizeof(lstd->td.td_status),
-                   BUS_DMASYNC_PREREAD);
                return;
        }
  done:
@@ -1830,6 +1821,7 @@
                    uhci_soft_td_t *stdend)
 {
        uhci_soft_td_t *p;
+       uint32_t td_link;
 
        /*
         * to avoid race condition with the controller which may be looking
@@ -1841,8 +1833,13 @@
                    p->offs + offsetof(uhci_td_t, td_link),
                    sizeof(p->td.td_link),
                    BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-               if ((p->td.td_link & UHCI_PTR_T) == 0) {
-                       p->td.td_link = UHCI_PTR_T;
+               td_link =  le32toh(p->td.td_link);
+               usb_syncmem(&p->dma,
+                   p->offs + offsetof(uhci_td_t, td_link),
+                   sizeof(p->td.td_link),
+                   BUS_DMASYNC_PREREAD);
+               if ((td_link & UHCI_PTR_T) == 0) {
+                       p->td.td_link = htole32(UHCI_PTR_T);
                        usb_syncmem(&p->dma,
                            p->offs + offsetof(uhci_td_t, td_link),
                            sizeof(p->td.td_link),
@@ -2142,14 +2139,10 @@
         */
        usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
        s = splusb();
-#ifdef USB_USE_SOFTINTR
        sc->sc_softwake = 1;
-#endif /* USB_USE_SOFTINTR */
        usb_schedsoftintr(&sc->sc_bus);
-#ifdef USB_USE_SOFTINTR
        DPRINTFN(1,("uhci_abort_xfer: tsleep\n"));
        tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
-#endif /* USB_USE_SOFTINTR */
        splx(s);
 
        /*


Home | Main Index | Thread Index | Old Index