[coreboot-gerrit] Change in coreboot[master]: google/chromeec: Drain all MKBP events while clearing host events

Furquan Shaikh (Code Review) gerrit at coreboot.org
Fri Oct 13 23:37:23 CEST 2017


Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/22005


Change subject: google/chromeec: Drain all MKBP events while clearing host events
......................................................................

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



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/22005/1

diff --git a/src/ec/google/chromeec/smihandler.c b/src/ec/google/chromeec/smihandler.c
index 379ff68..60b4d15 100644
--- a/src/ec/google/chromeec/smihandler.c
+++ b/src/ec/google/chromeec/smihandler.c
@@ -48,8 +48,13 @@
 
 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)

-- 
To view, visit https://review.coreboot.org/22005
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I131722dc01608dff30230fe341e6b23ae4cc409e
Gerrit-Change-Number: 22005
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171013/fe0d0640/attachment.html>


More information about the coreboot-gerrit mailing list