Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Another contribution to PR kern/42225 which will...



details:   https://anonhg.NetBSD.org/src/rev/b1b746753bb4
branches:  trunk
changeset: 781175:b1b746753bb4
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri Aug 24 12:20:02 2012 +0000

description:
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.

diffstat:

 sys/dev/usb/umass.c        |  17 ++++++++++-------
 sys/dev/usb/umass_quirks.c |  13 ++-----------
 sys/dev/usb/umassvar.h     |   3 +--
 3 files changed, 13 insertions(+), 20 deletions(-)

diffs (89 lines):

diff -r bd2aec81d462 -r b1b746753bb4 sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c       Fri Aug 24 09:01:22 2012 +0000
+++ b/sys/dev/usb/umass.c       Fri Aug 24 12:20:02 2012 +0000
@@ -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 @@
 
                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) &&
diff -r bd2aec81d462 -r b1b746753bb4 sys/dev/usb/umass_quirks.c
--- a/sys/dev/usb/umass_quirks.c        Fri Aug 24 09:01:22 2012 +0000
+++ b/sys/dev/usb/umass_quirks.c        Fri Aug 24 12:20:02 2012 +0000
@@ -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 @@
          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 *
diff -r bd2aec81d462 -r b1b746753bb4 sys/dev/usb/umassvar.h
--- a/sys/dev/usb/umassvar.h    Fri Aug 24 09:01:22 2012 +0000
+++ b/sys/dev/usb/umassvar.h    Fri Aug 24 12:20:02 2012 +0000
@@ -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 <bishop%rr.iij4u.or.jp@localhost>,
@@ -184,7 +184,6 @@
 #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
 



Home | Main Index | Thread Index | Old Index