From 69206d90fe99e0420ea5715736fe4b2403cbad06 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 31 Jul 2017 14:20:07 +0200 Subject: ec/google: Add command to fetch SKU ID from EC BUG=b:64468585 BRANCH=none TEST=with the other sku-id related patches applied, coreboot obtains the right SKU ID from EC Change-Id: I82e324407b4b96495a3eb3d4caf110f9eae05116 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/20946 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Paul Menzel --- src/ec/google/chromeec/ec.c | 18 ++++++++++++++++++ src/ec/google/chromeec/ec.h | 1 + 2 files changed, 19 insertions(+) (limited to 'src/ec') diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 2efc66a77c..4d47982aa6 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -386,6 +386,24 @@ u16 google_chromeec_get_board_version(void) return board_v.board_version; } +u32 google_chromeec_get_sku_id(void) +{ + struct chromeec_command cmd; + struct ec_response_sku_id sku_v; + + cmd.cmd_code = EC_CMD_GET_SKU_ID; + cmd.cmd_version = 0; + cmd.cmd_size_in = 0; + cmd.cmd_size_out = sizeof(sku_v); + cmd.cmd_data_out = &sku_v; + cmd.cmd_dev_index = 0; + + if (google_chromeec_command(&cmd) != 0) + return 0; + + return sku_v.sku_id; +} + int google_chromeec_vbnv_context(int is_read, uint8_t *data, int len) { struct chromeec_command cec_cmd; diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index b2b63e8e5f..60d5a323b7 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -49,6 +49,7 @@ void google_chromeec_check_pd_image(int expected_type); int google_chromeec_check_feature(int feature); uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size); u16 google_chromeec_get_board_version(void); +u32 google_chromeec_get_sku_id(void); u32 google_chromeec_get_events_b(void); int google_chromeec_clear_events_b(u32 mask); int google_chromeec_kbbacklight(int percent); -- cgit v1.2.3