aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-21 14:18:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-21 14:18:25 -0400
commit28e4b224955cbe30275b2a7842e729023a4f4b03 (patch)
treeab4d28fecc06070fc2a2742f4b4550b29de44912 /drivers/scsi/scsi_scan.c
parent22ae813b85df7c0b0fc7c8d6f336d6a9f566ff97 (diff)
parent67d59dfdeb21df2c16dcd478b66177e91178ecd0 (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: (85 commits) [SCSI] 53c700: remove reliance on deprecated cmnd fields [SCSI] hptiop: don't use cmnd->bufflen [SCSI] hptiop: HighPoint RocketRAID 3xxx controller driver [SCSI] aacraid: small misc. cleanups [SCSI] aacraid: Update supported product information [SCSI] aacraid: Fix return code interpretation [SCSI] scsi_transport_sas: fix panic in sas_free_rphy [SCSI] remove RQ_SCSI_* flags [SCSI] remove scsi_request infrastructure [SCSI] mptfusion: change driver revision to 3.03.10 [SCSI] mptfc: abort of board reset leaves port dead requiring reboot [SCSI] mptfc: fix fibre channel infinite request/response loop [SCSI] mptfc: set fibre channel fw target missing timers to one second [SCSI] mptfusion: move fc event/reset handling to mptfc [SCSI] spi transport: don't allow dt to be set on SE or HVD buses [SCSI] aic7xxx: expose the bus setting to sysfs [SCSI] scsi: remove Documentation/scsi/cpqfc.txt [SCSI] drivers/scsi: Use ARRAY_SIZE macro [SCSI] Remove last page_address from dc395x.c [SCSI] hptiop: HighPoint RocketRAID 3xxx controller driver ... Fixed up conflicts in drivers/message/fusion/mptbase.c manually (due to the sparc interrupt cleanups)
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c68
1 files changed, 49 insertions, 19 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 1a5474bd11a1..0f7e6f94d66b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -33,11 +33,11 @@
33#include <asm/semaphore.h> 33#include <asm/semaphore.h>
34 34
35#include <scsi/scsi.h> 35#include <scsi/scsi.h>
36#include <scsi/scsi_cmnd.h>
36#include <scsi/scsi_device.h> 37#include <scsi/scsi_device.h>
37#include <scsi/scsi_driver.h> 38#include <scsi/scsi_driver.h>
38#include <scsi/scsi_devinfo.h> 39#include <scsi/scsi_devinfo.h>
39#include <scsi/scsi_host.h> 40#include <scsi/scsi_host.h>
40#include <scsi/scsi_request.h>
41#include <scsi/scsi_transport.h> 41#include <scsi/scsi_transport.h>
42#include <scsi/scsi_eh.h> 42#include <scsi/scsi_eh.h>
43 43
@@ -816,6 +816,32 @@ 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#ifdef CONFIG_SCSI_LOGGING
820/**
821 * scsi_inq_str - print INQUIRY data from min to max index,
822 * strip trailing whitespace
823 * @buf: Output buffer with at least end-first+1 bytes of space
824 * @inq: Inquiry buffer (input)
825 * @first: Offset of string into inq
826 * @end: Index after last character in inq
827 */
828static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
829 unsigned first, unsigned end)
830{
831 unsigned term = 0, idx;
832
833 for (idx = 0; idx + first < end && idx + first < inq[4] + 5; idx++) {
834 if (inq[idx+first] > ' ') {
835 buf[idx] = inq[idx+first];
836 term = idx+1;
837 } else {
838 buf[idx] = ' ';
839 }
840 }
841 buf[term] = 0;
842 return buf;
843}
844#endif
819 845
820/** 846/**
821 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 847 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
@@ -880,10 +906,12 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
880 if (scsi_probe_lun(sdev, result, result_len, &bflags)) 906 if (scsi_probe_lun(sdev, result, result_len, &bflags))
881 goto out_free_result; 907 goto out_free_result;
882 908
909 if (bflagsp)
910 *bflagsp = bflags;
883 /* 911 /*
884 * result contains valid SCSI INQUIRY data. 912 * result contains valid SCSI INQUIRY data.
885 */ 913 */
886 if ((result[0] >> 5) == 3) { 914 if (((result[0] >> 5) == 3) && !(bflags & BLIST_ATTACH_PQ3)) {
887 /* 915 /*
888 * For a Peripheral qualifier 3 (011b), the SCSI 916 * For a Peripheral qualifier 3 (011b), the SCSI
889 * spec says: The device server is not capable of 917 * spec says: The device server is not capable of
@@ -894,9 +922,22 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
894 * logical disk configured at sdev->lun, but there 922 * logical disk configured at sdev->lun, but there
895 * is a target id responding. 923 * is a target id responding.
896 */ 924 */
897 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO 925 SCSI_LOG_SCAN_BUS(2, sdev_printk(KERN_INFO, sdev, "scsi scan:"
898 "scsi scan: peripheral qualifier of 3," 926 " peripheral qualifier of 3, device not"
899 " no device added\n")); 927 " added\n"))
928 if (lun == 0) {
929 SCSI_LOG_SCAN_BUS(1, {
930 unsigned char vend[9];
931 unsigned char mod[17];
932
933 sdev_printk(KERN_INFO, sdev,
934 "scsi scan: consider passing scsi_mod."
935 "dev_flags=%s:%s:0x240 or 0x800240\n",
936 scsi_inq_str(vend, result, 8, 16),
937 scsi_inq_str(mod, result, 16, 32));
938 });
939 }
940
900 res = SCSI_SCAN_TARGET_PRESENT; 941 res = SCSI_SCAN_TARGET_PRESENT;
901 goto out_free_result; 942 goto out_free_result;
902 } 943 }
@@ -920,8 +961,6 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
920 sdev->lockable = 0; 961 sdev->lockable = 0;
921 scsi_unlock_floptical(sdev, result); 962 scsi_unlock_floptical(sdev, result);
922 } 963 }
923 if (bflagsp)
924 *bflagsp = bflags;
925 } 964 }
926 965
927 out_free_result: 966 out_free_result:
@@ -946,7 +985,6 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
946 * scsi_sequential_lun_scan - sequentially scan a SCSI target 985 * scsi_sequential_lun_scan - sequentially scan a SCSI target
947 * @starget: pointer to target structure to scan 986 * @starget: pointer to target structure to scan
948 * @bflags: black/white list flag for LUN 0 987 * @bflags: black/white list flag for LUN 0
949 * @lun0_res: result of scanning LUN 0
950 * 988 *
951 * Description: 989 * Description:
952 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been 990 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been
@@ -956,8 +994,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
956 * Modifies sdevscan->lun. 994 * Modifies sdevscan->lun.
957 **/ 995 **/
958static void scsi_sequential_lun_scan(struct scsi_target *starget, 996static void scsi_sequential_lun_scan(struct scsi_target *starget,
959 int bflags, int lun0_res, int scsi_level, 997 int bflags, int scsi_level, int rescan)
960 int rescan)
961{ 998{
962 unsigned int sparse_lun, lun, max_dev_lun; 999 unsigned int sparse_lun, lun, max_dev_lun;
963 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 1000 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -978,13 +1015,6 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
978 sparse_lun = 0; 1015 sparse_lun = 0;
979 1016
980 /* 1017 /*
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 1018 * 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 1019 * scanning; this matches 2.4 behaviour, but could just be a bug
990 * (to continue scanning a SCSI_1_CSS device). 1020 * (to continue scanning a SCSI_1_CSS device).
@@ -1395,7 +1425,7 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1395 * do a sequential scan. 1425 * do a sequential scan.
1396 */ 1426 */
1397 scsi_sequential_lun_scan(starget, bflags, 1427 scsi_sequential_lun_scan(starget, bflags,
1398 res, starget->scsi_level, rescan); 1428 starget->scsi_level, rescan);
1399 } 1429 }
1400 1430
1401 out_reap: 1431 out_reap:
@@ -1473,7 +1503,7 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
1473 __FUNCTION__, channel, id, lun)); 1503 __FUNCTION__, channel, id, lun));
1474 1504
1475 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) || 1505 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
1476 ((id != SCAN_WILD_CARD) && (id > shost->max_id)) || 1506 ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
1477 ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun))) 1507 ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
1478 return -EINVAL; 1508 return -EINVAL;
1479 1509