<p>Werner Zeh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21518">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">siemens/mc_apl1: Add delay to wait for legacy devices<br><br>There are old legacy onboard devices which are too slow for a coreboot<br>boot with log level BIOS_ERR. In this case coreboot is so fast that these<br>devices do not have enough time to become visible on the PCI bus and<br>this in turn leads to missing resource allocation for this devices. The<br>most generic way to work around this problem on existing hardware is to<br>introduce a delay right before the PCI enumeration starts. The needed<br>delay time depends on the hardware and will therefore be get from<br>hwinfo.<br><br>Change-Id: Ia91babc81e3a347bbc498c3def97b2ea70e10922<br>Signed-off-by: Werner Zeh <werner.zeh@siemens.com><br>---<br>M src/mainboard/siemens/mc_apl1/mainboard.c<br>1 file changed, 31 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/21518/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/mainboard/siemens/mc_apl1/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c<br>index d8374fc..fb849f9 100644<br>--- a/src/mainboard/siemens/mc_apl1/mainboard.c<br>+++ b/src/mainboard/siemens/mc_apl1/mainboard.c<br>@@ -23,6 +23,9 @@<br> #include <intelblocks/lpc_lib.h><br> #include <soc/pci_devs.h><br> #include <string.h><br>+#include <bootstate.h><br>+#include <timer.h><br>+#include <timestamp.h><br> #include "brd_gpio.h"<br> #include "ptn3460.h"<br> <br>@@ -141,6 +144,34 @@<br>       }<br> }<br> <br>+static void wait_for_legacy_dev(void *unused)<br>+{<br>+ uint32_t legacy_delay, us_since_boot;<br>+        struct stopwatch sw;<br>+<br>+      /* Open main hwinfo block. */<br>+        if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS)<br>+                return;<br>+<br>+   /* Get legacy delay parameter from hwinfo. */<br>+        if (hwilib_get_field(LegacyDelay, (uint8_t *) &legacy_delay,<br>+                           sizeof(legacy_delay)) != sizeof(legacy_delay))<br>+         return;<br>+<br>+   us_since_boot = get_us_since_boot();<br>+ /* No need to wait if the time since boot is already long enough.*/<br>+  if (us_since_boot > legacy_delay)<br>+         return;<br>+      stopwatch_init_msecs_expire(&sw, (legacy_delay - us_since_boot) / 1000);<br>+ printk(BIOS_NOTICE, "Wait remaining %d of %d us for legacy devices...",<br>+                    legacy_delay - us_since_boot, legacy_delay);<br>+ while (!stopwatch_expired(&sw))<br>+          ;<br>+    printk(BIOS_NOTICE, "done!\n");<br>+}<br>+<br>+BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL);<br>+<br> struct chip_operations mainboard_ops = {<br>     .init = mainboard_init,<br>       .final = mainboard_final,<br></pre><p>To view, visit <a href="https://review.coreboot.org/21518">change 21518</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21518"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia91babc81e3a347bbc498c3def97b2ea70e10922 </div>
<div style="display:none"> Gerrit-Change-Number: 21518 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Werner Zeh <werner.zeh@siemens.com> </div>