ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / cpu-single.h
1 /*
2  *  linux/include/asm-arm/cpu-single.h
3  *
4  *  Copyright (C) 2000 Russell King
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 /*
11  * Single CPU
12  */
13 #ifdef __STDC__
14 #define __catify_fn(name,x)     name##x
15 #else
16 #define __catify_fn(name,x)     name/**/x
17 #endif
18 #define __cpu_fn(name,x)        __catify_fn(name,x)
19
20 /*
21  * If we are supporting multiple CPUs, then we must use a table of
22  * function pointers for this lot.  Otherwise, we can optimise the
23  * table away.
24  */
25 #define cpu_proc_init                   __cpu_fn(CPU_NAME,_proc_init)
26 #define cpu_proc_fin                    __cpu_fn(CPU_NAME,_proc_fin)
27 #define cpu_reset                       __cpu_fn(CPU_NAME,_reset)
28 #define cpu_do_idle                     __cpu_fn(CPU_NAME,_do_idle)
29 #define cpu_dcache_clean_area           __cpu_fn(CPU_NAME,_dcache_clean_area)
30 #define cpu__switch_mm                  __cpu_fn(CPU_NAME,_switch_mm)
31 #define cpu_set_pte                     __cpu_fn(CPU_NAME,_set_pte)
32
33 #ifndef __ASSEMBLY__
34
35 #include <asm/memory.h>
36 #include <asm/page.h>
37
38 struct mm_struct;
39
40 /* declare all the functions as extern */
41 extern void cpu_proc_init(void);
42 extern void cpu_proc_fin(void);
43 extern int cpu_do_idle(void);
44 extern void cpu_dcache_clean_area(void *, int);
45 extern void cpu__switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
46 extern void cpu_set_pte(pte_t *ptep, pte_t pte);
47
48 extern volatile void cpu_reset(unsigned long addr);
49
50 #define cpu_switch_mm(pgd,mm) cpu__switch_mm(__virt_to_phys((unsigned long)(pgd)),mm)
51
52 #define cpu_get_pgd()   \
53         ({                                              \
54                 unsigned long pg;                       \
55                 __asm__("mrc    p15, 0, %0, c2, c0, 0"  \
56                          : "=r" (pg) : : "cc");         \
57                 pg &= ~0x3fff;                          \
58                 (pgd_t *)phys_to_virt(pg);              \
59         })
60
61 #endif