summaryrefslogtreecommitdiff
path: root/src/mainboard/prodrive/hermes/smbios.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-07 18:08:23 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-06-16 09:56:54 +0000
commita15dea9ab257362306be3205460b974c5688e128 (patch)
tree8fc91b13d9b40becf55359d40b2d4c7bd212c384 /src/mainboard/prodrive/hermes/smbios.c
parentf8986a94b175d8703e18265c8c079fc73e8bcbc5 (diff)
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 <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55275 Reviewed-by: Patrick Rudolph <siro@das-labor.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/prodrive/hermes/smbios.c')
-rw-r--r--src/mainboard/prodrive/hermes/smbios.c28
1 files changed, 28 insertions, 0 deletions
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 <smbios.h>
+#include <types.h>
+
+#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;
+}