diff options
author | Wonkyu Kim <wonkyu.kim@intel.com> | 2021-11-01 20:15:30 -0700 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2021-11-08 14:46:57 +0000 |
commit | 3864973a0960c942ad96664676f59dae9f3eff2d (patch) | |
tree | 4e5b93d561bd1b3058c620f9b47c745ee9c5164b /src/lib | |
parent | dc45951e88d4833241f475ad85663a077906ef00 (diff) | |
download | coreboot-3864973a0960c942ad96664676f59dae9f3eff2d.tar.gz coreboot-3864973a0960c942ad96664676f59dae9f3eff2d.tar.bz2 coreboot-3864973a0960c942ad96664676f59dae9f3eff2d.zip |
src/lib/fw_config: Change fw_config sources priority
Request fw_config values from various sources (as enabled via Kconfig)
until a valid value has been read.
With this change, Chrome EC CBI takes precedence over CBFS fw_config.
TEST=select both configs and check fallback behavior.
1. select both FW_CONFIG_SOURCE_CHROMEEC_CBI and FW_CONFIG_SOURCE_CBFS
2. check log for reading fw_config from CBI and CBFS
Signed-off-by: Wonkyu Kim <wonkyu.kim@intel.com>
Change-Id: I215c13a4fcb9dc3b94f73c770e704d4e353e9cff
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58833
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/fw_config.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c index 8e45c004fbfa..3546736b7b36 100644 --- a/src/lib/fw_config.c +++ b/src/lib/fw_config.c @@ -21,30 +21,29 @@ uint64_t fw_config_get(void) if (fw_config_value_initialized) return fw_config_value; fw_config_value_initialized = true; + fw_config_value = UNDEFINED_FW_CONFIG; + + /* Read the value from EC CBI. */ + if (CONFIG(FW_CONFIG_SOURCE_CHROMEEC_CBI)) { + if (google_chromeec_cbi_get_fw_config(&fw_config_value)) + printk(BIOS_WARNING, "%s: Could not get fw_config from CBI\n", + __func__); + else + printk(BIOS_INFO, "FW_CONFIG value from CBI is 0x%" PRIx64 "\n", + fw_config_value); + } /* Look in CBFS to allow override of value. */ - if (CONFIG(FW_CONFIG_SOURCE_CBFS)) { + if (CONFIG(FW_CONFIG_SOURCE_CBFS) && fw_config_value == UNDEFINED_FW_CONFIG) { if (cbfs_load(CONFIG_CBFS_PREFIX "/fw_config", &fw_config_value, - sizeof(fw_config_value)) != sizeof(fw_config_value)) { + sizeof(fw_config_value)) != sizeof(fw_config_value)) printk(BIOS_WARNING, "%s: Could not get fw_config from CBFS\n", - __func__); - fw_config_value = UNDEFINED_FW_CONFIG; - } else { + __func__); + else printk(BIOS_INFO, "FW_CONFIG value from CBFS is 0x%" PRIx64 "\n", - fw_config_value); - return fw_config_value; - } - } - - /* Read the value from EC CBI. */ - if (CONFIG(FW_CONFIG_SOURCE_CHROMEEC_CBI)) { - if (google_chromeec_cbi_get_fw_config(&fw_config_value)) { - printk(BIOS_WARNING, "%s: Could not get fw_config from EC\n", __func__); - fw_config_value = UNDEFINED_FW_CONFIG; - } + fw_config_value); } - printk(BIOS_INFO, "FW_CONFIG value is 0x%" PRIx64 "\n", fw_config_value); return fw_config_value; } |