summaryrefslogtreecommitdiff
path: root/src/mainboard/prodrive/hermes/mainboard.c
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/prodrive/hermes/mainboard.c
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/prodrive/hermes/mainboard.c')
-rw-r--r--src/mainboard/prodrive/hermes/mainboard.c23
1 files changed, 23 insertions, 0 deletions
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;