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>
This commit is contained in:
Furquan Shaikh 2016-11-11 13:57:55 -08:00 committed by Martin Roth
parent 626eea2d42
commit bce8bb6e6c
1 changed files with 39 additions and 0 deletions

View File

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