public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 5/6: scsi_inq_timeout
@ 2004-04-18 18:59 Kurt Garloff
  2004-04-18 19:21 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Kurt Garloff @ 2004-04-18 18:59 UTC (permalink / raw)
  To: Linux SCSI list; +Cc: James Bottomley, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2810 bytes --]


Feature.

Introduce a new SCSI scanning boot/module parameter
scsi_inq_timeout=N
which sets the timeout used when the INQUIRY is send in the SCSI 
scanning procedure to N seconds. (Half a second is added, so 0 is safe.)
This is useful, because some devices need an excessive amount of time to 
recover from the bootup SCSI reset.
Also changes the default for PPC64, as some largely used crap chip there
requires it.

Note that the second INQUIRY (with more than 36 bytes) only gets half 
the amount of seconds, the long delay for the first is only due to the 
recovery needed from the initial bus reset.

--- linux-2.6.5.noreplunhost/drivers/scsi/scsi_scan.c.orig	2004-04-15 22:51:08.000000000 +0200
+++ linux-2.6.5.noreplunhost/drivers/scsi/scsi_scan.c	2004-04-16 19:30:43.289826746 +0200
@@ -125,6 +125,22 @@ MODULE_PARM_DESC(scsi_allow_ghost_device
 		 "allow devices marked as being offline to be accessed anyway "
 		 "(0 = off, else allow ghosts on lun 0 through allow_ghost_devices - 1");
 
+/* Some AChip ARC765 based DVD-ROM's take 15 or more seconds
+ * to reset.  A scan will fail if made right after a reset.
+ * It's completely broken device behaviour: SCSI specification
+ * says devices need to be able to respond to INQUIRY always
+ * (after a selection timeout ... of 250ms).
+ */
+#ifdef __powerpc64__
+static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ+25;
+#else
+static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ+3;
+#endif
+
+module_param_named(scsi_inq_timeout, scsi_inq_timeout, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_inq_timeout, 
+		 "Timeout (in seconds) waiting for devices to answer INQUIRY."
+		 " Default is 6. Some non-compliant devices need more.");
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
@@ -376,7 +392,7 @@ static void scsi_probe_lun(struct scsi_r
 
 	memset(inq_result, 0, 36);
 	scsi_wait_req(sreq, (void *) scsi_cmd, (void *) inq_result, 36,
-		      SCSI_TIMEOUT + 4 * HZ, 3);
+		      HZ/2 + HZ*scsi_inq_timeout, 3);
 
 	SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 1st INQUIRY %s with"
 			" code 0x%x\n", sreq->sr_result ?
@@ -425,7 +441,7 @@ static void scsi_probe_lun(struct scsi_r
 		memset(inq_result, 0, possible_inq_resp_len);
 		scsi_wait_req(sreq, (void *) scsi_cmd,
 			      (void *) inq_result,
-			      possible_inq_resp_len, SCSI_TIMEOUT + 4 * HZ, 3);
+			      possible_inq_resp_len, (1+scsi_inq_timeout)*(HZ/2), 3);
 		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 2nd INQUIRY"
 				" %s with code 0x%x\n", sreq->sr_result ?
 				"failed" : "successful", sreq->sr_result));
-- 
Kurt Garloff  <garloff@suse.de>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-20 11:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-18 18:59 [PATCH] 5/6: scsi_inq_timeout Kurt Garloff
2004-04-18 19:21 ` Christoph Hellwig
2004-04-18 22:16   ` Kurt Garloff
2004-04-19 16:41     ` Patrick Mansfield
2004-04-20 11:34       ` Kurt Garloff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox