Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: ncu_bank_en_status_wptect.s | |
5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
7 | * | |
8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; version 2 of the License. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | * | |
23 | * For the avoidance of doubt, and except that if any non-GPL license | |
24 | * choice is available it will apply instead, Sun elects to use only | |
25 | * the General Public License version 2 (GPLv2) at this time for any | |
26 | * software where a choice of GPL license versions is made | |
27 | * available with the language indicating that GPLv2 or any later version | |
28 | * may be used, or where a choice of which version of the GPL is applied is | |
29 | * otherwise unspecified. | |
30 | * | |
31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
32 | * CA 95054 USA or visit www.sun.com if you need additional information or | |
33 | * have any questions. | |
34 | * | |
35 | * | |
36 | * ========== Copyright Header End ============================================ | |
37 | */ | |
38 | #define MAIN_PAGE_NUCLEUS_ALSO | |
39 | #define MAIN_PAGE_HV_ALSO | |
40 | ||
41 | #include "hboot.s" | |
42 | #include "asi_s.h" | |
43 | ||
44 | .text | |
45 | .global main | |
46 | ||
47 | ||
48 | main: | |
49 | ta T_CHANGE_HPRIV | |
50 | ||
51 | get_th_id: | |
52 | ta T_RD_THID | |
53 | wr %g0,ASI_CMP_CORE,%asi | |
54 | ||
55 | ! Read bank enable comb | |
56 | setx 0xffffff0010,%g7,%i2 | |
57 | ldub [%i2],%g1 | |
58 | ||
59 | ! End of diag check | |
60 | cmp %g1,0x0 | |
61 | be program_bank_comb | |
62 | nop | |
63 | cmp %g1,0xb | |
64 | be test_pass | |
65 | nop | |
66 | ba other_comb | |
67 | nop | |
68 | ||
69 | program_bank_comb: | |
70 | set 0xb,%g2 | |
71 | setx 0xffffff0020,%g7,%g3 | |
72 | setx bank_comb,%g7,%g4 | |
73 | program_loop: | |
74 | ldub [%g4],%g5 | |
75 | stb %g5,[%g3] | |
76 | ldub [%g3],%g5 | |
77 | add %g3,1,%g3 | |
78 | add %g4,1,%g4 | |
79 | subcc %g2,1,%g2 | |
80 | bnz program_loop | |
81 | nop | |
82 | ||
83 | other_comb: | |
84 | setx 0xffffff0020,%g7,%i3 | |
85 | add %g1,%i3,%i3 | |
86 | ldub [%i3],%g6 | |
87 | ||
88 | ! Check that bank_enable_status is correct | |
89 | call calc_bank_en_st !return in %g5 | |
90 | nop | |
91 | setx 0x8000001028,%g7,%i1 | |
92 | ldx [%i1],%g2 | |
93 | cmp %g2,%g5 | |
94 | bne %xcc,test_fail | |
95 | nop | |
96 | ||
97 | ! Next bank combination | |
98 | add %g1,1,%g1 | |
99 | stb %g1,[%i2] | |
100 | ldub [%i2],%g1 | |
101 | add %i3,1,%i3 | |
102 | ldub [%i3],%g6 | |
103 | ||
104 | ! Program bank_enable | |
105 | setx 0x8000001020,%g7,%i4 | |
106 | stx %g6,[%i4] | |
107 | ||
108 | ! Check bank_enable_status | |
109 | call calc_bank_en_st_prvw !return in %g5 | |
110 | nop | |
111 | ldx [%i1],%g2 | |
112 | cmp %g2,%g5 | |
113 | bne %xcc,test_fail | |
114 | nop | |
115 | ||
116 | ! Warm reset to turn on next bank combination | |
117 | setx 0x8900000808,%g7,%i5 | |
118 | set 0x1,%g1 | |
119 | stx %g1,[%i5] | |
120 | ||
121 | halt: | |
122 | ba halt | |
123 | nop | |
124 | ||
125 | /****************************************************** | |
126 | * Subroutine code | |
127 | *******************************************************/ | |
128 | ||
129 | calc_bank_en_st_prvw: | |
130 | add %g5,%g0,%l7 | |
131 | and %g6,0x1,%l0 | |
132 | srl %g6,1,%l6 | |
133 | and %l6,%l0,%l0 | |
134 | ||
135 | srl %l6,1,%l6 | |
136 | and %l6,0x1,%l1 | |
137 | srl %l6,1,%l6 | |
138 | and %l6,%l1,%l1 | |
139 | ||
140 | srl %l6,1,%l6 | |
141 | and %l6,0x1,%l2 | |
142 | srl %l6,1,%l6 | |
143 | and %l6,%l2,%l2 | |
144 | ||
145 | srl %l6,1,%l6 | |
146 | and %l6,0x1,%l3 | |
147 | srl %l6,1,%l6 | |
148 | and %l6,%l3,%l3 | |
149 | ||
150 | sll %l3,3,%l3 | |
151 | sll %l2,2,%l2 | |
152 | sll %l1,1,%l1 | |
153 | or %l0,%l1,%l0 | |
154 | or %l0,%l2,%l0 | |
155 | or %l0,%l3,%l0 | |
156 | and %l0,0xf,%l0 | |
157 | cmp %l0,0xf | |
158 | be not_pm_1 | |
159 | nop | |
160 | or %l0,0x10,%l0 | |
161 | ||
162 | not_pm_1: | |
163 | ! Remove illegal combinations | |
164 | cmp %l0,0x17 | |
165 | be val_13_1 | |
166 | nop | |
167 | cmp %l0,0x1b | |
168 | be val_13_1 | |
169 | nop | |
170 | cmp %l0,0x1d | |
171 | be val_1c_1 | |
172 | nop | |
173 | cmp %l0,0x1e | |
174 | be val_1c_1 | |
175 | nop | |
176 | ||
177 | final_shift_1: | |
178 | sll %l0,8,%l4 | |
179 | or %l0,%l4,%g5 | |
180 | srlx %g5,5,%g5 | |
181 | sllx %g5,5,%g5 | |
182 | and %l7,0xff,%l7 | |
183 | or %g5,%l7,%g5 | |
184 | retl | |
185 | nop | |
186 | ||
187 | val_13_1: | |
188 | set 0x13,%l0 | |
189 | ba final_shift_1 | |
190 | nop | |
191 | ||
192 | val_1c_1: | |
193 | set 0x1c,%l0 | |
194 | ba final_shift_1 | |
195 | nop | |
196 | ||
197 | ||
198 | calc_bank_en_st: | |
199 | and %g6,0x1,%l0 | |
200 | srl %g6,1,%l6 | |
201 | and %l6,%l0,%l0 | |
202 | ||
203 | srl %l6,1,%l6 | |
204 | and %l6,0x1,%l1 | |
205 | srl %l6,1,%l6 | |
206 | and %l6,%l1,%l1 | |
207 | ||
208 | srl %l6,1,%l6 | |
209 | and %l6,0x1,%l2 | |
210 | srl %l6,1,%l6 | |
211 | and %l6,%l2,%l2 | |
212 | ||
213 | srl %l6,1,%l6 | |
214 | and %l6,0x1,%l3 | |
215 | srl %l6,1,%l6 | |
216 | and %l6,%l3,%l3 | |
217 | ||
218 | sll %l3,3,%l3 | |
219 | sll %l2,2,%l2 | |
220 | sll %l1,1,%l1 | |
221 | or %l0,%l1,%l0 | |
222 | or %l0,%l2,%l0 | |
223 | or %l0,%l3,%l0 | |
224 | and %l0,0xf,%l0 | |
225 | cmp %l0,0xf | |
226 | be not_pm_2 | |
227 | nop | |
228 | or %l0,0x10,%l0 | |
229 | ||
230 | not_pm_2: | |
231 | ! Remove illegal combinations | |
232 | cmp %l0,0x17 | |
233 | be val_13_2 | |
234 | nop | |
235 | cmp %l0,0x1b | |
236 | be val_13_2 | |
237 | nop | |
238 | cmp %l0,0x1d | |
239 | be val_1c_2 | |
240 | nop | |
241 | cmp %l0,0x1e | |
242 | be val_1c_2 | |
243 | nop | |
244 | ||
245 | final_shift_2: | |
246 | sll %l0,8,%l4 | |
247 | or %l0,%l4,%g5 | |
248 | retl | |
249 | nop | |
250 | ||
251 | val_13_2: | |
252 | set 0x13,%l0 | |
253 | ba final_shift_2 | |
254 | nop | |
255 | ||
256 | val_1c_2: | |
257 | set 0x1c,%l0 | |
258 | ba final_shift_2 | |
259 | nop | |
260 | ||
261 | ||
262 | /****************************************************** | |
263 | * Exit code | |
264 | *******************************************************/ | |
265 | ||
266 | test_pass: | |
267 | EXIT_GOOD | |
268 | ||
269 | test_fail: | |
270 | EXIT_BAD | |
271 | ||
272 | .data | |
273 | bank_enable_status_code: | |
274 | .word 0x00000f0f | |
275 | bank_comb: | |
276 | .byte 0xff | |
277 | .byte 0x03 | |
278 | .byte 0x0c | |
279 | .byte 0x30 | |
280 | .byte 0xc0 | |
281 | .byte 0x0f | |
282 | .byte 0x33 | |
283 | .byte 0xc3 | |
284 | .byte 0x3c | |
285 | .byte 0xcc | |
286 | .byte 0xf0 | |
287 | .byte 0xff | |
288 | .end |