diff options
author | Pi-Hsun Shih <pihsun@chromium.org> | 2020-09-25 17:03:38 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-17 08:29:12 +0000 |
commit | b0c66ad28ce20a7dfb5081828a680b1ecb1647eb (patch) | |
tree | ea6e629eb2148af274bd069531447bd34951d4cf | |
parent | f0ed846e721e7c7fc6fbf4b49a3afc485d8512ac (diff) | |
download | chrome-ec-b0c66ad28ce20a7dfb5081828a680b1ecb1647eb.tar.gz |
system: Add EC_REBOOT_COLD_AP_OFF command
Add EC_REBOOT_COLD_AP_OFF as a command of EC_CMD_REBOOT_EC host command,
that would cold reboot EC without booting AP.
BUG=chromium:1121907
TEST=With CL:2422025 CL:2459802,
echo 1 > /var/lib/power_manager/reset_ec_on_next_shutdown
click shutdown on UI and observe that EC is rebooted and AP is
still off.
TEST=With CL:2422025 CL:2459802,
echo 1 > /var/lib/power_manager/reset_ec_on_next_shutdown
dbus-send --system --print-reply --dest=org.chromium.PowerManager \
/org/chromium/PowerManager \
org.chromium.PowerManager.RequestRestart \
int32:0 string:test
observe that EC is rebooted.
Change-Id: Ifccff3831d785091b7c99def0e43a0d20bfc412b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428361
Commit-Queue: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/system.c | 10 | ||||
-rw-r--r-- | include/ec_commands.h | 1 | ||||
-rw-r--r-- | util/ectool.c | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/common/system.c b/common/system.c index 2f11945d71..e657859160 100644 --- a/common/system.c +++ b/common/system.c @@ -891,6 +891,7 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) case EC_REBOOT_JUMP_RW: return system_run_image_copy(system_get_active_copy()); case EC_REBOOT_COLD: + case EC_REBOOT_COLD_AP_OFF: /* * Reboot the PD chip(s) as well, but first suspend the ports * if this board has PD tasks running so they don't query the @@ -916,7 +917,11 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) board_reset_pd_mcu(); cflush(); - system_reset(SYSTEM_RESET_HARD); + if (cmd == EC_REBOOT_COLD_AP_OFF) + system_reset(SYSTEM_RESET_HARD | + SYSTEM_RESET_LEAVE_AP_OFF); + else + system_reset(SYSTEM_RESET_HARD); /* That shouldn't return... */ return EC_ERROR_UNKNOWN; case EC_REBOOT_DISABLE_JUMP: @@ -1618,7 +1623,8 @@ enum ec_status host_command_reboot(struct host_cmd_handler_args *args) if (p.cmd == EC_REBOOT_JUMP_RO || p.cmd == EC_REBOOT_JUMP_RW || p.cmd == EC_REBOOT_COLD || - p.cmd == EC_REBOOT_HIBERNATE) { + p.cmd == EC_REBOOT_HIBERNATE || + p.cmd == EC_REBOOT_COLD_AP_OFF) { /* Clean busy bits on host for commands that won't return */ args->result = EC_RES_SUCCESS; host_send_response(args); diff --git a/include/ec_commands.h b/include/ec_commands.h index ebef2b69dd..c0bd7ae1ea 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -5207,6 +5207,7 @@ enum ec_reboot_cmd { EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */ EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_IDLE flag */ + EC_REBOOT_COLD_AP_OFF = 8, /* Cold-reboot and don't boot AP */ }; /* Flags for ec_params_reboot_ec.reboot_flags */ diff --git a/util/ectool.c b/util/ectool.c index f34a7c88c6..5a0ba609e9 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -256,7 +256,7 @@ const char help_str[] = " generate <num_bytes> of random numbers\n" " readtest <patternoffset> <size>\n" " Reads a pattern from the EC via LPC\n" - " reboot_ec <RO|RW|cold|hibernate|hibernate-clear-ap-off|disable-jump>" + " 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" @@ -1170,6 +1170,8 @@ int cmd_reboot_ec(int argc, char *argv[]) p.cmd = EC_REBOOT_HIBERNATE; else if (!strcmp(argv[1], "hibernate-clear-ap-off")) p.cmd = EC_REBOOT_HIBERNATE_CLEAR_AP_OFF; + else if (!strcmp(argv[1], "cold-ap-off")) + p.cmd = EC_REBOOT_COLD_AP_OFF; else { fprintf(stderr, "Unknown command: %s\n", argv[1]); return -1; |