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.c57
1 files changed, 40 insertions, 17 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 1a5474bd11a1..5c7e51f9efed 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -816,6 +816,29 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
816 put_device(&sdev->sdev_gendev); 816 put_device(&sdev->sdev_gendev);
817} 817}
818 818
819/**
820 * scsi_inq_str - print INQUIRY data from min to max index,
821 * strip trailing whitespace
822 * @buf: Output buffer with at least end-first+1 bytes of space
823 * @inq: Inquiry buffer (input)
824 * @first: Offset of string into inq
825 * @end: Index after last character in inq
826 */
827static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
828 unsigned first, unsigned end)
829{
830 unsigned term = 0, idx;
831 for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
832 if (inq[idx+first] > 0x20) {
833 buf[idx] = inq[idx+first];
834 term = idx+1;
835 } else {
836 buf[idx] = ' ';
837 }
838 }
839 buf[term] = 0;
840 return buf;
841}
819 842
820/** 843/**
821 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 844 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
@@ -880,10 +903,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
880 if (scsi_probe_lun(sdev, result, result_len, &bflags)) 903 if (scsi_probe_lun(sdev, result, result_len, &bflags))
881 goto out_free_result; 904 goto out_free_result;
882 905
906 if (bflagsp)
907 *bflagsp = bflags;
883 /* 908 /*
884 * result contains valid SCSI INQUIRY data. 909 * result contains valid SCSI INQUIRY data.
885 */ 910 */
886 if ((result[0] >> 5) == 3) { 911 if (((result[0] >> 5) == 3) && !(bflags & BLIST_ATTACH_PQ3)) {
887 /* 912 /*
888 * For a Peripheral qualifier 3 (011b), the SCSI 913 * For a Peripheral qualifier 3 (011b), the SCSI
889 * spec says: The device server is not capable of 914 * spec says: The device server is not capable of
@@ -894,9 +919,18 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
894 * logical disk configured at sdev->lun, but there 919 * logical disk configured at sdev->lun, but there
895 * is a target id responding. 920 * is a target id responding.
896 */ 921 */
897 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO 922 SCSI_LOG_SCAN_BUS(2, sdev_printk(KERN_INFO, sdev, "scsi scan:"
898 "scsi scan: peripheral qualifier of 3," 923 " peripheral qualifier of 3, device not"
899 " no device added\n")); 924 " added\n"))
925 if (lun == 0) {
926 unsigned char vend[9], mod[17];
927 SCSI_LOG_SCAN_BUS(1, sdev_printk(KERN_INFO, sdev,
928 "scsi scan: consider passing scsi_mod."
929 "dev_flags=%s:%s:0x240 or 0x800240\n",
930 scsi_inq_str(vend, result, 8, 16),
931 scsi_inq_str(mod, result, 16, 32)));
932 }
933
900 res = SCSI_SCAN_TARGET_PRESENT; 934 res = SCSI_SCAN_TARGET_PRESENT;
901 goto out_free_result; 935 goto out_free_result;
902 } 936 }
@@ -920,8 +954,6 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
920 sdev->lockable = 0; 954 sdev->lockable = 0;
921 scsi_unlock_floptical(sdev, result); 955 scsi_unlock_floptical(sdev, result);
922 } 956 }
923 if (bflagsp)
924 *bflagsp = bflags;
925 } 957 }
926 958
927 out_free_result: 959 out_free_result:
@@ -946,7 +978,6 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
946 * scsi_sequential_lun_scan - sequentially scan a SCSI target 978 * scsi_sequential_lun_scan - sequentially scan a SCSI target
947 * @starget: pointer to target structure to scan 979 * @starget: pointer to target structure to scan
948 * @bflags: black/white list flag for LUN 0 980 * @bflags: black/white list flag for LUN 0
949 * @lun0_res: result of scanning LUN 0
950 * 981 *
951 * Description: 982 * Description:
952 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been 983 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been
@@ -956,8 +987,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
956 * Modifies sdevscan->lun. 987 * Modifies sdevscan->lun.
957 **/ 988 **/
958static void scsi_sequential_lun_scan(struct scsi_target *starget, 989static void scsi_sequential_lun_scan(struct scsi_target *starget,
959 int bflags, int lun0_res, int scsi_level, 990 int bflags, int scsi_level, int rescan)
960 int rescan)
961{ 991{
962 unsigned int sparse_lun, lun, max_dev_lun; 992 unsigned int sparse_lun, lun, max_dev_lun;
963 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 993 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -978,13 +1008,6 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
978 sparse_lun = 0; 1008 sparse_lun = 0;
979 1009
980 /* 1010 /*
981 * If not sparse lun and no device attached at LUN 0 do not scan
982 * any further.
983 */
984 if (!sparse_lun && (lun0_res != SCSI_SCAN_LUN_PRESENT))
985 return;
986
987 /*
988 * If less than SCSI_1_CSS, and no special lun scaning, stop 1011 * If less than SCSI_1_CSS, and no special lun scaning, stop
989 * scanning; this matches 2.4 behaviour, but could just be a bug 1012 * scanning; this matches 2.4 behaviour, but could just be a bug
990 * (to continue scanning a SCSI_1_CSS device). 1013 * (to continue scanning a SCSI_1_CSS device).
@@ -1395,7 +1418,7 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1395 * do a sequential scan. 1418 * do a sequential scan.
1396 */ 1419 */
1397 scsi_sequential_lun_scan(starget, bflags, 1420 scsi_sequential_lun_scan(starget, bflags,
1398 res, starget->scsi_level, rescan); 1421 starget->scsi_level, rescan);
1399 } 1422 }
1400 1423
1401 out_reap: 1424 out_reap: