65c3e37f879aced6501861eff95d56e08735236a
[cascardo/linux.git] / arch / x86 / include / asm / spinlock_types.h
1 #ifndef _ASM_X86_SPINLOCK_TYPES_H
2 #define _ASM_X86_SPINLOCK_TYPES_H
3
4 #include <linux/types.h>
5
6 #ifdef CONFIG_PARAVIRT_SPINLOCKS
7 #define __TICKET_LOCK_INC       2
8 #define TICKET_SLOWPATH_FLAG    ((__ticket_t)1)
9 #else
10 #define __TICKET_LOCK_INC       1
11 #define TICKET_SLOWPATH_FLAG    ((__ticket_t)0)
12 #endif
13
14 #if (CONFIG_NR_CPUS < (256 / __TICKET_LOCK_INC))
15 typedef u8  __ticket_t;
16 typedef u16 __ticketpair_t;
17 #else
18 typedef u16 __ticket_t;
19 typedef u32 __ticketpair_t;
20 #endif
21
22 #define TICKET_LOCK_INC ((__ticket_t)__TICKET_LOCK_INC)
23
24 #define TICKET_SHIFT    (sizeof(__ticket_t) * 8)
25
26 #ifdef CONFIG_QUEUED_SPINLOCKS
27 #include <asm-generic/qspinlock_types.h>
28 #else
29 typedef struct arch_spinlock {
30         union {
31                 __ticketpair_t head_tail;
32                 struct __raw_tickets {
33                         __ticket_t head, tail;
34                 } tickets;
35         };
36 } arch_spinlock_t;
37
38 #define __ARCH_SPIN_LOCK_UNLOCKED       { { 0 } }
39 #endif /* CONFIG_QUEUED_SPINLOCKS */
40
41 #include <asm-generic/qrwlock_types.h>
42
43 #endif /* _ASM_X86_SPINLOCK_TYPES_H */