Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/55174 )
Change subject: ec/google/chromeec: Separate SMBIOS SKU functions ......................................................................
ec/google/chromeec: Separate SMBIOS SKU functions
All functions in ec_skuid.c except google_chromeec_get_board_sku() are for SMBIOS platforms. Move these functions to a new file to allow non-SMBIOS platforms to use google_chromeec_get_board_sku() without having to declare MAINBOARD_SMBIOS_MANUFACTURER.
BUG=none TEST=emerge-cherry coreboot BRANCH=none
Change-Id: I8916223f5f04afe4761be4ad3313e900efae90d4 Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M src/ec/google/chromeec/Makefile.inc M src/ec/google/chromeec/ec_skuid.c A src/ec/google/chromeec/ec_smbios_skuid.c 3 files changed, 45 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/55174/1
diff --git a/src/ec/google/chromeec/Makefile.inc b/src/ec/google/chromeec/Makefile.inc index a37d673..c53bffd 100644 --- a/src/ec/google/chromeec/Makefile.inc +++ b/src/ec/google/chromeec/Makefile.inc @@ -13,6 +13,12 @@ romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c
+ifeq ($(CONFIG_GENERATE_SMBIOS_TABLES),y) +smm-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_smbios_skuid.c +romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_smbios_skuid.c +ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_smbios_skuid.c +endif + bootblock-y += ec.c bootblock-$(CONFIG_EC_GOOGLE_CHROMEEC_LPC) += ec_lpc.c ramstage-y += ec.c crosec_proto.c vstore.c diff --git a/src/ec/google/chromeec/ec_skuid.c b/src/ec/google/chromeec/ec_skuid.c index 39a1c0b..8743244 100644 --- a/src/ec/google/chromeec/ec_skuid.c +++ b/src/ec/google/chromeec/ec_skuid.c @@ -1,11 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <stddef.h> -#include <boardid.h> #include <ec/google/chromeec/ec.h> -#include <console/console.h> -#include <string.h> -#include <smbios.h>
uint32_t google_chromeec_get_board_sku(void) { @@ -19,35 +15,3 @@
return sku_id; } - -const char *google_chromeec_smbios_system_sku(void) -{ - static char sku_str[14]; /* sku{0..2147483647} */ - uint32_t sku_id = google_chromeec_get_board_sku(); - snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id); - return sku_str; -} - -const char *smbios_system_sku(void) -{ - return google_chromeec_smbios_system_sku(); -} - -const char *smbios_mainboard_manufacturer(void) -{ - static char oem_name[32]; - static const char *manuf; - - if (manuf) - return manuf; - - if (google_chromeec_cbi_get_oem_name(&oem_name[0], - ARRAY_SIZE(oem_name)) < 0) { - printk(BIOS_ERR, "Couldn't obtain OEM name from CBI\n"); - manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; - } else { - manuf = &oem_name[0]; - } - - return manuf; -} diff --git a/src/ec/google/chromeec/ec_smbios_skuid.c b/src/ec/google/chromeec/ec_smbios_skuid.c new file mode 100644 index 0000000..1ee7283 --- /dev/null +++ b/src/ec/google/chromeec/ec_smbios_skuid.c @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <stddef.h> +#include <ec/google/chromeec/ec.h> +#include <console/console.h> +#include <string.h> +#include <smbios.h> + +const char *google_chromeec_smbios_system_sku(void) +{ + static char sku_str[14]; /* sku{0..2147483647} */ + uint32_t sku_id = google_chromeec_get_board_sku(); + snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id); + return sku_str; +} + +const char *smbios_system_sku(void) +{ + return google_chromeec_smbios_system_sku(); +} + +const char *smbios_mainboard_manufacturer(void) +{ + static char oem_name[32]; + static const char *manuf; + + if (manuf) + return manuf; + + if (google_chromeec_cbi_get_oem_name(&oem_name[0], + ARRAY_SIZE(oem_name)) < 0) { + printk(BIOS_ERR, "Couldn't obtain OEM name from CBI\n"); + manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; + } else { + manuf = &oem_name[0]; + } + + return manuf; +}