From da1b429c79ac591fb077a705ac41cb188a2500a9 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Mon, 2 Apr 2018 09:39:39 +0800 Subject: [PATCH] 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: If868095f19fe1940b4f5924cf669a719f9535991 Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/989514 Reviewed-by: Furquan Shaikh --- common/host_event_commands.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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);