Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / arch / x86 / include / asm / rwlock.h
bloba5370a03d90c6feaec7afe3d16e94e9154fcbd93
1 #ifndef _ASM_X86_RWLOCK_H
2 #define _ASM_X86_RWLOCK_H
4 #include <asm/asm.h>
6 #if CONFIG_NR_CPUS <= 2048
8 #ifndef __ASSEMBLY__
9 typedef union {
10 s32 lock;
11 s32 write;
12 } arch_rwlock_t;
13 #endif
15 #define RW_LOCK_BIAS 0x00100000
16 #define READ_LOCK_SIZE(insn) __ASM_FORM(insn##l)
17 #define READ_LOCK_ATOMIC(n) atomic_##n
18 #define WRITE_LOCK_ADD(n) __ASM_FORM_COMMA(addl n)
19 #define WRITE_LOCK_SUB(n) __ASM_FORM_COMMA(subl n)
20 #define WRITE_LOCK_CMP RW_LOCK_BIAS
22 #else /* CONFIG_NR_CPUS > 2048 */
24 #include <linux/const.h>
26 #ifndef __ASSEMBLY__
27 typedef union {
28 s64 lock;
29 struct {
30 u32 read;
31 s32 write;
33 } arch_rwlock_t;
34 #endif
36 #define RW_LOCK_BIAS (_AC(1,L) << 32)
37 #define READ_LOCK_SIZE(insn) __ASM_FORM(insn##q)
38 #define READ_LOCK_ATOMIC(n) atomic64_##n
39 #define WRITE_LOCK_ADD(n) __ASM_FORM(incl)
40 #define WRITE_LOCK_SUB(n) __ASM_FORM(decl)
41 #define WRITE_LOCK_CMP 1
43 #endif /* CONFIG_NR_CPUS */
45 #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
47 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */
49 #endif /* _ASM_X86_RWLOCK_H */