linux/drivers/usb/storage
Alan Stern 50c4e96411 scsi: don't store LUN bits in CDB[1] for USB mass-storage devices
The SCSI specification requires that the second Command Data Byte
should contain the LUN value in its high-order bits if the recipient
device reports SCSI level 2 or below.  Nevertheless, some USB
mass-storage devices use those bits for other purposes in
vendor-specific commands.  Currently Linux has no way to send such
commands, because the SCSI stack always overwrites the LUN bits.

Testing shows that Windows 7 and XP do not store the LUN bits in the
CDB when sending commands to a USB device.  This doesn't matter if the
device uses the Bulk-Only or UAS transports (which virtually all
modern USB mass-storage devices do), as these have a separate
mechanism for sending the LUN value.

Therefore this patch introduces a flag in the Scsi_Host structure to
inform the SCSI midlayer that a transport does not require the LUN
bits to be stored in the CDB, and it makes usb-storage set this flag
for all devices using the Bulk-Only transport.  (UAS is handled by a
separate driver, but it doesn't really matter because no SCSI-2 or
lower device is at all likely to use UAS.)

The patch also cleans up the code responsible for storing the LUN
value by adding a bitflag to the scsi_device structure.  The test for
whether to stick the LUN value in the CDB can be made when the device
is probed, and stored for future use rather than being made over and
over in the fast path.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Tiziano Bacocco <tiziano.bacocco@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-15 16:01:58 -07:00
..
Kconfig SCSI misc on 20140806 2014-08-06 20:10:32 -07:00
Makefile usb: remove libusual 2012-09-05 17:21:36 -07:00
alauda.c usb: storage: alauda: initialize variables directly 2013-05-16 17:48:28 -07:00
cypress_atacb.c usb-storage: CY7C68300A chips do not support Cypress ATACB 2013-04-23 10:08:13 -07:00
datafab.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
debug.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
debug.h usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
ene_ub6250.c staging: keucr: remove driver 2014-07-23 19:01:36 -07:00
freecom.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
initializers.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
initializers.h USB: storage: fix Huawei mode switching regression 2013-03-07 12:23:17 +08:00
isd200.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
jumpshot.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
karma.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
onetouch.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
option_ms.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
option_ms.h
protocol.c USB: storage: fix compile warning 2013-12-09 23:45:39 -08:00
protocol.h
realtek_cr.c USB: usb-stor: realtek_cr: Fix compile error 2013-05-16 17:28:27 -07:00
scsiglue.c usb-storage/SCSI: Add broken_fua blacklist flag 2014-06-30 22:47:18 -07:00
scsiglue.h
sddr09.c scsi: use 64-bit LUNs 2014-07-17 22:07:37 +02:00
sddr55.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
shuttle_usbat.c usb: storage: shuttle_usbat: fix discs being detected twice 2014-05-03 18:04:28 -04:00
sierra_ms.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
sierra_ms.h
transport.c usb: storage: Convert US_DEBUGP to usb_stor_dbg 2013-04-19 11:46:50 -07:00
transport.h usb/storage: a couple defines from drivers/usb/storage/transport.h to include/linux/usb/storage.h 2012-02-28 11:05:18 -08:00
uas-detect.h uas: Add missing le16_to_cpu calls to asm1051 / asm1053 usb-id check 2014-09-11 14:21:43 -07:00
uas.c uas: Limit qdepth to 32 when connected over usb-2 2014-08-01 15:48:08 -07:00
unusual_alauda.h
unusual_cypress.h usb-storage: restrict bcdDevice range for Super Top in Cypress ATACB 2014-02-04 12:59:14 -08:00
unusual_datafab.h
unusual_devs.h storage: Add single-LUN quirk for Jaz USB Adapter 2014-09-11 14:22:25 -07:00
unusual_ene_ub6250.h
unusual_freecom.h
unusual_isd200.h
unusual_jumpshot.h
unusual_karma.h
unusual_onetouch.h
unusual_realtek.h
unusual_sddr09.h
unusual_sddr55.h
unusual_uas.h uas: Add the posibilty to blacklist uas devices from using the uas driver 2014-03-04 15:38:16 -08:00
unusual_usbat.h
usb.c scsi: don't store LUN bits in CDB[1] for USB mass-storage devices 2014-09-15 16:01:58 -07:00
usb.h usb-storage: Modify and export adjust_quirks so that it can be used by uas 2014-03-04 15:38:17 -08:00
usual-tables.c USB: storage: Define a new macro for USB storage match rules 2013-02-04 10:40:16 -08:00