summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-07-25 12:18:49 +0200
committerNico Huber <nico.h@gmx.de>2017-07-27 13:56:53 +0000
commit1a4add9e873fb312c21c57ac3208cd758f16033c (patch)
treedcb5c4153ce7e8cdc368a452d48c163e1b93597e /payloads/libpayload
parenta67dd9de7708563df5b7f019b3c32ac005d5db2e (diff)
libpayload/storage: Replace 1s AHCI reset delay with a timeout
AHCI spec explicitly states that we may poll. TEST=Ran FILO on kontron/bsl6 and observed that the controller always becomes ready during the first delay. Change-Id: If34694abff14d719d10d89bc6771dbfa12065071 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/20764 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/storage/ahci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/storage/ahci.c b/payloads/libpayload/drivers/storage/ahci.c
index 3a0b99df42..f3882830d2 100644
--- a/payloads/libpayload/drivers/storage/ahci.c
+++ b/payloads/libpayload/drivers/storage/ahci.c
@@ -258,7 +258,9 @@ static void ahci_init_pci(pcidev_t dev)
/* Reset host controller. */
ctrl->global_ctrl |= HBA_CTRL_RESET;
/* Reset has to be finished after 1s. */
- delay(1);
+ int timeout = 10 * 1000; /* Time out after 10,000 * 100us == 1s. */
+ while (ctrl->global_ctrl & HBA_CTRL_RESET && timeout--)
+ udelay(100);
if (ctrl->global_ctrl & HBA_CTRL_RESET) {
printf("ahci: ERROR: "
"Controller reset didn't finish within 1s.\n");