summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-10-13 11:06:37 -0700
committerFurquan Shaikh <furquan@google.com>2017-10-18 00:38:49 +0000
commitc1ca65df3f3d4d98820f9431a2e41b446928d8dd (patch)
treef09dcf48998215a8c5e093766e5c6dcee33adc66
parente01bf6452fb215a4598fb0edcdbf6e532ee6505f (diff)
google/chromeec: Drain all MKBP events while clearing host events
EC maintains a FIFO of all MKBP events and sets host event whenever a new entry is added to the FIFO. Clearing only the host event for MKBP creates an inconsistent state where there are pending MKBP events in the FIFO but host event for MKBP is cleared. In order to maintain a consistent view, host should clear all MKBP events in the FIFO if host event is being cleared. This change drains out all the MKBP events in the FIFO when clear_pending_events is called. TEST=Verified by adding debug logs in EC to verify that all the MKBP events that occur before clear_pending_events is called get cleared from the FIFO. Change-Id: I131722dc01608dff30230fe341e6b23ae4cc409e Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/22005 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--src/ec/google/chromeec/smihandler.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/smihandler.c b/src/ec/google/chromeec/smihandler.c
index 379ff68019..60b4d15058 100644
--- a/src/ec/google/chromeec/smihandler.c
+++ b/src/ec/google/chromeec/smihandler.c
@@ -48,8 +48,13 @@ void chromeec_smi_process_events(void)
static void clear_pending_events(void)
{
+ struct ec_response_get_next_event mkbp_event;
+
while (google_chromeec_get_event() != 0)
;
+
+ while (google_chromeec_get_mkbp_event(&mkbp_event) == 0)
+ ;
}
void chromeec_smi_sleep(int slp_type, uint32_t s3_mask, uint32_t s5_mask)