diff options
author | Sameer Nanda <snanda@chromium.org> | 2012-08-24 17:38:26 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-08-28 12:09:23 -0700 |
commit | 73e439dc87767e92f45ff78641449c796caa6ef8 (patch) | |
tree | 1a5e2afaee6c8ef3b9bde1dadce197d81126c2e6 /chip | |
parent | bb3bb9262893453ac6a57d5ee02abd73540cf705 (diff) | |
download | chrome-ec-73e439dc87767e92f45ff78641449c796caa6ef8.tar.gz |
gaia: Add a warm reboot function
Added a warm reboot function that reboots the AP while preserving
RAM contents. This will be helpful in debugging AP/OS hard hangs since
in conjunction with PSTORE_CONSOLE in the kernel, the kernel log messages
from the previous boot will be preserved.
BUG=chrome-os-partner:13249
TEST=1. From EC console issue the "warm_reboot" command. Upon rebooting
"cat /dev/pstore/console-ramoops" and ensure that the contents are dmesg
of previous boot.
2. Reboot the system using alt-volume_up-r key combination. Upon
rebooting, check pstore contents in the same manner as case#1 above.
BRANCH=snow
Change-Id: Ic8f0415da6182f4c1bc2d35b91302ceda5c19569
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31523
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/stm32/keyboard_scan.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c index 350439ef1e..de537cc931 100644 --- a/chip/stm32/keyboard_scan.c +++ b/chip/stm32/keyboard_scan.c @@ -64,6 +64,16 @@ static const uint8_t actual_key_masks[4][KB_OUTPUTS] = { #define MASK_INDEX_REFRESH 2 #define MASK_VALUE_REFRESH 0x04 +/* Key masks and values for warm reboot combination */ +#define MASK_INDEX_KEYR 3 +#define MASK_VALUE_KEYR 0x80 +#define MASK_INDEX_VOL_UP 4 +#define MASK_VALUE_VOL_UP 0x01 +#define MASK_INDEX_RIGHT_ALT 10 +#define MASK_VALUE_RIGHT_ALT 0x01 +#define MASK_INDEX_LEFT_ALT 10 +#define MASK_VALUE_LEFT_ALT 0x40 + struct kbc_gpio { int num; /* logical row or column number */ uint32_t port; @@ -217,6 +227,16 @@ void enter_polling_mode(void) select_column(COL_TRI_STATE_ALL); } +static int check_warm_reboot_keys(void) +{ + if (raw_state[MASK_INDEX_KEYR] == MASK_VALUE_KEYR && + raw_state[MASK_INDEX_VOL_UP] == MASK_VALUE_VOL_UP && + (raw_state[MASK_INDEX_RIGHT_ALT] == MASK_VALUE_RIGHT_ALT || + raw_state[MASK_INDEX_LEFT_ALT] == MASK_VALUE_LEFT_ALT)) + return 1; + + return 0; +} /* Returns 1 if any key is still pressed. 0 if no key is pressed. */ static int check_keys_changed(void) @@ -295,6 +315,11 @@ static int check_keys_changed(void) } CPUTS("]\n"); + if (num_press == 3) { + if (check_warm_reboot_keys()) + system_warm_reboot(); + } + if (kb_fifo_add(raw_state) == EC_SUCCESS) board_interrupt_host(1); else |