Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Nov 2009 14:33:19 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r199050 - in head/sys: conf dev/ata
Message-ID:  <200911081433.nA8EXJnp088767@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Nov  8 14:33:19 2009
New Revision: 199050
URL: http://svn.freebsd.org/changeset/base/199050

Log:
  Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
  command timeout.
  
  Submitted by:	keramida

Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/ata-queue.c
  head/sys/dev/ata/ata-raid.c
  head/sys/dev/ata/atapi-cd.c

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/conf/NOTES	Sun Nov  8 14:33:19 2009	(r199050)
@@ -1715,8 +1715,11 @@ hint.ata.1.irq="15"
 #
 # ATA_STATIC_ID:	controller numbering is static ie depends on location
 #			else the device numbers are dynamically allocated.
+# ATA_REQUEST_TIMEOUT:	the number of seconds to wait for an ATA request
+#			before timing out.
 
 options 	ATA_STATIC_ID
+#options 	ATA_REQUEST_TIMEOUT=10
 
 #
 # Standard floppy disk controllers and floppy tapes, supports

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/conf/options	Sun Nov  8 14:33:19 2009	(r199050)
@@ -350,6 +350,7 @@ ISCSI_INITIATOR_DEBUG	opt_iscsi_initiato
 # Options used in the 'ata' ATA/ATAPI driver
 ATA_STATIC_ID		opt_ata.h
 ATA_NOPCI		opt_ata.h
+ATA_REQUEST_TIMEOUT	opt_ata.h
 
 # Net stuff.
 ACCEPT_FILTER_DATA

Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-all.h	Sun Nov  8 14:33:19 2009	(r199050)
@@ -345,6 +345,10 @@ struct ata_ahci_cmd_list {
 #define ATA_OP_FINISHED                 1
 #define ATA_MAX_28BIT_LBA               268435455UL
 
+#ifndef	ATA_REQUEST_TIMEOUT
+#define	ATA_REQUEST_TIMEOUT		10
+#endif
+
 /* structure used for composite atomic operations */
 #define MAX_COMPOSITES          32              /* u_int32_t bits */
 struct ata_composite {

Modified: head/sys/dev/ata/ata-disk.c
==============================================================================
--- head/sys/dev/ata/ata-disk.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-disk.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -230,7 +230,7 @@ ad_spindown(void *priv)
     }
     request->dev = dev;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 1;
     request->callback = ad_power_callback;
     request->u.ata.command = ATA_STANDBY_IMMEDIATE;
@@ -262,10 +262,10 @@ ad_strategy(struct bio *bp)
     if (atadev->spindown_state) {
 	device_printf(dev, "request while spun down, starting.\n");
 	atadev->spindown_state = 0;
-	request->timeout = 31;
+	request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
     }
     else {
-	request->timeout = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
     }
     request->retries = 2;
     request->data = bp->bio_data;
@@ -468,7 +468,7 @@ ad_set_geometry(device_t dev)
     request->u.ata.count = 0;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL | ATA_R_QUIET;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)
@@ -487,7 +487,7 @@ ad_set_geometry(device_t dev)
     request->u.ata.count = 1;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)

Modified: head/sys/dev/ata/ata-queue.c
==============================================================================
--- head/sys/dev/ata/ata-queue.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-queue.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -141,9 +141,9 @@ ata_controlcmd(device_t dev, u_int8_t co
 	if (atadev->spindown_state) {
 	    device_printf(dev, "request while spun down, starting.\n");
 	    atadev->spindown_state = 0;
-	    request->timeout = 31;
+	    request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
 	} else {
-	    request->timeout = 10;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	}
 	request->retries = 0;
 	ata_queue_request(request);
@@ -397,7 +397,7 @@ ata_completed(void *context, int dummy)
 	    request->bytecount = sizeof(struct atapi_sense);
 	    request->donecount = 0;
 	    request->transfersize = sizeof(struct atapi_sense);
-	    request->timeout = 10;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	    request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG);
 	    request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE);
 	    ATA_DEBUG_RQ(request, "autoissue request sense");

Modified: head/sys/dev/ata/ata-raid.c
==============================================================================
--- head/sys/dev/ata/ata-raid.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/ata-raid.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -273,7 +273,7 @@ ata_raid_flush(struct bio *bp)
 	request->u.ata.lba = 0;
 	request->u.ata.count = 0;
 	request->u.ata.feature = 0;
-	request->timeout = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	request->retries = 0;
 	request->flags |= ATA_R_ORDERED | ATA_R_DIRECT;
 	ata_queue_request(request);
@@ -4371,7 +4371,7 @@ ata_raid_init_request(device_t dev, stru
 	return NULL;
     }
     request->dev = dev;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 2;
     request->callback = ata_raid_done;
     request->driver = rdp;
@@ -4445,7 +4445,7 @@ ata_raid_rw(device_t dev, u_int64_t lba,
 
     /* setup request */
     request->dev = dev;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     request->data = data;
     request->bytecount = bcount;

Modified: head/sys/dev/ata/atapi-cd.c
==============================================================================
--- head/sys/dev/ata/atapi-cd.c	Sun Nov  8 14:28:23 2009	(r199049)
+++ head/sys/dev/ata/atapi-cd.c	Sun Nov  8 14:33:19 2009	(r199050)
@@ -700,7 +700,7 @@ acd_geom_access(struct g_provider *pp, i
 	request->dev = dev;
 	bcopy(ccb, request->u.atapi.ccb, 16);
 	request->flags = ATA_R_ATAPI;
-	request->timeout = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	ata_queue_request(request);
 	if (!request->error &&
 	    (request->u.atapi.sense.key == 2 ||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911081433.nA8EXJnp088767>