Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37445 )
Change subject: mb/ocp/monolake: Override SMBIOS data with IPMI read FRU data ......................................................................
mb/ocp/monolake: Override SMBIOS data with IPMI read FRU data
SMBIOS type 1 data fields are overwritten by FRU product info area data, SMBIOS type 2 fields are overwritten by FRU board info area data.
Tested on OCP Mono Lake.
Change-Id: I58cbe95055dea053b115e99f354f40d5902c6a35 Signed-off-by: Johnny Lin johnny_lin@wiwynn.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/37445 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: David Hendricks david.hendricks@gmail.com --- M src/mainboard/ocp/monolake/Kconfig M src/mainboard/ocp/monolake/mainboard.c 2 files changed, 89 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified David Hendricks: Looks good to me, approved
diff --git a/src/mainboard/ocp/monolake/Kconfig b/src/mainboard/ocp/monolake/Kconfig index 7d85bbb..bbc29a3 100644 --- a/src/mainboard/ocp/monolake/Kconfig +++ b/src/mainboard/ocp/monolake/Kconfig @@ -60,4 +60,6 @@ config IPMI_KCS_REGISTER_SPACING default 4
+config IPMI_FRU_SINGLE_RW_SZ + default 16 endif # BOARD_OCP_MONOLAKE diff --git a/src/mainboard/ocp/monolake/mainboard.c b/src/mainboard/ocp/monolake/mainboard.c index a75aae7..9a1c995 100644 --- a/src/mainboard/ocp/monolake/mainboard.c +++ b/src/mainboard/ocp/monolake/mainboard.c @@ -30,6 +30,9 @@ #define VPD_LEN 10 /* Default countdown is 15 minutes. */ #define DEFAULT_COUNTDOWN 9000 +#define FRU_DEVICE_ID 0 + +static struct fru_info_str fru_strings;
static void init_frb2_wdt(void) { @@ -76,6 +79,7 @@ clear_ipmi_flags(&rsp); system_reset(); } + read_fru_areas(BMC_KCS_BASE, FRU_DEVICE_ID, 0, &fru_strings); }
struct chip_operations mainboard_ops = { @@ -101,3 +105,86 @@ { ipmi_get_system_guid(BMC_KCS_BASE, uuid); } +/* Override SMBIOS type 1 data. */ +const char *smbios_system_manufacturer(void) +{ + if (fru_strings.prod_info.manufacturer != NULL) + return (const char *)fru_strings.prod_info.manufacturer; + else + return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; +} + +const char *smbios_system_product_name(void) +{ + char *prod_name_partnumber; + /* Concatenates IPMI FRU Product Info product name + * and product part number. */ + if (fru_strings.prod_info.product_name != NULL) { + if (fru_strings.prod_info.product_partnumber != NULL) { + /* Append a space after product_name. */ + prod_name_partnumber = strconcat(fru_strings.prod_info.product_name, + " "); + if (!prod_name_partnumber) + return (const char *)fru_strings.prod_info.product_name; + + prod_name_partnumber = strconcat(prod_name_partnumber, + fru_strings.prod_info.product_partnumber); + if (!prod_name_partnumber) + return (const char *)fru_strings.prod_info.product_name; + + return (const char *)prod_name_partnumber; + } else { + return (const char *)fru_strings.prod_info.product_name; + } + } else { + return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; + } +} + +const char *smbios_system_serial_number(void) +{ + if (fru_strings.prod_info.serial_number != NULL) + return (const char *)fru_strings.prod_info.serial_number; + else + return CONFIG_MAINBOARD_SERIAL_NUMBER; +} + +const char *smbios_system_version(void) +{ + if (fru_strings.prod_info.product_version != NULL) + return (const char *)fru_strings.prod_info.product_version; + else + return CONFIG_MAINBOARD_SERIAL_NUMBER; +} +/* Override SMBIOS type 2 data. */ +const char *smbios_mainboard_version(void) +{ + if (fru_strings.board_info.part_number != NULL) + return (const char *)fru_strings.board_info.part_number; + else + return CONFIG_MAINBOARD_VERSION; +} + +const char *smbios_mainboard_manufacturer(void) +{ + if (fru_strings.board_info.manufacturer != NULL) + return (const char *)fru_strings.board_info.manufacturer; + else + return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; +} + +const char *smbios_mainboard_product_name(void) +{ + if (fru_strings.board_info.product_name != NULL) + return (const char *)fru_strings.board_info.product_name; + else + return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; +} + +const char *smbios_mainboard_serial_number(void) +{ + if (fru_strings.board_info.serial_number != NULL) + return (const char *)fru_strings.board_info.serial_number; + else + return CONFIG_MAINBOARD_SERIAL_NUMBER; +}