Module Name:    src
Committed By:   snj
Date:           Tue Mar  9 03:45:43 UTC 2010

Modified Files:
        src/sys/dev/usb [netbsd-5]: umass.c usbdevs

Log Message:
Pull up following revision(s) (requested by is/martin):
        sys/dev/usb/usbdevs: revision 1.535
        sys/dev/usb/umass.c: revision 1.137
Add SuperTop and SuperTop IDE Bridge to usbdevs.
--
Max out the expected response size at the actual transfer length.
Fixes PR kern/42225.


To generate a diff of this commit:
cvs rdiff -u -r1.129.4.1 -r1.129.4.2 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.519.4.4 -r1.519.4.5 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.129.4.1 src/sys/dev/usb/umass.c:1.129.4.2
--- src/sys/dev/usb/umass.c:1.129.4.1	Sat Dec 13 21:44:42 2008
+++ src/sys/dev/usb/umass.c	Tue Mar  9 03:45:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.129.4.1 2008/12/13 21:44:42 bouyer Exp $	*/
+/*	$NetBSD: umass.c,v 1.129.4.2 2010/03/09 03:45:43 snj Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.129.4.1 2008/12/13 21:44:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.129.4.2 2010/03/09 03:45:43 snj Exp $");
 
 #include "atapibus.h"
 #include "scsibus.h"
@@ -996,6 +996,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",
@@ -1168,6 +1169,10 @@
 
 		DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw));
 
+		residue = UGETDW(sc->csw.dCSWDataResidue);
+		if (residue < sc->transfer_datalen - sc->transfer_actlen)
+		    residue = sc->transfer_datalen - sc->transfer_actlen;
+
 		/* Translate weird command-status signatures. */
 		if ((sc->sc_quirks & UMASS_QUIRK_WRONG_CSWSIG) &&
 		    UGETDW(sc->csw.dCSWSignature) == CSWSIGNATURE_OLYMPUS_C1)
@@ -1210,8 +1215,7 @@
 			return;
 		} else if (sc->csw.bCSWStatus == CSWSTATUS_PHASE) {
 			printf("%s: Phase Error, residue = %d\n",
-				USBDEVNAME(sc->sc_dev),
-				UGETDW(sc->csw.dCSWDataResidue));
+				USBDEVNAME(sc->sc_dev), residue);
 
 			umass_bbb_reset(sc, STATUS_WIRE_FAILED);
 			return;
@@ -1223,32 +1227,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",
 				USBDEVNAME(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",
-				USBDEVNAME(sc->sc_dev),
-				UGETDW(sc->csw.dCSWDataResidue)));
+				USBDEVNAME(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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.519.4.4 src/sys/dev/usb/usbdevs:1.519.4.5
--- src/sys/dev/usb/usbdevs:1.519.4.4	Sat Jan 16 17:47:12 2010
+++ src/sys/dev/usb/usbdevs	Tue Mar  9 03:45:43 2010
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.519.4.4 2010/01/16 17:47:12 bouyer Exp $
+$NetBSD: usbdevs,v 1.519.4.5 2010/03/09 03:45:43 snj Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -454,6 +454,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
@@ -2194,6 +2195,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

Reply via email to