summaryrefslogtreecommitdiff
path: root/src/ec/google
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2021-06-03 16:26:13 +0800
committerPatrick Georgi <pgeorgi@google.com>2021-06-09 05:18:35 +0000
commit863b753918381fea66615185c3367cda0cb42d0a (patch)
treeb0fd3a1245b7b70c97ac3f9c08f9678eed64798b /src/ec/google
parentaddf340adfe8875781948514479959a9bfb8c6ed (diff)
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>
Diffstat (limited to 'src/ec/google')
-rw-r--r--src/ec/google/chromeec/Makefile.inc5
-rw-r--r--src/ec/google/chromeec/ec_skuid.c36
-rw-r--r--src/ec/google/chromeec/ec_smbios.c39
3 files changed, 44 insertions, 36 deletions
diff --git a/src/ec/google/chromeec/Makefile.inc b/src/ec/google/chromeec/Makefile.inc
index a37d673b33..cb3b97e610 100644
--- a/src/ec/google/chromeec/Makefile.inc
+++ b/src/ec/google/chromeec/Makefile.inc
@@ -13,6 +13,11 @@ smm-$(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
+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-$(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 39a1c0be82..874324497f 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 @@ uint32_t google_chromeec_get_board_sku(void)
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.c b/src/ec/google/chromeec/ec_smbios.c
new file mode 100644
index 0000000000..1ee7283dc1
--- /dev/null
+++ b/src/ec/google/chromeec/ec_smbios.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;
+}