Martin Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/67759 )
Change subject: mb/prodrive/hermes: Add part numbers to SMBIOS ......................................................................
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 --- M src/mainboard/prodrive/hermes/eeprom.c M src/mainboard/prodrive/hermes/eeprom.h M src/mainboard/prodrive/hermes/mainboard.c 3 files changed, 49 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Lean Sheng Tan: Looks good to me, approved
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index 54e0e11..4d67133 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -91,7 +91,7 @@
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 63e84af..97a1f48 100644 --- a/src/mainboard/prodrive/hermes/eeprom.h +++ b/src/mainboard/prodrive/hermes/eeprom.h @@ -68,7 +68,7 @@ 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 @@ 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 a713342..c2f8b63 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 @@ 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 @@ 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;