aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/storage
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2013-06-17 17:42:35 +0200
committerRonald G. Minnich <rminnich@gmail.com>2013-06-18 19:29:36 +0200
commit354066e1179e2c3ca14c5b1216d3a565fb6da813 (patch)
tree040f8b23e10545e219d2400bc8d3aef535c071a0 /payloads/libpayload/drivers/storage
parentcacc58a874092bbbd680cd636ed840c1844c84a1 (diff)
libpayload: ahci: Increase timeout for signature reading
We can't read the drives signature before it's ready, i.e. spun up. So set the timeout to the standard 30s. Also put a notice on the console, so the user knows why the signature reading failed. Change-Id: I2148258f9b0eb950b71544dafd95776ae70afac8 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/3493 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Dave Frodin <dave.frodin@se-eng.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'payloads/libpayload/drivers/storage')
-rw-r--r--payloads/libpayload/drivers/storage/ahci.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/storage/ahci.c b/payloads/libpayload/drivers/storage/ahci.c
index 2b33b599f9..ec4db4ca7a 100644
--- a/payloads/libpayload/drivers/storage/ahci.c
+++ b/payloads/libpayload/drivers/storage/ahci.c
@@ -406,11 +406,19 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
dev->cmdtable = cmdtable;
dev->rcvd_fis = rcvd_fis;
- /* Wait for D2H Register FIS with device' signature. */
- int timeout = 200; /* Time out after 200 * 10ms == 2s. */
+ /*
+ * Wait for D2H Register FIS with device' signature.
+ * The drive has to spin up here, so wait up to 30s.
+ */
+ const int timeout_s = 30; /* Time out after 30s. */
+ int timeout = timeout_s * 100;
while ((port->taskfile_data & HBA_PxTFD_BSY) && timeout--)
mdelay(10);
+ if (port->taskfile_data & HBA_PxTFD_BSY)
+ printf("ahci: Timed out after %d seconds "
+ "of waiting for device to spin up.\n", timeout_s);
+
/* Initialize device or fall through to clean up. */
switch (port->signature) {
case HBA_PxSIG_ATA: