diff options
-rw-r--r-- | common/cbi.c | 13 | ||||
-rw-r--r-- | include/cros_board_info.h | 3 | ||||
-rw-r--r-- | include/ec_commands.h | 1 | ||||
-rw-r--r-- | util/cbi-util.c | 16 | ||||
-rw-r--r-- | util/ectool.c | 1 |
5 files changed, 33 insertions, 1 deletions
diff --git a/common/cbi.c b/common/cbi.c index 8ec4472b24..4b99a5a33f 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -238,27 +238,39 @@ static int write_board_info(void) int cbi_get_board_version(uint32_t *ver) { uint8_t size = sizeof(*ver); + return cbi_get_board_info(CBI_TAG_BOARD_VERSION, (uint8_t *)ver, &size); } int cbi_get_sku_id(uint32_t *id) { uint8_t size = sizeof(*id); + return cbi_get_board_info(CBI_TAG_SKU_ID, (uint8_t *)id, &size); } int cbi_get_oem_id(uint32_t *id) { uint8_t size = sizeof(*id); + return cbi_get_board_info(CBI_TAG_OEM_ID, (uint8_t *)id, &size); } int cbi_get_model_id(uint32_t *id) { uint8_t size = sizeof(*id); + return cbi_get_board_info(CBI_TAG_MODEL_ID, (uint8_t *)id, &size); } +int cbi_get_fw_config(uint32_t *fw_config) +{ + uint8_t size = sizeof(*fw_config); + + return cbi_get_board_info(CBI_TAG_FW_CONFIG, (uint8_t *)fw_config, + &size); +} + static int hc_cbi_get(struct host_cmd_handler_args *args) { const struct __ec_align4 ec_params_get_cbi *p = args->params; @@ -375,6 +387,7 @@ static void dump_cbi(void) print_tag("OEM_ID", cbi_get_oem_id(&val), &val); print_tag("MODEL_ID", cbi_get_model_id(&val), &val); print_tag("SKU_ID", cbi_get_sku_id(&val), &val); + print_tag("FW_CONFIG", cbi_get_fw_config(&val), &val); } static int cc_cbi(int argc, char **argv) diff --git a/include/cros_board_info.h b/include/cros_board_info.h index 8ed8737731..4bc711450f 100644 --- a/include/cros_board_info.h +++ b/include/cros_board_info.h @@ -44,13 +44,14 @@ struct cbi_data { /** * Board info accessors * - * @param version/sku_id/oem_id [OUT] Data read from EEPROM + * @param version/sku_id/oem_id/id/fw_config [OUT] Data read from EEPROM * @return EC_SUCCESS on success or EC_ERROR_* otherwise. */ int cbi_get_board_version(uint32_t *version); int cbi_get_sku_id(uint32_t *sku_id); int cbi_get_oem_id(uint32_t *oem_id); int cbi_get_model_id(uint32_t *id); +int cbi_get_fw_config(uint32_t *fw_config); /** * Primitive accessors diff --git a/include/ec_commands.h b/include/ec_commands.h index 45198db0dc..5b1ea04296 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -5010,6 +5010,7 @@ enum cbi_data_tag { CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */ CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */ CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */ + CBI_TAG_FW_CONFIG = 6, /* uint32_t bit field */ CBI_TAG_COUNT, }; diff --git a/util/cbi-util.c b/util/cbi-util.c index 2ea86b14cf..1dc4ec3cce 100644 --- a/util/cbi-util.c +++ b/util/cbi-util.c @@ -38,6 +38,7 @@ enum { OPT_DRAM_PART_NUM, OPT_OEM_NAME, OPT_MODEL_ID, + OPT_FW_CONFIG, OPT_SIZE, OPT_ERASE_BYTE, OPT_SHOW_ALL, @@ -52,6 +53,7 @@ static const struct option opts_create[] = { {"dram_part_num", 1, 0, OPT_DRAM_PART_NUM}, {"oem_name", 1, 0, OPT_OEM_NAME}, {"model_id", 1, 0, OPT_MODEL_ID}, + {"fw_config", 1, 0, OPT_FW_CONFIG}, {"size", 1, 0, OPT_SIZE}, {"erase_byte", 1, 0, OPT_ERASE_BYTE}, {NULL, 0, 0, 0} @@ -71,6 +73,7 @@ static const char *field_name[] = { "DRAM_PART_NUM", "OEM_NAME", "MODEL_ID", + "FW_CONFIG", }; BUILD_ASSERT(ARRAY_SIZE(field_name) == CBI_TAG_COUNT); @@ -92,6 +95,11 @@ const char help_create[] = " --erase_byte <uint8> Byte used for empty space. Default:0xff\n" " --format_version <uint16> Data format version\n" " --model_id <value> Model ID\n" + " --fw_config <value> Firmware configuration bit-field\n" + "\n" + "<value> must be a positive integer <= 0XFFFFFFFF and field size can\n" + " be optionally specified by <value:size> notation: e.g. 0xabcd:4.\n" + "<size> must be a positive integer <= 0XFFFF.\n" "<string> is a string\n" "\n"; @@ -245,6 +253,7 @@ static int cmd_create(int argc, char **argv) struct integer_field oem; struct integer_field sku; struct integer_field model; + struct integer_field fw_config; const char *dram_part_num; const char *oem_name; } bi; @@ -314,6 +323,10 @@ static int cmd_create(int argc, char **argv) if (parse_integer_field(optarg, &bi.model)) return -1; break; + case OPT_FW_CONFIG: + if (parse_integer_field(optarg, &bi.fw_config)) + return -1; + break; } } @@ -340,6 +353,8 @@ static int cmd_create(int argc, char **argv) p = cbi_set_data(p, CBI_TAG_OEM_ID, &bi.oem.val, bi.oem.size); p = cbi_set_data(p, CBI_TAG_SKU_ID, &bi.sku.val, bi.sku.size); p = cbi_set_data(p, CBI_TAG_MODEL_ID, &bi.model.val, bi.model.size); + p = cbi_set_data(p, CBI_TAG_FW_CONFIG, &bi.fw_config.val, + bi.fw_config.size); if (bi.dram_part_num != NULL) { p = cbi_set_data(p, CBI_TAG_DRAM_PART_NUM, bi.dram_part_num, strlen(bi.dram_part_num) + 1); @@ -469,6 +484,7 @@ static int cmd_show(int argc, char **argv) print_integer(buf, CBI_TAG_OEM_ID); print_integer(buf, CBI_TAG_SKU_ID); print_integer(buf, CBI_TAG_MODEL_ID); + print_integer(buf, CBI_TAG_FW_CONFIG); print_string(buf, CBI_TAG_DRAM_PART_NUM); print_string(buf, CBI_TAG_OEM_NAME); diff --git a/util/ectool.c b/util/ectool.c index 5eadc99bfb..369f563390 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -6808,6 +6808,7 @@ static void cmd_cbi_help(char *cmd) " 3: DRAM_PART_NUM (string)\n" " 4: OEM_NAME (string)\n" " 5: MODEL_ID\n" + " 6: FW_CONFIG\n" " <size> is the size of the data in byte. It should be zero for\n" " string types.\n" " <value/string> is an integer or a string to be set\n" |