Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Quirk to regenerate residue for borken UMASS dev...



details:   https://anonhg.NetBSD.org/src/rev/ed65d2e78aac
branches:  trunk
changeset: 748659:ed65d2e78aac
user:      is <is%NetBSD.org@localhost>
date:      Fri Oct 30 16:22:32 2009 +0000

description:
Quirk to regenerate residue for borken UMASS devices; needed (at least)
for Supertop IDE bridge. From Matthias Kretschmer, PR 42225.

diffstat:

 sys/dev/usb/umass.c        |  26 ++++++++++++++------------
 sys/dev/usb/umass_quirks.c |  15 +++++++++++++--
 sys/dev/usb/umassvar.h     |   3 ++-
 sys/dev/usb/usbdevs        |   6 +++++-
 4 files changed, 34 insertions(+), 16 deletions(-)

diffs (166 lines):

diff -r 34517f67c927 -r ed65d2e78aac sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c       Fri Oct 30 15:09:24 2009 +0000
+++ b/sys/dev/usb/umass.c       Fri Oct 30 16:22:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass.c,v 1.134 2009/09/23 19:07:19 plunky Exp $       */
+/*     $NetBSD: umass.c,v 1.135 2009/10/30 16:22:32 is Exp $   */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.134 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.135 2009/10/30 16:22:32 is Exp $");
 
 #include "atapibus.h"
 #include "scsibus.h"
@@ -1012,6 +1012,7 @@
 {
        struct umass_softc *sc = (struct umass_softc *) priv;
        usbd_xfer_handle next_xfer;
+       int residue;
 
        KASSERT(sc->sc_wire & UMASS_WPROTO_BBB,
                ("sc->sc_wire == 0x%02x wrong for umass_bbb_state\n",
@@ -1184,6 +1185,11 @@
 
                DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw));
 
+               if (sc->sc_quirks & UMASS_QUIRK_IGNORE_RESIDUE)
+                    residue = sc->transfer_datalen - sc->transfer_actlen;
+                else
+                    residue = UGETDW(sc->csw.dCSWDataResidue);
+
                /* Translate weird command-status signatures. */
                if ((sc->sc_quirks & UMASS_QUIRK_WRONG_CSWSIG) &&
                    UGETDW(sc->csw.dCSWSignature) == CSWSIGNATURE_OLYMPUS_C1)
@@ -1226,8 +1232,7 @@
                        return;
                } else if (sc->csw.bCSWStatus == CSWSTATUS_PHASE) {
                        printf("%s: Phase Error, residue = %d\n",
-                               device_xname(sc->sc_dev),
-                               UGETDW(sc->csw.dCSWDataResidue));
+                               device_xname(sc->sc_dev), residue);
 
                        umass_bbb_reset(sc, STATUS_WIRE_FAILED);
                        return;
@@ -1239,32 +1244,29 @@
                                sc->transfer_actlen, sc->transfer_datalen);
 #if 0
                } else if (sc->transfer_datalen - sc->transfer_actlen
-                          != UGETDW(sc->csw.dCSWDataResidue)) {
+                          != residue) {
                        DPRINTF(UDMASS_BBB, ("%s: actlen=%d != residue=%d\n",
                                device_xname(sc->sc_dev),
                                sc->transfer_datalen - sc->transfer_actlen,
-                               UGETDW(sc->csw.dCSWDataResidue)));
+                               residue));
 
                        umass_bbb_reset(sc, STATUS_WIRE_FAILED);
                        return;
 #endif
                } else if (sc->csw.bCSWStatus == CSWSTATUS_FAILED) {
                        DPRINTF(UDMASS_BBB, ("%s: Command Failed, res = %d\n",
-                               device_xname(sc->sc_dev),
-                               UGETDW(sc->csw.dCSWDataResidue)));
+                               device_xname(sc->sc_dev), residue));
 
                        /* SCSI command failed but transfer was succesful */
                        sc->transfer_state = TSTATE_IDLE;
-                       sc->transfer_cb(sc, sc->transfer_priv,
-                                       UGETDW(sc->csw.dCSWDataResidue),
+                       sc->transfer_cb(sc, sc->transfer_priv, residue,
                                        STATUS_CMD_FAILED);
 
                        return;
 
                } else {        /* success */
                        sc->transfer_state = TSTATE_IDLE;
-                       sc->transfer_cb(sc, sc->transfer_priv,
-                                       UGETDW(sc->csw.dCSWDataResidue),
+                       sc->transfer_cb(sc, sc->transfer_priv, residue,
                                        STATUS_CMD_OK);
 
                        return;
diff -r 34517f67c927 -r ed65d2e78aac sys/dev/usb/umass_quirks.c
--- a/sys/dev/usb/umass_quirks.c        Fri Oct 30 15:09:24 2009 +0000
+++ b/sys/dev/usb/umass_quirks.c        Fri Oct 30 16:22:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass_quirks.c,v 1.77 2009/10/12 23:43:05 wiz Exp $    */
+/*     $NetBSD: umass_quirks.c,v 1.78 2009/10/30 16:22:32 is 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.77 2009/10/12 23:43:05 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_quirks.c,v 1.78 2009/10/30 16:22:32 is Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -229,6 +229,17 @@
          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 34517f67c927 -r ed65d2e78aac sys/dev/usb/umassvar.h
--- a/sys/dev/usb/umassvar.h    Fri Oct 30 15:09:24 2009 +0000
+++ b/sys/dev/usb/umassvar.h    Fri Oct 30 16:22:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umassvar.h,v 1.27 2008/09/06 21:49:00 rmind Exp $      */
+/*     $NetBSD: umassvar.h,v 1.28 2009/10/30 16:22:32 is Exp $ */
 /*-
  * Copyright (c) 1999 MAEKAWA Masahide <bishop%rr.iij4u.or.jp@localhost>,
  *                   Nick Hibma <n_hibma%freebsd.org@localhost>
@@ -180,6 +180,7 @@
 #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
 
diff -r 34517f67c927 -r ed65d2e78aac sys/dev/usb/usbdevs
--- a/sys/dev/usb/usbdevs       Fri Oct 30 15:09:24 2009 +0000
+++ b/sys/dev/usb/usbdevs       Fri Oct 30 16:22:32 2009 +0000
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.534 2009/10/12 22:28:15 wiz Exp $
+$NetBSD: usbdevs,v 1.535 2009/10/30 16:22:32 is Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -464,6 +464,7 @@
 vendor RALINK          0x1485  Ralink Technology
 vendor RALINK_2                0x148f  Ralink Technology
 vendor CONCEPTRONIC    0x14b2  Conceptronic
+vendor SUPERTOP                0x14cd  SuperTop
 vendor PLANEX3         0x14ea  Planex Communications
 vendor SILICONPORTALS  0x1527  Silicon Portals
 vendor OQO             0x1557  OQO
@@ -2234,6 +2235,9 @@
 /* XXX The above is a North American PC style keyboard possibly */
 product SUN MOUSE              0x0100  Type 6 USB mouse
 
+/* SuperTop products */
+product SUPERTOP IDEBRIDGE      0x6600  SuperTop IDE Bridge
+
 /* Supra products */
 product DIAMOND2 SUPRAEXPRESS56K 0x07da Supra Express 56K modem
 product DIAMOND2 SUPRA2890     0x0b4a  SupraMax 2890 56K Modem



Home | Main Index | Thread Index | Old Index