summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-07-23 12:29:58 +0800
committerChromeBot <chrome-bot@google.com>2013-07-24 15:50:20 -0700
commitb13a2aed146c7e54c21fe5d84f0a3ff1989a612b (patch)
treedbebe07dbdb06e1b5f12df948a8bf8d261c77717
parent99e4a977986f67334f6b82a87f23f66cf88f4cb4 (diff)
downloadchrome-ec-b13a2aed146c7e54c21fe5d84f0a3ff1989a612b.tar.gz
Support emulator hibernate
If we are hibernating indefinitely, just exit with hibernate exit code. If hibernating with a delay, delay for that amount of time and then reboot. BUG=chrome-os-partner:19235 TEST='hibernate 1' and see emulator reboot after a second with reset flag 'hibernate' BRANCH=None Change-Id: If25bf2eefbcf275f2592b92a997a9d7e1ff2384d Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62970 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/host/system.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/chip/host/system.c b/chip/host/system.c
index e726245ee0..41f634aadd 100644
--- a/chip/host/system.c
+++ b/chip/host/system.c
@@ -152,7 +152,17 @@ test_mockable void system_reset(int flags)
test_mockable void system_hibernate(uint32_t seconds, uint32_t microseconds)
{
- exit(EXIT_CODE_HIBERNATE);
+ uint32_t i;
+
+ save_reset_flags(RESET_FLAG_HIBERNATE);
+
+ if (!seconds && !microseconds)
+ exit(EXIT_CODE_HIBERNATE);
+
+ for (i = 0; i < seconds; ++i)
+ udelay(SECOND);
+ udelay(microseconds);
+ emulator_reboot();
}
test_mockable int system_is_locked(void)