summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.c12
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.h1
-rw-r--r--src/mainboard/prodrive/hermes/smbios.c14
3 files changed, 15 insertions, 12 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c
index 7a92fe3757..54e0e11ec7 100644
--- a/src/mainboard/prodrive/hermes/eeprom.c
+++ b/src/mainboard/prodrive/hermes/eeprom.c
@@ -7,6 +7,7 @@
#include <device/pci_ops.h>
#include <device/smbus_host.h>
#include <soc/intel/common/block/smbus/smbuslib.h>
+#include <string.h>
#include <types.h>
#include "eeprom.h"
@@ -88,6 +89,17 @@ struct eeprom_bmc_settings *get_bmc_settings(void)
return &bmc_cfg;
}
+const char *eeprom_read_serial(const size_t offset, const char *const fallback)
+{
+ static char serial_no[HERMES_SERIAL_NUMBER_LENGTH] = { 0 };
+ memset(serial_no, 0, sizeof(serial_no));
+
+ if (eeprom_read_buffer(serial_no, offset, sizeof(serial_no)) == 0)
+ return serial_no;
+ else
+ return fallback;
+}
+
uint8_t get_bmc_hsi(void)
{
uint8_t hsi = 0;
diff --git a/src/mainboard/prodrive/hermes/eeprom.h b/src/mainboard/prodrive/hermes/eeprom.h
index 2f7eac7253..63e84afb6d 100644
--- a/src/mainboard/prodrive/hermes/eeprom.h
+++ b/src/mainboard/prodrive/hermes/eeprom.h
@@ -105,6 +105,7 @@ bool eeprom_read_buffer(void *blob, size_t read_offset, size_t size);
int check_signature(const size_t offset, const uint64_t signature);
struct eeprom_board_settings *get_board_settings(void);
struct eeprom_bmc_settings *get_bmc_settings(void);
+const char *eeprom_read_serial(size_t offset, const char *fallback);
uint8_t get_bmc_hsi(void);
void report_eeprom_error(const size_t off);
bool write_board_settings(const struct eeprom_board_layout *new_layout);
diff --git a/src/mainboard/prodrive/hermes/smbios.c b/src/mainboard/prodrive/hermes/smbios.c
index c1325d4771..923ce8170c 100644
--- a/src/mainboard/prodrive/hermes/smbios.c
+++ b/src/mainboard/prodrive/hermes/smbios.c
@@ -9,23 +9,13 @@
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;
+ return eeprom_read_serial(offset, 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;
+ return eeprom_read_serial(offset, CONFIG_MAINBOARD_SERIAL_NUMBER);
}
const char *smbios_mainboard_version(void)