Module Name: src
Committed By: skrll
Date: Tue Jan 31 07:34:02 UTC 2017
Modified Files:
src/sys/dev/usb: ohci.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.271 src/sys/dev/usb/ohci.c:1.272
--- src/sys/dev/usb/ohci.c:1.271 Mon Jan 30 21:42:08 2017
+++ src/sys/dev/usb/ohci.c Tue Jan 31 07:34:02 2017
@@ -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 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
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 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
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 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
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;
}