Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / arm / include / asm / proc-fns.h
blob34e852c636e0b97ef24ba32bcb8e70e6a9ab8a61
1 /*
2 * arch/arm/include/asm/proc-fns.h
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #ifndef __ASM_PROCFNS_H
12 #define __ASM_PROCFNS_H
14 #ifdef __KERNEL__
16 #include <asm/glue-proc.h>
17 #include <asm/page.h>
19 #ifndef __ASSEMBLY__
21 struct mm_struct;
24 * Don't change this structure - ASM code relies on it.
26 extern struct processor {
27 /* MISC
28 * get data abort address/flags
30 void (*_data_abort)(unsigned long pc);
32 * Retrieve prefetch fault address
34 unsigned long (*_prefetch_abort)(unsigned long lr);
36 * Set up any processor specifics
38 void (*_proc_init)(void);
40 * Disable any processor specifics
42 void (*_proc_fin)(void);
44 * Special stuff for a reset
46 void (*reset)(unsigned long addr) __attribute__((noreturn));
48 * Idle the processor
50 int (*_do_idle)(void);
52 * Processor architecture specific
55 * clean a virtual address range from the
56 * D-cache without flushing the cache.
58 void (*dcache_clean_area)(void *addr, int size);
61 * Set the page table
63 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
65 * Set a possibly extended PTE. Non-extended PTEs should
66 * ignore 'ext'.
68 #ifdef CONFIG_ARM_LPAE
69 void (*set_pte_ext)(pte_t *ptep, pte_t pte);
70 #else
71 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
72 #endif
74 /* Suspend/resume */
75 unsigned int suspend_size;
76 void (*do_suspend)(void *);
77 void (*do_resume)(void *);
78 } processor;
80 #ifndef MULTI_CPU
81 extern void cpu_proc_init(void);
82 extern void cpu_proc_fin(void);
83 extern int cpu_do_idle(void);
84 extern void cpu_dcache_clean_area(void *, int);
85 extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
86 #ifdef CONFIG_ARM_LPAE
87 extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
88 #else
89 extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
90 #endif
91 extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
92 #else
93 #define cpu_proc_init processor._proc_init
94 #define cpu_proc_fin processor._proc_fin
95 #define cpu_reset processor.reset
96 #define cpu_do_idle processor._do_idle
97 #define cpu_dcache_clean_area processor.dcache_clean_area
98 #define cpu_set_pte_ext processor.set_pte_ext
99 #define cpu_do_switch_mm processor.switch_mm
100 #endif
102 extern void cpu_resume(void);
104 #include <asm/memory.h>
106 #ifdef CONFIG_MMU
108 #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
110 #ifdef CONFIG_ARM_LPAE
111 #define cpu_get_pgd() \
112 ({ \
113 unsigned long pg, pg2; \
114 __asm__("mrrc p15, 0, %0, %1, c2" \
115 : "=r" (pg), "=r" (pg2) \
117 : "cc"); \
118 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
119 (pgd_t *)phys_to_virt(pg); \
121 #else
122 #define cpu_get_pgd() \
123 ({ \
124 unsigned long pg; \
125 __asm__("mrc p15, 0, %0, c2, c0, 0" \
126 : "=r" (pg) : : "cc"); \
127 pg &= ~0x3fff; \
128 (pgd_t *)phys_to_virt(pg); \
130 #endif
132 #endif
134 #endif /* __ASSEMBLY__ */
135 #endif /* __KERNEL__ */
136 #endif /* __ASM_PROCFNS_H */