From f45fcd1cf3ff801816ea5462a0f0f3208a585c3a Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 26 Feb 2024 11:48:03 +0530 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80741 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- src/drivers/vpd/Makefile.mk | 2 +- src/drivers/vpd/vpd.h | 5 +++++ src/drivers/vpd/vpd_device_feature.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/drivers/vpd/vpd_device_feature.c 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 + +#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 ""; +} -- cgit v1.2.3