diff options
author | Vic Yang <victoryang@chromium.org> | 2013-07-23 12:29:58 +0800 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2013-07-30 10:35:50 -0700 |
commit | e1e903caac3480bf940688b5158e95d1d7096b1e (patch) | |
tree | dbebe07dbdb06e1b5f12df948a8bf8d261c77717 | |
parent | 7431c57f476c6a9ceb7fb7f34480ecd142bb9306 (diff) | |
download | chrome-ec-e1e903caac3480bf940688b5158e95d1d7096b1e.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
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>
(cherry picked from commit b13a2aed146c7e54c21fe5d84f0a3ff1989a612b)
Change-Id: I982ad8990f12647eb1675f9f3bf9259cdb1d6089
Reviewed-on: https://gerrit.chromium.org/gerrit/63728
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | chip/host/system.c | 12 |
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) |