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>
This commit is contained in:
Vic Yang
2013-07-23 12:29:58 +08:00
committed by ChromeBot
parent 99e4a97798
commit b13a2aed14

View File

@@ -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)