Attention is currently required from: Sean Rhodes, Jason Nien, Patrick Rudolph, Caveh Jalali, Christian Walter, Martin Roth, Boris Mittelberg.
Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74452 )
Change subject: SMBIOS: Move identication strings ......................................................................
SMBIOS: Move identication strings
This improve ccache hit rate, as the strings are only expanded in for object lib/identity.o.
Change-Id: I28a8199b4a5482984dd7fdde67e90acca5af5ca6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/smbios.c M src/arch/x86/smbios_defaults.c M src/drivers/generic/cbfs-serial/cbfs-serial.c M src/ec/google/chromeec/ec_smbios.c M src/include/identity.h M src/include/smbios.h M src/lib/identity.c M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/google/kahlee/variants/baseboard/mainboard.c M src/mainboard/google/poppy/variants/nami/mainboard.c M src/mainboard/prodrive/hermes/smbios.c M src/mainboard/starlabs/lite/smbios.c M src/mainboard/starlabs/starbook/smbios.c 13 files changed, 60 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/74452/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 1ec0ad2..d40b958 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -4,13 +4,13 @@ #include <string.h> #include <smbios.h> #include <console/console.h> -#include <version.h> #include <device/device.h> #include <device/dram/spd.h> #include <arch/cpu.h> #include <cpu/x86/name.h> #include <elog.h> #include <endian.h> +#include <identity.h> #include <memory_info.h> #include <spd.h> #include <cbmem.h> @@ -19,6 +19,7 @@ #include <device/pci.h> #include <drivers/vpd/vpd.h> #include <stdlib.h> +#include <version.h>
#define update_max(len, max_len, stmt) \ do { \ @@ -493,9 +494,8 @@ t->wakeup_type = smbios_system_wakeup_type(); 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, CONFIG_MAINBOARD_FAMILY); -#endif + if (smbios_cfg_mb_family[0]) + t->family = smbios_add_string(t->eos, smbios_cfg_mb_family); smbios_system_set_uuid(t->uuid); const int len = smbios_full_table_len(&t->header, t->eos); *current += len; diff --git a/src/arch/x86/smbios_defaults.c b/src/arch/x86/smbios_defaults.c index 8b62ebb..171802c 100644 --- a/src/arch/x86/smbios_defaults.c +++ b/src/arch/x86/smbios_defaults.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <identity.h> #include <memory_info.h> #include <smbios.h> #include <stdint.h> @@ -39,22 +40,22 @@
__weak const char *smbios_mainboard_serial_number(void) { - return CONFIG_MAINBOARD_SERIAL_NUMBER; + return smbios_cfg_mb_serial_number; }
__weak const char *smbios_mainboard_version(void) { - return CONFIG_MAINBOARD_VERSION; + return smbios_cfg_mb_version; }
__weak const char *smbios_mainboard_manufacturer(void) { - return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + return smbios_cfg_mb_manufacturer; }
__weak const char *smbios_mainboard_product_name(void) { - return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; + return smbios_cfg_mb_product_name; }
__weak const char *smbios_mainboard_asset_tag(void) diff --git a/src/drivers/generic/cbfs-serial/cbfs-serial.c b/src/drivers/generic/cbfs-serial/cbfs-serial.c index 6ff010c..6963df9 100644 --- a/src/drivers/generic/cbfs-serial/cbfs-serial.c +++ b/src/drivers/generic/cbfs-serial/cbfs-serial.c @@ -20,8 +20,7 @@ return serial_number; }
- strncpy(serial_number, CONFIG_MAINBOARD_SERIAL_NUMBER, - MAX_SERIAL_LENGTH); + strncpy(serial_number, smbios_cfg_mb_serial_number, MAX_SERIAL_LENGTH);
return serial_number; } diff --git a/src/ec/google/chromeec/ec_smbios.c b/src/ec/google/chromeec/ec_smbios.c index d804f64..9878c0b 100644 --- a/src/ec/google/chromeec/ec_smbios.c +++ b/src/ec/google/chromeec/ec_smbios.c @@ -27,7 +27,7 @@ if (manuf) return manuf;
- manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + manuf = smbios_cfg_mb_manufacturer; if (google_chromeec_cbi_get_oem_name(&oem_name[0], ARRAY_SIZE(oem_name)) < 0) printk(BIOS_INFO, "Couldn't obtain OEM name from CBI\n"); else if (strlen(oem_name) > 0) diff --git a/src/include/identity.h b/src/include/identity.h index d939291..e329cae 100644 --- a/src/include/identity.h +++ b/src/include/identity.h @@ -8,4 +8,11 @@ extern const char mainboard_vendor[]; extern const char mainboard_part_number[];
+/* SMBIOS defaults */ +extern const char smbios_cfg_mb_serial_number[]; +extern const char smbios_cfg_mb_manufacturer[]; +extern const char smbios_cfg_mb_version[]; +extern const char smbios_cfg_mb_product_name[]; +extern const char smbios_cfg_mb_family[]; + #endif /* IDENTITY_H */ diff --git a/src/include/smbios.h b/src/include/smbios.h index 446652c..fc93c4b 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -6,6 +6,9 @@ #include <types.h> #include <memory_info.h>
+/* indirect */ +#include <version.h> + unsigned long smbios_write_tables(unsigned long start); int smbios_add_string(u8 *start, const char *str); int smbios_string_table_len(u8 *start); diff --git a/src/lib/identity.c b/src/lib/identity.c index 04371a7..3cc90b82 100644 --- a/src/lib/identity.c +++ b/src/lib/identity.c @@ -12,3 +12,15 @@ const char mainboard_vendor[] = CONFIG_MAINBOARD_VENDOR; const char mainboard_part_number[] = CONFIG_MAINBOARD_PART_NUMBER; const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER; + +const char smbios_cfg_mb_version[] = CONFIG_MAINBOARD_VERSION; +const char smbios_cfg_mb_serial_number[] = CONFIG_MAINBOARD_SERIAL_NUMBER; +#ifdef CONFIG_MAINBOARD_FAMILY +const char smbios_cfg_mb_family[] = CONFIG_MAINBOARD_FAMILY; +#else +const char smbios_cfg_mb_family[] = "\0"; +#endif + +/* These default to MAINBOARD_VENDOR and MAINBOARD_PART_NUMBER. */ +const char smbios_cfg_mb_manufacturer[] = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; +const char smbios_cfg_mb_product_name[] = CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index 5c23988..bea0964 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -478,25 +478,25 @@ const char *smbios_mainboard_manufacturer(void) { fw_cfg_smbios_init(); - return type1_manufacturer ?: CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + return type1_manufacturer ?: smbios_cfg_mb_manufacturer; }
const char *smbios_mainboard_product_name(void) { fw_cfg_smbios_init(); - return type1_product_name ?: CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; + return type1_product_name ?: smbios_cfg_mb_product_name; }
const char *smbios_mainboard_version(void) { fw_cfg_smbios_init(); - return type1_version ?: CONFIG_MAINBOARD_VERSION; + return type1_version ?: smbios_cfg_mb_version; }
const char *smbios_mainboard_serial_number(void) { fw_cfg_smbios_init(); - return type1_serial_number ?: CONFIG_MAINBOARD_SERIAL_NUMBER; + return type1_serial_number ?: smbios_cfg_mb_serial_number; }
void smbios_system_set_uuid(u8 *uuid) diff --git a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c index 7893449..5c012e2 100644 --- a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c +++ b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c @@ -35,7 +35,7 @@ static const char *manuf;
if (!CONFIG(USE_OEM_BIN)) - return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + return smbios_cfg_mb_manufacturer;
if (manuf) return manuf; @@ -43,7 +43,7 @@ if (cbfs_load("oem.bin", oem_bin_data, sizeof(oem_bin_data) - 1)) manuf = &oem_bin_data[0]; else - manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + manuf = smbios_cfg_mb_manufacturer;
return manuf; } diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c index b703d40..ad7a7df 100644 --- a/src/mainboard/google/poppy/variants/nami/mainboard.c +++ b/src/mainboard/google/poppy/variants/nami/mainboard.c @@ -153,7 +153,7 @@
/* If OEM ID cannot be determined, return default manuf string. */ if (oem_id == OEM_UNKNOWN) - return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + return smbios_cfg_mb_manufacturer;
oem_data_size = cbfs_load("oem.bin", oem_bin_data, sizeof(oem_bin_data)); @@ -169,7 +169,7 @@ }
if (manuf == NULL) - manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + manuf = smbios_cfg_mb_manufacturer;
return manuf; } diff --git a/src/mainboard/prodrive/hermes/smbios.c b/src/mainboard/prodrive/hermes/smbios.c index 923ce81..855c288 100644 --- a/src/mainboard/prodrive/hermes/smbios.c +++ b/src/mainboard/prodrive/hermes/smbios.c @@ -9,13 +9,13 @@ const char *smbios_system_serial_number(void) { const size_t offset = offsetof(struct eeprom_layout, system_serial_number); - return eeprom_read_serial(offset, CONFIG_MAINBOARD_SERIAL_NUMBER); + return eeprom_read_serial(offset, smbios_cfg_mb_serial_number); }
const char *smbios_mainboard_serial_number(void) { const size_t offset = offsetof(struct eeprom_layout, board_serial_number); - return eeprom_read_serial(offset, CONFIG_MAINBOARD_SERIAL_NUMBER); + return eeprom_read_serial(offset, smbios_cfg_mb_serial_number); }
const char *smbios_mainboard_version(void) diff --git a/src/mainboard/starlabs/lite/smbios.c b/src/mainboard/starlabs/lite/smbios.c index d9ae270..2f578fa 100644 --- a/src/mainboard/starlabs/lite/smbios.c +++ b/src/mainboard/starlabs/lite/smbios.c @@ -8,6 +8,7 @@ #include <types.h> #include <uuid.h> #include <variants.h> +#include <identity.h>
/* Get the Embedded Controller firmware version */ void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision) @@ -20,7 +21,7 @@
const char *smbios_system_sku(void) { - return CONFIG_MAINBOARD_FAMILY; + return smbios_cfg_mb_family; }
u8 smbios_mainboard_feature_flags(void) diff --git a/src/mainboard/starlabs/starbook/smbios.c b/src/mainboard/starlabs/starbook/smbios.c index ab2c211..3a53f6e 100644 --- a/src/mainboard/starlabs/starbook/smbios.c +++ b/src/mainboard/starlabs/starbook/smbios.c @@ -8,6 +8,7 @@ #include <types.h> #include <uuid.h> #include <variants.h> +#include <identity.h>
/* Get the Embedded Controller firmware version */ void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision) @@ -20,7 +21,7 @@
const char *smbios_system_sku(void) { - return CONFIG_MAINBOARD_FAMILY; + return smbios_cfg_mb_family; }
u8 smbios_mainboard_feature_flags(void)