diff options
author | Atish Patra <atish.patra@wdc.com> | 2019-01-21 10:23:28 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-01-22 07:33:49 +0300 |
commit | 312b6bf32f51e530dd22746fe2a36d6459e29588 (patch) | |
tree | f7f9270897139dce8886b1db11f02cc087559f9f /include/sbi/riscv_atomic.h | |
parent | 784a4657c0957e7f9561fd2d87930ba008643c1e (diff) | |
download | opensbi-312b6bf32f51e530dd22746fe2a36d6459e29588.tar.xz |
lib: Add atomic bit set/clear operations.
Add addtional functionlities for set/clear bits
atomically.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/riscv_atomic.h')
-rw-r--r-- | include/sbi/riscv_atomic.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/sbi/riscv_atomic.h b/include/sbi/riscv_atomic.h index 775cd6f..0fea6bd 100644 --- a/include/sbi/riscv_atomic.h +++ b/include/sbi/riscv_atomic.h @@ -34,5 +34,33 @@ long arch_atomic_xchg(atomic_t *atom, long newval); unsigned int atomic_raw_xchg_uint(volatile unsigned int *ptr, unsigned int newval); +/** + * Set a bit in an atomic variable and return the new value. + * @nr : Bit to set. + * @atom: atomic variable to modify + */ +int atomic_set_bit(int nr, atomic_t *atom); + +/** + * Clear a bit in an atomic variable and return the new value. + * @nr : Bit to set. + * @atom: atomic variable to modify + */ + +int atomic_clear_bit(int nr, atomic_t *atom); + +/** + * Set a bit in any address and return the new value . + * @nr : Bit to set. + * @addr: Address to modify + */ +int atomic_raw_set_bit(int nr, volatile unsigned long *addr); + +/** + * Clear a bit in any address and return the new value . + * @nr : Bit to set. + * @addr: Address to modify + */ +int atomic_raw_clear_bit(int nr, volatile unsigned long *addr); #endif |