summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-04-02 09:39:39 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-04-26 01:30:14 +0000
commit82431de06730b0c4e1f4a867591900fbf2827d98 (patch)
tree1fc3a892ff05019fbc4bfc44af97e99af1ed0a15
parent4f298fa78e253e0105970a9e458ea12b743aaa32 (diff)
downloadchrome-ec-82431de06730b0c4e1f4a867591900fbf2827d98.tar.gz
host_event_commands: Fix lpc_get_next_host_event for 64-bit events
__builtin_ffs takes an int as argument, and, therefore, does not find bits >= 32. Fix this up when CONFIG_HOST_EVENT64. BUG=b:69329196 BRANCH=fizz,poppy TEST=Patch coreboot to add bit 33 in SCI mask, add EC code to send such events, EC does not watchdog anymore Change-Id: I91a4366c7b0e565fc523246d0abb684ffa50d483 Original-Change-Id: If868095f19fe1940b4f5924cf669a719f9535991 Original-Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/989514 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1029250 Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--common/host_event_commands.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 587fa12df2..52d4049120 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -137,6 +137,15 @@ int lpc_get_next_host_event(void)
host_event_t ev;
int evt_idx = __builtin_ffs(lpc_host_events);
+#ifdef CONFIG_HOST_EVENT64
+ if (evt_idx == 0) {
+ int evt_idx_high = __builtin_ffs(lpc_host_events >> 32);
+
+ if (evt_idx_high)
+ evt_idx = 32 + evt_idx_high;
+ }
+#endif
+
if (evt_idx) {
host_event_set_bit(&ev, evt_idx);
host_clear_events(ev);