summaryrefslogtreecommitdiff
path: root/include/ec_commands.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-02-14 15:20:09 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-16 18:47:52 -0800
commit5946911129779469abc40e40beb278c1685af462 (patch)
tree2276e781353f50c02daef46f22c10e54087d77d7 /include/ec_commands.h
parentf29bf0fbbd0e83fcae6dd71cb2bc23647c80b8be (diff)
downloadchrome-ec-5946911129779469abc40e40beb278c1685af462.tar.gz
CBI: Make data offset and size variable
Currently CBI data offset and size are fixed. This patch makes them variable. Each data item consists of <tag><size><value> where <tag> is a numeric value assigned to each data item, <size> is the number of bytes used for <value>. BUG=b:70294260 BRANCH=none TEST=Use 'ectool cbi set' to set board version, oem, sku. Verify the contents by cbi console command and ectool cbi get. 1. ectool cbi set 0 0x202 2 2 (Init CBI and write board ver. of size 2) 2. ectool cbi set 1 1 1 (write oem id of size 1) 3. ectool cbi set 2 2 1 (write sku id of size 1) 4. ectool cbi get 0 514 (0x202) 5. ectool cbi get 1 1 (0x1) 6. ectool cbi get 2 2 (0x2) 7. Run cbi console command: CBI_VERSION: 0x0000 TOTAL_SIZE: 18 BOARD_VERSION: 514 (0x202) OEM_ID: 1 (0x1) SKU_ID: 2 (0x2) 43 42 49 8c 00 00 12 00 00 02 02 02 01 01 01 02 01 02 Change-Id: I5a30a4076e3eb448f4808d2af8ec4ef4c016ae5e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/920905 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r--include/ec_commands.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 1d8761be8b..bc654209f0 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4587,14 +4587,11 @@ struct __ec_align1 ec_params_efs_verify {
*/
#define EC_CMD_SET_CROS_BOARD_INFO 0x0120
-enum cbi_data_type {
- /* integer types */
- CBI_DATA_BOARD_VERSION = 0,
- CBI_DATA_OEM_ID = 1,
- CBI_DATA_SKU_ID = 2,
- /* string types */
- CBI_FIRST_STRING_PARAM = 0x1000,
- CBI_DATA_COUNT,
+enum cbi_data_tag {
+ CBI_TAG_BOARD_VERSION = 0, /* uint16_t or uint8_t[] = {minor,major} */
+ CBI_TAG_OEM_ID = 1, /* uint8_t */
+ CBI_TAG_SKU_ID = 2, /* uint8_t */
+ CBI_TAG_COUNT,
};
/*
@@ -4606,7 +4603,7 @@ enum cbi_data_type {
#define CBI_GET_RELOAD (1 << 0)
struct __ec_align4 ec_params_get_cbi {
- uint32_t type; /* enum cbi_data_type */
+ uint32_t tag; /* enum cbi_data_tag */
uint32_t flag; /* CBI_GET_* */
};
@@ -4622,10 +4619,10 @@ struct __ec_align4 ec_params_get_cbi {
#define CBI_SET_INIT (1 << 1)
struct __ec_align1 ec_params_set_cbi {
- uint32_t type; /* enum cbi_data_type */
+ uint32_t tag; /* enum cbi_data_tag */
uint32_t flag; /* CBI_SET_* */
- uint32_t data; /* For numeric value */
- uint8_t raw[]; /* For string and raw data */
+ uint32_t size; /* Data size */
+ uint8_t data[]; /* For string and raw data */
};
/*****************************************************************************/