diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-09-23 15:21:18 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-29 16:30:59 +0000 |
commit | d4be394be0b91a71b2f16ca476114b7470bc630f (patch) | |
tree | e08dd7e428be1d27b65c4bae3ba8a47e40c8b1a5 /core/riscv-rv32i | |
parent | 9513a63a626021b071199d02b7c73112eb746833 (diff) | |
download | chrome-ec-d4be394be0b91a71b2f16ca476114b7470bc630f.tar.gz |
tree: rename atomic_* functions to deprecated_atomic_*
We will move to an API compatible with Zephyr's API. See the bug for
complete rationale and plan.
BUG=b:169151160
BRANCH=none
TEST=buildall
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: Id611f663446abf00b24298a669f2ae47fef7f632
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427507
Tested-by: Dawid Niedźwiecki <dn@semihalf.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'core/riscv-rv32i')
-rw-r--r-- | core/riscv-rv32i/atomic.h | 25 | ||||
-rw-r--r-- | core/riscv-rv32i/task.c | 21 |
2 files changed, 29 insertions, 17 deletions
diff --git a/core/riscv-rv32i/atomic.h b/core/riscv-rv32i/atomic.h index d9f25cd38d..a9e4df0344 100644 --- a/core/riscv-rv32i/atomic.h +++ b/core/riscv-rv32i/atomic.h @@ -22,37 +22,48 @@ tmp; \ }) -static inline void atomic_clear(volatile uint32_t *addr, uint32_t bits) +/* + * The atomic_* functions are marked as deprecated as a part of the process of + * transaction to Zephyr compatible atomic functions. These prefixes will be + * removed in the following patches. Please see b:169151160 for more details. + */ + +static inline void deprecated_atomic_clear(volatile uint32_t *addr, + uint32_t bits) { ATOMIC_OP(and, ~bits, addr); } -static inline void atomic_or(volatile uint32_t *addr, uint32_t bits) +static inline void deprecated_atomic_or(volatile uint32_t *addr, uint32_t bits) { ATOMIC_OP(or, bits, addr); } -static inline void atomic_add(volatile uint32_t *addr, uint32_t value) +static inline void deprecated_atomic_add(volatile uint32_t *addr, + uint32_t value) { ATOMIC_OP(add, value, addr); } -static inline void atomic_sub(volatile uint32_t *addr, uint32_t value) +static inline void deprecated_atomic_sub(volatile uint32_t *addr, + uint32_t value) { ATOMIC_OP(add, -value, addr); } -static inline uint32_t atomic_read_clear(volatile uint32_t *addr) +static inline uint32_t deprecated_atomic_read_clear(volatile uint32_t *addr) { return ATOMIC_OP(and, 0, addr); } -static inline uint32_t atomic_inc(volatile uint32_t *addr, uint32_t value) +static inline uint32_t deprecated_atomic_inc(volatile uint32_t *addr, + uint32_t value) { return ATOMIC_OP(add, value, addr); } -static inline uint32_t atomic_dec(volatile uint32_t *addr, uint32_t value) +static inline uint32_t deprecated_atomic_dec(volatile uint32_t *addr, + uint32_t value) { return ATOMIC_OP(add, -value, addr); } diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c index 3ad78994bd..862f9e3b81 100644 --- a/core/riscv-rv32i/task.c +++ b/core/riscv-rv32i/task.c @@ -397,7 +397,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched) ret = timer_arm(deadline, me); ASSERT(ret == EC_SUCCESS); } - while (!(evt = atomic_read_clear(&tsk->events))) { + while (!(evt = deprecated_atomic_read_clear(&tsk->events))) { /* Remove ourself and get the next task in the scheduler */ __schedule(1, resched, 0); resched = TASK_ID_IDLE; @@ -405,7 +405,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched) if (timeout_us > 0) { timer_cancel(me); /* Ensure timer event is clear, we no longer care about it */ - atomic_clear(&tsk->events, TASK_EVENT_TIMER); + deprecated_atomic_clear(&tsk->events, TASK_EVENT_TIMER); } return evt; } @@ -417,12 +417,12 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait) ASSERT(receiver); /* Set the event bit in the receiver message bitmap */ - atomic_or(&receiver->events, event); + deprecated_atomic_or(&receiver->events, event); /* Re-schedule if priorities have changed */ if (in_interrupt_context()) { /* The receiver might run again */ - atomic_or(&tasks_ready, 1 << tskid); + deprecated_atomic_or(&tasks_ready, 1 << tskid); if (start_called) need_resched = 1; } else { @@ -463,7 +463,8 @@ uint32_t __ram_code task_wait_event_mask(uint32_t event_mask, int timeout_us) /* Re-post any other events collected */ if (events & ~event_mask) - atomic_or(¤t_task->events, events & ~event_mask); + deprecated_atomic_or(¤t_task->events, + events & ~event_mask); return events & event_mask; } @@ -493,12 +494,12 @@ void task_enable_all_tasks(void) void task_enable_task(task_id_t tskid) { - atomic_or(&tasks_enabled, BIT(tskid)); + deprecated_atomic_or(&tasks_enabled, BIT(tskid)); } void task_disable_task(task_id_t tskid) { - atomic_clear(&tasks_enabled, BIT(tskid)); + deprecated_atomic_clear(&tasks_enabled, BIT(tskid)); if (!in_interrupt_context() && tskid == task_get_current()) __schedule(0, 0, 0); @@ -557,7 +558,7 @@ void __ram_code mutex_lock(struct mutex *mtx) uint32_t id = 1 << task_get_current(); ASSERT(id != TASK_ID_INVALID); - atomic_or(&mtx->waiters, id); + deprecated_atomic_or(&mtx->waiters, id); while (1) { asm volatile ( @@ -574,7 +575,7 @@ void __ram_code mutex_lock(struct mutex *mtx) task_wait_event_mask(TASK_EVENT_MUTEX, 0); } - atomic_clear(&mtx->waiters, id); + deprecated_atomic_clear(&mtx->waiters, id); } void __ram_code mutex_unlock(struct mutex *mtx) @@ -598,7 +599,7 @@ void __ram_code mutex_unlock(struct mutex *mtx) } /* Ensure no event is remaining from mutex wake-up */ - atomic_clear(&tsk->events, TASK_EVENT_MUTEX); + deprecated_atomic_clear(&tsk->events, TASK_EVENT_MUTEX); } void task_print_list(void) |