From a15dea9ab257362306be3205460b974c5688e128 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 7 Jun 2021 18:08:23 +0200 Subject: mb/prodrive/hermes: Use serial numbers from BMC The BMC EEPROM layout has been updated to contain system and mainboard serial numbers. Use these values in SMBIOS Type 1 and Type 2 tables. Change-Id: I55b51a856b4ad28fd56b02015b2e1d49cd629735 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/55275 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- src/mainboard/prodrive/hermes/Makefile.inc | 1 + src/mainboard/prodrive/hermes/smbios.c | 28 ++++++++++++++++++++++ .../hermes/variants/baseboard/include/eeprom.h | 6 ++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/prodrive/hermes/smbios.c diff --git a/src/mainboard/prodrive/hermes/Makefile.inc b/src/mainboard/prodrive/hermes/Makefile.inc index 6f6a638aff..d13b50aff7 100644 --- a/src/mainboard/prodrive/hermes/Makefile.inc +++ b/src/mainboard/prodrive/hermes/Makefile.inc @@ -10,6 +10,7 @@ romstage-y += eeprom.c ramstage-y += ramstage.c ramstage-y += mainboard.c ramstage-y += eeprom.c +ramstage-y += smbios.c ramstage-$(CONFIG_AZALIA_PLUGIN_SUPPORT) += variants/baseboard/hda_verb.c ramstage-$(CONFIG_AZALIA_PLUGIN_SUPPORT) += variants/r04/hda_verb.c diff --git a/src/mainboard/prodrive/hermes/smbios.c b/src/mainboard/prodrive/hermes/smbios.c new file mode 100644 index 0000000000..02567d8777 --- /dev/null +++ b/src/mainboard/prodrive/hermes/smbios.c @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +#include "variants/baseboard/include/eeprom.h" + +const char *smbios_system_serial_number(void) +{ + const size_t offset = offsetof(struct eeprom_layout, system_serial_number); + static char serial_no[HERMES_SERIAL_NUMBER_LENGTH] = { 0 }; + + if (eeprom_read_buffer(serial_no, offset, sizeof(serial_no)) == 0) + return serial_no; + else + return CONFIG_MAINBOARD_SERIAL_NUMBER; +} + +const char *smbios_mainboard_serial_number(void) +{ + const size_t offset = offsetof(struct eeprom_layout, board_serial_number); + static char serial_no[HERMES_SERIAL_NUMBER_LENGTH] = { 0 }; + + if (eeprom_read_buffer(serial_no, offset, sizeof(serial_no)) == 0) + return serial_no; + else + return CONFIG_MAINBOARD_SERIAL_NUMBER; +} diff --git a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h index 4e6557a15a..9ec4604fc2 100644 --- a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h +++ b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h @@ -62,6 +62,8 @@ struct __packed eeprom_bmc_settings { uint8_t hsi; }; +#define HERMES_SERIAL_NUMBER_LENGTH 32 + /* The EEPROM on address 0x57 has the following vendor defined layout: */ struct __packed eeprom_layout { union { @@ -76,7 +78,9 @@ struct __packed eeprom_layout { uint8_t RawBoardLayout[0x400]; struct eeprom_board_layout BoardLayout; }; - uint8_t BootOrder[0x900]; + char system_serial_number[HERMES_SERIAL_NUMBER_LENGTH]; + char board_serial_number[HERMES_SERIAL_NUMBER_LENGTH]; + uint8_t BootOrder[0x8c0]; union { uint8_t RawBoardSetting[0xF8]; struct eeprom_board_settings BoardSettings; -- cgit v1.2.3