Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jul 2013 13:00:09 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253803 - head/sys/cam/scsi
Message-ID:  <201307301300.r6UD09Te019110@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jul 30 13:00:09 2013
New Revision: 253803
URL: http://svnweb.freebsd.org/changeset/base/253803

Log:
  Add NO_RC16 quirk to make da driver avoid using READ CAPACITY(16) command
  if possible.  Use it for Kingston JetFlash USB sticks, that are known to
  return garbage in response to that command.

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Tue Jul 30 12:33:21 2013	(r253802)
+++ head/sys/cam/scsi/scsi_da.c	Tue Jul 30 13:00:09 2013	(r253803)
@@ -98,7 +98,8 @@ typedef enum {
 	DA_Q_NO_SYNC_CACHE	= 0x01,
 	DA_Q_NO_6_BYTE		= 0x02,
 	DA_Q_NO_PREVENT		= 0x04,
-	DA_Q_4K			= 0x08
+	DA_Q_4K			= 0x08,
+	DA_Q_NO_RC16		= 0x10
 } da_quirks;
 
 #define DA_Q_BIT_STRING		\
@@ -106,7 +107,8 @@ typedef enum {
 	"\001NO_SYNC_CACHE"	\
 	"\002NO_6_BYTE"		\
 	"\003NO_PREVENT"	\
-	"\0044K"
+	"\0044K"		\
+	"\005NO_RC16"
 
 typedef enum {
 	DA_CCB_PROBE_RC		= 0x01,
@@ -680,6 +682,11 @@ static struct da_quirk_entry da_quirk_ta
 		{T_DIRECT, SIP_MEDIA_REMOVABLE, "Kingston", "DataTraveler G3",
 		 "1.00"}, /*quirks*/ DA_Q_NO_PREVENT
 	},
+	{
+		/* At least several Transcent USB sticks lie on RC16. */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "JetFlash", "Transcend*",
+		 "*"}, /*quirks*/ DA_Q_NO_RC16
+	},
 	/* ATA/SATA devices over SAS/USB/... */
 	{
 		/* Hitachi Advanced Format (4k) drives */
@@ -2075,7 +2082,8 @@ daregister(struct cam_periph *periph, vo
 		softc->minimum_cmd_size = 16;
 
 	/* Predict whether device may support READ CAPACITY(16). */
-	if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) {
+	if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3 &&
+	    (softc->quirks & DA_Q_NO_RC16) == 0) {
 		softc->flags |= DA_FLAG_CAN_RC16;
 		softc->state = DA_STATE_PROBE_RC16;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307301300.r6UD09Te019110>