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>
This commit is contained in:
Subrata Banik
2024-02-26 11:48:03 +05:30
parent be426e0722
commit f45fcd1cf3
3 changed files with 21 additions and 1 deletions

View File

@@ -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

View File

@@ -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__ */

View File

@@ -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 "";
}