diff options
author | Nick Vaccaro <nvaccaro@chromium.org> | 2017-05-04 20:17:42 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-09 21:44:03 -0700 |
commit | e9215ba711d337e4cfc9524c4ef07b03a813c8fb (patch) | |
tree | 02b56ba3ffa440b40db38da3be2808ab1c3fc0f4 /common/host_event_commands.c | |
parent | 14a3a3ac23bc5b03a4d884106a8cb4a75d861fb7 (diff) | |
download | chrome-ec-e9215ba711d337e4cfc9524c4ef07b03a813c8fb.tar.gz |
common: allow report disabling of host events
Adds a mechanism that allows a board to disable interrupting the AP /
kernel when the status of any one of the EC_HOST_EVENTS included in
CONFIG_HOST_EVENT_REPORT_MASK changes state. Default state enables
reporting of all events; a board can override this by defining
CONFIG_HOST_EVENT_REPORT_MASK in its board.h file.
NOTE: The host_set_events() and host_clear_events() routines no longer
interrupt the AP if none of the host events the AP is interested in
changed state.
BRANCH=none
BUG=chromium:637061
TEST=make buildall passes
Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Change-Id: I678fb9d9dab6890848b94b314efd711842b1fd48
Reviewed-on: https://chromium-review.googlesource.com/502078
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/host_event_commands.c')
-rw-r--r-- | common/host_event_commands.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 0364474de0..1dc9ac5c0c 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -40,9 +40,14 @@ uint32_t host_get_events(void) void host_set_events(uint32_t mask) { - /* Only print if something's about to change */ - if ((events & mask) != mask || (events_copy_b & mask) != mask) - CPRINTS("event set 0x%08x", mask); + /* ignore host events the rest of board doesn't care about */ + mask &= CONFIG_HOST_EVENT_REPORT_MASK; + + /* exit now if nothing has changed */ + if (!((events & mask) != mask || (events_copy_b & mask) != mask)) + return; + + CPRINTS("event set 0x%08x", mask); atomic_or(&events, mask); atomic_or(&events_copy_b, mask); @@ -62,9 +67,14 @@ void host_set_events(uint32_t mask) void host_clear_events(uint32_t mask) { - /* Only print if something's about to change */ - if (events & mask) - CPRINTS("event clear 0x%08x", mask); + /* ignore host events the rest of board doesn't care about */ + mask &= CONFIG_HOST_EVENT_REPORT_MASK; + + /* return early if nothing changed */ + if (!(events & mask)) + return; + + CPRINTS("event clear 0x%08x", mask); atomic_clear(&events, mask); |