1
2
3
4
5
6
7
8
9
10
11#ifndef __ASM_PROCFNS_H
12#define __ASM_PROCFNS_H
13
14#ifdef __KERNEL__
15
16#include <asm/glue-proc.h>
17#include <asm/page.h>
18
19#ifndef __ASSEMBLY__
20
21struct mm_struct;
22
23
24
25
26extern struct processor {
27
28
29
30 void (*_data_abort)(unsigned long pc);
31
32
33
34 unsigned long (*_prefetch_abort)(unsigned long lr);
35
36
37
38 void (*_proc_init)(void);
39
40
41
42 void (*check_bugs)(void);
43
44
45
46 void (*_proc_fin)(void);
47
48
49
50 void (*reset)(unsigned long addr, bool hvc) __attribute__((noreturn));
51
52
53
54 int (*_do_idle)(void);
55
56
57
58
59
60
61
62 void (*dcache_clean_area)(void *addr, int size);
63
64
65
66
67 void (*switch_mm)(phys_addr_t pgd_phys, struct mm_struct *mm);
68
69
70
71
72#ifdef CONFIG_ARM_LPAE
73 void (*set_pte_ext)(pte_t *ptep, pte_t pte);
74#else
75 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
76#endif
77
78
79 unsigned int suspend_size;
80 void (*do_suspend)(void *);
81 void (*do_resume)(void *);
82} processor;
83
84#ifndef MULTI_CPU
85extern void cpu_proc_init(void);
86extern void cpu_proc_fin(void);
87extern int cpu_do_idle(void);
88extern void cpu_dcache_clean_area(void *, int);
89extern void cpu_do_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm);
90#ifdef CONFIG_ARM_LPAE
91extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
92#else
93extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
94#endif
95extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn));
96
97
98extern void cpu_do_suspend(void *);
99extern void cpu_do_resume(void *);
100#else
101#define cpu_proc_init processor._proc_init
102#define cpu_proc_fin processor._proc_fin
103#define cpu_reset processor.reset
104#define cpu_do_idle processor._do_idle
105#define cpu_dcache_clean_area processor.dcache_clean_area
106#define cpu_set_pte_ext processor.set_pte_ext
107#define cpu_do_switch_mm processor.switch_mm
108
109
110#define cpu_do_suspend processor.do_suspend
111#define cpu_do_resume processor.do_resume
112#endif
113
114extern void cpu_resume(void);
115
116#include <asm/memory.h>
117
118#ifdef CONFIG_MMU
119
120#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
121
122#ifdef CONFIG_ARM_LPAE
123
124#define cpu_get_ttbr(nr) \
125 ({ \
126 u64 ttbr; \
127 __asm__("mrrc p15, " #nr ", %Q0, %R0, c2" \
128 : "=r" (ttbr)); \
129 ttbr; \
130 })
131
132#define cpu_get_pgd() \
133 ({ \
134 u64 pg = cpu_get_ttbr(0); \
135 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
136 (pgd_t *)phys_to_virt(pg); \
137 })
138#else
139#define cpu_get_pgd() \
140 ({ \
141 unsigned long pg; \
142 __asm__("mrc p15, 0, %0, c2, c0, 0" \
143 : "=r" (pg) : : "cc"); \
144 pg &= ~0x3fff; \
145 (pgd_t *)phys_to_virt(pg); \
146 })
147#endif
148
149#else
150
151#define cpu_switch_mm(pgd,mm) { }
152
153#endif
154
155#endif
156#endif
157#endif
158