diff options
author | Werner Zeh <werner.zeh@siemens.com> | 2017-10-10 12:35:10 +0200 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-10-12 16:20:56 +0000 |
commit | c0d1e31617f7aa3a93e394dbd5fe5997a914cb25 (patch) | |
tree | ff942cde14912457237be81f4d658b77ec6c7f81 /src | |
parent | 0ccc3c49e47d46b6f2ad8d93182414850284ae70 (diff) |
siemens/mc_bdx1: Add delay to wait for legacy devices
Like happend in commit efd0eb35af5e5620331d885d3140c734a6fc9098
(siemens/mc_apl1: Add delay to wait for legacy devices) add the
feature to mc_bdx1 as it uses the same legacy devices.
Change-Id: I355a53ce7aea70098d7bc08f24dc6a4e43d1d618
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/21933
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/siemens/mc_bdx1/mainboard.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mainboard/siemens/mc_bdx1/mainboard.c b/src/mainboard/siemens/mc_bdx1/mainboard.c index d4d84b5599..ea525d4a6c 100644 --- a/src/mainboard/siemens/mc_bdx1/mainboard.c +++ b/src/mainboard/siemens/mc_bdx1/mainboard.c @@ -35,6 +35,9 @@ #include <soc/pci_devs.h> #include <soc/irq.h> #include <soc/lpc.h> +#include <bootstate.h> +#include <timer.h> +#include <timestamp.h> #define MAX_PATH_DEPTH 12 #define MAX_NUM_MAPPINGS 10 @@ -214,6 +217,33 @@ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[6]) return CB_ERR; } +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); + stopwatch_wait_until_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 = { .enable_dev = mainboard_enable, .init = mainboard_init, |