usb/95173: [usb] cannot mount external usb harddisk VIA
Technologies Inc. USB 2.0 IDE Bridge
James E. Flemer
jflemer at uvm.edu
Sat Sep 9 13:10:25 PDT 2006
The following reply was made to PR usb/95173; it has been noted by GNATS.
From: "James E. Flemer" <jflemer at uvm.edu>
To: diazepam at gmx.net
Cc: bug-followup at FreeBSD.org
Subject: Re: usb/95173: [usb] cannot mount external usb harddisk VIA Technologies
Inc. USB 2.0 IDE Bridge
Date: Sat, 09 Sep 2006 14:02:21 -0600
This is a multi-part message in MIME format.
--------------090805000301020904040608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I have a USB enclosure with the same chip set as the submitter, but a
different drive inside:
umass0: VIA Technologies Inc. USB 2.0 IDE Bridge, rev 2.00/0.03, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <HITACHI_ DK23DA-40 00J0> Fixed Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 38154MB (78140160 512 byte sectors: 255H 63S/T 4864C)
The device hangs on the SCSI SYNCHRONIZE_CACHE command, though I'm not
sure if it is the VIA bridge or the hard drive inside. The underlying
SCSI da(4) driver has a DA_Q_NO_SYNC_CACHE quirk to handle devices
without working SYNC_CACHE, but I don't know how to get to the da softc
from the umass driver to set the quirk flag. A quirk could be added to
the scsi_da.c quirks table for the drive, but that would be a poor
solution if the problem is really in the bridge.
There is a interesting and related patch proposed in this email:
http://lists.freebsd.org/pipermail/freebsd-current/2005-January/045779.html
With the patch in that email, plus the attached umass patch to add a
NO_SYNCHRONIZE_CACHE quirk, my USB enclosure works. (Note, the attached
patch includes some other unrelated umass patches, use at your own risk.)
-James
--------------090805000301020904040608
Content-Type: text/plain;
name="umass_no_sync_cache.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="umass_no_sync_cache.diff"
Index: sys/dev/usb/umass.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.122.2.10
diff -b -u -r1.122.2.10 umass.c
--- sys/dev/usb/umass.c 26 Jun 2006 00:31:25 -0000 1.122.2.10
+++ sys/dev/usb/umass.c 9 Sep 2006 19:57:06 -0000
@@ -113,8 +113,11 @@
#include <sys/bus.h>
#include <sys/sysctl.h>
+#include <machine/bus.h>
+
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
@@ -317,6 +320,10 @@
# define NO_INQUIRY_EVPD 0x0800
/* Pad all RBC requests to 12 bytes. */
# define RBC_PAD_TO_12 0x1000
+ /* The device returns wrong CSWTAG. */
+# define WRONG_CSWTAG 0x2000
+ /* Device cannot handle SYNCHRONIZE_CACHE. */
+# define NO_SYNCHRONIZE_CACHE 0x4000
};
Static struct umass_devdescr_t umass_devdescrs[] = {
@@ -426,6 +433,10 @@
UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
NO_INQUIRY | NO_GETMAXLUN
},
+ { USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN, RID_WILDCARD,
+ UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
+ NO_GETMAXLUN
+ },
{ USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN, RID_WILDCARD,
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
NO_QUIRKS
@@ -502,6 +513,10 @@
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
NO_QUIRKS
},
+ { USB_VENDOR_VIA, USB_PRODUCT_VIA_IDE_BRIDGE, RID_WILDCARD,
+ UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+ NO_SYNCHRONIZE_CACHE
+ },
{ USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_EXTHDD, RID_WILDCARD,
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
@@ -635,6 +650,7 @@
int timeout; /* in msecs */
int maxlun; /* maximum LUN number */
+ int port; /* port on the parent hub */
};
#ifdef USB_DEBUG
@@ -928,6 +944,7 @@
sc->iface = uaa->iface;
sc->ifaceno = uaa->ifaceno;
+ sc->port = uaa->port;
usb_callout_init(sc->cam_scsi_rescan_ch);
/* initialise the proto and drive values in the umass_softc (again) */
@@ -1661,6 +1678,10 @@
USETDW(sc->csw.dCSWSignature, CSWSIGNATURE);
}
+ /* Translate invalid command-status tags. */
+ if (sc->quirks & WRONG_CSWTAG)
+ USETDW(sc->csw.dCSWTag, UGETDW(sc->cbw.dCBWTag));
+
int Residue;
Residue = UGETDW(sc->csw.dCSWDataResidue);
if (Residue == 0 &&
@@ -1779,6 +1800,7 @@
usbd_device_handle udev;
usb_device_request_t req;
usbd_status err;
+ usb_port_status_t ps;
usb_interface_descriptor_t *id;
int maxlun = 0;
u_int8_t buf = 0;
@@ -1806,7 +1828,8 @@
/* Device doesn't support Get Max Lun request. */
printf("%s: Get Max Lun not supported (%s)\n",
USBDEVNAME(sc->sc_dev), usbd_errstr(err));
- /* XXX Should we port_reset the device? */
+ /* Reset the port on the hub for the device. */
+ usbd_reset_port(sc->sc_udev, sc->port, &ps);
break;
}
@@ -1886,6 +1909,8 @@
umass_cbi_adsc(sc, sc->cbl, SEND_DIAGNOSTIC_CMDLEN,
sc->transfer_xfer[XFER_CBI_RESET1]);
/* XXX if the command fails we should reset the port on the hub */
+ /* Reset the port on the hub for the device. */
+ /* usbd_reset_port(sc->sc_udev, sc->port, &ps); */
}
Static void
@@ -2896,6 +2921,15 @@
umass_scsi_transform(struct umass_softc *sc, unsigned char *cmd, int cmdlen,
unsigned char **rcmd, int *rcmdlen)
{
+ if (sc->quirks & NO_SYNCHRONIZE_CACHE
+ && cmd[0] == SYNCHRONIZE_CACHE)
+ {
+ printf("%s: Unsupported SCSI command 0x%02x",
+ USBDEVNAME(sc->sc_dev), cmd[0]);
+ printf("\n");
+ return 0; /* failure */
+ }
+
switch (cmd[0]) {
case TEST_UNIT_READY:
if (sc->quirks & NO_TEST_UNIT_READY) {
Index: sys/dev/usb/usbdevs
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.232.2.16
diff -b -u -r1.232.2.16 usbdevs
--- sys/dev/usb/usbdevs 20 Aug 2006 05:20:07 -0000 1.232.2.16
+++ sys/dev/usb/usbdevs 9 Sep 2006 19:57:08 -0000
@@ -1343,6 +1343,7 @@
product PALM ZIRE 0x0070 Palm Zire
/* Panasonic products */
+product PANASONIC KXL840AN 0x0d01 CD-R Drive KXL-840AN
product PANASONIC KXLRW32AN 0x0d09 CD-R Drive KXL-RW32AN
product PANASONIC KXLCB20AN 0x0d0a CD-R Drive KXL-CB20AN
product PANASONIC KXLCB35AN 0x0d0e DVD-ROM & CD-R/RW
@@ -1633,6 +1634,9 @@
/* Universal Access products */
product UNIACCESS PANACHE 0x0101 Panache Surf USB ISDN Adapter
+/* VIA products */
+product VIA IDE_BRIDGE 0x6204 USB 2.0 IDE Bridge
+
/* VidzMedia products */
product VIDZMEDIA MONSTERTV 0x4fb1 MonsterTV P2H
--------------090805000301020904040608--
More information about the freebsd-usb
mailing list