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>
This commit is contained in:
Matt DeVillier 2022-10-22 22:39:26 -05:00 committed by Felix Held
parent 96fa6a24d8
commit 4862d53ff2
1 changed files with 25 additions and 0 deletions

View File

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