summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Kconfig10
-rw-r--r--src/lib/fw_config.c12
2 files changed, 22 insertions, 0 deletions
diff --git a/src/Kconfig b/src/Kconfig
index e30152d2e5df..e1d0c00c4525 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -416,6 +416,16 @@ config FW_CONFIG_SOURCE_CBFS
local image to preempt the mainboard selected source and can be used as
FW_CONFIG_SOURCE_CHROMEEC_CBI fallback option.
+config FW_CONFIG_SOURCE_VPD
+ bool "Obtain Firmware Configuration value from VPD"
+ depends on FW_CONFIG && VPD
+ default n
+ help
+ With this option enabled coreboot will look for the 32bit firmware
+ configuration value in VPD key name "fw_config". This option will
+ override other sources and allow the local image to preempt the mainboard
+ selected source and can be used for other FW_CONFIG_SOURCEs fallback option.
+
config HAVE_RAMPAYLOAD
bool
diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c
index 3546736b7b36..72cf225caeed 100644
--- a/src/lib/fw_config.c
+++ b/src/lib/fw_config.c
@@ -11,6 +11,7 @@
#include <lib.h>
#include <stdbool.h>
#include <stdint.h>
+#include <drivers/vpd/vpd.h>
uint64_t fw_config_get(void)
{
@@ -44,6 +45,17 @@ uint64_t fw_config_get(void)
fw_config_value);
}
+ if (CONFIG(FW_CONFIG_SOURCE_VPD) && fw_config_value == UNDEFINED_FW_CONFIG) {
+ int vpd_value;
+ if (vpd_get_int("fw_config", VPD_RW_THEN_RO, &vpd_value)) {
+ fw_config_value = vpd_value;
+ printk(BIOS_INFO, "FW_CONFIG value from VPD is 0x%" PRIx64 "\n",
+ fw_config_value);
+ } else
+ printk(BIOS_WARNING, "%s: Could not get fw_config from vpd\n",
+ __func__);
+ }
+
return fw_config_value;
}