diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-12-30 14:11:17 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-01 00:27:33 +0000 |
commit | 783b46afb9f005cd7350d08f02691004f759a884 (patch) | |
tree | 0e25f6ee22fc3a6a2ba1bacc2cb8e8906b322488 | |
parent | a8ccffded0a447c5fe2ad0e4fe97b05bbc8a3be0 (diff) | |
download | chrome-ec-783b46afb9f005cd7350d08f02691004f759a884.tar.gz |
zinger: fix task_wait_event() bug causing missed wake events
Fix task_wait_event() in zinger runtime so that checking for events
fired is done with interrupts disabled to avoid getting an interrupt
that sets an event right after checking for that event.
BUG=none
BRANCH=samus
TEST=load on zinger and plug/unplug ~10 times and see successful
negotiations without any communication errors. note that without this
CL, under certain circumstances, zinger fails to respond with goodCRC
at the right time because the RX interrupt sets the event after
task_wait_event() has already checked it.
Change-Id: I2b43b8e389c6655d2a7a62b791014d1d5d678158
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/238092
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/zinger/runtime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c index 171c706bfa..186480f3e9 100644 --- a/board/zinger/runtime.c +++ b/board/zinger/runtime.c @@ -174,6 +174,7 @@ uint32_t task_wait_event(int timeout_us) asm volatile("cpsie i ; isb"); /* note: interrupt that woke us up will run here */ + asm volatile("cpsid i"); t0 = get_time(); /* check for timeout if timeout was set */ @@ -185,12 +186,11 @@ uint32_t task_wait_event(int timeout_us) /* recalculate timeout if timeout was set */ if (timeout_us >= 0) timeout_us = t1.val - t0.val; - - asm volatile("cpsid i"); } evt = last_event; last_event = 0; + asm volatile("cpsie i ; isb"); return evt; } |