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>
This commit is contained in:
parent
dc45951e88
commit
3864973a09
21
src/Kconfig
21
src/Kconfig
|
@ -395,16 +395,6 @@ config FW_CONFIG
|
|||
Enable support for probing devices with fw_config. This is a simple
|
||||
bitmask broken into fields and options for probing.
|
||||
|
||||
config FW_CONFIG_SOURCE_CBFS
|
||||
bool "Obtain Firmware Configuration value from CBFS"
|
||||
depends on FW_CONFIG
|
||||
default n
|
||||
help
|
||||
With this option enabled coreboot will look for the 32bit firmware
|
||||
configuration value in CBFS at the selected prefix with the file name
|
||||
"fw_config". This option will override other sources and allow the
|
||||
local image to preempt the mainboard selected source.
|
||||
|
||||
config FW_CONFIG_SOURCE_CHROMEEC_CBI
|
||||
bool "Obtain Firmware Configuration value from Google Chrome EC CBI"
|
||||
depends on FW_CONFIG && EC_GOOGLE_CHROMEEC
|
||||
|
@ -415,6 +405,17 @@ config FW_CONFIG_SOURCE_CHROMEEC_CBI
|
|||
is not tried if FW_CONFIG_SOURCE_CBFS is enabled and the value was
|
||||
found in CBFS.
|
||||
|
||||
config FW_CONFIG_SOURCE_CBFS
|
||||
bool "Obtain Firmware Configuration value from CBFS"
|
||||
depends on FW_CONFIG
|
||||
default n
|
||||
help
|
||||
With this option enabled coreboot will look for the 32bit firmware
|
||||
configuration value in CBFS at the selected prefix with the file name
|
||||
"fw_config". This option will override other sources and allow the
|
||||
local image to preempt the mainboard selected source and can be used as
|
||||
FW_CONFIG_SOURCE_CHROMEEC_CBI fallback option.
|
||||
|
||||
config HAVE_RAMPAYLOAD
|
||||
bool
|
||||
|
||||
|
|
|
@ -21,30 +21,29 @@ uint64_t fw_config_get(void)
|
|||
if (fw_config_value_initialized)
|
||||
return fw_config_value;
|
||||
fw_config_value_initialized = true;
|
||||
|
||||
/* Look in CBFS to allow override of value. */
|
||||
if (CONFIG(FW_CONFIG_SOURCE_CBFS)) {
|
||||
if (cbfs_load(CONFIG_CBFS_PREFIX "/fw_config", &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 {
|
||||
printk(BIOS_INFO, "FW_CONFIG value from CBFS is 0x%" PRIx64 "\n",
|
||||
fw_config_value);
|
||||
return fw_config_value;
|
||||
}
|
||||
}
|
||||
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 EC\n", __func__);
|
||||
fw_config_value = UNDEFINED_FW_CONFIG;
|
||||
}
|
||||
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) && 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))
|
||||
printk(BIOS_WARNING, "%s: Could not get fw_config from CBFS\n",
|
||||
__func__);
|
||||
else
|
||||
printk(BIOS_INFO, "FW_CONFIG value from CBFS is 0x%" PRIx64 "\n",
|
||||
fw_config_value);
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "FW_CONFIG value is 0x%" PRIx64 "\n", fw_config_value);
|
||||
return fw_config_value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue