ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / cpu-multi32.h
1 /*
2  *  linux/include/asm-arm/cpu-multi32.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 #ifndef __ASSEMBLY__
11
12 #include <asm/memory.h>
13 #include <asm/page.h>
14
15 struct mm_struct;
16
17 /*
18  * Don't change this structure - ASM code
19  * relies on it.
20  */
21 extern struct processor {
22         /* MISC
23          * get data abort address/flags
24          */
25         void (*_data_abort)(unsigned long pc);
26         /*
27          * Set up any processor specifics
28          */
29         void (*_proc_init)(void);
30         /*
31          * Disable any processor specifics
32          */
33         void (*_proc_fin)(void);
34         /*
35          * Special stuff for a reset
36          */
37         volatile void (*reset)(unsigned long addr);
38         /*
39          * Idle the processor
40          */
41         int (*_do_idle)(void);
42         /*
43          * Processor architecture specific
44          */
45         /*
46          * clean a virtual address range from the
47          * D-cache without flushing the cache.
48          */
49         void (*dcache_clean_area)(void *addr, int size);
50
51         /*
52          * Set the page table
53          */
54         void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
55         /*
56          * Set a PTE
57          */
58         void (*set_pte)(pte_t *ptep, pte_t pte);
59 } processor;
60
61 #define cpu_proc_init()                 processor._proc_init()
62 #define cpu_proc_fin()                  processor._proc_fin()
63 #define cpu_reset(addr)                 processor.reset(addr)
64 #define cpu_do_idle()                   processor._do_idle()
65 #define cpu_dcache_clean_area(addr,sz)  processor.dcache_clean_area(addr,sz)
66 #define cpu_set_pte(ptep, pte)          processor.set_pte(ptep, pte)
67
68 #define cpu_switch_mm(pgd,mm)   processor.switch_mm(__virt_to_phys((unsigned long)(pgd)),mm)
69
70 #define cpu_get_pgd()   \
71         ({                                              \
72                 unsigned long pg;                       \
73                 __asm__("mrc    p15, 0, %0, c2, c0, 0"  \
74                          : "=r" (pg) : : "cc");         \
75                 pg &= ~0x3fff;                          \
76                 (pgd_t *)phys_to_virt(pg);              \
77         })
78
79 #endif