summaryrefslogtreecommitdiff
path: root/core/cortex-m0
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-11-25 16:00:21 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-30 12:27:58 -0800
commit6e4848c2000bf41352e02935d2f9bdd482494fb0 (patch)
tree873c1e4eb9848e644cb8c5aa12cfafe7ad7556ca /core/cortex-m0
parent0c4408efdcd37a20c57e74b4b0778e5a477926ac (diff)
downloadchrome-ec-6e4848c2000bf41352e02935d2f9bdd482494fb0.tar.gz
task: Don't discard events on mutex contention
On mutex contention, call task_wait_event_mask(), which will wait for a mutex event without clearing other pending events. BUG=chrome-os-partner:47918,chromium:435611,chromium:435612 BRANCH=None TEST=Manual on snoball. Verify samus can successfully negotiate PD power contract when attached to snoball. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I85cd32f2670246da9e4787025390aba2c93f9c36 Reviewed-on: https://chromium-review.googlesource.com/314492 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'core/cortex-m0')
-rw-r--r--core/cortex-m0/task.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 7179d05629..1d4ded513e 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -509,9 +509,8 @@ void mutex_lock(struct mutex *mtx)
if (mtx->lock == 0)
break;
__asm__ __volatile__("cpsie i");
- /* TODO(crbug.com/435612, crbug.com/435611)
- * This discards any pending events! */
- task_wait_event(0); /* Contention on the mutex */
+ /* Contention on the mutex */
+ task_wait_event_mask(TASK_EVENT_MUTEX, 0);
}
mtx->lock = 2;
__asm__ __volatile__("cpsie i");