0001
0002
0003
0004
0005
0006 #ifndef _ASM_ARC_ATOMIC_H
0007 #define _ASM_ARC_ATOMIC_H
0008
0009 #ifndef __ASSEMBLY__
0010
0011 #include <linux/types.h>
0012 #include <linux/compiler.h>
0013 #include <asm/cmpxchg.h>
0014 #include <asm/barrier.h>
0015 #include <asm/smp.h>
0016
0017 #define arch_atomic_read(v) READ_ONCE((v)->counter)
0018
0019 #ifdef CONFIG_ARC_HAS_LLSC
0020 #include <asm/atomic-llsc.h>
0021 #else
0022 #include <asm/atomic-spinlock.h>
0023 #endif
0024
0025 #define arch_atomic_cmpxchg(v, o, n) \
0026 ({ \
0027 arch_cmpxchg(&((v)->counter), (o), (n)); \
0028 })
0029
0030 #ifdef arch_cmpxchg_relaxed
0031 #define arch_atomic_cmpxchg_relaxed(v, o, n) \
0032 ({ \
0033 arch_cmpxchg_relaxed(&((v)->counter), (o), (n)); \
0034 })
0035 #endif
0036
0037 #define arch_atomic_xchg(v, n) \
0038 ({ \
0039 arch_xchg(&((v)->counter), (n)); \
0040 })
0041
0042 #ifdef arch_xchg_relaxed
0043 #define arch_atomic_xchg_relaxed(v, n) \
0044 ({ \
0045 arch_xchg_relaxed(&((v)->counter), (n)); \
0046 })
0047 #endif
0048
0049
0050
0051
0052 #ifdef CONFIG_GENERIC_ATOMIC64
0053 #include <asm-generic/atomic64.h>
0054 #else
0055 #include <asm/atomic64-arcv2.h>
0056 #endif
0057
0058 #endif
0059
0060 #endif