[coreboot-gerrit] Change in coreboot[master]: siemens/mc_apl1: Add delay to wait for legacy devices

Werner Zeh (Code Review) gerrit at coreboot.org
Tue Sep 12 15:42:38 CEST 2017


Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/21518


Change subject: siemens/mc_apl1: Add delay to wait for legacy devices
......................................................................

siemens/mc_apl1: Add delay to wait for legacy devices

There are old legacy onboard devices which are too slow for a coreboot
boot with log level BIOS_ERR. In this case coreboot is so fast that these
devices do not have enough time to become visible on the PCI bus and
this in turn leads to missing resource allocation for this devices. The
most generic way to work around this problem on existing hardware is to
introduce a delay right before the PCI enumeration starts. The needed
delay time depends on the hardware and will therefore be get from
hwinfo.

Change-Id: Ia91babc81e3a347bbc498c3def97b2ea70e10922
Signed-off-by: Werner Zeh <werner.zeh at siemens.com>
---
M src/mainboard/siemens/mc_apl1/mainboard.c
1 file changed, 31 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/21518/1

diff --git a/src/mainboard/siemens/mc_apl1/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c
index d8374fc..fb849f9 100644
--- a/src/mainboard/siemens/mc_apl1/mainboard.c
+++ b/src/mainboard/siemens/mc_apl1/mainboard.c
@@ -23,6 +23,9 @@
 #include <intelblocks/lpc_lib.h>
 #include <soc/pci_devs.h>
 #include <string.h>
+#include <bootstate.h>
+#include <timer.h>
+#include <timestamp.h>
 #include "brd_gpio.h"
 #include "ptn3460.h"
 
@@ -141,6 +144,34 @@
 	}
 }
 
+static void wait_for_legacy_dev(void *unused)
+{
+	uint32_t legacy_delay, us_since_boot;
+	struct stopwatch sw;
+
+	/* Open main hwinfo block. */
+	if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS)
+		return;
+
+	/* Get legacy delay parameter from hwinfo. */
+	if (hwilib_get_field(LegacyDelay, (uint8_t *) &legacy_delay,
+			      sizeof(legacy_delay)) != sizeof(legacy_delay))
+		return;
+
+	us_since_boot = get_us_since_boot();
+	/* No need to wait if the time since boot is already long enough.*/
+	if (us_since_boot > legacy_delay)
+		return;
+	stopwatch_init_msecs_expire(&sw, (legacy_delay - us_since_boot) / 1000);
+	printk(BIOS_NOTICE, "Wait remaining %d of %d us for legacy devices...",
+			legacy_delay - us_since_boot, legacy_delay);
+	while (!stopwatch_expired(&sw))
+		;
+	printk(BIOS_NOTICE, "done!\n");
+}
+
+BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL);
+
 struct chip_operations mainboard_ops = {
 	.init = mainboard_init,
 	.final = mainboard_final,

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia91babc81e3a347bbc498c3def97b2ea70e10922
Gerrit-Change-Number: 21518
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh at siemens.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170912/ff8f3ceb/attachment-0001.html>


More information about the coreboot-gerrit mailing list