aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
commitbc06cffdec85d487c77109dffcd2f285bdc502d3 (patch)
treeadc6e6398243da87e66c56102840597a329183a0 /drivers/scsi/scsi_scan.c
parentd3502d7f25b22cfc9762bf1781faa9db1bb3be2e (diff)
parent9413d7b8aa777dd1fc7db9563ce5e80d769fe7b5 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (166 commits) [SCSI] ibmvscsi: convert to use the data buffer accessors [SCSI] dc395x: convert to use the data buffer accessors [SCSI] ncr53c8xx: convert to use the data buffer accessors [SCSI] sym53c8xx: convert to use the data buffer accessors [SCSI] ppa: coding police and printk levels [SCSI] aic7xxx_old: remove redundant GFP_ATOMIC from kmalloc [SCSI] i2o: remove redundant GFP_ATOMIC from kmalloc from device.c [SCSI] remove the dead CYBERSTORMIII_SCSI option [SCSI] don't build scsi_dma_{map,unmap} for !HAS_DMA [SCSI] Clean up scsi_add_lun a bit [SCSI] 53c700: Remove printk, which triggers because of low scsi clock on SNI RMs [SCSI] sni_53c710: Cleanup [SCSI] qla4xxx: Fix underrun/overrun conditions [SCSI] megaraid_mbox: use mutex instead of semaphore [SCSI] aacraid: add 51245, 51645 and 52245 adapters to documentation. [SCSI] qla2xxx: update version to 8.02.00-k1. [SCSI] qla2xxx: add support for NPIV [SCSI] stex: use resid for xfer len information [SCSI] Add Brownie 1200U3P to blacklist [SCSI] scsi.c: convert to use the data buffer accessors ...
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 662577fbe7a8..a86e62f4b3ba 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -703,16 +703,14 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
703 703
704/** 704/**
705 * scsi_add_lun - allocate and fully initialze a scsi_device 705 * scsi_add_lun - allocate and fully initialze a scsi_device
706 * @sdevscan: holds information to be stored in the new scsi_device 706 * @sdev: holds information to be stored in the new scsi_device
707 * @sdevnew: store the address of the newly allocated scsi_device
708 * @inq_result: holds the result of a previous INQUIRY to the LUN 707 * @inq_result: holds the result of a previous INQUIRY to the LUN
709 * @bflags: black/white list flag 708 * @bflags: black/white list flag
709 * @async: 1 if this device is being scanned asynchronously
710 * 710 *
711 * Description: 711 * Description:
712 * Allocate and initialize a scsi_device matching sdevscan. Optionally 712 * Initialize the scsi_device @sdev. Optionally set fields based
713 * set fields based on values in *@bflags. If @sdevnew is not 713 * on values in *@bflags.
714 * NULL, store the address of the new scsi_device in *@sdevnew (needed
715 * when scanning a particular LUN).
716 * 714 *
717 * Return: 715 * Return:
718 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device 716 * SCSI_SCAN_NO_RESPONSE: could not allocate or setup a scsi_device
@@ -752,25 +750,15 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
752 sdev->rev = (char *) (sdev->inquiry + 32); 750 sdev->rev = (char *) (sdev->inquiry + 32);
753 751
754 if (*bflags & BLIST_ISROM) { 752 if (*bflags & BLIST_ISROM) {
755 /* 753 sdev->type = TYPE_ROM;
756 * It would be better to modify sdev->type, and set 754 sdev->removable = 1;
757 * sdev->removable; this can now be done since 755 } else {
758 * print_inquiry has gone away. 756 sdev->type = (inq_result[0] & 0x1f);
759 */ 757 sdev->removable = (inq_result[1] & 0x80) >> 7;
760 inq_result[0] = TYPE_ROM; 758 }
761 inq_result[1] |= 0x80; /* removable */
762 } else if (*bflags & BLIST_NO_ULD_ATTACH)
763 sdev->no_uld_attach = 1;
764 759
765 switch (sdev->type = (inq_result[0] & 0x1f)) { 760 switch (sdev->type) {
766 case TYPE_RBC: 761 case TYPE_RBC:
767 /* RBC devices can return SCSI-3 compliance and yet
768 * still not support REPORT LUNS, so make them act as
769 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
770 * specifically set */
771 if ((*bflags & BLIST_REPORTLUN2) == 0)
772 *bflags |= BLIST_NOREPORTLUN;
773 /* fall through */
774 case TYPE_TAPE: 762 case TYPE_TAPE:
775 case TYPE_DISK: 763 case TYPE_DISK:
776 case TYPE_PRINTER: 764 case TYPE_PRINTER:
@@ -784,13 +772,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
784 sdev->writeable = 1; 772 sdev->writeable = 1;
785 break; 773 break;
786 case TYPE_ROM: 774 case TYPE_ROM:
787 /* MMC devices can return SCSI-3 compliance and yet
788 * still not support REPORT LUNS, so make them act as
789 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
790 * specifically set */
791 if ((*bflags & BLIST_REPORTLUN2) == 0)
792 *bflags |= BLIST_NOREPORTLUN;
793 /* fall through */
794 case TYPE_WORM: 775 case TYPE_WORM:
795 sdev->writeable = 0; 776 sdev->writeable = 0;
796 break; 777 break;
@@ -798,6 +779,15 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
798 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type); 779 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);
799 } 780 }
800 781
782 if (sdev->type == TYPE_RBC || sdev->type == TYPE_ROM) {
783 /* RBC and MMC devices can return SCSI-3 compliance and yet
784 * still not support REPORT LUNS, so make them act as
785 * BLIST_NOREPORTLUN unless BLIST_REPORTLUN2 is
786 * specifically set */
787 if ((*bflags & BLIST_REPORTLUN2) == 0)
788 *bflags |= BLIST_NOREPORTLUN;
789 }
790
801 /* 791 /*
802 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI 792 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI
803 * spec says: The device server is capable of supporting the 793 * spec says: The device server is capable of supporting the
@@ -815,12 +805,11 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
815 */ 805 */
816 806
817 sdev->inq_periph_qual = (inq_result[0] >> 5) & 7; 807 sdev->inq_periph_qual = (inq_result[0] >> 5) & 7;
818 sdev->removable = (0x80 & inq_result[1]) >> 7;
819 sdev->lockable = sdev->removable; 808 sdev->lockable = sdev->removable;
820 sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2); 809 sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2);
821 810
822 if (sdev->scsi_level >= SCSI_3 || (sdev->inquiry_len > 56 && 811 if (sdev->scsi_level >= SCSI_3 ||
823 inq_result[56] & 0x04)) 812 (sdev->inquiry_len > 56 && inq_result[56] & 0x04))
824 sdev->ppr = 1; 813 sdev->ppr = 1;
825 if (inq_result[7] & 0x60) 814 if (inq_result[7] & 0x60)
826 sdev->wdtr = 1; 815 sdev->wdtr = 1;
@@ -833,13 +822,10 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
833 sdev->inq_periph_qual, inq_result[2] & 0x07, 822 sdev->inq_periph_qual, inq_result[2] & 0x07,
834 (inq_result[3] & 0x0f) == 1 ? " CCS" : ""); 823 (inq_result[3] & 0x0f) == 1 ? " CCS" : "");
835 824
836 /*
837 * End sysfs code.
838 */
839
840 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) && 825 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) &&
841 !(*bflags & BLIST_NOTQ)) 826 !(*bflags & BLIST_NOTQ))
842 sdev->tagged_supported = 1; 827 sdev->tagged_supported = 1;
828
843 /* 829 /*
844 * Some devices (Texel CD ROM drives) have handshaking problems 830 * Some devices (Texel CD ROM drives) have handshaking problems
845 * when used with the Seagate controllers. borken is initialized 831 * when used with the Seagate controllers. borken is initialized
@@ -848,6 +834,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
848 if ((*bflags & BLIST_BORKEN) == 0) 834 if ((*bflags & BLIST_BORKEN) == 0)
849 sdev->borken = 0; 835 sdev->borken = 0;
850 836
837 if (*bflags & BLIST_NO_ULD_ATTACH)
838 sdev->no_uld_attach = 1;
839
851 /* 840 /*
852 * Apparently some really broken devices (contrary to the SCSI 841 * Apparently some really broken devices (contrary to the SCSI
853 * standards) need to be selected without asserting ATN 842 * standards) need to be selected without asserting ATN
@@ -872,7 +861,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
872 if (*bflags & BLIST_SINGLELUN) 861 if (*bflags & BLIST_SINGLELUN)
873 sdev->single_lun = 1; 862 sdev->single_lun = 1;
874 863
875
876 sdev->use_10_for_rw = 1; 864 sdev->use_10_for_rw = 1;
877 865
878 if (*bflags & BLIST_MS_SKIP_PAGE_08) 866 if (*bflags & BLIST_MS_SKIP_PAGE_08)
@@ -1213,7 +1201,7 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
1213 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns 1201 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
1214 * the integer: 0x0b030a04 1202 * the integer: 0x0b030a04
1215 **/ 1203 **/
1216static int scsilun_to_int(struct scsi_lun *scsilun) 1204int scsilun_to_int(struct scsi_lun *scsilun)
1217{ 1205{
1218 int i; 1206 int i;
1219 unsigned int lun; 1207 unsigned int lun;
@@ -1224,6 +1212,7 @@ static int scsilun_to_int(struct scsi_lun *scsilun)
1224 scsilun->scsi_lun[i + 1]) << (i * 8)); 1212 scsilun->scsi_lun[i + 1]) << (i * 8));
1225 return lun; 1213 return lun;
1226} 1214}
1215EXPORT_SYMBOL(scsilun_to_int);
1227 1216
1228/** 1217/**
1229 * int_to_scsilun: reverts an int into a scsi_lun 1218 * int_to_scsilun: reverts an int into a scsi_lun