summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorWonkyu Kim <wonkyu.kim@intel.com>2021-11-01 20:55:25 -0700
committerPaul Fagerburg <pfagerburg@chromium.org>2021-11-08 14:48:05 +0000
commit43e269239e43ad15b7324950e4b986a58abe766b (patch)
treec74bcb0817e0bdc24ef76b0f735b7ed4a9681005 /src/lib
parent3864973a0960c942ad96664676f59dae9f3eff2d (diff)
src/lib: Add FW_CONFIG_SOURCE_VPD
Read fw_config value from VPD. This new option can be used where chrome EC is not supported like pre-silicon platform and fw_config can be updated by VPD tool in OS. TEST= boot to OS and read fw_config from vpd 1. Boot to OS 2. Write "fw_config" in VPD ex) vpd -i "RW_VPD" -s "fw_config"="1" 3. reboot and check fw_config value from coreboot log Signed-off-by: Wonkyu Kim <wonkyu.kim@intel.com> Change-Id: I4df7d5612e18957416a40ab854fa63c8b11b4216 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58839 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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c
index 3546736b7b..72cf225cae 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;
}