summaryrefslogtreecommitdiff
path: root/src/ec
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-12-14 14:46:20 -0600
committerAaron Durbin <adurbin@chromium.org>2016-12-15 23:11:37 +0100
commit8f9a5ff8ec338dcaa1c43e4725ce0dbd6a01f37d (patch)
treedf86a1a8c397713020cb8974d37b91722ccbd42a /src/ec
parentb2a5f4833d022d16c934f7dad30cdfa8fb28863c (diff)
ec/google/chromeec: query cbmem for retrain status
The EC switches, including the hardware retrain flag, are cleared when handing off the vboot state in romstage. However, one may still want to query the state of the hardware retrain flag. Thus, add a method to get the flag from cbmem. BUG=chrome-os-partner:60592 BRANCH=reef Change-Id: Ic76cfb3255a8d3c179d5f8b13fa13c518f79faa2 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17869 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/ec')
-rw-r--r--src/ec/google/chromeec/switches.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ec/google/chromeec/switches.c b/src/ec/google/chromeec/switches.c
index 74f72105d0..7ed4bfd5cc 100644
--- a/src/ec/google/chromeec/switches.c
+++ b/src/ec/google/chromeec/switches.c
@@ -14,6 +14,7 @@
*/
#include <bootmode.h>
+#include <cbmem.h>
#include <ec/google/chromeec/ec.h>
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_LPC)
@@ -41,12 +42,25 @@ int get_recovery_mode_switch(void)
int get_recovery_mode_retrain_switch(void)
{
+ uint32_t events;
+ const uint32_t mask =
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT);
+
/*
* Check if the EC has posted the keyboard recovery event with memory
* retrain.
*/
- return !!(google_chromeec_get_events_b() &
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT));
+ events = google_chromeec_get_events_b();
+
+ if (cbmem_possibly_online()) {
+ const uint32_t *events_save;
+
+ events_save = cbmem_find(CBMEM_ID_EC_HOSTEVENT);
+ if (events_save != NULL)
+ events |= *events_save;
+ }
+
+ return !!(events & mask);
}
int clear_recovery_mode_switch(void)