aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/storage/usb.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 90bb0175a152..0ca095820f3e 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -439,7 +439,9 @@ static void adjust_quirks(struct us_data *us)
439 US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | 439 US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
440 US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | 440 US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
441 US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | 441 US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
442 US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT); 442 US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT |
443 US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 |
444 US_FL_INITIAL_READ10);
443 445
444 p = quirks; 446 p = quirks;
445 while (*p) { 447 while (*p) {
@@ -471,6 +473,12 @@ static void adjust_quirks(struct us_data *us)
471 case 'c': 473 case 'c':
472 f |= US_FL_FIX_CAPACITY; 474 f |= US_FL_FIX_CAPACITY;
473 break; 475 break;
476 case 'd':
477 f |= US_FL_NO_READ_DISC_INFO;
478 break;
479 case 'e':
480 f |= US_FL_NO_READ_CAPACITY_16;
481 break;
474 case 'h': 482 case 'h':
475 f |= US_FL_CAPACITY_HEURISTICS; 483 f |= US_FL_CAPACITY_HEURISTICS;
476 break; 484 break;
@@ -483,6 +491,9 @@ static void adjust_quirks(struct us_data *us)
483 case 'm': 491 case 'm':
484 f |= US_FL_MAX_SECTORS_64; 492 f |= US_FL_MAX_SECTORS_64;
485 break; 493 break;
494 case 'n':
495 f |= US_FL_INITIAL_READ10;
496 break;
486 case 'o': 497 case 'o':
487 f |= US_FL_CAPACITY_OK; 498 f |= US_FL_CAPACITY_OK;
488 break; 499 break;
@@ -512,10 +523,10 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
512 523
513 /* Store the entries */ 524 /* Store the entries */
514 us->unusual_dev = unusual_dev; 525 us->unusual_dev = unusual_dev;
515 us->subclass = (unusual_dev->useProtocol == US_SC_DEVICE) ? 526 us->subclass = (unusual_dev->useProtocol == USB_SC_DEVICE) ?
516 idesc->bInterfaceSubClass : 527 idesc->bInterfaceSubClass :
517 unusual_dev->useProtocol; 528 unusual_dev->useProtocol;
518 us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ? 529 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ?
519 idesc->bInterfaceProtocol : 530 idesc->bInterfaceProtocol :
520 unusual_dev->useTransport; 531 unusual_dev->useTransport;
521 us->fflags = USB_US_ORIG_FLAGS(id->driver_info); 532 us->fflags = USB_US_ORIG_FLAGS(id->driver_info);
@@ -552,10 +563,10 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
552 struct usb_device_descriptor *ddesc = &dev->descriptor; 563 struct usb_device_descriptor *ddesc = &dev->descriptor;
553 int msg = -1; 564 int msg = -1;
554 565
555 if (unusual_dev->useProtocol != US_SC_DEVICE && 566 if (unusual_dev->useProtocol != USB_SC_DEVICE &&
556 us->subclass == idesc->bInterfaceSubClass) 567 us->subclass == idesc->bInterfaceSubClass)
557 msg += 1; 568 msg += 1;
558 if (unusual_dev->useTransport != US_PR_DEVICE && 569 if (unusual_dev->useTransport != USB_PR_DEVICE &&
559 us->protocol == idesc->bInterfaceProtocol) 570 us->protocol == idesc->bInterfaceProtocol)
560 msg += 2; 571 msg += 2;
561 if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) 572 if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE))
@@ -582,21 +593,21 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
582static void get_transport(struct us_data *us) 593static void get_transport(struct us_data *us)
583{ 594{
584 switch (us->protocol) { 595 switch (us->protocol) {
585 case US_PR_CB: 596 case USB_PR_CB:
586 us->transport_name = "Control/Bulk"; 597 us->transport_name = "Control/Bulk";
587 us->transport = usb_stor_CB_transport; 598 us->transport = usb_stor_CB_transport;
588 us->transport_reset = usb_stor_CB_reset; 599 us->transport_reset = usb_stor_CB_reset;
589 us->max_lun = 7; 600 us->max_lun = 7;
590 break; 601 break;
591 602
592 case US_PR_CBI: 603 case USB_PR_CBI:
593 us->transport_name = "Control/Bulk/Interrupt"; 604 us->transport_name = "Control/Bulk/Interrupt";
594 us->transport = usb_stor_CB_transport; 605 us->transport = usb_stor_CB_transport;
595 us->transport_reset = usb_stor_CB_reset; 606 us->transport_reset = usb_stor_CB_reset;
596 us->max_lun = 7; 607 us->max_lun = 7;
597 break; 608 break;
598 609
599 case US_PR_BULK: 610 case USB_PR_BULK:
600 us->transport_name = "Bulk"; 611 us->transport_name = "Bulk";
601 us->transport = usb_stor_Bulk_transport; 612 us->transport = usb_stor_Bulk_transport;
602 us->transport_reset = usb_stor_Bulk_reset; 613 us->transport_reset = usb_stor_Bulk_reset;
@@ -608,35 +619,35 @@ static void get_transport(struct us_data *us)
608static void get_protocol(struct us_data *us) 619static void get_protocol(struct us_data *us)
609{ 620{
610 switch (us->subclass) { 621 switch (us->subclass) {
611 case US_SC_RBC: 622 case USB_SC_RBC:
612 us->protocol_name = "Reduced Block Commands (RBC)"; 623 us->protocol_name = "Reduced Block Commands (RBC)";
613 us->proto_handler = usb_stor_transparent_scsi_command; 624 us->proto_handler = usb_stor_transparent_scsi_command;
614 break; 625 break;
615 626
616 case US_SC_8020: 627 case USB_SC_8020:
617 us->protocol_name = "8020i"; 628 us->protocol_name = "8020i";
618 us->proto_handler = usb_stor_pad12_command; 629 us->proto_handler = usb_stor_pad12_command;
619 us->max_lun = 0; 630 us->max_lun = 0;
620 break; 631 break;
621 632
622 case US_SC_QIC: 633 case USB_SC_QIC:
623 us->protocol_name = "QIC-157"; 634 us->protocol_name = "QIC-157";
624 us->proto_handler = usb_stor_pad12_command; 635 us->proto_handler = usb_stor_pad12_command;
625 us->max_lun = 0; 636 us->max_lun = 0;
626 break; 637 break;
627 638
628 case US_SC_8070: 639 case USB_SC_8070:
629 us->protocol_name = "8070i"; 640 us->protocol_name = "8070i";
630 us->proto_handler = usb_stor_pad12_command; 641 us->proto_handler = usb_stor_pad12_command;
631 us->max_lun = 0; 642 us->max_lun = 0;
632 break; 643 break;
633 644
634 case US_SC_SCSI: 645 case USB_SC_SCSI:
635 us->protocol_name = "Transparent SCSI"; 646 us->protocol_name = "Transparent SCSI";
636 us->proto_handler = usb_stor_transparent_scsi_command; 647 us->proto_handler = usb_stor_transparent_scsi_command;
637 break; 648 break;
638 649
639 case US_SC_UFI: 650 case USB_SC_UFI:
640 us->protocol_name = "Uniform Floppy Interface (UFI)"; 651 us->protocol_name = "Uniform Floppy Interface (UFI)";
641 us->proto_handler = usb_stor_ufi_command; 652 us->proto_handler = usb_stor_ufi_command;
642 break; 653 break;
@@ -679,7 +690,7 @@ static int get_pipes(struct us_data *us)
679 } 690 }
680 } 691 }
681 692
682 if (!ep_in || !ep_out || (us->protocol == US_PR_CBI && !ep_int)) { 693 if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) {
683 US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n"); 694 US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n");
684 return -EIO; 695 return -EIO;
685 } 696 }
@@ -834,7 +845,7 @@ static int usb_stor_scan_thread(void * __us)
834 if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) { 845 if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) {
835 846
836 /* For bulk-only devices, determine the max LUN value */ 847 /* For bulk-only devices, determine the max LUN value */
837 if (us->protocol == US_PR_BULK && 848 if (us->protocol == USB_PR_BULK &&
838 !(us->fflags & US_FL_SINGLE_LUN)) { 849 !(us->fflags & US_FL_SINGLE_LUN)) {
839 mutex_lock(&us->dev_mutex); 850 mutex_lock(&us->dev_mutex);
840 us->max_lun = usb_stor_Bulk_max_lun(us); 851 us->max_lun = usb_stor_Bulk_max_lun(us);
@@ -946,6 +957,13 @@ int usb_stor_probe2(struct us_data *us)
946 if (result) 957 if (result)
947 goto BadDevice; 958 goto BadDevice;
948 959
960 /*
961 * If the device returns invalid data for the first READ(10)
962 * command, indicate the command should be retried.
963 */
964 if (us->fflags & US_FL_INITIAL_READ10)
965 set_bit(US_FLIDX_REDO_READ10, &us->dflags);
966
949 /* Acquire all the other resources and add the host */ 967 /* Acquire all the other resources and add the host */
950 result = usb_stor_acquire_resources(us); 968 result = usb_stor_acquire_resources(us);
951 if (result) 969 if (result)