Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_dram_dac_dau_fbr.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 H_HT0_Hw_Corrected_Error_0x63 My_Corrected_ECC_error_trap | |
39 | #define H_HT0_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap | |
40 | ||
41 | #define MAIN_PAGE_NUCLEUS_ALSO | |
42 | #define MAIN_PAGE_HV_ALSO | |
43 | ||
44 | ||
45 | #include "hboot.s" | |
46 | #include "asi_s.h" | |
47 | ||
48 | #define L20 0x0020134000 | |
49 | #define L21 0x0000134040 | |
50 | ||
51 | #define L22 0x0000134080 | |
52 | #define L23 0x00001340c0 | |
53 | ||
54 | #define L24 0x0000134100 | |
55 | #define L25 0x0000134140 | |
56 | ||
57 | #define L26 0x0000134180 | |
58 | #define L27 0x00001341c0 | |
59 | #define DRAM_ERR_INJ_REG 0x8400000290 | |
60 | ||
61 | ||
62 | #define ERR_TYPE 0x3 | |
63 | ||
64 | ||
65 | #ifdef MCU0 | |
66 | #define L2_BANK_ADDR 0x0 | |
67 | ||
68 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_0 | |
69 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_0 | |
70 | ||
71 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_0 | |
72 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_0 | |
73 | ||
74 | #define DRAM_ERR_INJ_REG 0x8400000290 | |
75 | #define DRAM_ERR_STAT_REG 0x8400000280 | |
76 | #define L2_ERR_STAT_REG 0xAB00000000 | |
77 | #define L2_ERR_ADDR_REG 0xAC00000000 | |
78 | #endif | |
79 | ||
80 | #ifdef MCU1 | |
81 | #define L2_BANK_ADDR 0x80 | |
82 | ||
83 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_1 | |
84 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_1 | |
85 | ||
86 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_1 | |
87 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_1 | |
88 | ||
89 | #define DRAM_ERR_INJ_REG 0x8400001290 | |
90 | #define DRAM_ERR_STAT_REG 0x8400001280 | |
91 | #define L2_ERR_STAT_REG 0xAB00000080 | |
92 | #define L2_ERR_ADDR_REG 0xAC00000080 | |
93 | #endif | |
94 | ||
95 | #ifdef MCU2 | |
96 | #define L2_BANK_ADDR 0x100 | |
97 | ||
98 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_2 | |
99 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_2 | |
100 | ||
101 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_2 | |
102 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_2 | |
103 | ||
104 | #define DRAM_ERR_INJ_REG 0x8400002290 | |
105 | #define DRAM_ERR_STAT_REG 0x8400002280 | |
106 | #define L2_ERR_STAT_REG 0xAB00000100 | |
107 | #define L2_ERR_ADDR_REG 0xAC00000100 | |
108 | ||
109 | #endif | |
110 | ||
111 | #ifdef MCU3 | |
112 | #define L2_BANK_ADDR 0x180 | |
113 | ||
114 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_3 | |
115 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_3 | |
116 | ||
117 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_3 | |
118 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_3 | |
119 | ||
120 | ||
121 | #define DRAM_ERR_INJ_REG 0x8400003290 | |
122 | #define DRAM_ERR_STAT_REG 0x8400003280 | |
123 | #define L2_ERR_STAT_REG 0xAB00000180 | |
124 | #define L2_ERR_ADDR_REG 0xAC00000180 | |
125 | #endif | |
126 | ||
127 | #define CMP_ECC_CNT 0x1 | |
128 | ||
129 | #ifdef L2_OFF | |
130 | #define L2_ON_OFF_DM 0x1 | |
131 | #else | |
132 | #define L2_ON_OFF_DM 0x0 | |
133 | #endif | |
134 | ||
135 | #define TT 0x63 | |
136 | ||
137 | .text | |
138 | .global main | |
139 | .global My_Corrected_ECC_error_trap | |
140 | .global My_Recoverable_Sw_error_trap | |
141 | ||
142 | ||
143 | main: | |
144 | ta T_CHANGE_HPRIV | |
145 | clr %i6 | |
146 | clr %i7 | |
147 | clr %i2 | |
148 | clr %i0 | |
149 | ! Now access L2 control and status registers | |
150 | disable_l1: | |
151 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
152 | ! Remove the lower 2 bits (I-Cache and D-Cache enables) | |
153 | andn %l0, 0x3, %l0 | |
154 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
155 | ||
156 | ||
157 | set_L2_Direct_Mapped_Mode: | |
158 | setx L2CS_PA0, %l6, %g1 | |
159 | add %g1,L2_BANK_ADDR,%g1 | |
160 | mov 0x2, %l0 | |
161 | stx %l0, [%g1] | |
162 | ||
163 | ||
164 | /**** | |
165 | enable_err_reporting: | |
166 | setx L2EE_PA0, %l0, %l1 | |
167 | ||
168 | ldx [%l1], %l2 | |
169 | mov 0x3, %l0 | |
170 | or %l2, %l0, %l2 | |
171 | stx %l2, [%l1] | |
172 | ****/ | |
173 | ||
174 | set_DRAM_error_inject_ch0: | |
175 | mov 0x2, %l1 ! ECC Mask (1-bit error) | |
176 | mov 0x1, %l2 | |
177 | sllx %l2, DRAM_EI_SSHOT, %l3 | |
178 | or %l1, %l3, %l1 ! Set single shot ; | |
179 | mov 0x1, %l2 | |
180 | sllx %l2, DRAM_EI_ENB, %l3 | |
181 | or %l1, %l3, %l1 ! Enable error injection for the next write | |
182 | setx DRAM_ERR_INJ_REG, %l3, %g6 | |
183 | ! add %g6, MCU_BANK_ADDR, %g6 | |
184 | stx %l1, [%g6] | |
185 | membar 0x40 | |
186 | ||
187 | ||
188 | store_to_L2_way0: | |
189 | setx 0x555555555, %l0, %g5 | |
190 | setx 0x22000000, %l0, %g7 ! bits [21:18] select way | |
191 | add %g7, L2_BANK_ADDR, %g7 | |
192 | stx %g5, [%g7] | |
193 | membar #Sync | |
194 | ||
195 | ! Storing to same L2 way0 but different tag,this will write to mcu | |
196 | write_mcu_channel_0: | |
197 | setx 0x31000000, %l0, %g3 ! bits [21:18] select way | |
198 | add %g3, L2_BANK_ADDR, %g3 | |
199 | stx %g5, [%g3] | |
200 | membar #Sync | |
201 | ||
202 | read_error_address_ch0: | |
203 | ldx [%g7], %l3 | |
204 | membar #Sync | |
205 | ||
206 | set_DRAM_error_inject_ch0_dau: | |
207 | mov 0x606, %l1 ! ECC Mask (1-bit error) | |
208 | mov 0x1, %l2 | |
209 | sllx %l2, DRAM_EI_SSHOT, %l3 | |
210 | or %l1, %l3, %l1 ! Set single shot ; | |
211 | mov 0x1, %l2 | |
212 | sllx %l2, DRAM_EI_ENB, %l3 | |
213 | or %l1, %l3, %l1 ! Enable error injection for the next write | |
214 | setx DRAM_ERR_INJ_REG, %l3, %g6 | |
215 | ! add %g6, MCU_BANK_ADDR, %g6 | |
216 | stx %l1, [%g6] | |
217 | membar 0x40 | |
218 | ||
219 | ||
220 | store_to_L2_way0_dau: | |
221 | setx 0x555555555, %l0, %g5 | |
222 | setx 0x11000000, %l0, %g7 ! bits [21:18] select way | |
223 | add %g7, L2_BANK_ADDR, %g7 | |
224 | stx %g5, [%g7] | |
225 | membar #Sync | |
226 | ||
227 | ! Storing to same L2 way0 but different tag,this will write to mcu | |
228 | write_mcu_channel_dau: | |
229 | setx 0x32000000, %l0, %g3 ! bits [21:18] select way | |
230 | add %g3, L2_BANK_ADDR, %g3 | |
231 | stx %g5, [%g3] | |
232 | membar #Sync | |
233 | ||
234 | write_mcu_fbr_count_reg: | |
235 | set 0x10000, %g6 !<16>=countone=1 | |
236 | setx DRAM_FBR_CNT_REG_PA, %l7, %o2 | |
237 | stx %g6, [%o2] | |
238 | ldx [%o2], %i1 | |
239 | ||
240 | set_error_count_reg: | |
241 | set 0x1, %g6 !<16>=countone=1 | |
242 | setx DRAM_ERR_CNT_REG_PA, %l7, %o2 | |
243 | stx %g6, [%o2] | |
244 | ||
245 | clear_soc_esr: | |
246 | setx SOC_ESR_REG, %l7, %g5 | |
247 | stx %g0, [%g5] | |
248 | ||
249 | clear_soc_per: | |
250 | setx SOC_PER_REG, %l7, %g5 | |
251 | stx %g0, [%g5] | |
252 | ||
253 | clear_mcu_esr: | |
254 | setx DRAM_ERR_STAT_REG, %l7, %g5 | |
255 | stx %g0, [%g5] | |
256 | ||
257 | clear_l2_esr: | |
258 | setx L2_ERR_STAT_REG, %l7, %g5 | |
259 | stx %g0, [%g5] | |
260 | ||
261 | clear_l2_ear: | |
262 | setx L2_ERR_ADDR_REG, %l7, %g5 | |
263 | stx %g0, [%g5] | |
264 | ||
265 | set_inj_err_src_reg: | |
266 | set FBSYND, %g1 | |
267 | setx DRAM_FBD_INJ_ERR_SRC_REG_PA, %l7, %g3 | |
268 | stx %g1, [%g3] | |
269 | membar 0x40 | |
270 | ||
271 | set_ejr: | |
272 | set 0x1, %g1 | |
273 | sllx %g1, ERR_FIELD, %g2 | |
274 | setx SOC_EJR_REG, %l7, %g3 | |
275 | stx %g2, [%g3] | |
276 | membar 0x40 | |
277 | ||
278 | set_eie: | |
279 | setx SOC_EIE_REG, %l7, %g3 | |
280 | stx %g2, [%g3] | |
281 | membar 0x40 | |
282 | ||
283 | read_error_address_ch0_FBR: | |
284 | ldx [%g7], %l3 | |
285 | membar #Sync | |
286 | ||
287 | idle_cycles: | |
288 | setx 0xfffffffffff,%l0,%l1 | |
289 | setx 0x12345678910,%l0,%l1 | |
290 | setx 0x55555555555,%l0,%l1 | |
291 | setx 0x66666666666,%l0,%l1 | |
292 | setx 0x77777777777,%l0,%l1 | |
293 | setx 0x88888888888,%l0,%l1 | |
294 | setx 0xfffffffffff,%l0,%l1 | |
295 | ||
296 | check_error_trap: | |
297 | setx EXECUTED, %l1, %g7 | |
298 | cmp %i2, %g7 | |
299 | bne test_fail | |
300 | nop | |
301 | ||
302 | mov TT, %l0 | |
303 | cmp %i0, %l0 | |
304 | bne test_fail | |
305 | nop | |
306 | ||
307 | /****************************************************** | |
308 | * Exit code | |
309 | *******************************************************/ | |
310 | ||
311 | test_pass: | |
312 | EXIT_GOOD | |
313 | ||
314 | test_fail: | |
315 | EXIT_BAD | |
316 | ||
317 | ||
318 | ||
319 | ||
320 | /************************************************************************ | |
321 | Trap Handlers | |
322 | ************************************************************************/ | |
323 | My_Recoverable_Sw_error_trap: | |
324 | nop | |
325 | !ba test_fail | |
326 | ba test_pass | |
327 | nop | |
328 | ||
329 | !PER not cleared at the end of the TRAP Handler to avoid further Trap | |
330 | My_Corrected_ECC_error_trap: | |
331 | ! Signal trap taken | |
332 | setx EXECUTED, %l0, %i2 | |
333 | ! save trap type value | |
334 | rdpr %tt, %i0 | |
335 | ||
336 | inc %i7 | |
337 | ||
338 | clear_ejr_tt63: | |
339 | setx SOC_EJR_REG, %l7, %l0 | |
340 | stx %g0, [%l0] | |
341 | nop | |
342 | ||
343 | check_desr_tt63: | |
344 | ldxa [%g0]0x4c, %g2 | |
345 | nop | |
346 | setx 0x8b00000000000000, %l0, %g3 | |
347 | subcc %g2, %g3, %g4 | |
348 | brnz %g4, test_fail | |
349 | nop | |
350 | ||
351 | check_mcu_ESR_tt63: | |
352 | mov 0x1, %l1 | |
353 | sllx %l1, DRAM_ES_FBR, %l6 | |
354 | sllx %l1, DRAM_ES_DAU, %l3 | |
355 | or %l6,%l3,%l6 | |
356 | sllx %l1, DRAM_ES_DAC, %l3 | |
357 | or %l6,%l3,%l6 | |
358 | ||
359 | ||
360 | ||
361 | setx DRAM_ERR_STAT_REG, %l3, %g5 | |
362 | ldx [%g5], %l1 | |
363 | ||
364 | setx 0xbfffffffffff0000, %l3, %l0 ! MEC bit not checked | |
365 | andcc %l0, %l1, %l5 | |
366 | ||
367 | sub %l5, %l6, %i4 | |
368 | brnz %i4, test_fail | |
369 | nop | |
370 | ||
371 | ||
372 | check_mcu_EAR_tt63: | |
373 | setx DRAM_ERR_ADDR_REG_PA_0, %l3, %g5 | |
374 | ldx [%g5], %l1 | |
375 | ||
376 | ||
377 | /* | |
378 | ! Setting DSC and/ or DSU does not cause any logging of the error | |
379 | ! address or syndrome in the L2 Error Address register. | |
380 | ! It also does not update the VEC/VEU/MEC/MEU bits */ | |
381 | check_L2_ESR_tt63: | |
382 | setx L2_ERR_STAT_REG, %l3, %g5 | |
383 | ldx [%g5], %l6 | |
384 | ||
385 | setx 0xbffffffff0000000, %l3, %l0 | |
386 | andcc %l0, %l6, %l5 ! Donot check L2ESR SYND bits and MEC | |
387 | ||
388 | mov 0x1, %l1 | |
389 | sllx %l1, L2ES_DSC, %l0 | |
390 | sllx %l1, L2ES_DAU, %l3 | |
391 | or %l0,%l3,%l0 | |
392 | sllx %l1, L2ES_VEU, %l3 | |
393 | or %l0,%l3,%l0 | |
394 | sllx %l1, L2ES_DAC, %l3 | |
395 | or %l0,%l3,%l0 | |
396 | sllx %l1, L2ES_VEC, %l3 | |
397 | or %l0,%l3,%l0 | |
398 | ||
399 | ||
400 | ||
401 | cmp %l5, %l0 | |
402 | bne %xcc, test_fail | |
403 | nop | |
404 | ||
405 | check_fbr_cnt_reg_tt63: | |
406 | setx DRAM_FBR_CNT_REG_PA, %l7, %o2 | |
407 | ldx [%o2], %g1 | |
408 | set 0x10000, %g6 !<16>=countone=1 | |
409 | sub %g1, %g6, %i4 | |
410 | brnz %i4, test_fail | |
411 | nop | |
412 | ||
413 | read_err_cnt_reg_tt63: | |
414 | setx DRAM_ERR_CNT_REG_PA, %l7, %o2 | |
415 | ldx [%o2], %g1 | |
416 | set CMP_ECC_CNT, %i1 | |
417 | sub %g1, %i1, %i4 | |
418 | brnz %i4, test_fail | |
419 | nop | |
420 | ||
421 | read_fbd_err_synd_reg_tt63: | |
422 | setx DRAM_FBD_ERR_SYND_REG_PA, %l7, %o2 | |
423 | ldx [%o2], %g1 | |
424 | ||
425 | setx 0x8000000000000000, %l7, %o3 | |
426 | set 0x1, %o4 | |
427 | sll %o4, FBSYND, %o5 | |
428 | or %o3, %o5, %g2 | |
429 | ||
430 | and %g1, %g2, %g3 | |
431 | subcc %g2, %g3, %g4 | |
432 | brnz %g4, test_fail | |
433 | nop | |
434 | ||
435 | clear_per_tt63: | |
436 | setx SOC_PER_REG, %l7, %l0 | |
437 | stx %g0, [%l0] | |
438 | nop | |
439 | ||
440 | clear_esr_tt63: | |
441 | setx SOC_ESR_REG, %l7, %l0 | |
442 | stx %g0, [%l0] | |
443 | nop | |
444 | ||
445 | done | |
446 | nop | |
447 | ||
448 | ||
449 |