diff options
author | Duncan Laurie <dlaurie@google.com> | 2019-05-17 12:06:37 -0600 |
---|---|---|
committer | Duncan Laurie <dlaurie@chromium.org> | 2019-05-18 20:32:29 +0000 |
commit | 9beb52a17ca2dd574e1bfd734b9af88bf57db328 (patch) | |
tree | c340ec5f6ccf8d87845d3f8af5658d612f65608f | |
parent | f85f2f87465a50ff9572f4e3039c01105494f60a (diff) |
mb/google/sarien: Set serial number in SMBIOS
Set the system serial number from the VPD key "serial_number" and
the mainboard serial number from the VPD key "mlb_serial_number".
BUG=b:132970635
TEST=check serial number is set in SMBIOS based on VPD, and if there
is no VPD key found then it is empty.
Change-Id: Ia8f1486dcb1edc968b8eb1e6d989b10c05913aca
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32851
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r-- | src/mainboard/google/sarien/ramstage.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mainboard/google/sarien/ramstage.c b/src/mainboard/google/sarien/ramstage.c index d8d1c9dbe3..1d220461cf 100644 --- a/src/mainboard/google/sarien/ramstage.c +++ b/src/mainboard/google/sarien/ramstage.c @@ -14,6 +14,7 @@ */ #include <arch/acpi.h> +#include <drivers/vpd/vpd.h> #include <smbios.h> #include <soc/gpio.h> #include <soc/ramstage.h> @@ -21,6 +22,26 @@ #include <vendorcode/google/chromeos/chromeos.h> #if CONFIG(GENERATE_SMBIOS_TABLES) +#define VPD_KEY_SYSTEM_SERIAL "serial_number" +#define VPD_KEY_MAINBOARD_SERIAL "mlb_serial_number" +#define VPD_SERIAL_LEN 64 + +const char *smbios_system_serial_number(void) +{ + static char serial[VPD_SERIAL_LEN]; + if (vpd_gets(VPD_KEY_SYSTEM_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO)) + return serial; + return ""; +} + +const char *smbios_mainboard_serial_number(void) +{ + static char serial[VPD_SERIAL_LEN]; + if (vpd_gets(VPD_KEY_MAINBOARD_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO)) + return serial; + return ""; +} + /* mainboard silk screen shows DIMM-A and DIMM-B */ void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t) |