From b26f0236318d1df7f94d2d0495bb5f3914b85dba Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Tue, 5 Dec 2017 15:13:37 -0800 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/809944 Reviewed-by: Randall Spangler --- util/ectool.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/ectool.c b/util/ectool.c index 97f86eb5c2..f8f9e6cfef 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -203,7 +203,8 @@ const char help_str[] = " Set 16 bit duty cycle of given PWM\n" " readtest \n" " Reads a pattern from the EC via LPC\n" - " reboot_ec [at-shutdown]\n" + " reboot_ec " + "[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; }