Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2009 23:42:28 +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: r188905 - head/sys/dev/ata/chipsets
Message-ID:  <200902212342.n1LNgS9w078456@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Feb 21 23:42:28 2009
New Revision: 188905
URL: http://svn.freebsd.org/changeset/base/188905

Log:
  Increase initial busy waiting time. If drive was hot-plugged, it may need
  much time to spin-up.

Modified:
  head/sys/dev/ata/chipsets/ata-ahci.c

Modified: head/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-ahci.c	Sat Feb 21 23:15:34 2009	(r188904)
+++ head/sys/dev/ata/chipsets/ata-ahci.c	Sat Feb 21 23:42:28 2009	(r188905)
@@ -624,7 +624,7 @@ ata_ahci_start(device_t dev)
 }
 
 static int
-ata_ahci_wait_ready(device_t dev)
+ata_ahci_wait_ready(device_t dev, int t)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
@@ -634,7 +634,7 @@ ata_ahci_wait_ready(device_t dev)
     while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset) &
 	(ATA_S_BUSY | ATA_S_DRQ)) {
 	    DELAY(1000);
-	    if (timeout++ > 1000) {
+	    if (timeout++ > t) {
 		device_printf(dev, "port is not ready\n");
 		return (-1);
 	    }
@@ -680,7 +680,7 @@ ata_ahci_softreset(device_t dev, int por
     if (ata_ahci_issue_cmd(dev, 0, 0))
 	return -1;
 
-    if (ata_ahci_wait_ready(dev))
+    if (ata_ahci_wait_ready(dev, 1000))
 	return (-1);
 
     return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset);
@@ -738,7 +738,7 @@ ata_ahci_reset(device_t dev)
 	      ATA_AHCI_P_IX_PS | ATA_AHCI_P_IX_DHR));
 
     /* Wait for initial TFD from device. */
-    ata_ahci_wait_ready(dev);
+    ata_ahci_wait_ready(dev, 10000);
 
     /* only probe for PortMultiplier if HW has support */
     if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_SPM) {



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