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>
This commit is contained in:
Nico Huber 2017-07-25 12:18:49 +02:00 committed by Nico Huber
parent a67dd9de77
commit 1a4add9e87
1 changed files with 3 additions and 1 deletions

View File

@ -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");