Module Name:    src
Committed By:   skrll
Date:           Sat Sep 24 15:06:29 UTC 2016

Modified Files:
        src/sys/dev/ic: sl811hs.c sl811hsreg.h

Log Message:
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)


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/sl811hs.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/sl811hsreg.h

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/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.95 src/sys/dev/ic/sl811hs.c:1.96
--- src/sys/dev/ic/sl811hs.c:1.95	Thu Sep 15 21:45:37 2016
+++ src/sys/dev/ic/sl811hs.c	Sat Sep 24 15:06:29 2016
@@ -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 @@ slhci_abdone(struct slhci_softc *sc, int
 #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 @@ slhci_abdone(struct slhci_softc *sc, int
 			    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;

Index: src/sys/dev/ic/sl811hsreg.h
diff -u src/sys/dev/ic/sl811hsreg.h:1.5 src/sys/dev/ic/sl811hsreg.h:1.6
--- src/sys/dev/ic/sl811hsreg.h:1.5	Sat Sep 24 14:55:16 2016
+++ src/sys/dev/ic/sl811hsreg.h	Sat Sep 24 15:06:29 2016
@@ -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 \
     )

Reply via email to