26404b77f007b6029e4fba1fc276c36ec604cbc0
[sfrench/cifs-2.6.git] / include / asm-ia64 / percpu.h
1 #ifndef _ASM_IA64_PERCPU_H
2 #define _ASM_IA64_PERCPU_H
3
4 /*
5  * Copyright (C) 2002-2003 Hewlett-Packard Co
6  *      David Mosberger-Tang <davidm@hpl.hp.com>
7  */
8
9 #define PERCPU_ENOUGH_ROOM PERCPU_PAGE_SIZE
10
11 #ifdef __ASSEMBLY__
12 # define THIS_CPU(var)  (per_cpu__##var)  /* use this to mark accesses to per-CPU variables... */
13 #else /* !__ASSEMBLY__ */
14
15
16 #include <linux/threads.h>
17
18 #ifdef HAVE_MODEL_SMALL_ATTRIBUTE
19 # define PER_CPU_ATTRIBUTES     __attribute__((__model__ (__small__)))
20 #endif
21
22 #ifdef CONFIG_SMP
23
24 #define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
25
26 extern void *per_cpu_init(void);
27
28 #else /* ! SMP */
29
30 #define per_cpu_init()                          (__phys_per_cpu_start)
31
32 #endif  /* SMP */
33
34 /*
35  * Be extremely careful when taking the address of this variable!  Due to virtual
36  * remapping, it is different from the canonical address returned by __get_cpu_var(var)!
37  * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
38  * more efficient.
39  */
40 #define __ia64_per_cpu_var(var) per_cpu__##var
41
42 #include <asm-generic/percpu.h>
43
44 /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
45 DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
46
47 #endif /* !__ASSEMBLY__ */
48
49 #endif /* _ASM_IA64_PERCPU_H */