summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;