]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - include/asm-ia64/percpu.h
percpu: move arch XX_PER_CPU_XX definitions into linux/percpu.h
[mirror_ubuntu-kernels.git] / include / asm-ia64 / percpu.h
CommitLineData
1da177e4
LT
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
1da177e4
LT
15
16#include <linux/threads.h>
17
18#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
5280e004 19# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
1da177e4
LT
20#endif
21
22#define DECLARE_PER_CPU(type, name) \
5280e004 23 extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
5fb7dc37 24
1da177e4
LT
25/*
26 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
27 * external routine, to avoid include-hell.
28 */
29#ifdef CONFIG_SMP
30
31extern unsigned long __per_cpu_offset[NR_CPUS];
d7c4086a 32#define per_cpu_offset(x) (__per_cpu_offset[x])
1da177e4
LT
33
34/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
35DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
36
37#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
38#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
bfe5d834 39#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
1da177e4
LT
40
41extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
42extern void setup_per_cpu_areas (void);
43extern void *per_cpu_init(void);
44
45#else /* ! SMP */
46
11c80c83 47#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
1da177e4 48#define __get_cpu_var(var) per_cpu__##var
bfe5d834 49#define __raw_get_cpu_var(var) per_cpu__##var
1da177e4
LT
50#define per_cpu_init() (__phys_per_cpu_start)
51
52#endif /* SMP */
53
1da177e4
LT
54/*
55 * Be extremely careful when taking the address of this variable! Due to virtual
56 * remapping, it is different from the canonical address returned by __get_cpu_var(var)!
57 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
58 * more efficient.
59 */
60#define __ia64_per_cpu_var(var) (per_cpu__##var)
61
62#endif /* !__ASSEMBLY__ */
63
64#endif /* _ASM_IA64_PERCPU_H */