patch-2.4.0-test2 linux/drivers/scsi/scsi_scan.c

Next file: linux/drivers/scsi/sd.c
Previous file: linux/drivers/scsi/scsi_lib.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/scsi/scsi_scan.c linux/drivers/scsi/scsi_scan.c
@@ -38,7 +38,6 @@
 #define BLIST_MAX5LUN		0x080
 #define BLIST_ISDISK    	0x100
 #define BLIST_ISROM     	0x200
-#define BLIST_GHOST     	0x400   
 
 static void print_inquiry(unsigned char *data);
 static int scan_scsis_single(int channel, int dev, int lun, int *max_scsi_dev,
@@ -137,13 +136,7 @@
 	{"NEC", "PD-1 ODX654P", "*", BLIST_FORCELUN | BLIST_SINGLELUN},
 	{"MATSHITA", "PD-1", "*", BLIST_FORCELUN | BLIST_SINGLELUN},
 	{"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN},
- 	{"CREATIVE","DVD-RAM RAM","*", BLIST_GHOST},
- 	{"MATSHITA","PD-2 LF-D100","*", BLIST_GHOST},
-	{"AOpen", "PD-2 DVD-520S", "*", BLIST_GHOST},
- 	{"HITACHI", "GF-1050","*", BLIST_GHOST},  /* Hitachi SCSI DVD-RAM */
  	{"TOSHIBA","CDROM","*", BLIST_ISROM},
-	{"TOSHIBA","DVD-RAM SD-W1101","*", BLIST_GHOST},
-	{"TOSHIBA","DVD-RAM SD-W1111","*", BLIST_GHOST},
 	{"MegaRAID", "LD", "*", BLIST_FORCELUN},
 
 	/*
@@ -278,8 +271,8 @@
 	if (SDpnt) {
 		memset(SDpnt, 0, sizeof(Scsi_Device));
 		/*
-		 * Register the queue for the device.  All I/O requests will come
-		 * in through here.  We also need to register a pointer to
+		 * Register the queue for the device.  All I/O requests will
+		 * come in through here.  We also need to register a pointer to
 		 * ourselves, since the queue handler won't know what device
 		 * the queue actually represents.   We could look it up, but it
 		 * is pointless work.
@@ -468,8 +461,6 @@
 	Scsi_Device *SDtail, *SDpnt = *SDpnt2;
 	Scsi_Request * SRpnt;
 	int bflags, type = -1;
-	static int ghost_channel=-1, ghost_dev=-1;
-	int org_lun = lun;
 	extern devfs_handle_t scsi_devfs_handle;
 
 	SDpnt->host = shpnt;
@@ -480,13 +471,6 @@
 
 	scsi_build_commandblocks(SDpnt);
  
-	if ((channel == ghost_channel) && (dev == ghost_dev) && (lun == 1)) {
-		SDpnt->lun = 0;
-	} else {
-		ghost_channel = ghost_dev = -1;
-	}
-	     
-
 	/* Some low level driver could use device->type (DB) */
 	SDpnt->type = -1;
 
@@ -499,39 +483,14 @@
 	SDpnt->expecting_cc_ua = 0;
 	SDpnt->starved = 0;
 
-	scsi_cmd[0] = TEST_UNIT_READY;
-	scsi_cmd[1] = lun << 5;
-	scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[4] = scsi_cmd[5] = 0;
-
 	SRpnt = scsi_allocate_request(SDpnt);
 
-	SRpnt->sr_data_direction = SCSI_DATA_NONE;
-
-	scsi_wait_req (SRpnt, (void *) scsi_cmd,
-	          (void *) NULL,
-	          0, SCSI_TIMEOUT + 4 * HZ, 5);
-
-	SCSI_LOG_SCAN_BUS(3, printk("scsi: scan_scsis_single id %d lun %d. Return code 0x%08x\n",
-				    dev, lun, SRpnt->sr_result));
-	SCSI_LOG_SCAN_BUS(3, print_driverbyte(SRpnt->sr_result));
-	SCSI_LOG_SCAN_BUS(3, print_hostbyte(SRpnt->sr_result));
-	SCSI_LOG_SCAN_BUS(3, printk("\n"));
+	/*
+	 * We used to do a TEST_UNIT_READY before the INQUIRY but that was 
+	 * not really necessary.  Spec recommends using INQUIRY to scan for
+	 * devices (and TEST_UNIT_READY to poll for media change). - Paul G.
+	 */
 
-	if (SRpnt->sr_result) {
-		if (((driver_byte(SRpnt->sr_result) & DRIVER_SENSE) ||
-		     (status_byte(SRpnt->sr_result) & CHECK_CONDITION)) &&
-		    ((SRpnt->sr_sense_buffer[0] & 0x70) >> 4) == 7) {
-			if (((SRpnt->sr_sense_buffer[2] & 0xf) != NOT_READY) &&
-			    ((SRpnt->sr_sense_buffer[2] & 0xf) != UNIT_ATTENTION) &&
-			    ((SRpnt->sr_sense_buffer[2] & 0xf) != ILLEGAL_REQUEST || lun > 0)) {
-				scsi_release_request(SRpnt);
-				return 1;
-			}
-		} else {
-			scsi_release_request(SRpnt);
-			return 0;
-		}
-	}
 	SCSI_LOG_SCAN_BUS(3, printk("scsi: performing INQUIRY\n"));
 	/*
 	 * Build an INQUIRY command block.
@@ -547,7 +506,7 @@
 
 	scsi_wait_req (SRpnt, (void *) scsi_cmd,
 	          (void *) scsi_result,
-	          256, SCSI_TIMEOUT, 3);
+	          256, SCSI_TIMEOUT+4*HZ, 3);
 
 	SCSI_LOG_SCAN_BUS(3, printk("scsi: INQUIRY %s with code 0x%x\n",
 		SRpnt->sr_result ? "failed" : "successful", SRpnt->sr_result));
@@ -588,18 +547,6 @@
 		scsi_result[1] |= 0x80;     /* removable */
 	}
     
-  	if (bflags & BLIST_GHOST) {
-		if ((ghost_channel == channel) && (ghost_dev == dev) && (org_lun == 1)) {
-			lun=1;
-		} else {
-			ghost_channel = channel;
-			ghost_dev = dev;
-			scsi_result[0] = TYPE_MOD;
-			scsi_result[1] |= 0x80;     /* removable */
-		}
-	}
-       
-
 	memcpy(SDpnt->vendor, scsi_result + 8, 8);
 	memcpy(SDpnt->model, scsi_result + 16, 16);
 	memcpy(SDpnt->rev, scsi_result + 32, 4);
@@ -808,19 +755,9 @@
 	}
 
 	/*
-	 * If this device is Ghosted, scan upto two luns. (It physically only
-	 * has one). -- REW
-	 */
-	if (bflags & BLIST_GHOST) {
-	        *max_dev_lun = 2;
-	        return 1;
-	}  
-
-
-	/*
-	 * We assume the device can't handle lun!=0 if: - it reports scsi-0 (ANSI
-	 * SCSI Revision 0) (old drives like MAXTOR XT-3280) or - it reports scsi-1
-	 * (ANSI SCSI Revision 1) and Response Data Format 0
+	 * We assume the device can't handle lun!=0 if: - it reports scsi-0
+	 * (ANSI SCSI Revision 0) (old drives like MAXTOR XT-3280) or - it
+	 * reports scsi-1 (ANSI SCSI Revision 1) and Response Data Format 0
 	 */
 	if (((scsi_result[2] & 0x07) == 0)
 	    ||

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)