Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Backout the ED/QH change removal in [eo]hci_devi...
details: https://anonhg.NetBSD.org/src/rev/a98a355497a6
branches: trunk
changeset: 325275:a98a355497a6
user: skrll <skrll%NetBSD.org@localhost>
date: Mon Dec 16 10:04:20 2013 +0000
description:
Backout the ED/QH change removal in [eo]hci_device_request.
Reports of the KASSERT firing mean this needs more thought/testing.
diffstat:
sys/dev/usb/ehci.c | 21 +++++++++++++++------
sys/dev/usb/ohci.c | 24 ++++++++++++++++--------
2 files changed, 31 insertions(+), 14 deletions(-)
diffs (111 lines):
diff -r f275d2ea204b -r a98a355497a6 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Mon Dec 16 01:51:19 2013 +0000
+++ b/sys/dev/usb/ehci.c Mon Dec 16 10:04:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.223 2013/12/15 17:15:34 para Exp $ */
+/* $NetBSD: ehci.c,v 1.224 2013/12/16 10:04:20 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.223 2013/12/15 17:15:34 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.224 2013/12/16 10:04:20 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -3364,7 +3364,7 @@
usb_device_request_t *req = &xfer->request;
usbd_device_handle dev = epipe->pipe.device;
ehci_softc_t *sc = dev->bus->hci_private;
- int addr __diagused = dev->address;
+ int addr = dev->address;
ehci_soft_qtd_t *setup, *stat, *next;
ehci_soft_qh_t *sqh;
int isread;
@@ -3395,9 +3395,18 @@
sqh = epipe->sqh;
- 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));
+ /*
+ * 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))
+ );
/* Set up data transaction */
if (len != 0) {
diff -r f275d2ea204b -r a98a355497a6 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Mon Dec 16 01:51:19 2013 +0000
+++ b/sys/dev/usb/ohci.c Mon Dec 16 10:04:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.247 2013/12/15 18:50:25 jakllsch Exp $ */
+/* $NetBSD: ohci.c,v 1.248 2013/12/16 10:04:20 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.247 2013/12/15 18:50:25 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.248 2013/12/16 10:04:20 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1683,6 +1683,7 @@
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;
@@ -1697,7 +1698,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, dev->address,
+ UGETW(req->wIndex), len, addr,
opipe->pipe.endpoint->edesc->bEndpointAddress));
setup = opipe->tail.td;
@@ -1716,14 +1717,21 @@
sed = opipe->sed;
opipe->u.ctl.length = len;
- /* XXX is this ever written to by hardware ??? */
+ /* 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! */
+
usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags),
sizeof(sed->ed.ed_flags),
BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-
- KASSERT(OHCI_ED_GET_FA(HTOO32(sed->ed.ed_flags)) == dev->address);
- KASSERT(OHCI_ED_GET_MAXP(HTOO32(sed->ed.ed_flags)) ==
- UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize));
+ 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);
next = stat;
Home |
Main Index |
Thread Index |
Old Index