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 (*_proc_fin)(void);
43
44
45
46 void (*reset)(unsigned long addr) __attribute__((noreturn));
47
48
49
50 int (*_do_idle)(void);
51
52
53
54
55
56
57
58 void (*dcache_clean_area)(void *addr, int size);
59
60
61
62
63 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
64
65
66
67
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
73
74
75 unsigned int suspend_size;
76 void (*do_suspend)(void *);
77 void (*do_resume)(void *);
78} processor;
79
80#ifndef MULTI_CPU
81extern void cpu_proc_init(void);
82extern void cpu_proc_fin(void);
83extern int cpu_do_idle(void);
84extern void cpu_dcache_clean_area(void *, int);
85extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
86#ifdef CONFIG_ARM_LPAE
87extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
88#else
89extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
90#endif
91extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
92
93
94extern void cpu_do_suspend(void *);
95extern void cpu_do_resume(void *);
96#else
97#define cpu_proc_init processor._proc_init
98#define cpu_proc_fin processor._proc_fin
99#define cpu_reset processor.reset
100#define cpu_do_idle processor._do_idle
101#define cpu_dcache_clean_area processor.dcache_clean_area
102#define cpu_set_pte_ext processor.set_pte_ext
103#define cpu_do_switch_mm processor.switch_mm
104
105
106#define cpu_do_suspend processor.do_suspend
107#define cpu_do_resume processor.do_resume
108#endif
109
110extern void cpu_resume(void);
111
112#include <asm/memory.h>
113
114#ifdef CONFIG_MMU
115
116#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
117
118#ifdef CONFIG_ARM_LPAE
119#define cpu_get_pgd() \
120 ({ \
121 unsigned long pg, pg2; \
122 __asm__("mrrc p15, 0, %0, %1, c2" \
123 : "=r" (pg), "=r" (pg2) \
124 : \
125 : "cc"); \
126 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
127 (pgd_t *)phys_to_virt(pg); \
128 })
129#else
130#define cpu_get_pgd() \
131 ({ \
132 unsigned long pg; \
133 __asm__("mrc p15, 0, %0, c2, c0, 0" \
134 : "=r" (pg) : : "cc"); \
135 pg &= ~0x3fff; \
136 (pgd_t *)phys_to_virt(pg); \
137 })
138#endif
139
140#endif
141
142#endif
143#endif
144#endif
145