aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-01-08 16:18:05 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:44:35 -0500
commitf3f4906516a084bbd9aa3da7592e6b029fe78f5b (patch)
tree129dbc126c9728c55c90159d3038adf7db9ccd11 /drivers
parent85a975d0ce48dfa8dec5bf1bd970f8fd2c48af32 (diff)
usb-storage: SCSI level fixes
This patch (as835) removes from usb-storage the code which sets all devices to a SCSI level of at least SCSI-2. The original reasons for doing this no longer apply, and in fact it prevents certain kinds of ATA pass-thru commands from being used. The patch also marks CB and CBI devices that are SCSI-0 (legacy SCSI) as being single-LUN, since the combined SCSI-over-USB transport protocol has no way to convey LUN information to these devices. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/storage/scsiglue.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index e1072d52d641..70234f5dbeeb 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -110,23 +110,6 @@ static int slave_configure(struct scsi_device *sdev)
110 * the end, scatter-gather buffers follow page boundaries. */ 110 * the end, scatter-gather buffers follow page boundaries. */
111 blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); 111 blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
112 112
113 /* Set the SCSI level to at least 2. We'll leave it at 3 if that's
114 * what is originally reported. We need this to avoid confusing
115 * the SCSI layer with devices that report 0 or 1, but need 10-byte
116 * commands (ala ATAPI devices behind certain bridges, or devices
117 * which simply have broken INQUIRY data).
118 *
119 * NOTE: This means /dev/sg programs (ala cdrecord) will get the
120 * actual information. This seems to be the preference for
121 * programs like that.
122 *
123 * NOTE: This also means that /proc/scsi/scsi and sysfs may report
124 * the actual value or the modified one, depending on where the
125 * data comes from.
126 */
127 if (sdev->scsi_level < SCSI_2)
128 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
129
130 /* Many devices have trouble transfering more than 32KB at a time, 113 /* Many devices have trouble transfering more than 32KB at a time,
131 * while others have trouble with more than 64K. At this time we 114 * while others have trouble with more than 64K. At this time we
132 * are limiting both to 32K (64 sectores). 115 * are limiting both to 32K (64 sectores).
@@ -176,7 +159,9 @@ static int slave_configure(struct scsi_device *sdev)
176 * a Get-Max-LUN request, we won't lose much by setting the 159 * a Get-Max-LUN request, we won't lose much by setting the
177 * revision level down to 2. The only devices that would be 160 * revision level down to 2. The only devices that would be
178 * affected are those with sparse LUNs. */ 161 * affected are those with sparse LUNs. */
179 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; 162 if (sdev->scsi_level > SCSI_2)
163 sdev->sdev_target->scsi_level =
164 sdev->scsi_level = SCSI_2;
180 165
181 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable 166 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
182 * Hardware Error) when any low-level error occurs, 167 * Hardware Error) when any low-level error occurs,
@@ -194,6 +179,16 @@ static int slave_configure(struct scsi_device *sdev)
194 sdev->use_10_for_ms = 1; 179 sdev->use_10_for_ms = 1;
195 } 180 }
196 181
182 /* The CB and CBI transports have no way to pass LUN values
183 * other than the bits in the second byte of a CDB. But those
184 * bits don't get set to the LUN value if the device reports
185 * scsi_level == 0 (UNKNOWN). Hence such devices must necessarily
186 * be single-LUN.
187 */
188 if ((us->protocol == US_PR_CB || us->protocol == US_PR_CBI) &&
189 sdev->scsi_level == SCSI_UNKNOWN)
190 us->max_lun = 0;
191
197 /* Some devices choke when they receive a PREVENT-ALLOW MEDIUM 192 /* Some devices choke when they receive a PREVENT-ALLOW MEDIUM
198 * REMOVAL command, so suppress those commands. */ 193 * REMOVAL command, so suppress those commands. */
199 if (us->flags & US_FL_NOT_LOCKABLE) 194 if (us->flags & US_FL_NOT_LOCKABLE)