1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include <asm/cache.h>
17 #include <asm/tlb.h>
18 #include <cpu/mmu_context.h>
19 #include <cpu/registers.h>
20
21
22
23
24 #define MMUIR_TEXT_H 0x0000000000000003 | CONFIG_MEMORY_START
25
26 #define MMUIR_TEXT_L 0x000000000000009a | CONFIG_MEMORY_START
27
28
29 #define MMUDR_CACHED_H 0x0000000000000003 | CONFIG_MEMORY_START
30
31 #define MMUDR_CACHED_L 0x000000000000015a | CONFIG_MEMORY_START
32
33
34 #define ICCR0_INIT_VAL ICCR0_ON | ICCR0_ICI
35 #define ICCR1_INIT_VAL ICCR1_NOLOCK
36
37 #define OCCR0_INIT_VAL OCCR0_ON | OCCR0_OCI | OCCR0_WB
38 #define OCCR1_INIT_VAL OCCR1_NOLOCK
39
40 .text
41
42 .global startup
43 startup:
44
45
46
47
48
49 ptabs/u r63, tr0
50 ptabs/u r63, tr1
51 ptabs/u r63, tr2
52 ptabs/u r63, tr3
53 ptabs/u r63, tr4
54 ptabs/u r63, tr5
55 ptabs/u r63, tr6
56 ptabs/u r63, tr7
57 synci
58
59
60
61
62
63
64 pta 1f, tr1
65 movi ITLB_FIXED, r21
66 movi ITLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
67 1: putcfg r21, 0, r63
68 addi r21, TLB_STEP, r21
69 bne r21, r22, tr1
70
71
72 pta 1f, tr1
73 movi DTLB_FIXED, r21
74 movi DTLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
75 1: putcfg r21, 0, r63
76 addi r21, TLB_STEP, r21
77 bne r21, r22, tr1
78
79
80 movi ITLB_FIXED, r21
81 movi MMUIR_TEXT_L, r22
82 putcfg r21, 1, r22
83 movi MMUIR_TEXT_H, r22
84 putcfg r21, 0, r22
85
86
87 movi DTLB_FIXED, r21
88 movi MMUDR_CACHED_L, r22
89 putcfg r21, 1, r22
90 movi MMUDR_CACHED_H, r22
91 putcfg r21, 0, r22
92
93
94 movi ICCR_BASE, r21
95 movi ICCR0_INIT_VAL, r22
96 movi ICCR1_INIT_VAL, r23
97 putcfg r21, ICCR_REG0, r22
98 putcfg r21, ICCR_REG1, r23
99 synci
100
101
102 movi OCCR_BASE, r21
103 movi OCCR0_INIT_VAL, r22
104 movi OCCR1_INIT_VAL, r23
105 putcfg r21, OCCR_REG0, r22
106 putcfg r21, OCCR_REG1, r23
107 synco
108
109
110
111
112
113 movi SR_HARMLESS | SR_ENABLE_MMU, r22
114 putcon r22, SSR
115 movi 1f, r22
116 putcon r22, SPC
117 synco
118 rte
119 1:
120
121
122 movi datalabel stack_start, r0
123 ld.l r0, 0, r15
124
125
126
127
128 pt 1f, tr1
129 movi datalabel __bss_start, r22
130 movi datalabel _end, r23
131 1: st.l r22, 0, r63
132 addi r22, 4, r22
133 bne r22, r23, tr1
134
135
136
137
138 pt decompress_kernel, tr0
139 blink tr0, r18
140
141
142
143
144 movi SR_HARMLESS, r22
145 putcon r22, SSR
146 movi 1f, r22
147 putcon r22, SPC
148 synco
149 rte
150 1:
151
152
153 movi datalabel (CONFIG_MEMORY_START + 0x2000)+1, r19
154 ptabs r19, tr0
155 blink tr0, r18
156
157
158 pt 1f, tr0
159 1: blink tr0, r63