diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-09-14 18:32:50 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-20 21:30:02 -0700 |
commit | 852a4f2f35602724ac8d784b721df5cdc57ac086 (patch) | |
tree | 5802d31fbce654a86609f17c665964c49ef49b7e /util | |
parent | 6cb09dc09f5e3891f6155fac9ae6779cb861d6d1 (diff) | |
download | chrome-ec-852a4f2f35602724ac8d784b721df5cdc57ac086.tar.gz |
rollback: Add host command to query rollback information
Rollback id will be useful to check that the secret has actually
been wiped. Min rollback version and RW rollback version might
be useful in the future.
BRANCH=nocturne
BUG=b:115733483
TEST=ectool --name=cros_fp rollbackinfo
=> Rollback block id: X
ectool --name=cros_fp reboot_ec; sleep 0.5; \
ectool --name=cros_fp rwsigaction abort && \
ectool --name=cros_fp addentropy reset && \
ectool --name=cros_fp reboot_ec
ectool --name=cros_fp rollbackinfo
=> Rollback block id: X+2
Change-Id: I039d26d302d3a12b0d41acca34aa28d4a2dd096d
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1226126
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index 4806f298d8..00b58b026e 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -229,6 +229,8 @@ const char help_str[] = " reboot_ec <RO|RW|cold|hibernate|hibernate-clear-ap-off|disable-jump>" " [at-shutdown|switch-slot]\n" " Reboot EC to RO or RW\n" + " rollbackinfo\n" + " Print rollback block information\n" " rtcget\n" " Print real-time clock\n" " rtcgetalarm\n" @@ -1305,6 +1307,25 @@ int cmd_rwsig_action(int argc, char *argv[]) return ec_command(EC_CMD_RWSIG_ACTION, 0, &req, sizeof(req), NULL, 0); } +int cmd_rollback_info(int argc, char *argv[]) +{ + struct ec_response_rollback_info r; + int rv; + + rv = ec_command(EC_CMD_ROLLBACK_INFO, 0, NULL, 0, &r, sizeof(r)); + if (rv < 0) { + fprintf(stderr, "ERROR: EC_CMD_ROLLBACK_INFO failed: %d\n", rv); + return rv; + } + + /* Print versions */ + printf("Rollback block id: %d\n", r.id); + printf("Rollback min version: %d\n", r.rollback_min_version); + printf("RW rollback version: %d\n", r.rw_rollback_version); + + return rv; +} + #define FP_FRAME_INDEX_SIMPLE_IMAGE -1 /* @@ -8363,6 +8384,7 @@ const struct command commands[] = { {"pwmsetduty", cmd_pwm_set_duty}, {"readtest", cmd_read_test}, {"reboot_ec", cmd_reboot_ec}, + {"rollbackinfo", cmd_rollback_info}, {"rtcget", cmd_rtc_get}, {"rtcgetalarm", cmd_rtc_get_alarm}, {"rtcset", cmd_rtc_set}, |