diff options
author | Hans de Goede <hdegoede@redhat.com> | 2016-04-12 06:27:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-13 15:02:28 -0400 |
commit | 1363074667a6b7d0507527742ccd7bbed5e3ceaa (patch) | |
tree | 88249097c34ae887df935f2d896d29641af7b1d2 | |
parent | 198de51dbc3454d95b015ca0a055b673f85f01bb (diff) |
USB: uas: Add a new NO_REPORT_LUNS quirk
Add a new NO_REPORT_LUNS quirk and set it for Seagate drives with
an usb-id of: 0bc2:331a, as these will fail to respond to a
REPORT_LUNS command.
Cc: stable@vger.kernel.org
Reported-and-tested-by: David Webb <djw@noc.ac.uk>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/kernel-parameters.txt | 2 | ||||
-rw-r--r-- | drivers/usb/storage/uas.c | 14 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_uas.h | 7 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 5 | ||||
-rw-r--r-- | include/linux/usb_usual.h | 2 |
5 files changed, 28 insertions, 2 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ecc74fa4bfde..0b3de80ec8f6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -4077,6 +4077,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
4077 | sector if the number is odd); | 4077 | sector if the number is odd); |
4078 | i = IGNORE_DEVICE (don't bind to this | 4078 | i = IGNORE_DEVICE (don't bind to this |
4079 | device); | 4079 | device); |
4080 | j = NO_REPORT_LUNS (don't use report luns | ||
4081 | command, uas only); | ||
4080 | l = NOT_LOCKABLE (don't try to lock and | 4082 | l = NOT_LOCKABLE (don't try to lock and |
4081 | unlock ejectable media); | 4083 | unlock ejectable media); |
4082 | m = MAX_SECTORS_64 (don't transfer more | 4084 | m = MAX_SECTORS_64 (don't transfer more |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index b1ec7499166d..16bc679dc2fc 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * USB Attached SCSI | 2 | * USB Attached SCSI |
3 | * Note that this is not the same as the USB Mass Storage driver | 3 | * Note that this is not the same as the USB Mass Storage driver |
4 | * | 4 | * |
5 | * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014 | 5 | * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016 |
6 | * Copyright Matthew Wilcox for Intel Corp, 2010 | 6 | * Copyright Matthew Wilcox for Intel Corp, 2010 |
7 | * Copyright Sarah Sharp for Intel Corp, 2010 | 7 | * Copyright Sarah Sharp for Intel Corp, 2010 |
8 | * | 8 | * |
@@ -781,6 +781,17 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
781 | return SUCCESS; | 781 | return SUCCESS; |
782 | } | 782 | } |
783 | 783 | ||
784 | static int uas_target_alloc(struct scsi_target *starget) | ||
785 | { | ||
786 | struct uas_dev_info *devinfo = (struct uas_dev_info *) | ||
787 | dev_to_shost(starget->dev.parent)->hostdata; | ||
788 | |||
789 | if (devinfo->flags & US_FL_NO_REPORT_LUNS) | ||
790 | starget->no_report_luns = 1; | ||
791 | |||
792 | return 0; | ||
793 | } | ||
794 | |||
784 | static int uas_slave_alloc(struct scsi_device *sdev) | 795 | static int uas_slave_alloc(struct scsi_device *sdev) |
785 | { | 796 | { |
786 | struct uas_dev_info *devinfo = | 797 | struct uas_dev_info *devinfo = |
@@ -831,6 +842,7 @@ static struct scsi_host_template uas_host_template = { | |||
831 | .module = THIS_MODULE, | 842 | .module = THIS_MODULE, |
832 | .name = "uas", | 843 | .name = "uas", |
833 | .queuecommand = uas_queuecommand, | 844 | .queuecommand = uas_queuecommand, |
845 | .target_alloc = uas_target_alloc, | ||
834 | .slave_alloc = uas_slave_alloc, | 846 | .slave_alloc = uas_slave_alloc, |
835 | .slave_configure = uas_slave_configure, | 847 | .slave_configure = uas_slave_configure, |
836 | .eh_abort_handler = uas_eh_abort_handler, | 848 | .eh_abort_handler = uas_eh_abort_handler, |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index ccc113e83d88..53341a77d89f 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -64,6 +64,13 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, | |||
64 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 64 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
65 | US_FL_NO_ATA_1X), | 65 | US_FL_NO_ATA_1X), |
66 | 66 | ||
67 | /* Reported-by: David Webb <djw@noc.ac.uk> */ | ||
68 | UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, | ||
69 | "Seagate", | ||
70 | "Expansion Desk", | ||
71 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
72 | US_FL_NO_REPORT_LUNS), | ||
73 | |||
67 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 74 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
68 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, | 75 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, |
69 | "Seagate", | 76 | "Seagate", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 43576ed31ccd..9de988a0f856 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -482,7 +482,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
482 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | | 482 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
483 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | | 483 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | |
484 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | | 484 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | |
485 | US_FL_MAX_SECTORS_240); | 485 | US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS); |
486 | 486 | ||
487 | p = quirks; | 487 | p = quirks; |
488 | while (*p) { | 488 | while (*p) { |
@@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
532 | case 'i': | 532 | case 'i': |
533 | f |= US_FL_IGNORE_DEVICE; | 533 | f |= US_FL_IGNORE_DEVICE; |
534 | break; | 534 | break; |
535 | case 'j': | ||
536 | f |= US_FL_NO_REPORT_LUNS; | ||
537 | break; | ||
535 | case 'l': | 538 | case 'l': |
536 | f |= US_FL_NOT_LOCKABLE; | 539 | f |= US_FL_NOT_LOCKABLE; |
537 | break; | 540 | break; |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 7f5f78bd15ad..245f57dbbb61 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -79,6 +79,8 @@ | |||
79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ | 79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ |
80 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ | 80 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ |
81 | /* Sets max_sectors to 240 */ \ | 81 | /* Sets max_sectors to 240 */ \ |
82 | US_FLAG(NO_REPORT_LUNS, 0x10000000) \ | ||
83 | /* Cannot handle REPORT_LUNS */ \ | ||
82 | 84 | ||
83 | #define US_FLAG(name, value) US_FL_##name = value , | 85 | #define US_FLAG(name, value) US_FL_##name = value , |
84 | enum { US_DO_ALL_FLAGS }; | 86 | enum { US_DO_ALL_FLAGS }; |