summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-01-17 17:22:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-18 20:18:11 -0800
commitead2428e915ba97185d35dfcfcf86feda5ff0059 (patch)
tree8faded8de55974aff489ff7a79a3ffa8dbf2d022 /util
parent4941dd5542339f603b5d73ec61846a282e6556a8 (diff)
downloadchrome-ec-ead2428e915ba97185d35dfcfcf86feda5ff0059.tar.gz
CBI: Allow get command to reload data from EEPROM
This patch adds CBI_GET_RELOAD flag to EC_CMD_GET_CROS_BOARD_INFO command. When the flag is set, the command will be forced to read data from EEPROM even, ignoring the data cached by the previous read. This allows ectool to verify a write was successful without reboot. BUG=b:70294260 BRANCH=none TEST=ectool cbi set 0 0x1234 && ectool cbi get 0 1 Change-Id: I3e7ced5be56a74c605870a4c0622c0a2f47963bb Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/874155 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 4737ac91e3..97cfaa8262 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -6230,13 +6230,15 @@ int cmd_board_version(int argc, char *argv[])
static void cmd_cbi_help(char *cmd)
{
fprintf(stderr,
- " Usage: %s get <type>\n"
- " Usage: %s set <type> value [flag]\n"
+ " Usage: %s get <type> [get_flag]\n"
+ " Usage: %s set <type> value [set_flag]\n"
" <type> is one of:\n"
" 0: BOARD_VERSION\n"
" 1: OEM_ID\n"
" 2: SKU_ID\n"
- " [flag] is combination of:\n"
+ " [get_flag] is combination of:\n"
+ " 01b: Invalidate cache and reload data from EEPROM\n"
+ " [set_flag] is combination of:\n"
" 01b: Skip write to EEPROM. Use for back-to-back writes\n"
" 10b: Set all fields to defaults first\n", cmd, cmd);
}
@@ -6269,6 +6271,13 @@ static int cmd_cbi(int argc, char *argv[])
struct ec_params_get_cbi p;
uint32_t r;
p.type = type;
+ if (argc > 3) {
+ p.flag = strtol(argv[3], &e, 0);
+ if (e && *e) {
+ fprintf(stderr, "Bad flag\n");
+ return -1;
+ }
+ }
rv = ec_command(EC_CMD_GET_CROS_BOARD_INFO, 0, &p, sizeof(p),
&r, sizeof(r));
if (rv < 0) {