提交 f3f49065 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 85a975d0
......@@ -110,23 +110,6 @@ static int slave_configure(struct scsi_device *sdev)
* the end, scatter-gather buffers follow page boundaries. */
blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
/* Set the SCSI level to at least 2. We'll leave it at 3 if that's
* what is originally reported. We need this to avoid confusing
* the SCSI layer with devices that report 0 or 1, but need 10-byte
* commands (ala ATAPI devices behind certain bridges, or devices
* which simply have broken INQUIRY data).
*
* NOTE: This means /dev/sg programs (ala cdrecord) will get the
* actual information. This seems to be the preference for
* programs like that.
*
* NOTE: This also means that /proc/scsi/scsi and sysfs may report
* the actual value or the modified one, depending on where the
* data comes from.
*/
if (sdev->scsi_level < SCSI_2)
sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
/* Many devices have trouble transfering more than 32KB at a time,
* while others have trouble with more than 64K. At this time we
* are limiting both to 32K (64 sectores).
......@@ -176,7 +159,9 @@ static int slave_configure(struct scsi_device *sdev)
* a Get-Max-LUN request, we won't lose much by setting the
* revision level down to 2. The only devices that would be
* affected are those with sparse LUNs. */
sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
if (sdev->scsi_level > SCSI_2)
sdev->sdev_target->scsi_level =
sdev->scsi_level = SCSI_2;
/* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
* Hardware Error) when any low-level error occurs,
......@@ -194,6 +179,16 @@ static int slave_configure(struct scsi_device *sdev)
sdev->use_10_for_ms = 1;
}
/* The CB and CBI transports have no way to pass LUN values
* other than the bits in the second byte of a CDB. But those
* bits don't get set to the LUN value if the device reports
* scsi_level == 0 (UNKNOWN). Hence such devices must necessarily
* be single-LUN.
*/
if ((us->protocol == US_PR_CB || us->protocol == US_PR_CBI) &&
sdev->scsi_level == SCSI_UNKNOWN)
us->max_lun = 0;
/* Some devices choke when they receive a PREVENT-ALLOW MEDIUM
* REMOVAL command, so suppress those commands. */
if (us->flags & US_FL_NOT_LOCKABLE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册