aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/proc-v7.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/proc-v7.S')
-rw-r--r--arch/arm/mm/proc-v7.S39
1 files changed, 21 insertions, 18 deletions
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index b49f9a4c82c8..34e424041927 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -12,7 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/elf.h> 15#include <asm/hwcap.h>
16#include <asm/pgtable-hwdef.h> 16#include <asm/pgtable-hwdef.h>
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18 18
@@ -25,9 +25,11 @@
25 25
26ENTRY(cpu_v7_proc_init) 26ENTRY(cpu_v7_proc_init)
27 mov pc, lr 27 mov pc, lr
28ENDPROC(cpu_v7_proc_init)
28 29
29ENTRY(cpu_v7_proc_fin) 30ENTRY(cpu_v7_proc_fin)
30 mov pc, lr 31 mov pc, lr
32ENDPROC(cpu_v7_proc_fin)
31 33
32/* 34/*
33 * cpu_v7_reset(loc) 35 * cpu_v7_reset(loc)
@@ -43,6 +45,7 @@ ENTRY(cpu_v7_proc_fin)
43 .align 5 45 .align 5
44ENTRY(cpu_v7_reset) 46ENTRY(cpu_v7_reset)
45 mov pc, r0 47 mov pc, r0
48ENDPROC(cpu_v7_reset)
46 49
47/* 50/*
48 * cpu_v7_do_idle() 51 * cpu_v7_do_idle()
@@ -52,8 +55,9 @@ ENTRY(cpu_v7_reset)
52 * IRQs are already disabled. 55 * IRQs are already disabled.
53 */ 56 */
54ENTRY(cpu_v7_do_idle) 57ENTRY(cpu_v7_do_idle)
55 .long 0xe320f003 @ ARM V7 WFI instruction 58 wfi
56 mov pc, lr 59 mov pc, lr
60ENDPROC(cpu_v7_do_idle)
57 61
58ENTRY(cpu_v7_dcache_clean_area) 62ENTRY(cpu_v7_dcache_clean_area)
59#ifndef TLB_CAN_READ_FROM_L1_CACHE 63#ifndef TLB_CAN_READ_FROM_L1_CACHE
@@ -65,6 +69,7 @@ ENTRY(cpu_v7_dcache_clean_area)
65 dsb 69 dsb
66#endif 70#endif
67 mov pc, lr 71 mov pc, lr
72ENDPROC(cpu_v7_dcache_clean_area)
68 73
69/* 74/*
70 * cpu_v7_switch_mm(pgd_phys, tsk) 75 * cpu_v7_switch_mm(pgd_phys, tsk)
@@ -89,6 +94,7 @@ ENTRY(cpu_v7_switch_mm)
89 isb 94 isb
90#endif 95#endif
91 mov pc, lr 96 mov pc, lr
97ENDPROC(cpu_v7_switch_mm)
92 98
93/* 99/*
94 * cpu_v7_set_pte_ext(ptep, pte) 100 * cpu_v7_set_pte_ext(ptep, pte)
@@ -99,26 +105,19 @@ ENTRY(cpu_v7_switch_mm)
99 * (hardware version is stored at -1024 bytes) 105 * (hardware version is stored at -1024 bytes)
100 * - pte - PTE value to store 106 * - pte - PTE value to store
101 * - ext - value for extended PTE bits 107 * - ext - value for extended PTE bits
102 *
103 * Permissions:
104 * YUWD APX AP1 AP0 SVC User
105 * 0xxx 0 0 0 no acc no acc
106 * 100x 1 0 1 r/o no acc
107 * 10x0 1 0 1 r/o no acc
108 * 1011 0 0 1 r/w no acc
109 * 110x 0 1 0 r/w r/o
110 * 11x0 0 1 0 r/w r/o
111 * 1111 0 1 1 r/w r/w
112 */ 108 */
113ENTRY(cpu_v7_set_pte_ext) 109ENTRY(cpu_v7_set_pte_ext)
114#ifdef CONFIG_MMU 110#ifdef CONFIG_MMU
115 str r1, [r0], #-2048 @ linux version 111 str r1, [r0], #-2048 @ linux version
116 112
117 bic r3, r1, #0x000003f0 113 bic r3, r1, #0x000003f0
118 bic r3, r3, #0x00000003 114 bic r3, r3, #PTE_TYPE_MASK
119 orr r3, r3, r2 115 orr r3, r3, r2
120 orr r3, r3, #PTE_EXT_AP0 | 2 116 orr r3, r3, #PTE_EXT_AP0 | 2
121 117
118 tst r2, #1 << 4
119 orrne r3, r3, #PTE_EXT_TEX(1)
120
122 tst r1, #L_PTE_WRITE 121 tst r1, #L_PTE_WRITE
123 tstne r1, #L_PTE_DIRTY 122 tstne r1, #L_PTE_DIRTY
124 orreq r3, r3, #PTE_EXT_APX 123 orreq r3, r3, #PTE_EXT_APX
@@ -128,19 +127,18 @@ ENTRY(cpu_v7_set_pte_ext)
128 tstne r3, #PTE_EXT_APX 127 tstne r3, #PTE_EXT_APX
129 bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 128 bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0
130 129
131 tst r1, #L_PTE_YOUNG
132 biceq r3, r3, #PTE_EXT_APX | PTE_EXT_AP_MASK
133
134 tst r1, #L_PTE_EXEC 130 tst r1, #L_PTE_EXEC
135 orreq r3, r3, #PTE_EXT_XN 131 orreq r3, r3, #PTE_EXT_XN
136 132
137 tst r1, #L_PTE_PRESENT 133 tst r1, #L_PTE_YOUNG
134 tstne r1, #L_PTE_PRESENT
138 moveq r3, #0 135 moveq r3, #0
139 136
140 str r3, [r0] 137 str r3, [r0]
141 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 138 mcr p15, 0, r0, c7, c10, 1 @ flush_pte
142#endif 139#endif
143 mov pc, lr 140 mov pc, lr
141ENDPROC(cpu_v7_set_pte_ext)
144 142
145cpu_v7_name: 143cpu_v7_name:
146 .ascii "ARMv7 Processor" 144 .ascii "ARMv7 Processor"
@@ -182,12 +180,17 @@ __v7_setup:
182 mov r10, #0x1f @ domains 0, 1 = manager 180 mov r10, #0x1f @ domains 0, 1 = manager
183 mcr p15, 0, r10, c3, c0, 0 @ load domain access register 181 mcr p15, 0, r10, c3, c0, 0 @ load domain access register
184#endif 182#endif
183 ldr r5, =0x40e040e0
184 ldr r6, =0xff0aa1a8
185 mcr p15, 0, r5, c10, c2, 0 @ write PRRR
186 mcr p15, 0, r6, c10, c2, 1 @ write NMRR
185 adr r5, v7_crval 187 adr r5, v7_crval
186 ldmia r5, {r5, r6} 188 ldmia r5, {r5, r6}
187 mrc p15, 0, r0, c1, c0, 0 @ read control register 189 mrc p15, 0, r0, c1, c0, 0 @ read control register
188 bic r0, r0, r5 @ clear bits them 190 bic r0, r0, r5 @ clear bits them
189 orr r0, r0, r6 @ set them 191 orr r0, r0, r6 @ set them
190 mov pc, lr @ return to head.S:__ret 192 mov pc, lr @ return to head.S:__ret
193ENDPROC(__v7_setup)
191 194
192 /* 195 /*
193 * V X F I D LR 196 * V X F I D LR
@@ -197,7 +200,7 @@ __v7_setup:
197 */ 200 */
198 .type v7_crval, #object 201 .type v7_crval, #object
199v7_crval: 202v7_crval:
200 crval clear=0x0120c302, mmuset=0x00c0387d, ucset=0x00c0187c 203 crval clear=0x0120c302, mmuset=0x10c0387d, ucset=0x00c0187c
201 204
202__v7_setup_stack: 205__v7_setup_stack:
203 .space 4 * 11 @ 11 registers 206 .space 4 * 11 @ 11 registers