Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_adv_NCUDMU_MONDO_IDP.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_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap | |
39 | #define H_HT0_Hw_Corrected_Error_0x63 My_Corrected_ECC_error_trap | |
40 | ||
41 | #define MAIN_PAGE_HV_ALSO | |
42 | ||
43 | #define H_HT0_Interrupt_0x60 | |
44 | #define My_HT0_Interrupt_0x60 \ | |
45 | call my_trap_code; \ | |
46 | nop; \ | |
47 | retry; \ | |
48 | nop; | |
49 | ||
50 | #include "hboot.s" | |
51 | #include "peu_defines.h" | |
52 | #include "ncu_defines.h" | |
53 | ||
54 | ||
55 | /************************************************************************ | |
56 | Test case code start | |
57 | ************************************************************************/ | |
58 | .text | |
59 | .global main | |
60 | .global My_Recoverable_Sw_error_trap | |
61 | .global My_Corrected_ECC_error_trap | |
62 | ||
63 | ||
64 | main: | |
65 | ta T_CHANGE_HPRIV | |
66 | nop | |
67 | ||
68 | clear_esr_first: | |
69 | setx SOC_ESR_REG, %l7, %i0 | |
70 | stx %g0, [%i0] | |
71 | ||
72 | ||
73 | inj_err4: | |
74 | nop !$EV trig_pc_d(0,@VA(.MAIN.inj_err4)) ->IosErrInj(NCUDMU_MONDO_IDP, 0000, 0) | |
75 | ||
76 | ||
77 | /* Initialize the NCU for the interrupt. */ | |
78 | ||
79 | ! Disable interrupts | |
80 | ||
81 | ||
82 | no_intr: | |
83 | rdpr %pstate, %g7 | |
84 | xor %g7, 0x2, %g7 ! Reset interrupt enable | |
85 | wrpr %g7, %pstate | |
86 | ||
87 | ! Initialize NCU's Mondo Interrupt Vector Register | |
88 | ! VECTOR = 63 | |
89 | ||
90 | ncu_mondo_int_vec: | |
91 | set 63, %g1 | |
92 | setx MONDO_INT_VEC, %g2, %g3 | |
93 | stx %g1, [%g3] | |
94 | ||
95 | ! Clear NCU's Mondo Interrupt Busy registers. | |
96 | ||
97 | ncu_mondo_int_busy: | |
98 | setx MONDO_INT_ABUSY, %g1, %g2 | |
99 | stx %g0, [%g2] | |
100 | ||
101 | ! Enable in MMU, TTE_INV_P, primary TTE valid bit not set error. | |
102 | ||
103 | mmu_intr_enable_reg_init: | |
104 | setx PCI_E_MMU_INT_ENB_ADDR, %g1, %g2 | |
105 | set PCI_E_MMU_INT_EN_TTE_INV_P_SHIFT, %g3 | |
106 | set 1, %g4 | |
107 | sllx %g4, %g3, %g4 | |
108 | stx %g4, [%g2] | |
109 | ||
110 | ! Enable in IMU, MSI_MAL_ERR_P, malformed MSI message error. | |
111 | ||
112 | imu_intr_enable_reg_init: | |
113 | setx PCI_E_IMU_INT_ENB_ADDR, %g1, %g2 | |
114 | set PCI_E_IMU_INT_EN_MSI_MAL_ERR_P_SHIFT, %g3 | |
115 | set 1, %g4 | |
116 | sllx %g4, %g3, %g4 | |
117 | stx %g4, [%g2] | |
118 | ||
119 | ! Initialize Interrupt Mapping register | |
120 | ! Valid, thread ID 0, no interrupt controller | |
121 | ||
122 | pci_intr_map_reg_init: | |
123 | setx PCI_E_INT_MAP_ADDR, %g1, %g7 | |
124 | setx PCI_E_INT_MAP_MONDO_62_OFFSET, %g1, %g3 | |
125 | add %g7, %g3, %g7 | |
126 | setx 0x80000040, %g1, %g6 ! valid = 1, thread id = 0 | |
127 | stx %g6, [%g7] ! interrupt controller = 1 | |
128 | ||
129 | yes_intr: | |
130 | rdpr %pstate, %g7 | |
131 | or %g7, 0x2, %g7 ! Set interrupt enable | |
132 | wrpr %g7, %pstate | |
133 | ||
134 | ! Enable IMU, MMU interrupts in the DMU Core and Block | |
135 | ! Interrupt Enable register. | |
136 | ||
137 | dmu_core_block_enable: | |
138 | setx PCI_E_DMU_CORE_BLK_INT_ENB_ADDR, %g1, %g2 | |
139 | setx PCI_E_DMU_CORE_BLK_INT_EN_DMC_MASK, %g1, %g3 | |
140 | setx PCI_E_DMU_CORE_BLK_INT_EN_MMU_MASK, %g1, %g4 | |
141 | or %g3, %g4, %g4 | |
142 | setx PCI_E_DMU_CORE_BLK_INT_EN_IMU_MASK, %g1, %g3 | |
143 | or %g3, %g4, %g4 | |
144 | stx %g4, [%g2] | |
145 | membar #Sync | |
146 | ||
147 | ! Generate an interrupt from the IMU block. | |
148 | ||
149 | gen_imu_intr: | |
150 | setx PCI_E_IMU_ERR_STAT_SET_ADDR, %g1, %g2 | |
151 | set 1, %g6 | |
152 | setx PCI_E_IMU_INT_EN_MSI_MAL_ERR_P_SHIFT, %g1, %g3 | |
153 | sllx %g6, %g3, %g6 | |
154 | stx %g6, [%g2] | |
155 | membar #Sync | |
156 | ||
157 | ! Wait for the interrupt trap | |
158 | ||
159 | intr_wait1: | |
160 | setx 0x400, %g1, %g2 ! timeout count | |
161 | setx user_data_start, %g1, %g7 | |
162 | ||
163 | intr_wait_loop1: | |
164 | ld [%g7], %g5 | |
165 | cmp %g5, 1 | |
166 | be read_esr | |
167 | nop | |
168 | ||
169 | cmp %g2, 0 | |
170 | be test_failed ! time out | |
171 | nop | |
172 | ba intr_wait_loop1 | |
173 | dec %g2 | |
174 | ||
175 | ||
176 | /****************************** | |
177 | Error Check | |
178 | ******************************/ | |
179 | read_esr: | |
180 | setx SOC_ESR_REG, %l7, %i0 | |
181 | ldx [%i0], %i1 | |
182 | nop | |
183 | ||
184 | setx 0x8000000000000000, %l7, %o3 !valid bit | |
185 | set 0x1, %i2 | |
186 | sllx %i2, ERR_FIELD, %i3 | |
187 | or %i3, %o3, %i4 | |
188 | sub %i1, %i4, %i5 | |
189 | brnz %i5, test_failed | |
190 | nop | |
191 | ||
192 | eie_reg_ones: | |
193 | setx SOC_EIE_REG, %g3, %g2 | |
194 | set 0x1, %i1 | |
195 | sllx %i1, ERR_FIELD, %g1 | |
196 | stx %g1, [%g2] | |
197 | membar 0x40 | |
198 | ||
199 | setx 0x40, %g7, %g6 | |
200 | set 0x1, %g1 ! 1 Trap | |
201 | err_trap_loop: | |
202 | cmp %g6, %g0 | |
203 | be %xcc, test_failed | |
204 | nop | |
205 | ||
206 | cmp %g1, %i7 | |
207 | be %xcc, check_tt | |
208 | nop | |
209 | ||
210 | ba err_trap_loop | |
211 | nop | |
212 | ||
213 | check_tt: | |
214 | mov TT, %l0 | |
215 | cmp %o7, %l0 | |
216 | bne %xcc, test_failed | |
217 | nop | |
218 | ||
219 | ||
220 | /********************************/ | |
221 | ||
222 | ||
223 | test_passed: | |
224 | EXIT_GOOD | |
225 | ||
226 | test_failed: | |
227 | EXIT_BAD | |
228 | ||
229 | ||
230 | /********************************************************************** | |
231 | Interrupt trap handler. | |
232 | **********************************************************************/ | |
233 | ||
234 | .global my_trap_code | |
235 | ||
236 | my_trap_code: | |
237 | ||
238 | ! Record interrupt occured. | |
239 | ||
240 | trap_intr_flag: | |
241 | setx user_data_start, %l1, %l3 | |
242 | set 1, %l1 | |
243 | st %l1, [%l3] | |
244 | ||
245 | ! Check Mondo Interrupt Busy reg. | |
246 | ||
247 | trap_mondo_busy: | |
248 | ta T_RD_THID ! thread id into %o1 | |
249 | setx MONDO_INT_BUSY, %l1, %l2 | |
250 | setx MONDO_INT_BUSY_STEP, %l1, %l3 | |
251 | mulx %l3, %o1, %l3 | |
252 | add %l3, %l2, %l2 | |
253 | ldx [%l2], %l4 | |
254 | and %l4, 0x40, %l5 ! Is busy bit set? | |
255 | cmp %l5, 0 | |
256 | be test_failed | |
257 | nop | |
258 | ||
259 | ! Clear the mondo interrupt in the PIU. | |
260 | ||
261 | ! MMU Error Status Set reg. | |
262 | ||
263 | trap_clear_mmu_err_set: | |
264 | setx PCI_E_MMU_ERR_STAT_SET_ADDR, %l1, %l2 | |
265 | stx %g0, [%l2] ! removes setting of the error | |
266 | ||
267 | ! MMU Error Status Clear reg. | |
268 | ||
269 | trap_mmu_err_clear: | |
270 | setx PCI_E_MMU_ERR_STAT_CL_ADDR, %l1, %l2 | |
271 | sub %g0, 1, %l0 ! a W1C register | |
272 | stx %l0, [%l2] ! clears the error flag | |
273 | ||
274 | ! IMU Error Status Set reg. | |
275 | ||
276 | trap_clear_imu_err_set: | |
277 | setx PCI_E_IMU_ERR_STAT_SET_ADDR, %l1, %l2 | |
278 | stx %g0, [%l2] ! removes setting of the error | |
279 | ||
280 | ! IMU Error Status Clear reg. | |
281 | ||
282 | trap_imu_err_clear: | |
283 | setx PCI_E_IMU_ERR_STAT_CLR_ADDR, %l1, %l2 | |
284 | sub %g0, 1, %l0 ! a W1C register | |
285 | stx %l0, [%l2] ! clears the error flag | |
286 | ||
287 | ! Interrupt Clear reg. | |
288 | ||
289 | trap_intr_clear: | |
290 | setx PCI_E_INT_CLEAR_ADDR, %l1, %l2 | |
291 | setx PCI_E_INT_CLEAR_MONDO_62_OFFSET, %l1, %l3 | |
292 | add %l2, %l3, %l2 | |
293 | stx %g0, [%l2] | |
294 | ||
295 | ! Clear the mondo interrupt in the NCU | |
296 | ||
297 | trap_mondo_intr_clear: | |
298 | setx MONDO_INT_ABUSY, %l0, %l1 | |
299 | stx %g0, [%l1] | |
300 | membar #Sync | |
301 | ||
302 | ldx [%l1], %l2 | |
303 | and %l2, 0x40, %l2 | |
304 | cmp %l2, 0 ! Busy should be cleared | |
305 | bne test_failed | |
306 | nop | |
307 | ||
308 | ! Clear the interrupt in the core. | |
309 | ||
310 | trap_clear_asi_intr_r: | |
311 | ldxa [%g0]ASI_SWVR_INTR_R, %l5 | |
312 | cmp %l5, 63 ! check for correct vector number | |
313 | bne test_failed | |
314 | nop | |
315 | ||
316 | ! Done. | |
317 | ||
318 | trap_done: | |
319 | jmpl %o7+0x8, %g0 | |
320 | nop | |
321 | ||
322 | ||
323 | ||
324 | ||
325 | /************************************************************************ | |
326 | RAS | |
327 | Trap Handlers | |
328 | ************************************************************************/ | |
329 | My_Recoverable_Sw_error_trap: | |
330 | ! Signal trap taken | |
331 | setx EXECUTED, %l0, %o6 | |
332 | ! save trap type value | |
333 | rdpr %tt, %o7 | |
334 | ||
335 | inc %i7 | |
336 | ||
337 | check_desr_tt40: | |
338 | ldxa [%g0]0x4c, %g2 | |
339 | nop | |
340 | setx 0xb300000000000000, %l0, %g3 | |
341 | subcc %g2, %g3, %g4 | |
342 | brnz %g4, test_failed | |
343 | nop | |
344 | ||
345 | check_DSFSR_tt32: | |
346 | set 0x18, %g1 | |
347 | ldxa [%g1]0x58, %g2 | |
348 | nop | |
349 | /* | |
350 | set 0x4, %g3 | |
351 | subcc %g2, %g3, %g4 | |
352 | brnz %g4, test_failed | |
353 | nop | |
354 | */ | |
355 | ||
356 | ||
357 | check_per_tt40: | |
358 | setx SOC_PER_REG, %l7, %g1 | |
359 | ldx [%g1], %g2 | |
360 | setx 0x8000000000000000, %g7, %g1 | |
361 | set 0x1, %g3 | |
362 | sllx %g3, ERR_FIELD, %g4 | |
363 | or %g1, %g4, %g3 | |
364 | sub %g2, %g3, %g5 | |
365 | brnz %g5, test_failed | |
366 | nop | |
367 | ||
368 | clear_per_tt40: | |
369 | setx SOC_PER_REG, %l7, %g1 | |
370 | stx %g0, [%g1] | |
371 | nop | |
372 | ||
373 | clear_ejr_tt40: | |
374 | setx SOC_EJR_REG, %l7, %g1 | |
375 | stx %g0, [%g1] | |
376 | nop | |
377 | ||
378 | clear_eie_tt40: | |
379 | setx SOC_EIE_REG, %l7, %g1 | |
380 | stx %g0, [%g1] | |
381 | nop | |
382 | ||
383 | trap_done_tt40: | |
384 | done | |
385 | nop | |
386 | ||
387 | ||
388 | My_Corrected_ECC_error_trap: | |
389 | ! Signal trap taken | |
390 | setx EXECUTED, %l0, %o6 | |
391 | ! save trap type value | |
392 | rdpr %tt, %o7 | |
393 | ||
394 | inc %i7 | |
395 | ||
396 | check_desr_tt63: | |
397 | ldxa [%g0]0x4c, %g2 | |
398 | nop | |
399 | setx 0x8b00000000000000, %l0, %g3 | |
400 | subcc %g2, %g3, %g4 | |
401 | brnz %g4, test_failed | |
402 | ||
403 | check_per_tt63: | |
404 | setx SOC_PER_REG, %l7, %i0 | |
405 | ldx [%i0], %i1 | |
406 | setx 0x8000000000000000, %l7, %o3 !valid bit | |
407 | set 0x1, %i2 | |
408 | sllx %i2, ERR_FIELD, %i3 | |
409 | or %i3, %o3, %i4 | |
410 | sub %i1, %i4, %i5 | |
411 | brnz %i5, test_failed | |
412 | nop | |
413 | ||
414 | clear_per_tt63: | |
415 | setx SOC_PER_REG, %l7, %i0 | |
416 | stx %g0, [%i0] | |
417 | nop | |
418 | done | |
419 | nop | |
420 | ||
421 | check_DSFSR_tt63: | |
422 | set 0x18, %g1 | |
423 | ldxa [%g1]0x58, %g5 | |
424 | ||
425 | trap_done_tt63: | |
426 | done | |
427 | nop | |
428 | ||
429 | ||
430 | ||
431 | /************************************************************************ | |
432 | Test case data start | |
433 | ************************************************************************/ | |
434 | ||
435 | .align 1024 | |
436 | .data | |
437 | user_data_start: | |
438 | .word 0x0 | |
439 | .word 0x0 | |
440 | .word 0x0 | |
441 | .word 0x0 | |
442 | user_data_end: | |
443 | .end | |
444 |