diff options
author | Wim Vervoorn <wvervoorn@eltan.com> | 2020-02-04 13:21:41 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-02-18 15:31:26 +0000 |
commit | 5bf7b1ac69e796ff508325eab2b8c27cc782372d (patch) | |
tree | db51e41ec0ff51d14600446b6042131641cbde62 /src/mainboard | |
parent | 2e7c2cef15c88f000380668e8948e71b7d8d7f75 (diff) |
mb/facebook/monolith: Use serial number and UUID from VPD
The serial number and UUID returned by DMI are retrieved from VPD.
The solution supports a 16 character "serial_number" and a 36 character
"UUID" string.
BUG=N/A
TEST=tested on monolith
Change-Id: I0b6ce769cfa81a1e248a35f6149b7d1bbcf1f836
Signed-off-by: Wim Vervoorn <wvervoorn@eltan.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38753
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/facebook/monolith/ramstage.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mainboard/facebook/monolith/ramstage.c b/src/mainboard/facebook/monolith/ramstage.c index bed104956f..05cbf31adc 100644 --- a/src/mainboard/facebook/monolith/ramstage.c +++ b/src/mainboard/facebook/monolith/ramstage.c @@ -14,7 +14,14 @@ * GNU General Public License for more details. */ +#include <stdint.h> +#include <console/console.h> +#include <drivers/vpd/vpd.h> +#include <lib.h> +#include <smbios.h> #include <soc/ramstage.h> +#include <uuid.h> + #include "gpio.h" void mainboard_silicon_init_params(FSP_SIL_UPD *params) @@ -24,3 +31,30 @@ void mainboard_silicon_init_params(FSP_SIL_UPD *params) gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); params->CdClock = 3; } + +#define VPD_KEY_SERIAL "serial_number" +#define VPD_KEY_UUID "UUID" +#define VPD_SERIAL_LEN 17 + +const char *smbios_system_serial_number(void) +{ + static char serial[VPD_SERIAL_LEN]; + + if (vpd_gets(VPD_KEY_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO)) + return serial; + + printk(BIOS_ERR, "serial_number could not be read or invalid.\n"); + return ""; +} + +void smbios_system_set_uuid(u8 *uuid) +{ + static char vpd_uuid_string[UUID_STRLEN+1]; + + if (vpd_gets(VPD_KEY_UUID, vpd_uuid_string, UUID_STRLEN+1, VPD_RO)) + if (!parse_uuid(uuid, vpd_uuid_string)) + return; + + memset(uuid, 0, UUID_LEN); + printk(BIOS_ERR, "UUID could not be read or invalid.\n"); +} |