summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-12-02 10:26:49 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-16 17:55:58 +0000
commit25002abca7e900d6473b40354c8bc79c4dfa11c7 (patch)
tree414c5bdcbef5509aaadb5bb1c5ed8aaedbf9b7fd
parente25c81318a06506c79423900b9592a7caa36cfed (diff)
downloadchrome-ec-25002abca7e900d6473b40354c8bc79c4dfa11c7.tar.gz
cbi: add FW_CONFIG CBI field
This field will be used to describe which "features" or path the firmware code should enable or disable. Firmware code should look at the firmware configuration value to make code decision for un-discoverable hardware connections or layouts that differ within the same firmware binary. Firmware should no longer use SKU_ID/VARIANT_ID to make decisions, only this new FW_CONFIG field. BRANCH=none BUG=b:145519081 TEST=Created cbi image with FW_CONFIG field Change-Id: I1db8e7638a15343173ea5061e9038a7d53bda090 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1945821 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--common/cbi.c13
-rw-r--r--include/cros_board_info.h3
-rw-r--r--include/ec_commands.h1
-rw-r--r--util/cbi-util.c12
-rw-r--r--util/ectool.c1
5 files changed, 29 insertions, 1 deletions
diff --git a/common/cbi.c b/common/cbi.c
index f29ae2040c..1f92e584c2 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -262,27 +262,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 enum ec_status hc_cbi_get(struct host_cmd_handler_args *args)
{
const struct __ec_align4 ec_params_get_cbi *p = args->params;
@@ -397,6 +409,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 7650cfc078..13eff572d9 100644
--- a/include/cros_board_info.h
+++ b/include/cros_board_info.h
@@ -44,7 +44,7 @@ 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.
* EC_ERROR_BUSY to indicate data is not ready.
*/
@@ -52,6 +52,7 @@ 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);
/**
* Get data from CBI store
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 00c692ec79..dcb4d3f68e 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -5559,6 +5559,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 97dade6754..2fd983c1aa 100644
--- a/util/cbi-util.c
+++ b/util/cbi-util.c
@@ -37,6 +37,7 @@ enum {
OPT_DRAM_PART_NUM,
OPT_OEM_NAME,
OPT_MODEL_ID,
+ OPT_FW_CONFIG,
OPT_SIZE,
OPT_ERASE_BYTE,
OPT_SHOW_ALL,
@@ -51,6 +52,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}
@@ -70,6 +72,7 @@ static const char *field_name[] = {
"DRAM_PART_NUM",
"OEM_NAME",
"MODEL_ID",
+ "FW_CONFIG",
};
BUILD_ASSERT(ARRAY_SIZE(field_name) == CBI_TAG_COUNT);
@@ -89,6 +92,7 @@ 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"
@@ -246,6 +250,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 +319,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 +349,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);
p = cbi_set_string(p, CBI_TAG_DRAM_PART_NUM, bi.dram_part_num);
p = cbi_set_string(p, CBI_TAG_OEM_NAME, bi.oem_name);
@@ -465,6 +476,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 32312fe52b..4f8d292e11 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -7398,6 +7398,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"