Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / siu / n2_err_siu_niu_rx_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_siu_niu_rx_trap.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 */ /* Access main in priviledge mode */
42#define MAIN_PAGE_HV_ALSO
43#define loop_count 0x104
44
45
46#include "err_defines.h"
47#include "hboot.s"
48#include "niu_defines.h"
49
50/************************************************************************
51 Test case code start
52 ************************************************************************/
53.text
54.global main
55.global My_Corrected_ECC_error_trap
56.global My_Recoverable_Sw_error_trap
57
58main:
59 ta T_CHANGE_HPRIV
60 nop
61
62!#include "niu_init.h"
63!
64! Thread 0 Start
65!
66!
67!thread_0:
68 nop
69
70 /******************************
71 RAS
72 Error Injection
73 ******************************/
74clear_esr_first:
75 setx SOC_ESR_REG, %l7, %i0
76 stx %g0, [%i0]
77
78set_ejr:
79 set 0x1, %i1
80 sllx %i1, ERR_FIELD, %i2
81 setx SOC_EJR_REG, %l7, %i3
82 stx %i2, [%i3]
83 membar 0x40
84
85eie_reg_ones:
86 setx SOC_EIE_REG, %l7, %g5
87 stx %i2, [%g5]
88 membar 0x40
89
90 /********************************/
91/************************************************************************
92 First call the Vera, so that values are updated in Memory and
93 then read those values from assembly and program the registers
94 ************************************************************************/
95P_NIU_RxInitDma:
96 nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxInitDma)) -> NIU_InitRxDma(RXDMA_CHNL, RX_DESC_RING_LENGTH, RX_COMPL_RING_LEN, RBR_CONFIG_B_DATA, RX_INITIAL_KICK, NIU_Xlate_On)
97
98 setx 0x5, %g1, %g4 ! Delay for Vera to complete
99delay_loop_Rx:
100 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
101 nop
102 nop
103 nop
104 nop
105 dec %g4
106 brnz %g4, delay_loop_Rx
107 nop
108
109 nop
110 setx RXDMA_CHNL, %g1, %o0
111 setx RX_DESC_RING_LENGTH, %g1, %o1
112 setx RX_COMPL_RING_LEN, %g1, %o2
113 setx RBR_CONFIG_B_DATA, %g1, %o3
114 setx RX_INITIAL_KICK, %g1, %o4
115 call NiuInitRxDma
116 nop
117
118P_NIU_RxPkt_Conf:
119 nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxPkt_Conf)) -> NIU_RxPktConf(RXMAC_PKTCNT, MAC_ID)
120 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for Delay
121 nop
122
123
124P_NIU_Rx_GenPkt:
125 setx RXMAC_PKTCNT, %g1, %g6 ! Packet count
126 nop
127Rx_pktcnt_loop:
128 nop !$EV trig_pc_d(1, @VA(.MAIN.Rx_pktcnt_loop)) -> NIU_RxGenPkt(MAC_ID, RXDMA_CHNL, 1, MAC_PKT_LEN, 0x0, RX_NIU_MULTI_DMA, 1)
129 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! just for delay
130 nop
131 dec %g6
132 brnz %g6, Rx_pktcnt_loop
133 nop
134
135 setx loop_count, %g1, %g4
136delay_loop:
137 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
138 nop
139 nop
140 nop
141 nop
142 dec %g4
143 brnz %g4, delay_loop
144 nop
145
146
147 /******************************
148 Error Check
149 ******************************/
150 ! ESR is cleared in INT
151check_esr:
152 setx SOC_ESR_REG, %l7, %i0
153 ldx [%i0], %i1
154
155check_per:
156 setx SOC_PER_REG, %l7, %i0
157 ldx [%i0], %i1
158 nop
159
160
161 ! Check if a Corrected ECC Trap happened
162check_error_trap:
163 setx EXECUTED, %l1, %l0
164 cmp %o6, %l0
165 bne test_fail
166 nop
167 mov TT, %l0
168 cmp %o7, %l0
169 bne test_fail
170 nop
171 /********************************/
172
173test_passed:
174 nop
175 EXIT_GOOD
176
177!.global test_fail
178!test_failed:
179! EXIT_BAD
180
181test_fail:
182 EXIT_BAD
183 nop
184
185
186/************************************************************************
187 Trap Handlers
188 ************************************************************************/
189My_Recoverable_Sw_error_trap:
190 ! Signal trap taken
191 setx EXECUTED, %l0, %o6
192 ! save trap type value
193 rdpr %tt, %o7
194
195check_desr_tt40:
196 ldxa [%g0]0x4c, %g2
197 nop
198 setx 0xb300000000000000, %l0, %g3
199 subcc %g2, %g3, %g4
200 brnz %g4, test_fail
201 nop
202
203check_per_tt40:
204 setx SOC_PER_REG, %l7, %i0
205 ldx [%i0], %i1
206 setx 0x8000000000000000, %l7, %o3 !valid bit
207 set 0x1, %i2
208 sllx %i2, ERR_FIELD, %i3
209 or %i3, %o3, %i4
210 sub %i1, %i4, %i5
211 brnz %i5, test_fail
212 nop
213
214clear_per_tt40:
215 setx SOC_PER_REG, %l7, %i0
216 stx %g0, [%i0]
217 nop
218 done
219 nop
220
221My_Corrected_ECC_error_trap:
222 ! Signal trap taken
223 setx EXECUTED, %l0, %o6
224 ! save trap type value
225 rdpr %tt, %o7
226
227check_desr_tt63:
228 ldxa [%g0]0x4c, %g2
229 nop
230 setx 0x8b00000000000000, %l0, %g3
231 subcc %g2, %g3, %g4
232 brnz %g4, test_fail
233
234check_per_tt63:
235 setx SOC_PER_REG, %l7, %i0
236 ldx [%i0], %i1
237 setx 0x8000000000000000, %l7, %o3 !valid bit
238 set 0x1, %i2
239 sllx %i2, ERR_FIELD, %i3
240 or %i3, %o3, %i4
241 sub %i1, %i4, %i5
242 brnz %i5, test_fail
243 nop
244
245clear_per_tt63:
246 setx SOC_PER_REG, %l7, %i0
247 stx %g0, [%i0]
248 nop
249 done
250 nop
251
252/*******************************************/
253
254/************************************************************************
255 Test case data start
256 ************************************************************************/
257/* These initialization is temporary, as there looks some bug in mempli */
258!
259!SECTION SetRngConfig_init data_va=0x100000000
260!attr_data {
261! Name = SetRngConfig_init,
262! hypervisor,
263! compressimage
264! }
265!.data
266!SetRngConfig_init:
267! .xword 0x0060452301000484
268/************************************************************************/
269
270SECTION SetRxLogMask1_init data_va=0x200000100
271attr_data {
272 Name = SetRxLogMask1_init,
273 hypervisor,
274 compressimage
275 }
276.data
277SetRxLogMask1_init:
278 .xword 0x0060452301000484
279/************************************************************************/
280
281SECTION SetRxLogVal1_init data_va=0x200000200
282attr_data {
283 Name = SetRxLogVal1_init,
284 hypervisor,
285 compressimage
286 }
287.data
288SetRxLogVal1_init:
289 .xword 0x0060452301000484
290/************************************************************************/
291
292SECTION SetRxLogRelo1_init data_va=0x200000300
293attr_data {
294 Name = SetRxLogRelo1_init,
295 hypervisor,
296 compressimage
297 }
298.data
299SetRxLogRelo1_init:
300 .xword 0x0060452301000484
301/************************************************************************/
302
303SECTION SetRxLogPgVld_init data_va=0x200000400
304attr_data {
305 Name = SetRxLogPgVld_init,
306 hypervisor,
307 compressimage
308 }
309.data
310SetRxLogPgVld_init:
311 .xword 0x0060452301000484
312/************************************************************************/
313SECTION SetRbrConfig_A_init data_va=0x200000500
314attr_data {
315 Name = SetRbrConfig_A_init,
316 hypervisor,
317 compressimage
318 }
319.data
320SetRbrConfig_A_init:
321 .xword 0x0060452301000484
322/************************************************************************/
323SECTION SetRbrConfig_B_init data_va=0x200000600
324attr_data {
325 Name = SetRbrConfig_B_init,
326 hypervisor,
327 compressimage
328 }
329.data
330SetRbrConfig_B_init:
331 .xword 0x0060452301000484
332/************************************************************************/
333SECTION SetRcrConfig_A_init data_va=0x200000700
334attr_data {
335 Name = SetRcrConfig_A_init,
336 hypervisor,
337 compressimage
338 }
339.data
340SetRcrConfig_A_init:
341 .xword 0x0060452301000484
342/************************************************************************/
343SECTION SetRxDmaCfig_1_0_init data_va=0x200000800
344attr_data {
345 Name = SetRxDmaCfig_1_0_init,
346 hypervisor,
347 compressimage
348 }
349.data
350SetRxDmaCfig_1_0_init:
351 .xword 0x0060452301000484
352/************************************************************************/
353SECTION SetRxdmaCfig2Start_init data_va=0x200000900
354attr_data {
355 Name = SetRxdmaCfig2Start_init,
356 hypervisor,
357 compressimage
358 }
359.data
360SetRxdmaCfig2Start_init:
361 .xword 0x0060452301000484
362/************************************************************************/
363SECTION SetRxDmaCfig_1_1_init data_va=0x200000a00
364attr_data {
365 Name = SetRxDmaCfig_1_1_init,
366 hypervisor,
367 compressimage
368 }
369.data
370SetRxDmaCfig_1_1_init:
371 .xword 0x0060452301000484
372
373/************************************************************************/
374
375SECTION SetRxRingKick_init data_va=0x200000b00
376attr_data {
377 Name = SetRxRingKick_init,
378 hypervisor,
379 compressimage
380 }
381.data
382SetRxRingKick_init:
383 .xword 0x0060452301000484
384/************************************************************************/
385
386SECTION SetRxLogMask2_init data_va=0x200000c00
387attr_data {
388 Name = SetRxLogMask2_init,
389 hypervisor,
390 compressimage
391 }
392.data
393SetRxLogMask2_init:
394 .xword 0x0060452301000484
395/************************************************************************/
396
397SECTION SetRxLogVal2_init data_va=0x200000d00
398attr_data {
399 Name = SetRxLogVal2_init,
400 hypervisor,
401 compressimage
402 }
403.data
404SetRxLogVal2_init:
405 .xword 0x0060452301000484
406/************************************************************************/
407
408SECTION SetRxLogRelo2_init data_va=0x200000e00
409attr_data {
410 Name = SetRxLogRelo2_init,
411 hypervisor,
412 compressimage
413 }
414.data
415SetRxLogRelo2_init:
416 .xword 0x0060452301000484
417
418/************************************************************************/
419