1 #ifndef _ASM_X86_SPINLOCK_TYPES_H
2 #define _ASM_X86_SPINLOCK_TYPES_H
4 #ifndef __LINUX_SPINLOCK_TYPES_H
5 # error "please don't include this file directly"
8 #include <linux/types.h>
10 #ifdef CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING
12 * On Xen we support CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING levels of
13 * interrupt re-enabling per IRQ-safe lock. Hence we can have
14 * (CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING + 1) times as many outstanding
15 * tickets. Thus the cut-off for using byte register pairs must be at
16 * a sufficiently smaller number of CPUs.
18 #if (CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING + 1) * CONFIG_NR_CPUS < 256
19 typedef u8 __ticket_t;
20 # define TICKET_SHIFT 8
21 typedef u16 __ticketpair_t;
23 typedef u16 __ticket_t;
24 # define TICKET_SHIFT 16
25 typedef u32 __ticketpair_t;
29 __ticketpair_t head_tail;
31 struct __raw_tickets {
32 __ticket_t head, tail;
34 #if CONFIG_NR_CPUS <= 256
40 #else /* ndef CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING */
43 * This differs from the pre-2.6.24 spinlock by always using xchgb
44 * rather than decb to take the lock; this allows it to use a
45 * zero-initialized lock structure. It also maintains a 1-byte
46 * contention counter, so that we can implement
47 * __byte_spin_is_contended.
50 #if CONFIG_NR_CPUS < 256
53 # error NR_CPUS >= 256 not implemented
55 #endif /* def CONFIG_XEN_SPINLOCK_ACQUIRE_NESTING */
58 #define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
60 #include <asm/rwlock.h>
62 #endif /* _ASM_X86_SPINLOCK_TYPES_H */