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:
		@@ -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");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user