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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55174
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Yu-Ping Wu
2021-06-03 16:26:13 +08:00
committed by Patrick Georgi
parent addf340adf
commit 863b753918
3 changed files with 44 additions and 36 deletions

View File

@@ -13,6 +13,11 @@ smm-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c
romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_skuid.c
ifeq ($(CONFIG_GENERATE_SMBIOS_TABLES),y)
romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_smbios.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SKUID) += ec_smbios.c
endif
bootblock-y += ec.c bootblock-y += ec.c
bootblock-$(CONFIG_EC_GOOGLE_CHROMEEC_LPC) += ec_lpc.c bootblock-$(CONFIG_EC_GOOGLE_CHROMEEC_LPC) += ec_lpc.c
ramstage-y += ec.c crosec_proto.c vstore.c ramstage-y += ec.c crosec_proto.c vstore.c

View File

@@ -1,11 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <stddef.h> #include <stddef.h>
#include <boardid.h>
#include <ec/google/chromeec/ec.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) uint32_t google_chromeec_get_board_sku(void)
{ {
@@ -19,35 +15,3 @@ uint32_t google_chromeec_get_board_sku(void)
return sku_id; 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;
}

View File

@@ -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;
}