google/chromeec: Do not set wake mask before logging EC events

Earlier the EC expected the host to set appropriate masks before
reading host events. However, with recent change in EC, this is no
longer required. This change removes the setting of wake_mask before
and after reading the host events. However, in order to support older
versions of EC, a new feature flag is added on the EC side that
informs the host whether or not it is using the new way of reporting
host events without having to set wake mask.

CQ-DEPEND=CL:719578
TEST=Verified that EC wake events are correctly logged with both old
and new versions of EC.

Change-Id: Ib17e1296fb7d3bbc84fc7581fd0a9bd179ac87b9
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/22006
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh 2017-10-13 11:31:35 -07:00 committed by Furquan Shaikh
parent 4854761ba4
commit 1432cbc4da
2 changed files with 14 additions and 4 deletions

View File

@ -261,19 +261,27 @@ void google_chromeec_log_events(u32 mask)
{
u8 event;
u32 wake_mask;
bool restore_wake_mask = false;
if (!IS_ENABLED(CONFIG_ELOG))
return;
/* Set wake mask so events will be read from ACPI interface */
/*
* If the EC supports unified wake masks, then there is no need to set
* wake mask before reading out the host events.
*/
if (google_chromeec_check_feature(EC_FEATURE_UNIFIED_WAKE_MASKS) != 1) {
wake_mask = google_chromeec_get_wake_mask();
google_chromeec_set_wake_mask(mask);
restore_wake_mask = true;
}
while ((event = google_chromeec_get_event()) != 0) {
if (EC_HOST_EVENT_MASK(event) & mask)
elog_add_event_byte(ELOG_TYPE_EC_EVENT, event);
}
if (restore_wake_mask)
google_chromeec_set_wake_mask(wake_mask);
}

View File

@ -1112,6 +1112,8 @@ enum ec_feature_code {
EC_FEATURE_RWSIG = 30,
/* EC has device events support */
EC_FEATURE_DEVICE_EVENT = 31,
/* EC supports the unified wake masks for LPC/eSPI systems */
EC_FEATURE_UNIFIED_WAKE_MASKS = 32,
};
#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))