diff options
author | Ravi Chandra Sadineni <ravisadineni@chromium.org> | 2019-06-18 10:10:19 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2019-08-21 02:34:29 +0000 |
commit | 6ae8b5034b73712b6c44ff6ee90d7b84bc104b5a (patch) | |
tree | e9a4ee12c0061d79aa66ef3794f38824d7e1f132 | |
parent | 6aa094e30d1e85a87ba5d936fe8c03ee9e19ec56 (diff) |
chromeec: Depend on events_copy_b to identify the wake source
google_chromec_get_event() depends on the main copy of EC which is
used by ACPI subsytem in the kernel for querying events.
google_chromeec_get_event() also clears the event from EC. Thus if the
kernel has to identify the wake source, it has no way to do that. Thus
instead depend on events_copy_b to log the wake source. Please look at
go/hostevent-refactor for more info.
BUG=b:133262012
BRANCH=None
TEST=Hack hatch bios and make sure hostevent log is correct.
Change-Id: I39caae2689e0c2a7bec16416978877885a9afc6c
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34801
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r-- | src/ec/google/chromeec/ec.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index ed53c61b81..89da3aef2d 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -428,30 +428,19 @@ static void google_chromeec_log_device_events(uint64_t mask) void google_chromeec_log_events(uint64_t mask) { - u8 event; - uint64_t wake_mask; - bool restore_wake_mask = false; + uint64_t events; + int i; if (!CONFIG(ELOG)) return; - /* - * 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); + events = google_chromeec_get_events_b() & mask; + for (i = 0; i < sizeof(events) * 8; i++) { + if (EC_HOST_EVENT_MASK(i) & events) + elog_add_event_byte(ELOG_TYPE_EC_EVENT, i); } - if (restore_wake_mask) - google_chromeec_set_wake_mask(wake_mask); + google_chromeec_clear_events_b(events); } void google_chromeec_events_init(const struct google_chromeec_event_info *info, @@ -467,10 +456,6 @@ void google_chromeec_events_init(const struct google_chromeec_event_info *info, /* Disable SMI and wake events. */ google_chromeec_set_smi_mask(0); - /* Clear pending events. */ - while (google_chromeec_get_event() != 0) - ; - /* Restore SCI event mask. */ google_chromeec_set_sci_mask(info->sci_events); |