From ebd8a4f90cf58cd03a95fcc01acea1c59b0cad4e Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Wed, 1 Nov 2017 09:49:16 +0100 Subject: x86/smbios: Untangle system and board tables We were used to set the same values in the system and board tables. We'll keep the mainboard values as defaults for the system tables, so nothing changes unless somebody overrides the system table hooks. Change-Id: I3c9c95a1307529c3137647a161a698a4c3daa0ae Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/29477 Tested-by: build bot (Jenkins) Reviewed-by: Richard Spiegel Reviewed-by: HAOUAS Elyes --- src/Kconfig | 16 +++---- src/arch/x86/smbios.c | 54 +++++++++++++--------- src/drivers/i2c/at24rf08c/lenovo_serials.c | 2 +- src/include/smbios.h | 15 +++--- src/mainboard/emulation/qemu-i440fx/fw_cfg.c | 2 +- src/mainboard/google/fizz/mainboard.c | 2 +- src/mainboard/google/hatch/mainboard.c | 2 +- src/mainboard/google/kahlee/mainboard.c | 2 +- src/mainboard/google/octopus/mainboard.c | 2 +- .../google/poppy/variants/nami/mainboard.c | 2 +- .../google/poppy/variants/nautilus/mainboard.c | 2 +- .../google/poppy/variants/rammus/mainboard.c | 2 +- src/mainboard/google/reef/mainboard.c | 2 +- src/mainboard/google/sarien/sku.c | 2 +- src/mainboard/pcengines/apu1/mainboard.c | 2 +- src/mainboard/pcengines/apu2/mainboard.c | 2 +- src/mainboard/scaleway/tagada/ramstage.c | 4 +- 17 files changed, 63 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/Kconfig b/src/Kconfig index e527751519..62b3818fe4 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -631,33 +631,33 @@ config SMBIOS_PROVIDED_BY_MOBO default n config MAINBOARD_SERIAL_NUMBER - string "SMBIOS Serial Number" + prompt "SMBIOS Serial Number" if !SMBIOS_PROVIDED_BY_MOBO + string depends on GENERATE_SMBIOS_TABLES - depends on !SMBIOS_PROVIDED_BY_MOBO default "123456789" help The Serial Number to store in SMBIOS structures. config MAINBOARD_VERSION - string "SMBIOS Version Number" + prompt "SMBIOS Version Number" if !SMBIOS_PROVIDED_BY_MOBO + string depends on GENERATE_SMBIOS_TABLES - depends on !SMBIOS_PROVIDED_BY_MOBO default "1.0" help The Version Number to store in SMBIOS structures. config MAINBOARD_SMBIOS_MANUFACTURER - string "SMBIOS Manufacturer" + prompt "SMBIOS Manufacturer" if !SMBIOS_PROVIDED_BY_MOBO + string depends on GENERATE_SMBIOS_TABLES - depends on !SMBIOS_PROVIDED_BY_MOBO default MAINBOARD_VENDOR help Override the default Manufacturer stored in SMBIOS structures. config MAINBOARD_SMBIOS_PRODUCT_NAME - string "SMBIOS Product name" + prompt "SMBIOS Product name" if !SMBIOS_PROVIDED_BY_MOBO + string depends on GENERATE_SMBIOS_TABLES - depends on !SMBIOS_PROVIDED_BY_MOBO default MAINBOARD_PART_NUMBER help Override the default Product name stored in SMBIOS structures. diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 1d0ced16c9..8cb59df6a3 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -402,8 +402,6 @@ static int smbios_write_type0(unsigned long *current, int handle) return len; } -#if !CONFIG(SMBIOS_PROVIDED_BY_MOBO) - const char *__weak smbios_mainboard_serial_number(void) { return CONFIG_MAINBOARD_SERIAL_NUMBER; @@ -424,12 +422,6 @@ const char *__weak smbios_mainboard_product_name(void) return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; } -void __weak smbios_mainboard_set_uuid(u8 *uuid) -{ - /* leave all zero */ -} -#endif - const char *__weak smbios_mainboard_asset_tag(void) { return ""; @@ -450,17 +442,35 @@ smbios_board_type __weak smbios_mainboard_board_type(void) return SMBIOS_BOARD_TYPE_UNKNOWN; } -const char *__weak smbios_mainboard_sku(void) +const char *__weak smbios_system_serial_number(void) { - return ""; + return smbios_mainboard_serial_number(); } -#ifdef CONFIG_MAINBOARD_FAMILY -const char *smbios_mainboard_family(void) +const char *__weak smbios_system_version(void) +{ + return smbios_mainboard_version(); +} + +const char *__weak smbios_system_manufacturer(void) +{ + return smbios_mainboard_manufacturer(); +} + +const char *__weak smbios_system_product_name(void) { - return CONFIG_MAINBOARD_FAMILY; + return smbios_mainboard_product_name(); +} + +void __weak smbios_system_set_uuid(u8 *uuid) +{ + /* leave all zero */ +} + +const char *__weak smbios_system_sku(void) +{ + return ""; } -#endif /* CONFIG_MAINBOARD_FAMILY */ static int smbios_write_type1(unsigned long *current, int handle) { @@ -472,17 +482,17 @@ static int smbios_write_type1(unsigned long *current, int handle) t->handle = handle; t->length = len - 2; t->manufacturer = smbios_add_string(t->eos, - smbios_mainboard_manufacturer()); + smbios_system_manufacturer()); t->product_name = smbios_add_string(t->eos, - smbios_mainboard_product_name()); + smbios_system_product_name()); t->serial_number = smbios_add_string(t->eos, - smbios_mainboard_serial_number()); - t->sku = smbios_add_string(t->eos, smbios_mainboard_sku()); - t->version = smbios_add_string(t->eos, smbios_mainboard_version()); + smbios_system_serial_number()); + t->sku = smbios_add_string(t->eos, smbios_system_sku()); + t->version = smbios_add_string(t->eos, smbios_system_version()); #ifdef CONFIG_MAINBOARD_FAMILY - t->family = smbios_add_string(t->eos, smbios_mainboard_family()); + t->family = smbios_add_string(t->eos, CONFIG_MAINBOARD_FAMILY); #endif - smbios_mainboard_set_uuid(t->uuid); + smbios_system_set_uuid(t->uuid); len = t->length + smbios_string_table_len(t->eos); *current += len; return len; @@ -526,7 +536,7 @@ static int smbios_write_type3(unsigned long *current, int handle) t->handle = handle; t->length = len - 2; t->manufacturer = smbios_add_string(t->eos, - smbios_mainboard_manufacturer()); + smbios_system_manufacturer()); t->bootup_state = SMBIOS_STATE_SAFE; t->power_supply_state = SMBIOS_STATE_SAFE; t->thermal_state = SMBIOS_STATE_SAFE; diff --git a/src/drivers/i2c/at24rf08c/lenovo_serials.c b/src/drivers/i2c/at24rf08c/lenovo_serials.c index 60b12cea99..0a6b343e6f 100644 --- a/src/drivers/i2c/at24rf08c/lenovo_serials.c +++ b/src/drivers/i2c/at24rf08c/lenovo_serials.c @@ -115,7 +115,7 @@ const char *smbios_mainboard_product_name(void) return lenovo_mainboard_partnumber(); } -void smbios_mainboard_set_uuid(u8 *uuid) +void smbios_system_set_uuid(u8 *uuid) { static char result[16]; unsigned i; diff --git a/src/include/smbios.h b/src/include/smbios.h index c046b1a2a9..af83bfe304 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -35,22 +35,23 @@ int smbios_write_type41(unsigned long *current, int *handle, const char *name, u8 instance, u16 segment, u8 bus, u8 device, u8 function); +const char *smbios_system_manufacturer(void); +const char *smbios_system_product_name(void); +const char *smbios_system_serial_number(void); +const char *smbios_system_version(void); +void smbios_system_set_uuid(u8 *uuid); +const char *smbios_system_sku(void); + const char *smbios_mainboard_manufacturer(void); const char *smbios_mainboard_product_name(void); - const char *smbios_mainboard_serial_number(void); const char *smbios_mainboard_version(void); -void smbios_mainboard_set_uuid(u8 *uuid); + const char *smbios_mainboard_bios_version(void); const char *smbios_mainboard_asset_tag(void); u8 smbios_mainboard_feature_flags(void); const char *smbios_mainboard_location_in_chassis(void); - -const char *smbios_mainboard_sku(void); u8 smbios_mainboard_enclosure_type(void); -#ifdef CONFIG_MAINBOARD_FAMILY -const char *smbios_mainboard_family(void); -#endif #define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7) #define BIOS_CHARACTERISTICS_PC_CARD (1 << 8) diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index a83c581746..3acb11e5f5 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -495,7 +495,7 @@ const char *smbios_mainboard_serial_number(void) return type1_serial_number ?: CONFIG_MAINBOARD_SERIAL_NUMBER; } -void smbios_mainboard_set_uuid(u8 *uuid) +void smbios_system_set_uuid(u8 *uuid) { fw_cfg_smbios_init(); memcpy(uuid, type1_uuid, 16); diff --git a/src/mainboard/google/fizz/mainboard.c b/src/mainboard/google/fizz/mainboard.c index 5670936021..54fd7dfe6d 100644 --- a/src/mainboard/google/fizz/mainboard.c +++ b/src/mainboard/google/fizz/mainboard.c @@ -177,7 +177,7 @@ static uint8_t board_oem_id(void) return oem_id; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[5]; /* sku{0..7} */ diff --git a/src/mainboard/google/hatch/mainboard.c b/src/mainboard/google/hatch/mainboard.c index a0fbb73f43..eb77a0030b 100644 --- a/src/mainboard/google/hatch/mainboard.c +++ b/src/mainboard/google/hatch/mainboard.c @@ -36,7 +36,7 @@ static uint32_t get_board_sku(void) return sku_id; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[7]; /* sku{0..255} */ uint32_t sku_id = get_board_sku(); diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c index 32bf88e54c..1bf6c07045 100644 --- a/src/mainboard/google/kahlee/mainboard.c +++ b/src/mainboard/google/kahlee/mainboard.c @@ -216,7 +216,7 @@ void __weak variant_mainboard_suspend_resume(void) { } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[7]; /* sku{0..255} */ diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c index 5b011c8f19..4316ffed23 100644 --- a/src/mainboard/google/octopus/mainboard.c +++ b/src/mainboard/google/octopus/mainboard.c @@ -131,7 +131,7 @@ static uint32_t get_board_sku(void) return sku_id; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[7]; /* sku{0..255} */ uint32_t sku_id = get_board_sku(); diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c index e279693511..836c97ea40 100644 --- a/src/mainboard/google/poppy/variants/nami/mainboard.c +++ b/src/mainboard/google/poppy/variants/nami/mainboard.c @@ -104,7 +104,7 @@ uint32_t variant_board_sku(void) return sku_id; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[14]; /* sku{0..4294967295} */ diff --git a/src/mainboard/google/poppy/variants/nautilus/mainboard.c b/src/mainboard/google/poppy/variants/nautilus/mainboard.c index 08fb73f932..6d9f2e99a9 100644 --- a/src/mainboard/google/poppy/variants/nautilus/mainboard.c +++ b/src/mainboard/google/poppy/variants/nautilus/mainboard.c @@ -28,7 +28,7 @@ #define B_PCH_OC_WDT_CTL_EN BIT14 #define B_PCH_OC_WDT_CTL_UNXP_RESET_STS BIT22 -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[5]; /* sku{0-1} */ diff --git a/src/mainboard/google/poppy/variants/rammus/mainboard.c b/src/mainboard/google/poppy/variants/rammus/mainboard.c index a3474d4666..5c5b258885 100644 --- a/src/mainboard/google/poppy/variants/rammus/mainboard.c +++ b/src/mainboard/google/poppy/variants/rammus/mainboard.c @@ -34,7 +34,7 @@ uint32_t variant_board_sku(void) return sku_id; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[14]; /* sku{0..4294967295} */ diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c index 05af84a03e..20b6a26459 100644 --- a/src/mainboard/google/reef/mainboard.c +++ b/src/mainboard/google/reef/mainboard.c @@ -88,7 +88,7 @@ void __weak variant_board_ec_set_skuid(void) { } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku_str[7]; /* sku{0..255} */ diff --git a/src/mainboard/google/sarien/sku.c b/src/mainboard/google/sarien/sku.c index c064c02ef7..708793db9e 100644 --- a/src/mainboard/google/sarien/sku.c +++ b/src/mainboard/google/sarien/sku.c @@ -22,7 +22,7 @@ uint32_t sku_id(void) return VARIANT_SKU_ID; } -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { return VARIANT_SKU_NAME; } diff --git a/src/mainboard/pcengines/apu1/mainboard.c b/src/mainboard/pcengines/apu1/mainboard.c index 10460bd6f2..79a54b51eb 100644 --- a/src/mainboard/pcengines/apu1/mainboard.c +++ b/src/mainboard/pcengines/apu1/mainboard.c @@ -263,7 +263,7 @@ static void usb_oc_setup(void) /* * We will stuff the memory size into the smbios sku location. */ -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku[5]; if (sku[0] != 0) diff --git a/src/mainboard/pcengines/apu2/mainboard.c b/src/mainboard/pcengines/apu2/mainboard.c index 472b864bd9..5a19d20efc 100644 --- a/src/mainboard/pcengines/apu2/mainboard.c +++ b/src/mainboard/pcengines/apu2/mainboard.c @@ -235,7 +235,7 @@ const char *smbios_mainboard_serial_number(void) /* * We will stuff the memory size into the smbios sku location. */ -const char *smbios_mainboard_sku(void) +const char *smbios_system_sku(void) { static char sku[5]; if (sku[0] != 0) diff --git a/src/mainboard/scaleway/tagada/ramstage.c b/src/mainboard/scaleway/tagada/ramstage.c index 561c081d4b..d592d99cf4 100644 --- a/src/mainboard/scaleway/tagada/ramstage.c +++ b/src/mainboard/scaleway/tagada/ramstage.c @@ -41,8 +41,8 @@ const char *smbios_mainboard_serial_number(void) return CONFIG_MAINBOARD_SERIAL_NUMBER; } -/* Override smbios_mainboard_set_uuid */ -void smbios_mainboard_set_uuid(u8 *uuid) +/* Override smbios_system_set_uuid */ +void smbios_system_set_uuid(u8 *uuid) { const u8 *bmc_uuid = bmcinfo_uuid(); if (bmc_uuid) -- cgit v1.2.1