[8910] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: LINUX Jobs for 2.4 update [scsi]

daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Sat May 27 16:06:53 2000

X-Apparently-From: <p?gortmaker@yahoo.com>
Message-ID: <39300F87.24A9B5EC@yahoo.com>
Date:	Sat, 27 May 2000 14:10:15 -0400
From: Paul Gortmaker <p_gortmaker@yahoo.com>
MIME-Version: 1.0
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.rutgers.edu, linux-scsi@vger.rutgers.edu


> To Do
> -----
> Linux sends a 1K buffer with SCSI inquiries. The ANSI-SCSI limit is 255.

I don't see how this can be.  In scan_scsis() scsi_result0[256] is
declared, and if that isn't appropriate for host needing DMA then 
we kmalloc(512, GFP_DMA) - either way it doesn't matter since the
allocation length field in the CCB for INQUIRY is only a byte (and
we set it to 255).  Even scsi_wait_req() is told the the result buffer
length is 255 when the INQUIRY command is lodged. 

> Linux uses TEST_UNIT_READY to chck for device presence on a PUN/LUN. The
>         INQUIRY is the only valid test allowed by the spec.

The draft of SCSI-2 spec I have here hints that INQUIRY should be used
to probe system configuration and that TEST_UNIT_READY is more for
polling on devices with removable media.  I tossed the TEST_UNIT_READY
part out and INQUIRY alone works fine (one disk, 2 CDs and a tape on
a BusLogic clone - all found as per usual).

Paul.

--- 2400-test1/linux/drivers/scsi/scsi_scan.c~	Fri May 26 16:34:59 2000
+++ 2400-test1/linux/drivers/scsi/scsi_scan.c	Sat May 27 06:14:44 2000
@@ -499,39 +499,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.



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post