aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/percpu.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ia64/percpu.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ia64/percpu.h')
-rw-r--r--include/asm-ia64/percpu.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
new file mode 100644
index 000000000000..1e87f19dad56
--- /dev/null
+++ b/include/asm-ia64/percpu.h
@@ -0,0 +1,72 @@
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#include <linux/config.h>
16
17#include <linux/threads.h>
18
19#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
20# define __SMALL_ADDR_AREA __attribute__((__model__ (__small__)))
21#else
22# define __SMALL_ADDR_AREA
23#endif
24
25#define DECLARE_PER_CPU(type, name) \
26 extern __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
27
28/* Separate out the type, so (int[3], foo) works. */
29#define DEFINE_PER_CPU(type, name) \
30 __attribute__((__section__(".data.percpu"))) \
31 __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
32
33/*
34 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
35 * external routine, to avoid include-hell.
36 */
37#ifdef CONFIG_SMP
38
39extern unsigned long __per_cpu_offset[NR_CPUS];
40
41/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
42DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
43
44#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
45#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
46
47extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
48extern void setup_per_cpu_areas (void);
49extern void *per_cpu_init(void);
50
51#else /* ! SMP */
52
53#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
54#define __get_cpu_var(var) per_cpu__##var
55#define per_cpu_init() (__phys_per_cpu_start)
56
57#endif /* SMP */
58
59#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
60#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
61
62/*
63 * Be extremely careful when taking the address of this variable! Due to virtual
64 * remapping, it is different from the canonical address returned by __get_cpu_var(var)!
65 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
66 * more efficient.
67 */
68#define __ia64_per_cpu_var(var) (per_cpu__##var)
69
70#endif /* !__ASSEMBLY__ */
71
72#endif /* _ASM_IA64_PERCPU_H */