1
2
3
4
5
6
7#include <asm/processor.h>
8#include <asm/page.h>
9#include <asm/cputable.h>
10#include <asm/ppc_asm.h>
11#include <asm/asm-offsets.h>
12#include <asm/cache.h>
13
14_GLOBAL(__cpu_preinit_ppc970)
15
16 mfmsr r0
17 rldicl. r0,r0,4,63
18 beqlr
19
20
21
22
23
24 li r0,0
25 mfspr r3,SPRN_HID4
26 rldimi r3,r0,40,23
27 rldimi r3,r0,2,61
28 sync
29 mtspr SPRN_HID4,r3
30 isync
31 sync
32 mfspr r3,SPRN_HID5
33 rldimi r3,r0,6,56
34 sync
35 mtspr SPRN_HID5,r3
36 isync
37 sync
38
39
40 mfspr r0,SPRN_HID1
41 li r3,0x1200
42 sldi r3,r3,44
43 or r0,r0,r3
44 mtspr SPRN_HID1,r0
45 mtspr SPRN_HID1,r0
46 isync
47
48
49 li r0,0
50 sync
51 mtspr SPRN_HIOR,0
52 isync
53 blr
54
55
56#define CS_HID0 0
57#define CS_HID1 8
58#define CS_HID4 16
59#define CS_HID5 24
60#define CS_SIZE 32
61
62 .data
63 .balign L1_CACHE_BYTES,0
64cpu_state_storage:
65 .space CS_SIZE
66 .balign L1_CACHE_BYTES,0
67 .text
68
69
70_GLOBAL(__setup_cpu_ppc970)
71
72 mfmsr r0
73 rldicl. r0,r0,4,63
74 beq no_hv_mode
75
76 mfspr r0,SPRN_HID0
77 li r11,5
78 rldimi r0,r11,52,8
79 li r11,0
80 rldimi r0,r11,32,31
81 b load_hids
82
83
84_GLOBAL(__setup_cpu_ppc970MP)
85
86 mfmsr r0
87 rldicl. r0,r0,4,63
88 beq no_hv_mode
89
90 mfspr r0,SPRN_HID0
91 li r11,0x15
92 rldimi r0,r11,52,6
93 li r11,0
94 rldimi r0,r11,32,31
95
96load_hids:
97 mtspr SPRN_HID0,r0
98 mfspr r0,SPRN_HID0
99 mfspr r0,SPRN_HID0
100 mfspr r0,SPRN_HID0
101 mfspr r0,SPRN_HID0
102 mfspr r0,SPRN_HID0
103 mfspr r0,SPRN_HID0
104 sync
105 isync
106
107
108 mfspr r0,SPRN_HID4
109 clrldi r0,r0,1
110 ori r0,r0,HID4_LPES1
111 sync
112 mtspr SPRN_HID4,r0
113 isync
114
115
116 LOAD_REG_ADDR(r5,cpu_state_storage)
117
118
119 mfspr r3,SPRN_HID0
120 std r3,CS_HID0(r5)
121 mfspr r3,SPRN_HID1
122 std r3,CS_HID1(r5)
123 mfspr r4,SPRN_HID4
124 std r4,CS_HID4(r5)
125 mfspr r3,SPRN_HID5
126 std r3,CS_HID5(r5)
127
128
129 andi. r4,r4,HID4_LPES1
130 bnelr
131
132no_hv_mode:
133
134 ld r5,CPU_SPEC_FEATURES(r4)
135 LOAD_REG_IMMEDIATE(r6,CPU_FTR_HVMODE)
136 andc r5,r5,r6
137 std r5,CPU_SPEC_FEATURES(r4)
138 blr
139
140
141
142
143
144_GLOBAL(__restore_cpu_ppc970)
145
146 mfmsr r0
147 rldicl. r0,r0,4,63
148 beqlr
149
150 LOAD_REG_ADDR(r5,cpu_state_storage)
151
152 li r0,0
153 mfspr r3,SPRN_HID4
154 rldimi r3,r0,40,23
155 sync
156 mtspr SPRN_HID4,r3
157 isync
158 sync
159
160
161 li r0,0
162 sync
163 mtspr SPRN_HIOR,0
164 isync
165
166
167 ld r3,CS_HID0(r5)
168 sync
169 isync
170 mtspr SPRN_HID0,r3
171 mfspr r3,SPRN_HID0
172 mfspr r3,SPRN_HID0
173 mfspr r3,SPRN_HID0
174 mfspr r3,SPRN_HID0
175 mfspr r3,SPRN_HID0
176 mfspr r3,SPRN_HID0
177 sync
178 isync
179
180
181 ld r3,CS_HID1(r5)
182 sync
183 isync
184 mtspr SPRN_HID1,r3
185 mtspr SPRN_HID1,r3
186 sync
187 isync
188
189
190 ld r3,CS_HID4(r5)
191 sync
192 isync
193 mtspr SPRN_HID4,r3
194 sync
195 isync
196
197
198 ld r3,CS_HID5(r5)
199 sync
200 isync
201 mtspr SPRN_HID5,r3
202 sync
203 isync
204 blr
205
206