Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Truncate the transfer length if an overflow is se...
details: https://anonhg.NetBSD.org/src/rev/f7ec2542fe70
branches: trunk
changeset: 347937:f7ec2542fe70
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Sep 24 15:06:29 2016 +0000
description:
Truncate the transfer length if an overflow is seen rather than halting.
Don't consider an EP11_STAT_SETUP as an error as it's not valid for
host operation.
Should fix kern/51500: axe(4) at slhci(4) does not attach, but there are
more problems with axe(4)
diffstat:
sys/dev/ic/sl811hs.c | 43 +++++++++++++++----------------------------
sys/dev/ic/sl811hsreg.h | 4 +---
2 files changed, 16 insertions(+), 31 deletions(-)
diffs (91 lines):
diff -r a8cedd4339fb -r f7ec2542fe70 sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c Sat Sep 24 14:55:16 2016 +0000
+++ b/sys/dev/ic/sl811hs.c Sat Sep 24 15:06:29 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sl811hs.c,v 1.95 2016/09/15 21:45:37 jdolecek Exp $ */
+/* $NetBSD: sl811hs.c,v 1.96 2016/09/24 15:06:29 skrll Exp $ */
/*
* Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.95 2016/09/15 21:45:37 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.96 2016/09/24 15:06:29 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_slhci.h"
@@ -2047,24 +2047,21 @@
#endif
if (!(status & SL11_EPSTAT_ERRBITS)) {
- unsigned int cont;
- cont = slhci_read(sc, slhci_tregs[ab][CONT]);
- if (cont != 0)
- DLOG(D_XFER, "cont %d len %d", cont,
- spipe->tregs[LEN], 0,0);
- if (__predict_false(cont > spipe->tregs[LEN])) {
- DDOLOG("cont > len! cont %d len %d xfer->ux_length %d "
- "spipe %p", cont, spipe->tregs[LEN], xfer->ux_length,
- spipe);
- printf("%s: cont > len! cont %d len %d xfer->ux_length "
- "%d", SC_NAME(sc), cont, spipe->tregs[LEN],
- xfer->ux_length);
- slhci_halt(sc, spipe, xfer);
- return;
+ unsigned int cont = slhci_read(sc, slhci_tregs[ab][CONT]);
+ unsigned int len = spipe->tregs[LEN];
+ DLOG(D_XFER, "cont %d len %d", cont, len, 0, 0);
+ if ((status & SL11_EPSTAT_OVERFLOW) || cont > len) {
+ DDOLOG("overflow - cont %d len %d xfer->ux_length %d "
+ "xfer->actlen %d", cont, len, xfer->ux_length,
+ xfer->ux_actlen);
+ printf("%s: overflow cont %d len %d xfer->ux_length"
+ " %d xfer->ux_actlen %d\n", SC_NAME(sc), cont,
+ len, xfer->ux_length, xfer->ux_actlen);
+ actlen = len;
} else {
- spipe->nerrs = 0;
- actlen = spipe->tregs[LEN] - cont;
+ actlen = len - cont;
}
+ spipe->nerrs = 0;
}
/* Actual copyin done after starting next transfer. */
@@ -2120,16 +2117,6 @@
0);
DDOLOGSTATUS(status);
- if (status & SL11_EPSTAT_OVERFLOW &&
- ratecheck(&sc->sc_overflow_warn_rate,
- &overflow_warn_rate)) {
- printf("%s: Overflow condition: "
- "data corruption possible\n",
- SC_NAME(sc));
- DDOLOG("Overflow condition: "
- "data corruption possible",
- 0, 0, 0, 0);
- }
head = Q_CALLBACKS;
} else {
head = Q_NEXT_CB;
diff -r a8cedd4339fb -r f7ec2542fe70 sys/dev/ic/sl811hsreg.h
--- a/sys/dev/ic/sl811hsreg.h Sat Sep 24 14:55:16 2016 +0000
+++ b/sys/dev/ic/sl811hsreg.h Sat Sep 24 15:06:29 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sl811hsreg.h,v 1.5 2016/09/24 14:55:16 skrll Exp $ */
+/* $NetBSD: sl811hsreg.h,v 1.6 2016/09/24 15:06:29 skrll Exp $ */
/*
* Not (c) 2007 Matthew Orgass
@@ -88,8 +88,6 @@
#define SL11_EPSTAT_ERRBITS ( \
SL11_EPSTAT_ERROR | \
SL11_EPSTAT_TIMEOUT | \
- SL11_EPSTAT_SETUP | \
- SL11_EPSTAT_OVERFLOW | \
SL11_EPSTAT_NAK | \
SL11_EPSTAT_STALL \
)
Home |
Main Index |
Thread Index |
Old Index