summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2020-03-11 09:14:32 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-01 12:20:33 +0000
commit89ddbd468ea95a8552ac05352a1e7aa88f9c63b3 (patch)
tree625d92b468e414424519a98fc86e02b9fbe54bc3
parent5c532b1d4fe9b92134b428cacee2a2fa9b4090f0 (diff)
downloadchrome-ec-89ddbd468ea95a8552ac05352a1e7aa88f9c63b3.tar.gz
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 <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108710 Reviewed-by: Jett Rink <jettrink@chromium.org> Tested-by: George Engelbrecht <engeg@google.com> Commit-Queue: George Engelbrecht <engeg@google.com> (cherry picked from commit f28e4caa00393a2bf16f37c929d7b5a95e654e90) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2387685 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org>
-rw-r--r--common/cbi.c9
-rw-r--r--include/cros_board_info.h4
-rw-r--r--include/ec_commands.h1
-rw-r--r--util/cbi-util.c12
-rw-r--r--util/ectool.c1
5 files changed, 26 insertions, 1 deletions
diff --git a/common/cbi.c b/common/cbi.c
index 4b99a5a33f..5d1c195c84 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -271,6 +271,14 @@ int cbi_get_fw_config(uint32_t *fw_config)
&size);
}
+int cbi_get_pcb_supplier(uint32_t *pcb_supplier)
+{
+ uint8_t size = sizeof(*pcb_supplier);
+
+ return cbi_get_board_info(CBI_TAG_PCB_SUPPLIER, (uint8_t *)pcb_supplier,
+ &size);
+}
+
static int hc_cbi_get(struct host_cmd_handler_args *args)
{
const struct __ec_align4 ec_params_get_cbi *p = args->params;
@@ -388,6 +396,7 @@ static void dump_cbi(void)
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);
+ print_tag("PCB_SUPPLIER", cbi_get_pcb_supplier(&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 4bc711450f..a8a1d5c023 100644
--- a/include/cros_board_info.h
+++ b/include/cros_board_info.h
@@ -44,7 +44,8 @@ struct cbi_data {
/**
* Board info accessors
*
- * @param version/sku_id/oem_id/id/fw_config [OUT] Data read from EEPROM
+ * @param version/sku_id/oem_id/id/fw_config/pcb_supplier [OUT] Data read from
+ * EEPROM
* @return EC_SUCCESS on success or EC_ERROR_* otherwise.
*/
int cbi_get_board_version(uint32_t *version);
@@ -52,6 +53,7 @@ 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);
+int cbi_get_pcb_supplier(uint32_t *pcb_supplier);
/**
* Primitive accessors
diff --git a/include/ec_commands.h b/include/ec_commands.h
index e87c94e843..edfdeef8f3 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -5044,6 +5044,7 @@ enum cbi_data_tag {
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_PCB_SUPPLIER = 7, /* uint32_t or smaller */
CBI_TAG_COUNT,
};
diff --git a/util/cbi-util.c b/util/cbi-util.c
index 1dc4ec3cce..328198f4f9 100644
--- a/util/cbi-util.c
+++ b/util/cbi-util.c
@@ -39,6 +39,7 @@ enum {
OPT_OEM_NAME,
OPT_MODEL_ID,
OPT_FW_CONFIG,
+ OPT_PCB_SUPPLIER,
OPT_SIZE,
OPT_ERASE_BYTE,
OPT_SHOW_ALL,
@@ -54,6 +55,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}
@@ -74,6 +76,7 @@ static const char *field_name[] = {
"OEM_NAME",
"MODEL_ID",
"FW_CONFIG",
+ "PCB_SUPPLIER",
};
BUILD_ASSERT(ARRAY_SIZE(field_name) == CBI_TAG_COUNT);
@@ -96,6 +99,7 @@ const char help_create[] =
" --format_version <uint16> Data format version\n"
" --model_id <value> Model ID\n"
" --fw_config <value> Firmware configuration bit-field\n"
+ " --pcb_supplier <value> PCB supplier\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"
@@ -254,6 +258,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;
@@ -327,6 +332,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;
}
}
@@ -355,6 +364,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);
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);
@@ -485,6 +496,7 @@ static int cmd_show(int argc, char **argv)
print_integer(buf, CBI_TAG_SKU_ID);
print_integer(buf, CBI_TAG_MODEL_ID);
print_integer(buf, CBI_TAG_FW_CONFIG);
+ print_integer(buf, CBI_TAG_PCB_SUPPLIER);
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 985909e5c2..24144901fd 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -6961,6 +6961,7 @@ static void cmd_cbi_help(char *cmd)
" 4: OEM_NAME (string)\n"
" 5: MODEL_ID\n"
" 6: FW_CONFIG\n"
+ " 7: PCB_VENDOR\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"