Module Name:    src
Committed By:   drochner
Date:           Fri Aug 24 12:20:02 UTC 2012

Modified Files:
        src/sys/dev/usb: umass.c umass_quirks.c umassvar.h

Log Message:
Another contribution to PR kern/42225 which will hopefully
bring the story to an end:

Always ignore the residue from the CSW, just use the real
transfer length counted by the USB stack. This was first
proposed by Markus Kilbinger but unfortunately ignored
later. (Too many cooks...)
According to Matthias Kretschmer, Darwin and Haiku do
the same.

Remove the "UMASS_QUIRK_IGNORE_RESIDUE" quirk which was
just for the one "SuperTop" device mentioned in the PR.
This device was successfully tested by Matthias Kretschmer /
Ignatios Souvatzis.

I've tested the patch with various other devices and
didn't find regressions.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/umass_quirks.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/usb/umassvar.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.145 src/sys/dev/usb/umass.c:1.146
--- src/sys/dev/usb/umass.c:1.145	Sun Jun 10 06:15:54 2012
+++ src/sys/dev/usb/umass.c	Fri Aug 24 12:20:02 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.145 2012/06/10 06:15:54 mrg Exp $	*/
+/*	$NetBSD: umass.c,v 1.146 2012/08/24 12:20:02 drochner Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.145 2012/06/10 06:15:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.146 2012/08/24 12:20:02 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -1183,11 +1183,14 @@ umass_bbb_state(usbd_xfer_handle xfer, u
 
 		DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw));
 
-		if ((sc->sc_quirks & UMASS_QUIRK_IGNORE_RESIDUE) == 0) {
-			residue = UGETDW(sc->csw.dCSWDataResidue);
-		} else {
-			residue = sc->transfer_datalen - sc->transfer_actlen;
-		}
+#ifdef UMASS_DEBUG
+		residue = UGETDW(sc->csw.dCSWDataResidue);
+		if (residue != sc->transfer_datalen - sc->transfer_actlen)
+			printf("%s: dCSWDataResidue=%d req=%d act=%d\n",
+			       device_xname(sc->sc_dev), residue,
+			       sc->transfer_datalen, sc->transfer_actlen);
+#endif
+		residue = sc->transfer_datalen - sc->transfer_actlen;
 
 		/* Translate weird command-status signatures. */
 		if ((sc->sc_quirks & UMASS_QUIRK_WRONG_CSWSIG) &&

Index: src/sys/dev/usb/umass_quirks.c
diff -u src/sys/dev/usb/umass_quirks.c:1.93 src/sys/dev/usb/umass_quirks.c:1.94
--- src/sys/dev/usb/umass_quirks.c:1.93	Sat Mar  3 21:35:32 2012
+++ src/sys/dev/usb/umass_quirks.c	Fri Aug 24 12:20:02 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_quirks.c,v 1.93 2012/03/03 21:35:32 riz Exp $	*/
+/*	$NetBSD: umass_quirks.c,v 1.94 2012/08/24 12:20:02 drochner Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_quirks.c,v 1.93 2012/03/03 21:35:32 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_quirks.c,v 1.94 2012/08/24 12:20:02 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -336,15 +336,6 @@ Static const struct umass_quirk umass_qu
 	  UMATCH_VENDOR_PRODUCT,
 	  NULL, NULL
 	},
-
-	/* Devices with bad residue. */
-	{ { USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDEBRIDGE },
-	  UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
-	  UMASS_QUIRK_IGNORE_RESIDUE,
-	  0,
-	  UMATCH_VENDOR_PRODUCT,
-	  NULL, NULL
-	},
 };
 
 const struct umass_quirk *

Index: src/sys/dev/usb/umassvar.h
diff -u src/sys/dev/usb/umassvar.h:1.33 src/sys/dev/usb/umassvar.h:1.34
--- src/sys/dev/usb/umassvar.h:1.33	Sun Jun 10 06:15:54 2012
+++ src/sys/dev/usb/umassvar.h	Fri Aug 24 12:20:02 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umassvar.h,v 1.33 2012/06/10 06:15:54 mrg Exp $	*/
+/*	$NetBSD: umassvar.h,v 1.34 2012/08/24 12:20:02 drochner Exp $	*/
 
 /*-
  * Copyright (c) 1999 MAEKAWA Masahide <bis...@rr.iij4u.or.jp>,
@@ -184,7 +184,6 @@ struct umass_softc {
 #define	UMASS_QUIRK_WRONG_CSWTAG	0x00000002
 #define	UMASS_QUIRK_RBC_PAD_TO_12	0x00000004
 #define	UMASS_QUIRK_NOGETMAXLUN		0x00000008
-#define	UMASS_QUIRK_IGNORE_RESIDUE	0x00000010
 
 #define UMASS_QUIRK_USE_DEFAULTMATCH	-1
 

Reply via email to