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 typedef struct arch_spinlock {
27 	union {
28 		__ticketpair_t head_tail;
29 		struct __raw_tickets {
30 			__ticket_t head, tail;
31 		} tickets;
32 	};
33 } arch_spinlock_t;
34 
35 #define __ARCH_SPIN_LOCK_UNLOCKED	{ { 0 } }
36 
37 #include <asm/rwlock.h>
38 
39 #endif /* _ASM_X86_SPINLOCK_TYPES_H */
40