From c1efec7f160ac208c5dcfee4a914da7279821af2 Mon Sep 17 00:00:00 2001 From: Wisley Chen Date: Tue, 6 Nov 2018 09:28:23 +0800 Subject: ec/google/chromeec: add support for retrieving OEM name OEM name can be stored in CBI. This change can support for fetching the OEM name from CBI. BUG=b:118798180 TEST=Verified to get data from CBI Change-Id: I4938c4d60fcad9e1f43ef69cc4441d1653de7e24 Signed-off-by: Wisley Chen Reviewed-on: https://review.coreboot.org/29497 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Karthik Ramasubramanian --- src/ec/google/chromeec/ec.c | 14 ++++++++++++-- src/ec/google/chromeec/ec.h | 1 + src/ec/google/chromeec/ec_commands.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 75d9da16e2..d2a0849dc9 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -611,10 +611,10 @@ int google_chromeec_cbi_get_oem_id(uint32_t *id) return cbi_get_uint32(id, CBI_TAG_OEM_ID); } -int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize) +static int cbi_get_string(char *buf, size_t bufsize, uint32_t tag) { struct ec_params_get_cbi p = { - .tag = CBI_TAG_DRAM_PART_NUM, + .tag = tag, }; struct chromeec_command cmd = { .cmd_code = EC_CMD_GET_CROS_BOARD_INFO, @@ -636,6 +636,16 @@ int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize) return 0; } +int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize) +{ + return cbi_get_string(buf, bufsize, CBI_TAG_DRAM_PART_NUM); +} + +int google_chromeec_cbi_get_oem_name(char *buf, size_t bufsize) +{ + return cbi_get_string(buf, bufsize, CBI_TAG_OEM_NAME); +} + int google_chromeec_get_board_version(uint32_t *version) { struct chromeec_command cmd; diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 1e23ae9205..70b2b525b5 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -84,6 +84,7 @@ int google_chromeec_reboot(int dev_idx, enum ec_reboot_cmd type, uint8_t flags); int google_chromeec_cbi_get_oem_id(uint32_t *id); int google_chromeec_cbi_get_sku_id(uint32_t *id); 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); /* MEC uses 0x800/0x804 as register/index pair, thus an 8-byte resource. */ #define MEC_EMI_BASE 0x800 diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h index 45865bc5ca..140ba5a19a 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -4781,6 +4781,7 @@ enum cbi_data_tag { CBI_TAG_OEM_ID = 1, /* uint8_t */ CBI_TAG_SKU_ID = 2, /* uint8_t */ CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */ + CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */ CBI_TAG_COUNT, }; -- cgit v1.2.3