From 4862d53ff25a5dc1c4e15a87240c666fa9bc2c6c Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sat, 22 Oct 2022 22:39:26 -0500 Subject: [PATCH] mb/google/glados/var/lars: Set SKU ID based on VPD LARS has two variants, LARS and LILI, which are differentiated via the customization_id field in the VPD. To make differentiation easier outside of ChromeOS (ie, for Windows/Linux drivers), set the SKU ID based on VPD so it can be easily read via SMBIOS. Modeled after similar code in google/reef (snappy variant). TEST=build/boot lili variant, verify sku1 populated in SMBIOS tables. Change-Id: I148462b6f86b25fa8db26ea6e1537d1a5e47984b Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/68754 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Angel Pons --- .../google/glados/variants/lars/variant.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/mainboard/google/glados/variants/lars/variant.c b/src/mainboard/google/glados/variants/lars/variant.c index a4e42b170f..aead670fb3 100644 --- a/src/mainboard/google/glados/variants/lars/variant.c +++ b/src/mainboard/google/glados/variants/lars/variant.c @@ -3,7 +3,9 @@ #include #include #include +#include #include +#include #define K4E6E304EB_MEM_ID 0x5 @@ -14,6 +16,9 @@ #define MEM_SINGLE_CHANB 0xb #define MEM_SINGLE_CHANC 0xc +#define VPD_KEY_CUSTOMIZATION_ID "customization_id" +#define VPD_CUSTOMIZATION_LEN 32 + void variant_memory_init_params(FSPM_UPD *mupd, const int spd_index) { FSP_M_CONFIG *mem_cfg; @@ -63,3 +68,23 @@ int is_dual_channel(const int spd_index) && spd_index != MEM_SINGLE_CHANB && spd_index != MEM_SINGLE_CHANC); } + +/* SKU ID enumeration */ +#define SKU_LARS "sku0" +#define SKU_LILI "sku1" + +const char *smbios_system_sku(void) +{ + if (!CONFIG(VPD)) + return SKU_LARS; + + static char customization_id[VPD_CUSTOMIZATION_LEN]; + if (!vpd_gets(VPD_KEY_CUSTOMIZATION_ID, customization_id, + VPD_CUSTOMIZATION_LEN, VPD_RO)) + return SKU_LARS; + + if (strstr(customization_id, "LILI")) + return SKU_LILI; + + return SKU_LARS; +}