1 #ifndef _ASM_X86_RWLOCK_H 2 #define _ASM_X86_RWLOCK_H 3 4 #include <asm/asm.h> 5 6 #if CONFIG_NR_CPUS <= 2048 7 8 #ifndef __ASSEMBLY__ 9 typedef union { 10 s32 lock; 11 s32 write; 12 } arch_rwlock_t; 13 #endif 14 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 21 22 #else /* CONFIG_NR_CPUS > 2048 */ 23 24 #include <linux/const.h> 25 26 #ifndef __ASSEMBLY__ 27 typedef union { 28 s64 lock; 29 struct { 30 u32 read; 31 s32 write; 32 }; 33 } arch_rwlock_t; 34 #endif 35 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 42 43 #endif /* CONFIG_NR_CPUS */ 44 45 #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } 46 47 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */ 48 49 #endif /* _ASM_X86_RWLOCK_H */ 50