Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Improve the usb_syncmem calls in ohci_reset_std_...
details: https://anonhg.NetBSD.org/src/rev/6a7c0c40cd52
branches: trunk
changeset: 351026:6a7c0c40cd52
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Jan 31 07:34:02 2017 +0000
description:
Improve the usb_syncmem calls in ohci_reset_std_chain.
Might help kern/51928: Errors reading a USB pen drive on macppc 7.99.59
diffstat:
sys/dev/usb/ohci.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (61 lines):
diff -r 5eb5e32f8b76 -r 6a7c0c40cd52 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Tue Jan 31 07:00:59 2017 +0000
+++ b/sys/dev/usb/ohci.c Tue Jan 31 07:34:02 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.271 2017/01/30 21:42:08 skrll Exp $ */
+/* $NetBSD: ohci.c,v 1.272 2017/01/31 07:34:02 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.271 2017/01/30 21:42:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.272 2017/01/31 07:34:02 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -655,15 +655,15 @@
cur->xfer = xfer;
ohci_hash_add_td(sc, cur);
- usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td),
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
-
curoffs += curlen;
len -= curlen;
if (len != 0) {
KASSERT(next != NULL);
DPRINTFN(10, "extend chain", 0, 0, 0, 0);
+ usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td),
+ BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+
cur = next;
}
}
@@ -673,6 +673,10 @@
if (!rd &&
(flags & USBD_FORCE_SHORT_XFER) &&
alen % mps == 0) {
+ /* We're adding a ZLP so sync the previous TD */
+ usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td),
+ BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+
/* Force a 0 length transfer at the end. */
KASSERT(next != NULL);
@@ -688,10 +692,10 @@
cur->xfer = xfer;
ohci_hash_add_td(sc, cur);
- usb_syncmem(&cur->dma, cur->offs, sizeof(cur->td),
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
DPRINTFN(2, "add 0 xfer", 0, 0, 0, 0);
}
+
+ /* Last TD gets usb_syncmem'ed by caller */
*ep = cur;
}
Home |
Main Index |
Thread Index |
Old Index