diff options
author | Furquan Shaikh <furquan@chromium.org> | 2016-11-11 13:57:55 -0800 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-11-14 20:15:03 +0100 |
commit | bce8bb6e6ce5045ea611dae96857cf93d596a86c (patch) | |
tree | 69c2128b95a9f35199ad3f15fe6778fb7be8453e | |
parent | 626eea2d42af79117879ceb2f6d354634f81aac8 (diff) | |
download | coreboot-bce8bb6e6ce5045ea611dae96857cf93d596a86c.tar.xz |
google/chromeec: Add elog events for recovery mode switches
BUG=chrome-os-partner:59352
BRANCH=None
TEST=Verified eventlog on reef
0 | 2016-11-12 19:49:25 | Log area cleared | 4088
1 | 2016-11-12 19:49:25 | Kernel Event | Clean Shutdown
2 | 2016-11-12 19:49:25 | ACPI Enter | S5
3 | 2016-11-12 19:49:39 | System boot | 365
4 | 2016-11-12 19:49:39 | EC Event | Power Button
5 | 2016-11-12 19:49:45 | Chrome OS Recovery Mode | Recovery Button
Pressed
6 | 2016-11-12 19:49:45 | Chrome OS Developer Mode
7 | 2016-11-12 19:49:45 | EC Event | Keyboard Recovery
8 | 2016-11-12 19:49:45 | Memory Cache Update | Recovery | Success
9 | 2016-11-12 19:50:46 | System boot | 366
10 | 2016-11-12 19:50:46 | EC Event | Power Button
11 | 2016-11-12 19:50:52 | Chrome OS Recovery Mode | Recovery Button
Pressed
12 | 2016-11-12 19:50:52 | Chrome OS Developer Mode
13 | 2016-11-12 19:50:52 | EC Event | Keyboard Recovery Forced Hardware
Reinit
14 | 2016-11-12 19:50:52 | Memory Cache Update | Recovery | Success
15 | 2016-11-12 19:51:24 | Power Button
16 | 2016-11-12 19:51:24 | ACPI Enter | S5
17 | 2016-11-12 19:51:27 | System boot | 367
18 | 2016-11-12 19:51:27 | EC Event | Power Button
19 | 2016-11-12 19:51:32 | Wake Source | Power Button | 0
20 | 2016-11-12 19:51:32 | ACPI Wake | S5
21 | 2016-11-12 19:51:32 | Chrome OS Developer Mode
22 | 2016-11-12 19:51:32 | Memory Cache Update | Normal | Success
Change-Id: I45dda210cf9d4e5a75404792fcee15b2010787a7
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/17394
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | src/ec/google/chromeec/ec.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index c8b6e7e10a..1308c3d13b 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -15,9 +15,13 @@ #include <stdint.h> #include <string.h> +#include <cbmem.h> #include <console/console.h> #include <arch/io.h> +#include <bootmode.h> +#include <bootstate.h> #include <delay.h> +#include <elog.h> #include <halt.h> #include <reset.h> #include <elog.h> @@ -29,6 +33,41 @@ #include "ec.h" #include "ec_commands.h" +void log_recovery_mode_switch(void) +{ + uint32_t *events; + + if (cbmem_find(CBMEM_ID_EC_HOSTEVENT)) + return; + + events = cbmem_add(CBMEM_ID_EC_HOSTEVENT, sizeof(*events)); + if (!events) + return; + + *events = google_chromeec_get_events_b(); +} + +static void google_chromeec_elog_add_recovery_event(void *unused) +{ + uint32_t *events = cbmem_find(CBMEM_ID_EC_HOSTEVENT); + uint8_t event_byte = EC_EVENT_KEYBOARD_RECOVERY; + + if (!events) + return; + + if (!(*events & EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY))) + return; + + if (*events & + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT)) + event_byte = EC_EVENT_KEYBOARD_RECOVERY_HWREINIT; + + elog_add_event_byte(ELOG_TYPE_EC_EVENT, event_byte); +} + +BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, + google_chromeec_elog_add_recovery_event, NULL); + uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size) { int csum; |