diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-04-15 09:40:34 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2014-04-18 17:47:17 +0000 |
commit | eb2246892e05f1cd1b14eb131b4a15cb5d0619d4 (patch) | |
tree | c8e9f5e833cfb535c8d073ce4cd0e60c690a7247 | |
parent | 4481150f012f70f98ef22f8fd9a5983d0dc09379 (diff) | |
download | chrome-ec-eb2246892e05f1cd1b14eb131b4a15cb5d0619d4.tar.gz |
lpc: ACPI query-next-event drops masked events
Previously, you could use EC_CMD_ACPI_QUERY_EVENT to read events that
were masked off (that is, events which would not generate SCI/SMI/wake
signals). The handlers for those signals on the host would still act
on the masked-off events - for example, causing unwanted power button
keypresses/releases.
Now, EC_CMD_ACPI_QUERY_EVENT will only return events which are unmasked.
This does not affect storing of events at event generation time.
Events are still queued; they won't be dropped until the host attempts
to read the next event. This gives the host a chance to set a mask
later in boot (but before querying any events) to capture events which
happened early in the boot process.
BUG=chrome-os-partner:26574
BRANCH=rambi
TEST=At EC console, type 'hostevent set 0x80' but don't press enter.
Hold down the power button; UI starts fading to white.
Press enter at the EC console to issue the hostevent command.
System should continue shutting down, not fade back as if the
power button were released.
Orig-Change-Id: Id2cb14b0979f49cdd42424b9a61b310a2bb506f5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194935
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
(cherry picked from commit d899fdaaeef175e97923b954342dad3a33c5c387)
Change-Id: I69f495809a72bda77841ed16c041d0c3dbe198c2
Reviewed-on: https://chromium-review.googlesource.com/195566
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | chip/lm4/lpc.c | 18 | ||||
-rw-r--r-- | chip/mec1322/lpc.c | 18 |
2 files changed, 30 insertions, 6 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index eb1e53a802..0593570b61 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -389,12 +389,25 @@ void lpc_set_host_event_state(uint32_t mask) int lpc_query_host_event_state(void) { + const uint32_t any_mask = event_mask[0] | event_mask[1] | event_mask[2]; int evt_index = 0; int i; for (i = 0; i < 32; i++) { - if (host_events & (1 << i)) { - host_clear_events(1 << i); + const uint32_t e = (1 << i); + + if (host_events & e) { + host_clear_events(e); + + /* + * If host hasn't unmasked this event, drop it. We do + * this at query time rather than event generation time + * so that the host has a chance to unmask events + * before they're dropped by a query. + */ + if (!(e & any_mask)) + continue; + evt_index = i + 1; /* Events are 1-based */ break; } @@ -403,7 +416,6 @@ int lpc_query_host_event_state(void) return evt_index; } - void lpc_set_host_event_mask(enum lpc_host_event_type type, uint32_t mask) { event_mask[type] = mask; diff --git a/chip/mec1322/lpc.c b/chip/mec1322/lpc.c index fb3ace7438..5c715797b5 100644 --- a/chip/mec1322/lpc.c +++ b/chip/mec1322/lpc.c @@ -341,12 +341,25 @@ void lpc_set_host_event_state(uint32_t mask) int lpc_query_host_event_state(void) { + const uint32_t any_mask = event_mask[0] | event_mask[1] | event_mask[2]; int evt_index = 0; int i; for (i = 0; i < 32; i++) { - if (host_events & (1 << i)) { - host_clear_events(1 << i); + const uint32_t e = (1 << i); + + if (host_events & e) { + host_clear_events(e); + + /* + * If host hasn't unmasked this event, drop it. We do + * this at query time rather than event generation time + * so that the host has a chance to unmask events + * before they're dropped by a query. + */ + if (!(e & any_mask)) + continue; + evt_index = i + 1; /* Events are 1-based */ break; } @@ -355,7 +368,6 @@ int lpc_query_host_event_state(void) return evt_index; } - void lpc_set_host_event_mask(enum lpc_host_event_type type, uint32_t mask) { event_mask[type] = mask; |