diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-12 15:26:30 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-07-12 18:23:36 -0700 |
commit | 8c701a7100cc63d664d6061651f8888bbe51f9e8 (patch) | |
tree | 9ebc9211689dfd6bc6038fd382a6fcd89f458334 | |
parent | a3701639fc805ef81c8f38e9522f33b1075c3ef5 (diff) | |
download | chrome-ec-8c701a7100cc63d664d6061651f8888bbe51f9e8.tar.gz |
Add keyboard recovery event
This is set when the EC boots and sees the recovery key combo.
This is preferable to the memmap'd keyboard recovery switch, which the
host has no way of clearing. The idea is that the host RO firmware
reads this event and sets the recovery reason.
I will be removing the memmap'd keyboard recovery switch once U-boot
and coreboot check this new event.
BUG=chrome-os-partner:10034
TEST=manual
1. power+esc+refresh; should see this even in EC log
[0.000838 event set 0x00004000]
(time of event may vary)
2. reboot EC; should NOT see the event
Change-Id: Id0672749f63c5022624a72ec91d30dcadfea5ef8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27328
-rw-r--r-- | chip/lm4/keyboard_scan.c | 8 | ||||
-rw-r--r-- | chip/lm4/lpc.c | 11 | ||||
-rw-r--r-- | chip/stm32/keyboard_scan.c | 3 | ||||
-rw-r--r-- | include/ec_commands.h | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/chip/lm4/keyboard_scan.c b/chip/lm4/keyboard_scan.c index e55bd17b4e..6d0b31c0e1 100644 --- a/chip/lm4/keyboard_scan.c +++ b/chip/lm4/keyboard_scan.c @@ -5,9 +5,9 @@ /* Keyboard scanner module for Chrome EC */ -#include "board.h" +#include "common.h" #include "console.h" -#include "eoption.h" +#include "host_command.h" #include "keyboard.h" #include "keyboard_scan.h" #include "keyboard_scan_stub.h" @@ -277,6 +277,10 @@ int keyboard_scan_init(void) break; } } + + /* Trigger event if recovery key was pressed */ + if (keyboard_scan_recovery_pressed()) + host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY); } return EC_SUCCESS; diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index 597eb80f71..12d761e365 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -36,6 +36,7 @@ static uint32_t host_events; /* Currently pending SCI/SMI events */ static uint32_t event_mask[3]; /* Event masks for each type */ static struct host_cmd_handler_args host_cmd_args; +static int init_done; static uint8_t * const cmd_params = (uint8_t *)LPC_POOL_CMD_DATA + EC_LPC_ADDR_HOST_PARAM - EC_LPC_ADDR_HOST_ARGS; @@ -258,6 +259,9 @@ static void update_host_event_status(void) { int need_sci = 0; int need_smi = 0; + if (!init_done) + return; + /* Disable LPC interrupt while updating status register */ task_disable_irq(LM4_IRQ_LPC); @@ -502,7 +506,6 @@ static void lpc_post_sysjump(void) return; memcpy(event_mask, prev_mask, sizeof(event_mask)); - update_host_event_status(); } @@ -652,6 +655,12 @@ static int lpc_init(void) /* Restore event masks if needed */ lpc_post_sysjump(); + /* Sufficiently initialized */ + init_done = 1; + + /* Update host events now that we can copy them to memmap */ + update_host_event_status(); + return EC_SUCCESS; } DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_DEFAULT); diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c index 99b08669aa..2e2a34adca 100644 --- a/chip/stm32/keyboard_scan.c +++ b/chip/stm32/keyboard_scan.c @@ -334,6 +334,9 @@ static int check_recovery_key(void) } CPRINTF("Keyboard RECOVERY detected !\n"); + + host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY); + return 1; } diff --git a/include/ec_commands.h b/include/ec_commands.h index 72dac87567..4f85aeb9ab 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -192,6 +192,8 @@ enum host_event_code { * determine when the EC is ready to accept subsequent commands. */ EC_HOST_EVENT_INTERFACE_READY = 14, + /* Keyboard recovery combo has been pressed */ + EC_HOST_EVENT_KEYBOARD_RECOVERY = 15, /* * The high bit of the event mask is not used as a host event code. If * it reads back as set, then the entire event mask should be |