From f28e4caa00393a2bf16f37c929d7b5a95e654e90 Mon Sep 17 00:00:00 2001 From: Abe Levkoy Date: Wed, 11 Mar 2020 09:14:32 -0600 Subject: cbi: Support PCB supplier field Add support for PCB_SUPPLIER, to distinguish boards of the same type with different PCB suppliers. BUG=b:140244489 TEST=ectool cbi set 7 0 1 0; ectool cbi get 7 TEST=cbi on EC console after writing with ectool TEST=/usr/share/userfeedback/scripts/cbi_info after writing with ectool TEST=cbi-util create --pcb_supplier 1 ...; cbi-util show ... BRANCH=none Change-Id: Ieadba91694f4775cc86c2c4b09cdf0874b9ad444 Signed-off-by: Abe Levkoy Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108710 Reviewed-by: Jett Rink Tested-by: George Engelbrecht Commit-Queue: George Engelbrecht --- util/cbi-util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'util/cbi-util.c') diff --git a/util/cbi-util.c b/util/cbi-util.c index 2fd983c1aa..06dc909c20 100644 --- a/util/cbi-util.c +++ b/util/cbi-util.c @@ -38,6 +38,7 @@ enum { OPT_OEM_NAME, OPT_MODEL_ID, OPT_FW_CONFIG, + OPT_PCB_SUPPLIER, OPT_SIZE, OPT_ERASE_BYTE, OPT_SHOW_ALL, @@ -53,6 +54,7 @@ static const struct option opts_create[] = { {"oem_name", 1, 0, OPT_OEM_NAME}, {"model_id", 1, 0, OPT_MODEL_ID}, {"fw_config", 1, 0, OPT_FW_CONFIG}, + {"pcb_supplier", 1, 0, OPT_PCB_SUPPLIER}, {"size", 1, 0, OPT_SIZE}, {"erase_byte", 1, 0, OPT_ERASE_BYTE}, {NULL, 0, 0, 0} @@ -73,6 +75,7 @@ static const char *field_name[] = { "OEM_NAME", "MODEL_ID", "FW_CONFIG", + "PCB_SUPPLIER", }; BUILD_ASSERT(ARRAY_SIZE(field_name) == CBI_TAG_COUNT); @@ -93,6 +96,7 @@ const char help_create[] = " --format_version Data format version\n" " --model_id Model ID\n" " --fw_config Firmware configuration bit-field\n" + " --pcb_supplier PCB supplier\n" "\n" " must be a positive integer <= 0XFFFFFFFF and field size can\n" " be optionally specified by notation: e.g. 0xabcd:4.\n" @@ -251,6 +255,7 @@ static int cmd_create(int argc, char **argv) struct integer_field sku; struct integer_field model; struct integer_field fw_config; + struct integer_field pcb_supplier; const char *dram_part_num; const char *oem_name; } bi; @@ -323,6 +328,10 @@ static int cmd_create(int argc, char **argv) if (parse_integer_field(optarg, &bi.fw_config)) return -1; break; + case OPT_PCB_SUPPLIER: + if (parse_integer_field(optarg, &bi.pcb_supplier)) + return -1; + break; } } @@ -351,6 +360,8 @@ static int cmd_create(int argc, char **argv) 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_data(p, CBI_TAG_PCB_SUPPLIER, &bi.pcb_supplier.val, + bi.pcb_supplier.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); @@ -479,6 +490,7 @@ static int cmd_show(int argc, char **argv) print_integer(buf, CBI_TAG_FW_CONFIG); print_string(buf, CBI_TAG_DRAM_PART_NUM); print_string(buf, CBI_TAG_OEM_NAME); + print_integer(buf, CBI_TAG_PCB_SUPPLIER); free(buf); -- cgit v1.2.1