summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2022-10-22 22:39:26 -0500
committerFelix Held <felix-coreboot@felixheld.de>2022-12-07 16:02:02 +0000
commit4862d53ff25a5dc1c4e15a87240c666fa9bc2c6c (patch)
treeae1118f128a367bb10dbd2eb94875564378fa8ff /src/mainboard/google
parent96fa6a24d858cbdcf849824a5f7e135f3ca2a84e (diff)
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 <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68754 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/glados/variants/lars/variant.c25
1 files changed, 25 insertions, 0 deletions
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 <stdint.h>
#include <string.h>
#include <baseboard/variant.h>
+#include <drivers/vpd/vpd.h>
#include <fsp/soc_binding.h>
+#include <smbios.h>
#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;
+}