drivers/vpd: add VPD region VPD_RW_THEN_RO

This change is based on the concept that system user's (overwrite)
settings are held in VPD_RW region, while system owner's (default)
settings are held in VPD_RO region.

Add VPD_RW_THEN_RO region type, so that VPD_RW region is searched
first to get overwrite setting, otherwise VPD_RO region is searched
to get default setting.

Signed-off-by: Jonathan Zhang <jonzhang@fb.com>
Change-Id: Icd7cbd9c3fb2a6b02fc417ad45d7d22ca6795457
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41732
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
Jonathan Zhang 2020-05-28 13:35:44 -07:00 committed by Patrick Georgi
parent a9117ed496
commit 9b110bf97a
2 changed files with 10 additions and 5 deletions

View File

@ -209,10 +209,14 @@ const void *vpd_find(const char *key, int *size, enum vpd_region region)
init_vpd_rdevs(); init_vpd_rdevs();
if (region != VPD_RW) if (region == VPD_RW_THEN_RO)
vpd_find_in(&rw_vpd, &arg);
if (!arg.matched && (region == VPD_RO || region == VPD_RO_THEN_RW ||
region == VPD_RW_THEN_RO))
vpd_find_in(&ro_vpd, &arg); vpd_find_in(&ro_vpd, &arg);
if (!arg.matched && region != VPD_RO) if (!arg.matched && (region == VPD_RW || region == VPD_RO_THEN_RW))
vpd_find_in(&rw_vpd, &arg); vpd_find_in(&rw_vpd, &arg);
if (!arg.matched) if (!arg.matched)

View File

@ -8,9 +8,10 @@
#define GOOGLE_VPD_2_0_OFFSET 0x600 #define GOOGLE_VPD_2_0_OFFSET 0x600
enum vpd_region { enum vpd_region {
VPD_RO_THEN_RW = 0, VPD_RO,
VPD_RO = 1, VPD_RW,
VPD_RW = 2 VPD_RO_THEN_RW,
VPD_RW_THEN_RO
}; };
/* /*