[coreboot-gerrit] Change in coreboot[master]: libpayload/storage: Replace 1s AHCI reset delay with a timeout

Nico Huber (Code Review) gerrit at coreboot.org
Tue Jul 25 16:34:27 CEST 2017


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/20764


Change subject: libpayload/storage: Replace 1s AHCI reset delay with a timeout
......................................................................

libpayload/storage: Replace 1s AHCI reset delay with a timeout

AHCI spec explicitly states that we may poll.

TEST=Run 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 at secunet.com>
---
M payloads/libpayload/drivers/storage/ahci.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/20764/1

diff --git a/payloads/libpayload/drivers/storage/ahci.c b/payloads/libpayload/drivers/storage/ahci.c
index 3a0b99d..f388283 100644
--- a/payloads/libpayload/drivers/storage/ahci.c
+++ b/payloads/libpayload/drivers/storage/ahci.c
@@ -258,7 +258,9 @@
 	/* 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");

-- 
To view, visit https://review.coreboot.org/20764
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If34694abff14d719d10d89bc6771dbfa12065071
Gerrit-Change-Number: 20764
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170725/d25a5252/attachment.html>


More information about the coreboot-gerrit mailing list