[coreboot-gerrit] Patch set updated for coreboot: google/chromeec: Add elog events for recovery mode switches

Furquan Shaikh (furquan@google.com) gerrit at coreboot.org
Sun Nov 13 04:55:57 CET 2016


Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17394

-gerrit

commit 7acca43a6e92dfbcea0b86a95d8a2b1d8ee752a4
Author: Furquan Shaikh <furquan at chromium.org>
Date:   Fri Nov 11 13:57:55 2016 -0800

    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 at chromium.org>
---
 src/ec/google/chromeec/ec.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index c8b6e7e..1308c3d 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;



More information about the coreboot-gerrit mailing list