Commit ef978a9d authored by Alan Stern's avatar Alan Stern Committed by Zefan Li

usb-storage/SCSI: Add broken_fua blacklist flag

commit b14bf2d0 upstream.

Some buggy JMicron USB-ATA bridges don't know how to translate the FUA
bit in READs or WRITEs.  This patch adds an entry in unusual_devs.h
and a blacklist flag to tell the sd driver not to use FUA.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reported-by: default avatarMichael Büsch <m@bues.ch>
Tested-by: default avatarMichael Büsch <m@bues.ch>
Acked-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent 89f1d011
...@@ -2238,7 +2238,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) ...@@ -2238,7 +2238,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
} }
sdkp->DPOFUA = (data.device_specific & 0x10) != 0; sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { if (sdp->broken_fua) {
sd_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
sdkp->DPOFUA = 0;
} else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
sd_printk(KERN_NOTICE, sdkp, sd_printk(KERN_NOTICE, sdkp,
"Uses READ/WRITE(6), disabling FUA\n"); "Uses READ/WRITE(6), disabling FUA\n");
sdkp->DPOFUA = 0; sdkp->DPOFUA = 0;
......
...@@ -242,6 +242,10 @@ static int slave_configure(struct scsi_device *sdev) ...@@ -242,6 +242,10 @@ static int slave_configure(struct scsi_device *sdev)
US_FL_SCM_MULT_TARG)) && US_FL_SCM_MULT_TARG)) &&
us->protocol == USB_PR_BULK) us->protocol == USB_PR_BULK)
us->use_last_sector_hacks = 1; us->use_last_sector_hacks = 1;
/* A few buggy USB-ATA bridges don't understand FUA */
if (us->fflags & US_FL_BROKEN_FUA)
sdev->broken_fua = 1;
} else { } else {
/* Non-disk-type devices don't need to blacklist any pages /* Non-disk-type devices don't need to blacklist any pages
......
...@@ -1940,6 +1940,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, ...@@ -1940,6 +1940,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
USB_SC_DEVICE, USB_PR_DEVICE, NULL, USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ), US_FL_IGNORE_RESIDUE ),
/* Reported by Michael Büsch <m@bues.ch> */
UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114,
"JMicron",
"USB to ATA/ATAPI Bridge",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_BROKEN_FUA ),
/* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* JMicron responds to USN and several other SCSI ioctls with a * JMicron responds to USN and several other SCSI ioctls with a
* residue that causes subsequent I/O requests to fail. */ * residue that causes subsequent I/O requests to fail. */
......
...@@ -64,7 +64,9 @@ ...@@ -64,7 +64,9 @@
US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \ US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
/* cannot handle READ_CAPACITY_16 */ \ /* cannot handle READ_CAPACITY_16 */ \
US_FLAG(INITIAL_READ10, 0x00100000) \ US_FLAG(INITIAL_READ10, 0x00100000) \
/* Initial READ(10) (and others) must be retried */ /* Initial READ(10) (and others) must be retried */ \
US_FLAG(BROKEN_FUA, 0x01000000) \
/* Cannot handle FUA in WRITE or READ CDBs */ \
#define US_FLAG(name, value) US_FL_##name = value , #define US_FLAG(name, value) US_FL_##name = value ,
enum { US_DO_ALL_FLAGS }; enum { US_DO_ALL_FLAGS };
......
...@@ -153,6 +153,7 @@ struct scsi_device { ...@@ -153,6 +153,7 @@ struct scsi_device {
unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */ unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */ unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */
unsigned is_visible:1; /* is the device visible in sysfs */ unsigned is_visible:1; /* is the device visible in sysfs */
unsigned broken_fua:1; /* Don't set FUA bit */
DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
struct list_head event_list; /* asserted events */ struct list_head event_list; /* asserted events */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment