summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2022-09-21 13:30:34 +0200
committerMartin Roth <martin.roth@amd.corp-partner.google.com>2022-10-08 21:06:08 +0000
commitc96056481115fd6656be87d62d039dfd5f0f591f (patch)
tree8946902ce5c59e12416f231c710d688e44a0c23c /src/mainboard
parentf007ab7b43f920c4a7d44dcc43782705ca32e28a (diff)
mb/prodrive/hermes: Add part numbers to SMBIOS
Adjust the EEPROM layout to account for two new fields: board part number and product part number. In addition, put them in a Type 11 SMBIOS table (OEM Strings). Also, rename a macro to better reflect its purpose. Change-Id: I26c17ab37859c3306fe72c3f0cdc1d3787b48157 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67759 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.c2
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.h11
-rw-r--r--src/mainboard/prodrive/hermes/mainboard.c23
3 files changed, 31 insertions, 5 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c
index 54e0e11ec7..4d671332ce 100644
--- a/src/mainboard/prodrive/hermes/eeprom.c
+++ b/src/mainboard/prodrive/hermes/eeprom.c
@@ -91,7 +91,7 @@ struct eeprom_bmc_settings *get_bmc_settings(void)
const char *eeprom_read_serial(const size_t offset, const char *const fallback)
{
- static char serial_no[HERMES_SERIAL_NUMBER_LENGTH] = { 0 };
+ static char serial_no[HERMES_SN_PN_LENGTH] = { 0 };
memset(serial_no, 0, sizeof(serial_no));
if (eeprom_read_buffer(serial_no, offset, sizeof(serial_no)) == 0)
diff --git a/src/mainboard/prodrive/hermes/eeprom.h b/src/mainboard/prodrive/hermes/eeprom.h
index 63e84afb6d..97a1f48dbe 100644
--- a/src/mainboard/prodrive/hermes/eeprom.h
+++ b/src/mainboard/prodrive/hermes/eeprom.h
@@ -68,7 +68,7 @@ struct __packed eeprom_bmc_settings {
uint8_t efp3_displayport;
};
-#define HERMES_SERIAL_NUMBER_LENGTH 32
+#define HERMES_SN_PN_LENGTH 32
/* The EEPROM on address 0x57 has the following vendor defined layout: */
struct __packed eeprom_layout {
@@ -84,9 +84,12 @@ struct __packed eeprom_layout {
uint8_t raw_board_layout[0x400];
struct eeprom_board_layout board_layout;
};
- char system_serial_number[HERMES_SERIAL_NUMBER_LENGTH];
- char board_serial_number[HERMES_SERIAL_NUMBER_LENGTH];
- uint8_t boot_order[0x8c0];
+ char system_serial_number[HERMES_SN_PN_LENGTH];
+ char board_serial_number[HERMES_SN_PN_LENGTH];
+ uint8_t boot_order[0x200];
+ char board_part_number[HERMES_SN_PN_LENGTH];
+ char product_part_number[HERMES_SN_PN_LENGTH];
+ uint8_t unused[0x680];
union {
uint8_t raw_board_settings[0xf8];
struct eeprom_board_settings board_settings;
diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c
index a713342d96..c2f8b63e10 100644
--- a/src/mainboard/prodrive/hermes/mainboard.c
+++ b/src/mainboard/prodrive/hermes/mainboard.c
@@ -14,6 +14,7 @@
#include <intelblocks/pmclib.h>
#include <smbios.h>
#include <soc/gpio.h>
+#include <string.h>
#include <types.h>
#include "eeprom.h"
@@ -170,6 +171,27 @@ static void mainboard_final(struct device *dev)
pmc_soc_set_afterg3_en(on);
}
+static const char *format_pn(const char *prefix, size_t offset)
+{
+ static char buffer[32 + HERMES_SN_PN_LENGTH] = { 0 };
+
+ const char *part_num = eeprom_read_serial(offset, "N/A");
+
+ memset(buffer, 0, sizeof(buffer));
+ strcpy(buffer, prefix);
+ strcpy(buffer + strlen(prefix), part_num);
+
+ return buffer;
+}
+
+static void mainboard_smbios_strings(struct device *dev, struct smbios_type11 *t)
+{
+ const size_t board_offset = offsetof(struct eeprom_layout, board_part_number);
+ const size_t product_offset = offsetof(struct eeprom_layout, product_part_number);
+ t->count = smbios_add_string(t->eos, format_pn("Board P/N: ", board_offset));
+ t->count = smbios_add_string(t->eos, format_pn("Product P/N: ", product_offset));
+}
+
#if CONFIG(HAVE_ACPI_TABLES)
static void mainboard_acpi_fill_ssdt(const struct device *dev)
{
@@ -215,6 +237,7 @@ static void mainboard_enable(struct device *dev)
mb_usb2_fp2_pwr_enable(1);
dev->ops->final = mainboard_final;
+ dev->ops->get_smbios_strings = mainboard_smbios_strings;
#if CONFIG(HAVE_ACPI_TABLES)
dev->ops->acpi_fill_ssdt = mainboard_acpi_fill_ssdt;