NetBSD-Bugs archive

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

kern/42225: can't read data from SuperTop IDE Bridge (umass)



>Number:         42225
>Category:       kern
>Synopsis:       can't read data from SuperTop IDE Bridge (umass)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 24 20:40:00 +0000 2009
>Originator:     Matthias Kretschmer
>Release:        NetBSD 5.0.1_PATCH
>Organization:
>Environment:
NetBSD fourier.hangelar.local 5.0.1_PATCH NetBSD 5.0.1_PATCH (GENERIC) #0: Sat 
Oct 24 21:33:44 CEST 2009  matthias pts/4    Oct 24 20:55  
(:0:S.2)@fourier.hangelar.local:/home/matthias/src/netbsd/5-0/src/sys/arch/amd64/compile/obj/GENERIC
 amd64
>Description:
Whenever I try to read data from a SuperTop IDE Bridge (an usb to ide bridge), 
I do not get any output.  NetBSD is unable to read any data.  Writing does not 
work as expected, too.

The problem is, that the device has some quirk, such that the residue 
information is bad (always zero).
>How-To-Repeat:
Just attach the device and try to read/write data using dd.
>Fix:
The following patches for netbsd-5-0, netbsd-5 and HEAD branches correct the 
problem.

I introduced a new umass quirk UMASS_QUIRK_IGNORE_RESIDUE and added a 
corresponding entry to umass_quirks.c for the specific device.  I used the code 
on 5.0.0_PATCH and 5.0.1_PATCH systems for some months without any problems.  I 
created patches against the code of netbsd-5-0, netbsd-5 and HEAD branches of 
today.  They are given below.  I compiled kernels of all three branches and 
tried the device to check if it performs properly.

According to other operating systems' quirk lists there are many other 
umass-devices with this quirk.  Using this patch and adding a corresponding 
quirk entry in umass_quirk.c might solve the problem with those devices, too.  
I did not add further entries, because I only have this single device with the 
quirk and I'm unable to test the others.


--
Patch for netbsd-5-0:

