diff options
author | ravindr1 <ravindra@intel.com> | 2020-11-05 03:57:48 +0530 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-23 09:31:45 +0000 |
commit | 5e3ff7b30e7313aec7144d9ffdf166e0900e7435 (patch) | |
tree | 2ff5f8606448133bae290bf8c9b40c4a465181f9 /util | |
parent | 4a399faf37a8c14797ea9f60e6430e678e6f8a15 (diff) | |
download | chrome-ec-5e3ff7b30e7313aec7144d9ffdf166e0900e7435.tar.gz |
Ectool: support reboot AP from G3 state with configurable delay.
On using Ectool command - reboot_ap_on_g3 [<delay>] && shutdown -h now,
AP must perform a reboot from G3 state to S0 state with configurable
delay in seconds on it's next corresponding shutdown cycle.
BUG=b:172885634
BRANCH=none
TEST=Run Ectool command - reboot_ap_on_g3 50 && shutdown -h now.
Change-Id: I2c5eb304d27a9647f0adc220d91de2d0b4061460
Signed-off-by: ravindr1 <ravindra@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2528731
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/util/ectool.c b/util/ectool.c index 5a0ba609e9..8c6fbdfb61 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -259,9 +259,10 @@ const char help_str[] = " reboot_ec <RO|RW|cold|hibernate|hibernate-clear-ap-off|disable-jump|cold-ap-off>" " [at-shutdown|switch-slot]\n" " Reboot EC to RO or RW\n" - " reboot_ap_on_g3\n" - " Requests that the EC will automatically reboot the AP the next time\n" - " we enter the G3 power state.\n" + " reboot_ap_on_g3 [<delay>]\n" + " Requests that the EC will automatically reboot the AP after a\n" + " configurable number of seconds the next time we enter the G3\n" + " power state.\n" " rollbackinfo\n" " Print rollback block information\n" " rtcget\n" @@ -1196,9 +1197,26 @@ int cmd_reboot_ec(int argc, char *argv[]) int cmd_reboot_ap_on_g3(int argc, char *argv[]) { + struct ec_params_reboot_ap_on_g3_v1 p; int rv; + char *e; + int cmdver; + + if (argc < 2) { + p.reboot_ap_at_g3_delay = 0; + } else { + p.reboot_ap_at_g3_delay = strtol(argv[1], &e, 0); + if (e && *e) { + fprintf(stderr, "invalid number\n"); + return -1; + } + } + if (ec_cmd_version_supported(EC_CMD_REBOOT_AP_ON_G3, 1)) + cmdver = 1; + else + cmdver = 0; - rv = ec_command(EC_CMD_REBOOT_AP_ON_G3, 0, NULL, 0, NULL, 0); + rv = ec_command(EC_CMD_REBOOT_AP_ON_G3, cmdver, &p, sizeof(p), NULL, 0); return (rv < 0 ? rv : 0); } |