diff options
| author | is <is@NetBSD.org> | 2009-10-30 16:22:32 +0000 |
|---|---|---|
| committer | is <is@NetBSD.org> | 2009-10-30 16:22:32 +0000 |
| commit | 5886aca913fd2a3adbd85d68f627ce9ea052b338 (patch) | |
| tree | c9358fce3885897d69d0521f1996ca6c00f7cbee /sys/dev | |
| parent | 4effe2d8e0044437cf25d0774f922c5dbced21fd (diff) | |
Quirk to regenerate residue for borken UMASS devices; needed (at least)
for Supertop IDE bridge. From Matthias Kretschmer, PR 42225.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/umass.c | 26 | ||||
| -rw-r--r-- | sys/dev/usb/umass_quirks.c | 15 | ||||
| -rw-r--r-- | sys/dev/usb/umassvar.h | 3 | ||||
| -rw-r--r-- | sys/dev/usb/usbdevs | 6 |
4 files changed, 34 insertions, 16 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index b4e33e7aa6d..6acf7df694e 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -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 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, { 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 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, 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 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, 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 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, 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 --git a/sys/dev/usb/umass_quirks.c b/sys/dev/usb/umass_quirks.c index a374dba5188..8bc0777cee9 100644 --- a/sys/dev/usb/umass_quirks.c +++ b/sys/dev/usb/umass_quirks.c @@ -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 @@ Static const struct umass_quirk umass_quirks[] = { 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 --git a/sys/dev/usb/umassvar.h b/sys/dev/usb/umassvar.h index f5aea73da8c..d9e52d9be89 100644 --- a/sys/dev/usb/umassvar.h +++ b/sys/dev/usb/umassvar.h @@ -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>, * Nick Hibma <n_hibma@freebsd.org> @@ -180,6 +180,7 @@ 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 diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 8c9bab962cf..a8e348d91dd 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -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 SILICOM 0x1485 Silicom 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 @@ product SUN KEYBOARD_TYPE_7 0x00a2 Type 7 USB keyboard /* 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 |
