ec/google/chromeec: expose failure and unprovisioned SKU id values

Provide CROS_SKU_UNKNOWN and CROS_SKU_UNPROVISIONED defintion so
callers can utilize the default and failing value without open coding it.

BUG=b:153642124

Change-Id: I447004e9016b6ab3306ea532721494ebbcda741d
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40299
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Aaron Durbin 2020-04-09 22:23:39 -06:00
parent 2a203c50ef
commit 32107dffb7
2 changed files with 6 additions and 5 deletions

View File

@ -79,6 +79,9 @@ int google_chromeec_cbi_get_fw_config(uint32_t *fw_config);
int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize); 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); int google_chromeec_cbi_get_oem_name(char *buf, size_t bufsize);
#define CROS_SKU_UNKNOWN 0xFFFFFFFF
#define CROS_SKU_UNPROVISIONED 0x7FFFFFFF
/* Returns CROS_SKU_UNKNOWN on failure. */
uint32_t google_chromeec_get_board_sku(void); uint32_t google_chromeec_get_board_sku(void);
const char *google_chromeec_smbios_system_sku(void); const char *google_chromeec_smbios_system_sku(void);

View File

@ -12,17 +12,15 @@
#include <string.h> #include <string.h>
#include <smbios.h> #include <smbios.h>
#define SKU_UNKNOWN 0xFFFFFFFF
uint32_t google_chromeec_get_board_sku(void) uint32_t google_chromeec_get_board_sku(void)
{ {
MAYBE_STATIC_NONZERO uint32_t sku_id = SKU_UNKNOWN; MAYBE_STATIC_NONZERO uint32_t sku_id = CROS_SKU_UNKNOWN;
if (sku_id != SKU_UNKNOWN) if (sku_id != CROS_SKU_UNKNOWN)
return sku_id; return sku_id;
if (google_chromeec_cbi_get_sku_id(&sku_id)) if (google_chromeec_cbi_get_sku_id(&sku_id))
sku_id = SKU_UNKNOWN; sku_id = CROS_SKU_UNKNOWN;
return sku_id; return sku_id;
} }