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>
This commit is contained in:
Angel Pons 2022-09-21 13:30:34 +02:00 committed by Martin Roth
parent f007ab7b43
commit c960564811
3 changed files with 31 additions and 5 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;