1
2
3
4
5
6
7
8
9
10
11#define TTB_S (1 << 1)
12#define TTB_RGN_NC (0 << 3)
13#define TTB_RGN_OC_WBWA (1 << 3)
14#define TTB_RGN_OC_WT (2 << 3)
15#define TTB_RGN_OC_WB (3 << 3)
16#define TTB_NOS (1 << 5)
17#define TTB_IRGN_NC ((0 << 0) | (0 << 6))
18#define TTB_IRGN_WBWA ((0 << 0) | (1 << 6))
19#define TTB_IRGN_WT ((1 << 0) | (0 << 6))
20#define TTB_IRGN_WB ((1 << 0) | (1 << 6))
21
22
23#define TTB_FLAGS_UP TTB_IRGN_WB|TTB_RGN_OC_WB
24#define PMD_FLAGS_UP PMD_SECT_WB
25
26
27#define TTB_FLAGS_SMP TTB_IRGN_WBWA|TTB_S|TTB_NOS|TTB_RGN_OC_WBWA
28#define PMD_FLAGS_SMP PMD_SECT_WBWA|PMD_SECT_S
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44ENTRY(cpu_ca8_switch_mm)
45#ifdef CONFIG_MMU
46 mov r2,
47 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
48#endif
49ENTRY(cpu_v7_switch_mm)
50#ifdef CONFIG_MMU
51 mmid r1, r1 @ get mm->context.id
52 ALT_SMP(orr r0, r0,
53 ALT_UP(orr r0, r0,
54#ifdef CONFIG_PID_IN_CONTEXTIDR
55 mrc p15, 0, r2, c13, c0, 1 @ read current context ID
56 lsr r2, r2,
57 bfi r1, r2,
58#endif
59#ifdef CONFIG_ARM_ERRATA_754322
60 dsb
61#endif
62 mcr p15, 0, r1, c13, c0, 1 @ set context ID
63 isb
64 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
65 isb
66#endif
67 bx lr
68ENDPROC(cpu_v7_switch_mm)
69ENDPROC(cpu_ca8_switch_mm)
70
71
72
73
74
75
76
77
78
79
80
81ENTRY(cpu_v7_set_pte_ext)
82#ifdef CONFIG_MMU
83 str r1, [r0] @ linux version
84
85 bic r3, r1,
86 bic r3, r3,
87 orr r3, r3, r2
88 orr r3, r3,
89
90 tst r1,
91 orrne r3, r3,
92
93 eor r1, r1,
94 tst r1,
95 orrne r3, r3,
96
97 tst r1,
98 orrne r3, r3,
99
100 tst r1,
101 orrne r3, r3,
102
103 tst r1,
104 tstne r1,
105 eorne r1, r1,
106 tstne r1,
107 moveq r3,
108
109 ARM( str r3, [r0,
110 THUMB( add r0, r0,
111 THUMB( str r3, [r0] )
112 ALT_SMP(W(nop))
113 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
114#endif
115 bx lr
116ENDPROC(cpu_v7_set_pte_ext)
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146.equ PRRR, 0xff0a81a8
147.equ NMRR, 0x40e040e0
148
149
150
151
152
153 .macro v7_ttb_setup, zero, ttbr0l, ttbr0h, ttbr1, tmp
154 mcr p15, 0, \zero, c2, c0, 2 @ TTB control register
155 ALT_SMP(orr \ttbr0l, \ttbr0l,
156 ALT_UP(orr \ttbr0l, \ttbr0l,
157 ALT_SMP(orr \ttbr1, \ttbr1,
158 ALT_UP(orr \ttbr1, \ttbr1,
159 mcr p15, 0, \ttbr1, c2, c0, 1 @ load TTB1
160 .endm
161
162
163
164
165
166
167
168 .align 2
169 .type v7_crval,
170v7_crval:
171 crval clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c
172