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>
This commit is contained in:
Johnny Lin 2019-12-03 18:46:54 +08:00 committed by Patrick Georgi
parent 8ac46b937c
commit 93ac30d189
2 changed files with 89 additions and 0 deletions

View File

@ -60,4 +60,6 @@ config FMDFILE
config IPMI_KCS_REGISTER_SPACING
default 4
config IPMI_FRU_SINGLE_RW_SZ
default 16
endif # BOARD_OCP_MONOLAKE

View File

@ -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 @@ static void mainboard_enable(struct device *dev)
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 @@ void smbios_system_set_uuid(u8 *uuid)
{
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;
}