summaryrefslogtreecommitdiff
path: root/util/cbi-util.c
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 /util/cbi-util.c
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>
Diffstat (limited to 'util/cbi-util.c')
-rw-r--r--util/cbi-util.c12
1 files changed, 12 insertions, 0 deletions
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);