ectool: Add switch-slot option to reboot_ec command

This patch adds switch-slot option to reboot_ec command. When the
option is specified, it'll make EC switch the active RW slot
before reboot.

BUG=b:69921268
BRANCH=none
TEST=Run ectool reboot_ec cold switch-slot and verify the active
slot is switched.

Change-Id: Iec568be36e6010ed9a51aa768a7f35e4a63f0fc0
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/809944
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Daisuke Nojiri
2017-12-05 15:13:37 -08:00
committed by chrome-bot
parent d990be3fb2
commit b26f023631

View File

@@ -203,7 +203,8 @@ const char help_str[] =
" Set 16 bit duty cycle of given PWM\n"
" readtest <patternoffset> <size>\n"
" Reads a pattern from the EC via LPC\n"
" reboot_ec <RO|RW|cold|hibernate|disable-jump> [at-shutdown]\n"
" reboot_ec <RO|RW|cold|hibernate|disable-jump> "
"[at-shutdown|switch-slot]\n"
" Reboot EC to RO or RW\n"
" rtcget\n"
" Print real-time clock\n"
@@ -733,9 +734,11 @@ int cmd_reboot_ec(int argc, char *argv[])
/* Parse flags, if any */
p.flags = 0;
for (i = 2; i < argc; i++) {
if (!strcmp(argv[i], "at-shutdown"))
if (!strcmp(argv[i], "at-shutdown")) {
p.flags |= EC_REBOOT_FLAG_ON_AP_SHUTDOWN;
else {
} else if (!strcmp(argv[i], "switch-slot")) {
p.flags |= EC_REBOOT_FLAG_SWITCH_RW_SLOT;
} else {
fprintf(stderr, "Unknown flag: %s\n", argv[i]);
return -1;
}