summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-03 15:09:08 -0700
committerGerrit <chrome-bot@google.com>2012-10-04 09:30:59 -0700
commita9e8f809a33d23430c87cc1944c9c37a015aee91 (patch)
treedc29c04592d4647184ef3c3407f1f025f16b4daf
parent66dda8936e4e72eab0d644a0754d52f7ddc1eb70 (diff)
downloadchrome-ec-a9e8f809a33d23430c87cc1944c9c37a015aee91.tar.gz
link: add hibernate option to ectool reboot_ec
This enables the OS to request the EC drop into its lowest-power shutdown state. Targeted at end of factory flow, where the at-shutdown variant is the desired variant because it allows the main processor to shut down cleanly first. BUG=chrome-os-partner:14838 BRANCH=link TEST=from root shell, ectool reboot_ec hibernate at-shutdown shutdown -h now System should shut down, and EC console should be unresponsive (since it's hibernating). Press power button, and system should power back on. ectool reboot_ec hibernate System should shut down immediately. Press power button, and system should power back on. Change-Id: I8084a3a1bca6b7c201e090552b193fe1568708a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34569 Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--common/system_common.c8
-rw-r--r--include/ec_commands.h7
-rw-r--r--util/ectool.c2
3 files changed, 13 insertions, 4 deletions
diff --git a/common/system_common.c b/common/system_common.c
index d3f4f3f6fd..979e934a12 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -546,6 +546,11 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
case EC_REBOOT_DISABLE_JUMP:
system_disable_jump();
return EC_SUCCESS;
+ case EC_REBOOT_HIBERNATE:
+ CPRINTF("[%T system hibernating]\n");
+ system_hibernate(0, 0);
+ /* That shouldn't return... */
+ return EC_ERROR_UNKNOWN;
default:
return EC_ERROR_INVAL;
}
@@ -868,7 +873,8 @@ int host_command_reboot(struct host_cmd_handler_args *args)
#ifdef CONFIG_TASK_HOSTCMD
if (p.cmd == EC_REBOOT_JUMP_RO ||
p.cmd == EC_REBOOT_JUMP_RW ||
- p.cmd == EC_REBOOT_COLD) {
+ p.cmd == EC_REBOOT_COLD ||
+ p.cmd == EC_REBOOT_HIBERNATE) {
/* 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 ac7a06893f..42882cba5d 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1038,11 +1038,12 @@ struct ec_params_force_idle {
/* Command */
enum ec_reboot_cmd {
EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */
- EC_REBOOT_JUMP_RO, /* Jump to RO without rebooting */
- EC_REBOOT_JUMP_RW, /* Jump to RW without rebooting */
+ EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */
+ EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */
/* (command 3 was jump to RW-B) */
EC_REBOOT_COLD = 4, /* Cold-reboot */
- EC_REBOOT_DISABLE_JUMP, /* Disable jump until next reboot */
+ EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
+ EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */
};
/* Flags for ec_params_reboot_ec.reboot_flags */
diff --git a/util/ectool.c b/util/ectool.c
index 43ea8e7c70..4516014b46 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -421,6 +421,8 @@ int cmd_reboot_ec(int argc, char *argv[])
p.cmd = EC_REBOOT_COLD;
else if (!strcmp(argv[1], "disable-jump"))
p.cmd = EC_REBOOT_DISABLE_JUMP;
+ else if (!strcmp(argv[1], "hibernate"))
+ p.cmd = EC_REBOOT_HIBERNATE;
else {
fprintf(stderr, "Unknown command: %s\n", argv[1]);
return -1;