Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39039 )
Change subject: mainboard/google/dedede: Migrate onto get fw_config helper ......................................................................
mainboard/google/dedede: Migrate onto get fw_config helper
Fix the FIXME.
BUG=b:149348474 BRANCH=none TEST=only tested on hatch
Change-Id: Ic84ffb6188d1f98b076142829fe49afd38c528bc Signed-off-by: Edward O'Callaghan quasisec@google.com --- M src/ec/google/chromeec/ec.c M src/ec/google/chromeec/ec.h M src/ec/google/chromeec/ec_boardid.c M src/mainboard/google/dedede/board_info.c 4 files changed, 13 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/39/39039/1
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 4bf41ac..c97b3ab 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -889,6 +889,17 @@
int google_chromeec_cbi_get_fw_config(uint32_t *fw_config) { + uint32_t sku_id = google_chromeec_get_board_sku(); + + /* + * FW_CONFIG can potentially have all the bits set. So check the + * sku_id to ensure that the CBI is provisioned before reading the + * FW_CONFIG. + */ + if ((sku_id == SKU_UNKNOWN) || + (sku_id > CONFIG_EC_GOOGLE_CHROMEEC_SKU_ID_MAX)) + return -1; + return cbi_get_uint32(fw_config, CBI_TAG_FW_CONFIG); }
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index f5c2e1a..16ecf88 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -88,6 +88,8 @@ int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize); int google_chromeec_cbi_get_oem_name(char *buf, size_t bufsize);
+#define SKU_UNKNOWN 0xFFFFFFFF + uint32_t google_chromeec_get_board_sku(void); const char *google_chromeec_smbios_system_sku(void);
diff --git a/src/ec/google/chromeec/ec_boardid.c b/src/ec/google/chromeec/ec_boardid.c index 41d9959..bc33007 100644 --- a/src/ec/google/chromeec/ec_boardid.c +++ b/src/ec/google/chromeec/ec_boardid.c @@ -30,8 +30,6 @@ return id; }
-#define SKU_UNKNOWN 0xFFFFFFFF - uint32_t google_chromeec_get_board_sku(void) { static uint32_t sku_id = SKU_UNKNOWN; diff --git a/src/mainboard/google/dedede/board_info.c b/src/mainboard/google/dedede/board_info.c index f9ed44d..7b10b23 100644 --- a/src/mainboard/google/dedede/board_info.c +++ b/src/mainboard/google/dedede/board_info.c @@ -38,19 +38,5 @@
int board_info_get_fw_config(uint32_t *fw_config) { - uint32_t sku_id = google_chromeec_get_board_sku(); - - /* FIXME: Move get_fw_config() in with rest of sku id helpers */ -#define SKU_UNKNOWN 0xffffffff -#define SKU_MAX 0x7fffffff - - /* - * FW_CONFIG can potentially have all the bits set. So check the - * sku_id to ensure that the CBI is provisioned before reading the - * FW_CONFIG. - */ - if (sku_id == SKU_UNKNOWN || sku_id > SKU_MAX) - return -1; - return google_chromeec_cbi_get_fw_config(fw_config); }