summaryrefslogtreecommitdiff
path: root/util/cbi-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbi-util.c')
-rw-r--r--util/cbi-util.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/util/cbi-util.c b/util/cbi-util.c
index cc4fda8ba5..2ea86b14cf 100644
--- a/util/cbi-util.c
+++ b/util/cbi-util.c
@@ -37,6 +37,7 @@ enum {
OPT_SKU_ID,
OPT_DRAM_PART_NUM,
OPT_OEM_NAME,
+ OPT_MODEL_ID,
OPT_SIZE,
OPT_ERASE_BYTE,
OPT_SHOW_ALL,
@@ -50,6 +51,7 @@ static const struct option opts_create[] = {
{"sku_id", 1, 0, OPT_SKU_ID},
{"dram_part_num", 1, 0, OPT_DRAM_PART_NUM},
{"oem_name", 1, 0, OPT_OEM_NAME},
+ {"model_id", 1, 0, OPT_MODEL_ID},
{"size", 1, 0, OPT_SIZE},
{"erase_byte", 1, 0, OPT_ERASE_BYTE},
{NULL, 0, 0, 0}
@@ -67,7 +69,8 @@ static const char *field_name[] = {
"OEM_ID",
"SKU_ID",
"DRAM_PART_NUM",
- "OEM_NAME"
+ "OEM_NAME",
+ "MODEL_ID",
};
BUILD_ASSERT(ARRAY_SIZE(field_name) == CBI_TAG_COUNT);
@@ -75,11 +78,11 @@ const char help_create[] =
"\n"
"'%s create [ARGS]' creates an EEPROM image file.\n"
"Required ARGS are:\n"
- " --file <file> Path to output file\n"
- " --board_version <value> Board version\n"
- " --oem_id <value> OEM ID\n"
- " --sku_id <value> SKU ID\n"
- " --size <size> Size of output file in bytes\n"
+ " --file <file> Path to output file\n"
+ " --board_version <value> Board version\n"
+ " --oem_id <value> OEM ID\n"
+ " --sku_id <value> SKU ID\n"
+ " --size <size> Size of output file in bytes\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"
@@ -88,6 +91,7 @@ const char help_create[] =
" --oem_name <string> OEM NAME\n"
" --erase_byte <uint8> Byte used for empty space. Default:0xff\n"
" --format_version <uint16> Data format version\n"
+ " --model_id <value> Model ID\n"
"<string> is a string\n"
"\n";
@@ -240,6 +244,7 @@ static int cmd_create(int argc, char **argv)
struct integer_field ver;
struct integer_field oem;
struct integer_field sku;
+ struct integer_field model;
const char *dram_part_num;
const char *oem_name;
} bi;
@@ -305,6 +310,10 @@ static int cmd_create(int argc, char **argv)
case OPT_OEM_NAME:
bi.oem_name = optarg;
break;
+ case OPT_MODEL_ID:
+ if (parse_integer_field(optarg, &bi.model))
+ return -1;
+ break;
}
}
@@ -330,6 +339,7 @@ static int cmd_create(int argc, char **argv)
p = cbi_set_data(p, CBI_TAG_BOARD_VERSION, &bi.ver.val, bi.ver.size);
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);
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);
@@ -458,6 +468,7 @@ static int cmd_show(int argc, char **argv)
print_integer(buf, CBI_TAG_BOARD_VERSION);
print_integer(buf, CBI_TAG_OEM_ID);
print_integer(buf, CBI_TAG_SKU_ID);
+ print_integer(buf, CBI_TAG_MODEL_ID);
print_string(buf, CBI_TAG_DRAM_PART_NUM);
print_string(buf, CBI_TAG_OEM_NAME);