Module Name: src
Committed By: skrll
Date: Sun Dec 15 10:25:23 UTC 2013
Modified Files:
src/sys/dev/usb: ehci.c ohci.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.245 -r1.246 src/sys/dev/usb/ohci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.221 src/sys/dev/usb/ehci.c:1.222
--- src/sys/dev/usb/ehci.c:1.221 Sun Dec 1 07:34:16 2013
+++ src/sys/dev/usb/ehci.c Sun Dec 15 10:25:23 2013
@@ -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 @@ ehci_device_request(usbd_xfer_handle xfe
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) {
Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.245 src/sys/dev/usb/ohci.c:1.246
--- src/sys/dev/usb/ohci.c:1.245 Sun Dec 1 07:28:47 2013
+++ src/sys/dev/usb/ohci.c Sun Dec 15 10:25:23 2013
@@ -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 @@ ohci_device_request(usbd_xfer_handle xfe
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 @@ ohci_device_request(usbd_xfer_handle xfe
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 @@ ohci_device_request(usbd_xfer_handle xfe
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;