aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 5df28e2fd3bb..0827df2ebb6d 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -694,16 +694,14 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
694 694
695/** 695/**
696 * scsi_add_lun - allocate and fully initialze a scsi_device 696 * scsi_add_lun - allocate and fully initialze a scsi_device
697 * @sdevscan: holds information to be stored in the new scsi_device 697 * @sdev: holds information to be stored in the new scsi_device
698 * @sdevnew: store the address of the newly allocated scsi_device
699 * @inq_result: holds the result of a previous INQUIRY to the LUN 698 * @inq_result: holds the result of a previous INQUIRY to the LUN
700 * @bflags: black/white list flag 699 * @bflags: black/white list flag
700 * @async: 1 if this device is being scanned asynchronously
701 * 701 *
702 * Description: 702 * Description:
703 * Allocate and initialize a scsi_device matching sdevscan. Optionally 703 * Initialize the scsi_device @sdev. Optionally set fields based
704 * set fields based on values in *@bflags. If @sdevnew is not 704 * on values in *@bflags.
705 * NULL, store the address of the new scsi_device in *@sdevnew (needed
706 * when scanning a particular LUN).
707 * 705 *
708 * Return: 706 * Return:
709 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device 707 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device
@@ -743,25 +741,15 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
743 sdev->rev = (char *) (sdev->inquiry + 32); 741 sdev->rev = (char *) (sdev->inquiry + 32);
744 742
745 if (*bflags & BLIST_ISROM) { 743 if (*bflags & BLIST_ISROM) {
746 /* 744 sdev->type = TYPE_ROM;
747 * It would be better to modify sdev->type, and set 745 sdev->removable = 1;
748 * sdev->removable; this can now be done since 746 } else {
749 * print_inquiry has gone away. 747 sdev->type = (inq_result[0] & 0x1f);
750 */ 748 sdev->removable = (inq_result[1] & 0x80) >> 7;
751 inq_result[0] = TYPE_ROM; 749 }
752 inq_result[1] |= 0x80; /* removable */
753 } else if (*bflags & BLIST_NO_ULD_ATTACH)
754 sdev->no_uld_attach = 1;
755 750
756 switch (sdev->type = (inq_result[0] & 0x1f)) { 751 switch (sdev->type) {
757 case TYPE_RBC: 752 case TYPE_RBC:
758 /* RBC devices can return SCSI-3 compliance and yet
759 * still not support REPORT LUNS, so make them act as
760 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
761 * specifically set */
762 if ((*bflags & BLIST_REPORTLUN2) == 0)
763 *bflags |= BLIST_NOREPORTLUN;
764 /* fall through */
765 case TYPE_TAPE: 753 case TYPE_TAPE:
766 case TYPE_DISK: 754 case TYPE_DISK:
767 case TYPE_PRINTER: 755 case TYPE_PRINTER:
@@ -775,13 +763,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
775 sdev->writeable = 1; 763 sdev->writeable = 1;
776 break; 764 break;
777 case TYPE_ROM: 765 case TYPE_ROM:
778 /* MMC devices can return SCSI-3 compliance and yet
779 * still not support REPORT LUNS, so make them act as
780 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
781 * specifically set */
782 if ((*bflags & BLIST_REPORTLUN2) == 0)
783 *bflags |= BLIST_NOREPORTLUN;
784 /* fall through */
785 case TYPE_WORM: 766 case TYPE_WORM:
786 sdev->writeable = 0; 767 sdev->writeable = 0;
787 break; 768 break;
@@ -789,6 +770,15 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
789 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type); 770 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);
790 } 771 }
791 772
773 if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) {
774 /* RBC and MMC devices can return SCSI-3 compliance and yet
775 * still not support REPORT LUNS, so make them act as
776 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
777 * specifically set */
778 if ((*bflags & BLIST_REPORTLUN2) == 0)
779 *bflags |= BLIST_NOREPORTLUN;
780 }
781
792 /* 782 /*
793 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI 783 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI
794 * spec says: The device server is capable of supporting the 784 * spec says: The device server is capable of supporting the
@@ -806,12 +796,11 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
806 */ 796 */
807 797
808 sdev->inq_periph_qual = (inq_result[0] >> 5) & 7; 798 sdev->inq_periph_qual = (inq_result[0] >> 5) & 7;
809 sdev->removable = (0x80 & inq_result[1]) >> 7;
810 sdev->lockable = sdev->removable; 799 sdev->lockable = sdev->removable;
811 sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2); 800 sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2);
812 801
813 if (sdev->scsi_level >= SCSI_3 || (sdev->inquiry_len > 56 && 802 if (sdev->scsi_level >= SCSI_3 ||
814 inq_result[56] & 0x04)) 803 (sdev->inquiry_len > 56 && inq_result[56] & 0x04))
815 sdev->ppr = 1; 804 sdev->ppr = 1;
816 if (inq_result[7] & 0x60) 805 if (inq_result[7] & 0x60)
817 sdev->wdtr = 1; 806 sdev->wdtr = 1;
@@ -824,13 +813,10 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
824 sdev->inq_periph_qual, inq_result[2] & 0x07, 813 sdev->inq_periph_qual, inq_result[2] & 0x07,
825 (inq_result[3] & 0x0f) == 1 ? " CCS" : ""); 814 (inq_result[3] & 0x0f) == 1 ? " CCS" : "");
826 815
827 /*
828 * End sysfs code.
829 */
830
831 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) && 816 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) &&
832 !(*bflags & BLIST_NOTQ)) 817 !(*bflags & BLIST_NOTQ))
833 sdev->tagged_supported = 1; 818 sdev->tagged_supported = 1;
819
834 /* 820 /*
835 * Some devices (Texel CD ROM drives) have handshaking problems 821 * Some devices (Texel CD ROM drives) have handshaking problems
836 * when used with the Seagate controllers. borken is initialized 822 * when used with the Seagate controllers. borken is initialized
@@ -839,6 +825,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
839 if ((*bflags & BLIST_BORKEN) == 0) 825 if ((*bflags & BLIST_BORKEN) == 0)
840 sdev->borken = 0; 826 sdev->borken = 0;
841 827
828 if (*bflags & BLIST_NO_ULD_ATTACH)
829 sdev->no_uld_attach = 1;
830
842 /* 831 /*
843 * Apparently some really broken devices (contrary to the SCSI 832 * Apparently some really broken devices (contrary to the SCSI
844 * standards) need to be selected without asserting ATN 833 * standards) need to be selected without asserting ATN
@@ -863,7 +852,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
863 if (*bflags & BLIST_SINGLELUN) 852 if (*bflags & BLIST_SINGLELUN)
864 sdev->single_lun = 1; 853 sdev->single_lun = 1;
865 854
866
867 sdev->use_10_for_rw = 1; 855 sdev->use_10_for_rw = 1;
868 856
869 if (*bflags & BLIST_MS_SKIP_PAGE_08) 857 if (*bflags & BLIST_MS_SKIP_PAGE_08)