summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2020-10-28 09:40:57 +0100
committerCommit Bot <commit-bot@chromium.org>2020-10-30 07:03:12 +0000
commit9b1733d659d764140c825c0f32dab43de27410be (patch)
tree79774bb583961265bde08fb6cf710af170143e33 /core
parentdeef4e1aa7c347740e6c12e2ca3d6893ec19c2fb (diff)
downloadchrome-ec-9b1733d659d764140c825c0f32dab43de27410be.tar.gz
atomic: remove deprecated atomic functions
Remove deprecated_atomic_* functions since only atomic_* are now used. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I6b25cc81aec126662ed779cf0f9309dcb77a754e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505142 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/atomic.h64
-rw-r--r--core/cortex-m0/atomic.h56
-rw-r--r--core/host/atomic.h34
-rw-r--r--core/minute-ia/atomic.h67
-rw-r--r--core/nds32/atomic.h52
-rw-r--r--core/riscv-rv32i/atomic.h56
6 files changed, 0 insertions, 329 deletions
diff --git a/core/cortex-m/atomic.h b/core/cortex-m/atomic.h
index 1f432e8d1e..67abfa4a77 100644
--- a/core/cortex-m/atomic.h
+++ b/core/cortex-m/atomic.h
@@ -13,90 +13,26 @@
typedef int atomic_t;
typedef atomic_t atomic_val_t;
-/**
- * Implements atomic arithmetic operations on 32-bit integers.
- *
- * It used load/store exclusive.
- * If you write directly the integer used as an atomic variable,
- * you must either clear explicitly the exclusive monitor (using clrex)
- * or do it in exception context (which clears the monitor).
- */
-#define ATOMIC_OP(asm_op, a, v) do { \
- uint32_t reg0, reg1; \
- \
- __asm__ __volatile__("1: ldrex %0, [%2]\n" \
- #asm_op" %0, %0, %3\n" \
- " strex %1, %0, [%2]\n" \
- " teq %1, #0\n" \
- " bne 1b" \
- : "=&r" (reg0), "=&r" (reg1) \
- : "r" (a), "r" (v) : "cc"); \
-} while (0)
-
-/*
- * 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_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- ATOMIC_OP(bic, addr, bits);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
__atomic_fetch_and(addr, ~bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- ATOMIC_OP(orr, addr, bits);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
return __atomic_fetch_or(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- ATOMIC_OP(add, addr, value);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_add(addr, value, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
-{
- ATOMIC_OP(sub, addr, value);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
-{
- uint32_t ret, tmp;
-
- __asm__ __volatile__(" mov %3, #0\n"
- "1: ldrex %0, [%2]\n"
- " strex %1, %3, [%2]\n"
- " teq %1, #0\n"
- " bne 1b"
- : "=&r" (ret), "=&r" (tmp)
- : "r" (addr), "r" (0) : "cc");
-
- return ret;
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
diff --git a/core/cortex-m0/atomic.h b/core/cortex-m0/atomic.h
index 539117a672..ad07beee35 100644
--- a/core/cortex-m0/atomic.h
+++ b/core/cortex-m0/atomic.h
@@ -18,18 +18,6 @@ typedef atomic_t atomic_val_t;
*
* There is no load/store exclusive on ARMv6-M, just disable interrupts
*/
-#define DEPRECATED_ATOMIC_OP(asm_op, a, v) do { \
- uint32_t reg0; \
- \
- __asm__ __volatile__(" cpsid i\n" \
- " ldr %0, [%1]\n" \
- #asm_op" %0, %0, %2\n" \
- " str %0, [%1]\n" \
- " cpsie i\n" \
- : "=&b" (reg0) \
- : "b" (a), "r" (v) : "cc"); \
-} while (0)
-
#define ATOMIC_OP(asm_op, a, v) \
({ \
uint32_t reg0, reg1; \
@@ -46,70 +34,26 @@ typedef atomic_t atomic_val_t;
reg1; \
})
-/*
- * 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_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- DEPRECATED_ATOMIC_OP(bic, addr, bits);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
ATOMIC_OP(bic, addr, bits);
}
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- DEPRECATED_ATOMIC_OP(orr, addr, bits);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
return ATOMIC_OP(orr, addr, bits);
}
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- DEPRECATED_ATOMIC_OP(add, addr, value);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
return ATOMIC_OP(add, addr, value);
}
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
-{
- DEPRECATED_ATOMIC_OP(sub, addr, value);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
return ATOMIC_OP(sub, addr, value);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
-{
- uint32_t ret;
-
- __asm__ __volatile__(" mov %2, #0\n"
- " cpsid i\n"
- " ldr %0, [%1]\n"
- " str %2, [%1]\n"
- " cpsie i\n"
- : "=&b" (ret)
- : "b" (addr), "r" (0) : "cc");
-
- return ret;
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
atomic_t ret;
diff --git a/core/host/atomic.h b/core/host/atomic.h
index 0e662c9106..aaf990dac1 100644
--- a/core/host/atomic.h
+++ b/core/host/atomic.h
@@ -13,60 +13,26 @@
typedef int atomic_t;
typedef atomic_t atomic_val_t;
-/*
- * 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_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- __sync_and_and_fetch(addr, ~bits);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
__atomic_fetch_and(addr, ~bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- __sync_or_and_fetch(addr, bits);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
return __atomic_fetch_or(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- __sync_add_and_fetch(addr, value);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_add(addr, value, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
-{
- __sync_sub_and_fetch(addr, value);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
-{
- return __sync_fetch_and_and(addr, 0);
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
diff --git a/core/minute-ia/atomic.h b/core/minute-ia/atomic.h
index f55018d445..7c63268963 100644
--- a/core/minute-ia/atomic.h
+++ b/core/minute-ia/atomic.h
@@ -14,14 +14,6 @@
typedef int atomic_t;
typedef atomic_t atomic_val_t;
-#define ATOMIC_OP(asm_op, a, v) do { \
- __asm__ __volatile__ ( \
- ASM_LOCK_PREFIX #asm_op " %1, %0\n" \
- : "+m" (*a) \
- : "ir" (v) \
- : "memory"); \
-} while (0)
-
static inline int bool_compare_and_swap_u32(uint32_t *var, uint32_t old_value,
uint32_t new_value)
{
@@ -35,100 +27,41 @@ static inline int bool_compare_and_swap_u32(uint32_t *var, uint32_t old_value,
return (_old_value == old_value);
}
-/*
- * 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_or_u8(uint8_t *addr, uint8_t bits)
-{
- ATOMIC_OP(or, addr, bits);
-}
-
static inline atomic_val_t atomic_or_u8(uint8_t *addr, uint8_t bits)
{
return __atomic_fetch_or(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_and_u8(uint8_t *addr, uint8_t bits)
-{
- ATOMIC_OP(and, addr, bits);
-}
-
static inline atomic_val_t atomic_and_u8(uint8_t *addr, uint8_t bits)
{
return __atomic_fetch_and(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_clear_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- ATOMIC_OP(andl, addr, ~bits);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
__atomic_fetch_and(addr, ~bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- ATOMIC_OP(orl, addr, bits);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
return __atomic_fetch_or(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- ATOMIC_OP(addl, addr, value);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_add(addr, value, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_and(uint32_t volatile *addr,
- uint32_t value)
-{
- ATOMIC_OP(andl, addr, value);
-}
-
static inline atomic_val_t atomic_and(atomic_t *addr, atomic_val_t bits)
{
return __atomic_fetch_and(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
-{
- ATOMIC_OP(subl, addr, value);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
-{
- int ret = 0;
-
- if (*addr == 0)
- return 0;
-
- asm volatile(ASM_LOCK_PREFIX "xchgl %0, %1\n"
- : "+r" (ret), "+m" (*addr)
- : : "memory", "cc");
-
- return ret;
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
diff --git a/core/nds32/atomic.h b/core/nds32/atomic.h
index ae33b39986..f42b91614f 100644
--- a/core/nds32/atomic.h
+++ b/core/nds32/atomic.h
@@ -15,21 +15,6 @@
typedef int atomic_t;
typedef atomic_t atomic_val_t;
-/*
- * 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_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- uint32_t int_mask = read_clear_int_mask();
-
- *addr &= ~bits;
- set_int_mask(int_mask);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
atomic_t volatile *ptr = addr;
@@ -39,14 +24,6 @@ static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
set_int_mask(int_mask);
}
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- uint32_t int_mask = read_clear_int_mask();
-
- *addr |= bits;
- set_int_mask(int_mask);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
atomic_val_t ret;
@@ -59,15 +36,6 @@ static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
return ret;
}
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- uint32_t int_mask = read_clear_int_mask();
-
- *addr += value;
- set_int_mask(int_mask);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
atomic_val_t ret;
@@ -80,15 +48,6 @@ static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
return ret;
}
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
-{
- uint32_t int_mask = read_clear_int_mask();
-
- *addr -= value;
- set_int_mask(int_mask);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
atomic_val_t ret;
@@ -101,17 +60,6 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return ret;
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
-{
- uint32_t val;
- uint32_t int_mask = read_clear_int_mask();
-
- val = *addr;
- *addr = 0;
- set_int_mask(int_mask);
- return val;
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
atomic_val_t ret;
diff --git a/core/riscv-rv32i/atomic.h b/core/riscv-rv32i/atomic.h
index 8dec97df48..c8baf9d42b 100644
--- a/core/riscv-rv32i/atomic.h
+++ b/core/riscv-rv32i/atomic.h
@@ -15,92 +15,36 @@
typedef int atomic_t;
typedef atomic_t atomic_val_t;
-#define ATOMIC_OP(op, value, addr) \
-({ \
- uint32_t tmp; \
- asm volatile ( \
- "amo" #op ".w.aqrl %0, %2, %1" \
- : "=r" (tmp), "+A" (*addr) \
- : "r" (value)); \
- tmp; \
-})
-
-/*
- * 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_bits(volatile uint32_t *addr,
- uint32_t bits)
-{
- ATOMIC_OP(and, ~bits, addr);
-}
-
static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
__atomic_fetch_and(addr, ~bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_or(volatile uint32_t *addr, uint32_t bits)
-{
- ATOMIC_OP(or, bits, addr);
-}
-
static inline atomic_val_t atomic_or(atomic_t *addr, atomic_val_t bits)
{
return __atomic_fetch_or(addr, bits, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_add(volatile uint32_t *addr,
- uint32_t value)
-{
- ATOMIC_OP(add, value, addr);
-}
-
static inline atomic_val_t atomic_add(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_add(addr, value, __ATOMIC_SEQ_CST);
}
-static inline void deprecated_atomic_sub(volatile uint32_t *addr,
- uint32_t value)
-{
- ATOMIC_OP(add, -value, addr);
-}
-
static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_clear(volatile uint32_t *addr)
-{
- return ATOMIC_OP(and, 0, addr);
-}
-
static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_add(volatile uint32_t *addr,
- uint32_t value)
-{
- return ATOMIC_OP(add, value, addr);
-}
-
static inline atomic_val_t atomic_read_add(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_add(addr, value, __ATOMIC_SEQ_CST);
}
-static inline uint32_t deprecated_atomic_read_sub(volatile uint32_t *addr,
- uint32_t value)
-{
- return ATOMIC_OP(add, -value, addr);
-}
-
static inline atomic_val_t atomic_read_sub(atomic_t *addr, atomic_val_t value)
{
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);