diff options
author | Subrata Banik <subratabanik@google.com> | 2024-02-26 11:48:03 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2024-02-28 11:05:42 +0000 |
commit | f45fcd1cf3ff801816ea5462a0f0f3208a585c3a (patch) | |
tree | 27c7e659a500fd93aef5350a0b557df1c1929e28 | |
parent | be426e0722be270916cadd2098b2224a6fa5ec00 (diff) |
drivers/vpd: Add API to read "feature_device_info" VPD
This patch introduces an API for reading "feature_device_info" VPD
data. This information is essential for correctly differentiating
ChromeOS product segments (e.g., Chromebook-Plus vs. standard
Chromebook models).
BUG=b:324107408
TEST=Build and boot successful on google/yahiko with this change.
Change-Id: I8d49e2dc49cd2935a9d8023c989869eb9558039d
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80741
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
-rw-r--r-- | src/drivers/vpd/Makefile.mk | 2 | ||||
-rw-r--r-- | src/drivers/vpd/vpd.h | 5 | ||||
-rw-r--r-- | src/drivers/vpd/vpd_device_feature.c | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/drivers/vpd/Makefile.mk b/src/drivers/vpd/Makefile.mk index 615e48a18e..74c0ab50cb 100644 --- a/src/drivers/vpd/Makefile.mk +++ b/src/drivers/vpd/Makefile.mk @@ -4,5 +4,5 @@ bootblock-$(CONFIG_VPD) += vpd_decode.c vpd.c verstage-$(CONFIG_VPD) += vpd_decode.c vpd.c romstage-$(CONFIG_VPD) += vpd_decode.c vpd.c postcar-$(CONFIG_VPD) += vpd_decode.c vpd.c -ramstage-$(CONFIG_VPD) += vpd_decode.c vpd.c +ramstage-$(CONFIG_VPD) += vpd_decode.c vpd.c vpd_device_feature.c ramstage-$(CONFIG_SMBIOS_SERIAL_FROM_VPD) += vpd_serial.c diff --git a/src/drivers/vpd/vpd.h b/src/drivers/vpd/vpd.h index 817867aba4..a23005fca1 100644 --- a/src/drivers/vpd/vpd.h +++ b/src/drivers/vpd/vpd.h @@ -59,4 +59,9 @@ bool vpd_get_bool(const char *key, enum vpd_region region, */ bool vpd_get_int(const char *key, enum vpd_region region, int *val); +/* + * Return the value after reading the VPD key named "feature_device_info". + */ +const char *vpd_get_feature_device_info(void); + #endif /* __VPD_H__ */ diff --git a/src/drivers/vpd/vpd_device_feature.c b/src/drivers/vpd/vpd_device_feature.c new file mode 100644 index 0000000000..1c8682ab7e --- /dev/null +++ b/src/drivers/vpd/vpd_device_feature.c @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <drivers/vpd/vpd.h> + +#define VPD_KEY_FEATURE_DEVICE_INFO "feature_device_info" +#define VPD_FEATURE_DEVICE_INFO_LEN 64 + +const char *vpd_get_feature_device_info(void) +{ + static char device_info[VPD_FEATURE_DEVICE_INFO_LEN]; + if (vpd_gets(VPD_KEY_FEATURE_DEVICE_INFO, device_info, VPD_FEATURE_DEVICE_INFO_LEN, + VPD_RW)) + return device_info; + return ""; +} |