summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ec/google/chromeec/ec.c39
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;