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 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
69
70
71 unsigned int suspend_size;
72 void (*do_suspend)(void *);
73 void (*do_resume)(void *);
74} processor;
75
76#ifndef MULTI_CPU
77extern void cpu_proc_init(void);
78extern void cpu_proc_fin(void);
79extern int cpu_do_idle(void);
80extern void cpu_dcache_clean_area(void *, int);
81extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
82extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
83extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
84#else
85#define cpu_proc_init() processor._proc_init()
86#define cpu_proc_fin() processor._proc_fin()
87#define cpu_reset(addr) processor.reset(addr)
88#define cpu_do_idle() processor._do_idle()
89#define cpu_dcache_clean_area(addr,sz) processor.dcache_clean_area(addr,sz)
90#define cpu_set_pte_ext(ptep,pte,ext) processor.set_pte_ext(ptep,pte,ext)
91#define cpu_do_switch_mm(pgd,mm) processor.switch_mm(pgd,mm)
92#endif
93
94extern void cpu_resume(void);
95
96#include <asm/memory.h>
97
98#ifdef CONFIG_MMU
99
100#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
101
102#define cpu_get_pgd() \
103 ({ \
104 unsigned long pg; \
105 __asm__("mrc p15, 0, %0, c2, c0, 0" \
106 : "=r" (pg) : : "cc"); \
107 pg &= ~0x3fff; \
108 (pgd_t *)phys_to_virt(pg); \
109 })
110
111#endif
112
113#endif
114#endif
115#endif
116