Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Now that usbd_new_device has been fixed there is...



details:   https://anonhg.NetBSD.org/src/rev/bba7b887b287
branches:  trunk
changeset: 325259:bba7b887b287
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Dec 15 10:25:23 2013 +0000

description:
Now that usbd_new_device has been fixed there is no need to touch QHs/EDs
in [eo]hci_device_request.

KASSERT the address and maximum packet length just in case.

diffstat:

 sys/dev/usb/ehci.c |  19 +++++--------------
 sys/dev/usb/ohci.c |  24 ++++++++----------------
 2 files changed, 13 insertions(+), 30 deletions(-)

diffs (102 lines):

diff -r 6c9896ea0842 -r bba7b887b287 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sun Dec 15 09:21:03 2013 +0000
+++ b/sys/dev/usb/ehci.c        Sun Dec 15 10:25:23 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.221 2013/12/01 07:34:16 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.222 2013/12/15 10:25:23 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.221 2013/12/01 07:34:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.222 2013/12/15 10:25:23 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3395,18 +3395,9 @@
 
        sqh = epipe->sqh;
 
-       /*
-        * Update device address and length since they may have changed
-        * during the setup of the control pipe in usbd_new_device().
-        */
-       /* XXX This only needs to be done once, but it's too early in open. */
-       /* XXXX Should not touch ED here! */
-       sqh->qh.qh_endp =
-           (sqh->qh.qh_endp & htole32(~(EHCI_QH_ADDRMASK | EHCI_QH_MPLMASK))) |
-           htole32(
-            EHCI_QH_SET_ADDR(addr) |
-            EHCI_QH_SET_MPL(UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize))
-           );
+       KASSERT(EHCI_QH_GET_ADDR(le32toh(sqh->qh.qh_endp)) == addr);
+       KASSERT(EHCI_QH_GET_MPL(le32toh(sqh->qh.qh_endp)) == 
+           UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize));
 
        /* Set up data transaction */
        if (len != 0) {
diff -r 6c9896ea0842 -r bba7b887b287 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sun Dec 15 09:21:03 2013 +0000
+++ b/sys/dev/usb/ohci.c        Sun Dec 15 10:25:23 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.245 2013/12/01 07:28:47 skrll Exp $ */
+/*     $NetBSD: ohci.c,v 1.246 2013/12/15 10:25:23 skrll Exp $ */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.245 2013/12/01 07:28:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.246 2013/12/15 10:25:23 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1683,7 +1683,6 @@
        usb_device_request_t *req = &xfer->request;
        usbd_device_handle dev = opipe->pipe.device;
        ohci_softc_t *sc = dev->bus->hci_private;
-       int addr = dev->address;
        ohci_soft_td_t *setup, *stat, *next, *tail;
        ohci_soft_ed_t *sed;
        int isread;
@@ -1698,7 +1697,7 @@
        DPRINTFN(3,("ohci_device_control type=0x%02x, request=0x%02x, "
                    "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
                    req->bmRequestType, req->bRequest, UGETW(req->wValue),
-                   UGETW(req->wIndex), len, addr,
+                   UGETW(req->wIndex), len, dev->address,
                    opipe->pipe.endpoint->edesc->bEndpointAddress));
 
        setup = opipe->tail.td;
@@ -1717,21 +1716,14 @@
        sed = opipe->sed;
        opipe->u.ctl.length = len;
 
-       /* Update device address and length since they may have changed
-          during the setup of the control pipe in usbd_new_device(). */
-       /* XXX This only needs to be done once, but it's too early in open. */
-       /* XXXX Should not touch ED here! */
-
+       /* XXX is this ever written to by hardware ??? */
        usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags),
            sizeof(sed->ed.ed_flags),
            BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-       sed->ed.ed_flags = HTOO32(
-        (O32TOH(sed->ed.ed_flags) & ~(OHCI_ED_ADDRMASK | OHCI_ED_MAXPMASK)) |
-        OHCI_ED_SET_FA(addr) |
-        OHCI_ED_SET_MAXP(UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize)));
-       usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags),
-           sizeof(sed->ed.ed_flags),
-           BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+
+        KASSERT(OHCI_ED_GET_FA(HTOO32(sed->ed.ed_flags)) == dev->address);
+        KASSERT(OHCI_ED_SET_MAXP(HTOO32(sed->ed.ed_flags)) ==
+            UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize));
 
        next = stat;
 



Home | Main Index | Thread Index | Old Index