Module Name: src
Committed By: is
Date: Fri Oct 30 16:22:32 UTC 2009
Modified Files:
src/sys/dev/usb: umass.c umass_quirks.c umassvar.h usbdevs
Log Message:
Quirk to regenerate residue for borken UMASS devices; needed (at least)
for Supertop IDE bridge. From Matthias Kretschmer, PR 42225.
To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/umass_quirks.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/umassvar.h
cvs rdiff -u -r1.534 -r1.535 src/sys/dev/usb/usbdevs
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.134 src/sys/dev/usb/umass.c:1.135
--- src/sys/dev/usb/umass.c:1.134 Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/umass.c Fri Oct 30 16:22:32 2009
@@ -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;
Index: src/sys/dev/usb/umass_quirks.c
diff -u src/sys/dev/usb/umass_quirks.c:1.77 src/sys/dev/usb/umass_quirks.c:1.78
--- src/sys/dev/usb/umass_quirks.c:1.77 Mon Oct 12 23:43:05 2009
+++ src/sys/dev/usb/umass_quirks.c Fri Oct 30 16:22:32 2009
@@ -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 *
Index: src/sys/dev/usb/umassvar.h
diff -u src/sys/dev/usb/umassvar.h:1.27 src/sys/dev/usb/umassvar.h:1.28
--- src/sys/dev/usb/umassvar.h:1.27 Sat Sep 6 21:49:00 2008
+++ src/sys/dev/usb/umassvar.h Fri Oct 30 16:22:32 2009
@@ -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 <[email protected]>,
* Nick Hibma <[email protected]>
@@ -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
Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.534 src/sys/dev/usb/usbdevs:1.535
--- src/sys/dev/usb/usbdevs:1.534 Mon Oct 12 22:28:15 2009
+++ src/sys/dev/usb/usbdevs Fri Oct 30 16:22:32 2009
@@ -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