Index: umass.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass.c,v
retrieving revision 1.129.4.1
diff -r1.129.4.1 umass.c
998a999
>       int residue;
1170a1172,1176
>               if (sc->sc_quirks & UMASS_QUIRK_IGNORE_RESIDUE)
>                   residue = sc->transfer_datalen - sc->transfer_actlen;
>               else
>                   residue = UGETDW(sc->csw.dCSWDataResidue);
> 
1213,1214c1219
<                               USBDEVNAME(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue));
---
>                               USBDEVNAME(sc->sc_dev), residue);
1226c1231
<                          != UGETDW(sc->csw.dCSWDataResidue)) {
---
>                          != residue) {
1230c1235
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               residue));
1237,1238c1242
<                               USBDEVNAME(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               USBDEVNAME(sc->sc_dev), residue));
1242,1243c1246
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
1250,1251c1253
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
Index: umass_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
retrieving revision 1.76
diff -r1.76 umass_quirks.c
223a224,234
> 
>       /*
>        * 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
>       },
Index: umassvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umassvar.h,v
retrieving revision 1.27
diff -r1.27 umassvar.h
182a183
> #define UMASS_QUIRK_IGNORE_RESIDUE    0x00000010
Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.519.4.1
diff -r1.519.4.1 usbdevs
456a457
> vendor SUPERTOP               0x14cd  SuperTop
2193a2195,2197
> /* SuperTop products */
> product SUPERTOP IDEBRIDGE    0x6600  SuperTop IDE Bridge
> 
Index: usbdevs.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.515.4.1
diff -r1.515.4.1 usbdevs.h
1c1
< /*    $NetBSD: usbdevs.h,v 1.515.4.1 2008/11/22 05:12:18 snj Exp $    */
---
> /*    $NetBSD$        */
463a464
> #define       USB_VENDOR_SUPERTOP     0x14cd          /* SuperTop */
2200a2202,2204
> /* SuperTop products */
> #define       USB_PRODUCT_SUPERTOP_IDEBRIDGE  0x6600          /* SuperTop IDE 
Bridge */
> 
Index: usbdevs_data.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.516.4.1
diff -r1.516.4.1 usbdevs_data.h
1c1
< /*    $NetBSD: usbdevs_data.h,v 1.516.4.1 2008/11/22 05:12:18 snj Exp $       
*/
---
> /*    $NetBSD$        */
1641a1642,1645
>           USB_VENDOR_SUPERTOP,
>           "SuperTop",
>       },
>       {
1858c1862
< const int usb_nvendors = 454;
---
> const int usb_nvendors = 455;
6349a6354,6357
>           USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDEBRIDGE,
>           "SuperTop IDE Bridge",
>       },
>       {
6826c6834
< const int usb_nproducts = 1241;
---
> const int usb_nproducts = 1242;


--
Patch for netbsd-5:
Index: umass.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass.c,v
retrieving revision 1.129.4.1
diff -r1.129.4.1 umass.c
998a999
>       int residue;
1170a1172,1176
>               if (sc->sc_quirks & UMASS_QUIRK_IGNORE_RESIDUE)
>                   residue = sc->transfer_datalen - sc->transfer_actlen;
>               else
>                   residue = UGETDW(sc->csw.dCSWDataResidue);
> 
1213,1214c1219
<                               USBDEVNAME(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue));
---
>                               USBDEVNAME(sc->sc_dev), residue);
1226c1231
<                          != UGETDW(sc->csw.dCSWDataResidue)) {
---
>                          != residue) {
1230c1235
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               residue));
1237,1238c1242
<                               USBDEVNAME(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               USBDEVNAME(sc->sc_dev), residue));
1242,1243c1246
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
1250,1251c1253
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
Index: umass_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
retrieving revision 1.76
diff -r1.76 umass_quirks.c
223a224,234
> 
>       /*
>        * 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
>       },
Index: umassvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umassvar.h,v
retrieving revision 1.27
diff -r1.27 umassvar.h
182a183
> #define UMASS_QUIRK_IGNORE_RESIDUE    0x00000010
Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.519.4.2
diff -r1.519.4.2 usbdevs
456a457
> vendor SUPERTOP               0x14cd  SuperTop
2193a2195,2197
> /* SuperTop products */
> product SUPERTOP IDEBRIDGE    0x6600  SuperTop IDE Bridge
> 
Index: usbdevs.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.515.4.2
diff -r1.515.4.2 usbdevs.h
1c1
< /*    $NetBSD: usbdevs.h,v 1.515.4.2 2009/10/10 20:35:19 sborrill Exp $       
*/
---
> /*    $NetBSD$        */
463a464
> #define       USB_VENDOR_SUPERTOP     0x14cd          /* SuperTop */
2200a2202,2204
> /* SuperTop products */
> #define       USB_PRODUCT_SUPERTOP_IDEBRIDGE  0x6600          /* SuperTop IDE 
Bridge */
> 
Index: usbdevs_data.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.516.4.2
diff -r1.516.4.2 usbdevs_data.h
1c1
< /*    $NetBSD: usbdevs_data.h,v 1.516.4.2 2009/10/10 20:35:20 sborrill Exp $  
*/
---
> /*    $NetBSD$        */
1641a1642,1645
>           USB_VENDOR_SUPERTOP,
>           "SuperTop",
>       },
>       {
1858c1862
< const int usb_nvendors = 454;
---
> const int usb_nvendors = 455;
6353a6358,6361
>           USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDEBRIDGE,
>           "SuperTop IDE Bridge",
>       },
>       {
6830c6838
< const int usb_nproducts = 1242;
---
> const int usb_nproducts = 1243;


--
Patch for HEAD:
Index: umass.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass.c,v
retrieving revision 1.134
diff -r1.134 umass.c
1014a1015
>       int residue;
1186a1188,1192
>               if (sc->sc_quirks & UMASS_QUIRK_IGNORE_RESIDUE)
>                     residue = sc->transfer_datalen - sc->transfer_actlen;
>                 else
>                     residue = UGETDW(sc->csw.dCSWDataResidue);
> 
1229,1230c1235
<                               device_xname(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue));
---
>                               device_xname(sc->sc_dev), residue);
1242c1247
<                          != UGETDW(sc->csw.dCSWDataResidue)) {
---
>                          != residue) {
1246c1251
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               residue));
1253,1254c1258
<                               device_xname(sc->sc_dev),
<                               UGETDW(sc->csw.dCSWDataResidue)));
---
>                               device_xname(sc->sc_dev), residue));
1258,1259c1262
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
1266,1267c1269
<                       sc->transfer_cb(sc, sc->transfer_priv,
<                                       UGETDW(sc->csw.dCSWDataResidue),
---
>                       sc->transfer_cb(sc, sc->transfer_priv, residue,
Index: umass_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
retrieving revision 1.77
diff -r1.77 umass_quirks.c
231a232,242
> 
>         /*
>          * 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
>         },
Index: umassvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umassvar.h,v
retrieving revision 1.27
diff -r1.27 umassvar.h
182a183
> #define UMASS_QUIRK_IGNORE_RESIDUE      0x00000010
Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.534
diff -r1.534 usbdevs
466a467
> vendor SUPERTOP               0x14cd  SuperTop
2236a2238,2240
> /* SuperTop products */
> product SUPERTOP IDEBRIDGE      0x6600  SuperTop IDE Bridge
> 
Index: usbdevs.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.528
diff -r1.528 usbdevs.h
1c1
< /*    $NetBSD: usbdevs.h,v 1.528 2009/10/12 22:29:16 wiz Exp $        */
---
> /*    $NetBSD$        */
473a474
> #define       USB_VENDOR_SUPERTOP     0x14cd          /* SuperTop */
2243a2245,2247
> /* SuperTop products */
> #define       USB_PRODUCT_SUPERTOP_IDEBRIDGE  0x6600          /* SuperTop IDE 
Bridge */
> 
Index: usbdevs_data.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.529
diff -r1.529 usbdevs_data.h
1c1
< /*    $NetBSD: usbdevs_data.h,v 1.529 2009/10/12 22:29:16 wiz Exp $   */
---
> /*    $NetBSD$        */
1665a1666,1669
>           USB_VENDOR_SUPERTOP,
>           "SuperTop",
>       },
>       {
1886c1890
< const int usb_nvendors = 461;
---
> const int usb_nvendors = 462;
6457a6462,6465
>           USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDEBRIDGE,
>           "SuperTop IDE Bridge",
>       },
>       {
6938c6946
< const int usb_nproducts = 1262;
---
> const int usb_nproducts = 1263;



Home | Main Index | Thread Index | Old Index