aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--drivers/usb/storage/transport.c17
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/usb/storage/usb.c3
-rw-r--r--include/linux/usb_usual.h4
5 files changed, 28 insertions, 5 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 777dc8a32df8..3f886e298f62 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2663,6 +2663,8 @@ and is between 256 and 4096 characters. It is defined in the file
2663 to a common usb-storage quirk flag as follows: 2663 to a common usb-storage quirk flag as follows:
2664 a = SANE_SENSE (collect more than 18 bytes 2664 a = SANE_SENSE (collect more than 18 bytes
2665 of sense data); 2665 of sense data);
2666 b = BAD_SENSE (don't collect more than 18
2667 bytes of sense data);
2666 c = FIX_CAPACITY (decrease the reported 2668 c = FIX_CAPACITY (decrease the reported
2667 device capacity by one sector); 2669 device capacity by one sector);
2668 h = CAPACITY_HEURISTICS (decrease the 2670 h = CAPACITY_HEURISTICS (decrease the
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 589f6b4404f0..cc313d16d727 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -666,10 +666,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
666 * to wait for at least one CHECK_CONDITION to determine 666 * to wait for at least one CHECK_CONDITION to determine
667 * SANE_SENSE support 667 * SANE_SENSE support
668 */ 668 */
669 if ((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) && 669 if (unlikely((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
670 result == USB_STOR_TRANSPORT_GOOD && 670 result == USB_STOR_TRANSPORT_GOOD &&
671 !(us->fflags & US_FL_SANE_SENSE) && 671 !(us->fflags & US_FL_SANE_SENSE) &&
672 !(srb->cmnd[2] & 0x20)) { 672 !(us->fflags & US_FL_BAD_SENSE) &&
673 !(srb->cmnd[2] & 0x20))) {
673 US_DEBUGP("-- SAT supported, increasing auto-sense\n"); 674 US_DEBUGP("-- SAT supported, increasing auto-sense\n");
674 us->fflags |= US_FL_SANE_SENSE; 675 us->fflags |= US_FL_SANE_SENSE;
675 } 676 }
@@ -718,6 +719,12 @@ Retry_Sense:
718 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { 719 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
719 US_DEBUGP("-- auto-sense aborted\n"); 720 US_DEBUGP("-- auto-sense aborted\n");
720 srb->result = DID_ABORT << 16; 721 srb->result = DID_ABORT << 16;
722
723 /* If SANE_SENSE caused this problem, disable it */
724 if (sense_size != US_SENSE_SIZE) {
725 us->fflags &= ~US_FL_SANE_SENSE;
726 us->fflags |= US_FL_BAD_SENSE;
727 }
721 goto Handle_Errors; 728 goto Handle_Errors;
722 } 729 }
723 730
@@ -727,10 +734,11 @@ Retry_Sense:
727 * (small) sense request. This fixes some USB GSM modems 734 * (small) sense request. This fixes some USB GSM modems
728 */ 735 */
729 if (temp_result == USB_STOR_TRANSPORT_FAILED && 736 if (temp_result == USB_STOR_TRANSPORT_FAILED &&
730 (us->fflags & US_FL_SANE_SENSE) && 737 sense_size != US_SENSE_SIZE) {
731 sense_size != US_SENSE_SIZE) {
732 US_DEBUGP("-- auto-sense failure, retry small sense\n"); 738 US_DEBUGP("-- auto-sense failure, retry small sense\n");
733 sense_size = US_SENSE_SIZE; 739 sense_size = US_SENSE_SIZE;
740 us->fflags &= ~US_FL_SANE_SENSE;
741 us->fflags |= US_FL_BAD_SENSE;
734 goto Retry_Sense; 742 goto Retry_Sense;
735 } 743 }
736 744
@@ -754,6 +762,7 @@ Retry_Sense:
754 */ 762 */
755 if (srb->sense_buffer[7] > (US_SENSE_SIZE - 8) && 763 if (srb->sense_buffer[7] > (US_SENSE_SIZE - 8) &&
756 !(us->fflags & US_FL_SANE_SENSE) && 764 !(us->fflags & US_FL_SANE_SENSE) &&
765 !(us->fflags & US_FL_BAD_SENSE) &&
757 (srb->sense_buffer[0] & 0x7C) == 0x70) { 766 (srb->sense_buffer[0] & 0x7C) == 0x70) {
758 US_DEBUGP("-- SANE_SENSE support enabled\n"); 767 US_DEBUGP("-- SANE_SENSE support enabled\n");
759 us->fflags |= US_FL_SANE_SENSE; 768 us->fflags |= US_FL_SANE_SENSE;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index d4f034ebaa8a..64a0a2c27e12 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -818,6 +818,13 @@ UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
818 US_SC_DEVICE, US_PR_DEVICE, NULL, 818 US_SC_DEVICE, US_PR_DEVICE, NULL,
819 US_FL_FIX_CAPACITY ), 819 US_FL_FIX_CAPACITY ),
820 820
821/* Reported by Daniel Kukula <daniel.kuku@gmail.com> */
822UNUSUAL_DEV( 0x067b, 0x1063, 0x0100, 0x0100,
823 "Prolific Technology, Inc.",
824 "Prolific Storage Gadget",
825 US_SC_DEVICE, US_PR_DEVICE, NULL,
826 US_FL_BAD_SENSE ),
827
821/* Reported by Rogerio Brito <rbrito@ime.usp.br> */ 828/* Reported by Rogerio Brito <rbrito@ime.usp.br> */
822UNUSUAL_DEV( 0x067b, 0x2317, 0x0001, 0x001, 829UNUSUAL_DEV( 0x067b, 0x2317, 0x0001, 0x001,
823 "Prolific Technology, Inc.", 830 "Prolific Technology, Inc.",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 1599d86154c4..f5c0264caa33 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -463,6 +463,9 @@ static void adjust_quirks(struct us_data *us)
463 case 'a': 463 case 'a':
464 f |= US_FL_SANE_SENSE; 464 f |= US_FL_SANE_SENSE;
465 break; 465 break;
466 case 'b':
467 f |= US_FL_BAD_SENSE;
468 break;
466 case 'c': 469 case 'c':
467 f |= US_FL_FIX_CAPACITY; 470 f |= US_FL_FIX_CAPACITY;
468 break; 471 break;
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 3d15fb9bc116..a4b947e470a5 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -56,7 +56,9 @@
56 US_FLAG(SANE_SENSE, 0x00008000) \ 56 US_FLAG(SANE_SENSE, 0x00008000) \
57 /* Sane Sense (> 18 bytes) */ \ 57 /* Sane Sense (> 18 bytes) */ \
58 US_FLAG(CAPACITY_OK, 0x00010000) \ 58 US_FLAG(CAPACITY_OK, 0x00010000) \
59 /* READ CAPACITY response is correct */ 59 /* READ CAPACITY response is correct */ \
60 US_FLAG(BAD_SENSE, 0x00020000) \
61 /* Bad Sense (never more than 18 bytes) */
60 62
61#define US_FLAG(name, value) US_FL_##name = value , 63#define US_FLAG(name, value) US_FL_##name = value ,
62enum { US_DO_ALL_FLAGS }; 64enum { US_DO_ALL_FLAGS };