Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / niu / NIU_Trap / FcNiuBasic_Trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: FcNiuBasic_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 MAIN_PAGE_HV_ALSO
39
40#include "hboot.s"
41#include "niu_defines.h"
42
43/************************************************************************
44 Test case code start
45 ************************************************************************/
46.text
47.global main
48
49main:
50 ta T_CHANGE_HPRIV
51 nop
52
53 mov 0x1, %g4
54
55 ta T_RD_THID
56 nop
57 cmp %g4, %o1 ! Check if its thread1
58 be thread_1 !
59 nop
60 brz %o1, thread_Tx ! Execute thread_0
61 nop
62 cmp %g4, %o1 ! Send the remaining threads to good-end, if any.
63 bne test_passed !
64 nop
65
66!
67! Thread 0 Start
68!
69!
70thread_Tx:
71 call HTrap_NCU_Setup
72 nop
73
74#ifdef TX_TEST
75 call HTrap_NIU_TxDma_Init
76 nop
77#endif
78
79#ifdef RX_TEST
80 call HTrap_NIU_RxDma_Init
81 nop
82#endif
83
84! nop
85! wr %g0, ASI_CMP_CORE, %asi
86! mov 0x2, %g4
87! stxa %g4, [ASI_CMP_CORE_RUNNING_W1S]%asi ! Start Thread_1
88! nop
89
90NIU_Tx_PktConfig:
91 nop ! $EV trig_pc_d(1, @VA(.MAIN.NIU_Tx_PktConfig)) -> pktGenConfig(MAC_ID, FRAME_TYPE, FRAME_CLASS, TX_PKT_LEN)
92
93NIU_Tx_Gen_Packet:
94 nop ! $EV trig_pc_d(1, @VA(.MAIN.NIU_Tx_Gen_Packet)) -> TxPktGen(MAC_ID, NIU_TxDmaNoUE,NIU_TX_PKT_CNT)
95 nop
96
97 setx 0x5, %g1, %g4
98delay_loop_tmp:
99 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
100 nop
101 nop
102 nop
103 nop
104 dec %g4
105 brnz %g4, delay_loop_tmp
106 nop
107
108
109SetTxRingKick:
110 setx 0x100000100, %g1, %g2 ! $EV trig_pc_d(1, @VA(.MAIN.SetTxRingKick)) -> NIU_SetTxRingKick(MAC_ID, NIU_TxDmaNoUE)
111 setx NIU_TxDmaNo, %g1, %o0
112 ldxa [%g2]ASI_PRIMARY_LITTLE, %g3
113 nop
114 mulx %o0, 0x200, %g5
115 setx TX_RING_KICK_Addr, %g1, %g2
116 add %g2, %g5, %g2
117 stxa %g3, [%g2]ASI_PRIMARY_LITTLE
118 nop
119
120SetTxCs :
121 setx NIU_TxDmaNo, %g1, %o0
122 setx TX_CS_Data, %g1, %g3
123 mulx %o0, 0x200, %g5
124 setx TX_CS_Addr, %g1, %g2
125 add %g2, %g5, %g2
126 stxa %g3, [%g2]ASI_PRIMARY_LITTLE
127 nop
128
129
130#ifdef JUMBO_FRAME_EN /* Extra Delay for Jumbo packets to go out */
131 setx loop_count, %g1, %g4
132delay_loop:
133 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
134 nop
135 nop
136 nop
137 nop
138 dec %g4
139 brnz %g4, delay_loop
140 nop
141#endif
142
143NIUTx_Pkt_Cnt_Chk:
144 setx MAC_ID, %g1, %o0
145 setx NIU_TX_PKT_CNT, %g1, %o1
146 call NiuTx_check_pkt_cnt
147 nop
148
149! Loop here to see ISR has Kicked successfully
150InFinit_loop:
151 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
152 nop
153 ba InFinit_loop
154 nop
155
156test_passed_tx:
157 nop ! $EV trig_pc_d(1, @VA(.MAIN.test_passed_tx)) -> NIU_EXIT_chk(MAC_ID)
158 EXIT_GOOD
159
160!
161! Thread 1 Start
162!
163!
164thread_1:
165
166/************************************************************************/
167/************************************************************************/
168
169P_NIU_RxPkt_Conf:
170 nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxPkt_Conf)) -> NIU_RxPktConf(RXMAC_PKTCNT)
171 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for Delay
172 nop
173
174
175P_NIU_Rx_GenPkt:
176 setx RXMAC_PKTCNT, %g1, %g6 ! Packet count
177 nop
178Rx_pktcnt_loop:
179 nop !$EV trig_pc_d(1, @VA(.MAIN.Rx_pktcnt_loop)) -> NIU_RxGenPkt(MAC_ID, RXDMA_CHNL, 1, MAC_PKT_LEN, 1)
180 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! just for delay
181 nop
182 dec %g6
183 brnz %g6, Rx_pktcnt_loop
184 nop
185
186 setx loop_count, %g1, %g4
187delay_loop:
188 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
189 nop
190 nop
191 nop
192 nop
193 dec %g4
194 brnz %g4, delay_loop
195 nop
196
197! Loop here to see ISR Kicked successfully
198
199test_passed:
200 nop
201 EXIT_GOOD
202
203
204/************************************************************************/
205
206SECTION SetRxLogMask1_init data_va=0x200000100
207attr_data {
208 Name = SetRxLogMask1_init,
209 hypervisor,
210 compressimage
211 }
212.data
213SetRxLogMask1_init:
214 .xword 0x0060452301000484
215/************************************************************************/
216
217SECTION SetRxLogVal1_init data_va=0x200000200
218attr_data {
219 Name = SetRxLogVal1_init,
220 hypervisor,
221 compressimage
222 }
223.data
224SetRxLogVal1_init:
225 .xword 0x0060452301000484
226/************************************************************************/
227
228SECTION SetRxLogRelo1_init data_va=0x200000300
229attr_data {
230 Name = SetRxLogRelo1_init,
231 hypervisor,
232 compressimage
233 }
234.data
235SetRxLogRelo1_init:
236 .xword 0x0060452301000484
237/************************************************************************/
238
239SECTION SetRxLogPgVld_init data_va=0x200000400
240attr_data {
241 Name = SetRxLogPgVld_init,
242 hypervisor,
243 compressimage
244 }
245.data
246SetRxLogPgVld_init:
247 .xword 0x0060452301000484
248/************************************************************************/
249SECTION SetRbrConfig_A_init data_va=0x200000500
250attr_data {
251 Name = SetRbrConfig_A_init,
252 hypervisor,
253 compressimage
254 }
255.data
256SetRbrConfig_A_init:
257 .xword 0x0060452301000484
258/************************************************************************/
259SECTION SetRbrConfig_B_init data_va=0x200000600
260attr_data {
261 Name = SetRbrConfig_B_init,
262 hypervisor,
263 compressimage
264 }
265.data
266SetRbrConfig_B_init:
267 .xword 0x0060452301000484
268/************************************************************************/
269SECTION SetRcrConfig_A_init data_va=0x200000700
270attr_data {
271 Name = SetRcrConfig_A_init,
272 hypervisor,
273 compressimage
274 }
275.data
276SetRcrConfig_A_init:
277 .xword 0x0060452301000484
278/************************************************************************/
279SECTION SetRxDmaCfig_1_0_init data_va=0x200000800
280attr_data {
281 Name = SetRxDmaCfig_1_0_init,
282 hypervisor,
283 compressimage
284 }
285.data
286SetRxDmaCfig_1_0_init:
287 .xword 0x0060452301000484
288/************************************************************************/
289SECTION SetRxdmaCfig2Start_init data_va=0x200000900
290attr_data {
291 Name = SetRxdmaCfig2Start_init,
292 hypervisor,
293 compressimage
294 }
295.data
296SetRxdmaCfig2Start_init:
297 .xword 0x0060452301000484
298/************************************************************************/
299SECTION SetRxDmaCfig_1_1_init data_va=0x200000a00
300attr_data {
301 Name = SetRxDmaCfig_1_1_init,
302 hypervisor,
303 compressimage
304 }
305.data
306SetRxDmaCfig_1_1_init:
307 .xword 0x0060452301000484
308
309/************************************************************************/
310
311SECTION SetRxRingKick_init data_va=0x200000b00
312attr_data {
313 Name = SetRxRingKick_init,
314 hypervisor,
315 compressimage
316 }
317.data
318SetRxRingKick_init:
319 .xword 0x0060452301000484
320/************************************************************************/
321
322SECTION SetRxLogMask2_init data_va=0x200000c00
323attr_data {
324 Name = SetRxLogMask2_init,
325 hypervisor,
326 compressimage
327 }
328.data
329SetRxLogMask2_init:
330 .xword 0x0060452301000484
331/************************************************************************/
332
333SECTION SetRxLogVal2_init data_va=0x200000d00
334attr_data {
335 Name = SetRxLogVal2_init,
336 hypervisor,
337 compressimage
338 }
339.data
340SetRxLogVal2_init:
341 .xword 0x0060452301000484
342/************************************************************************/
343
344SECTION SetRxLogRelo2_init data_va=0x200000e00
345attr_data {
346 Name = SetRxLogRelo2_init,
347 hypervisor,
348 compressimage
349 }
350.data
351SetRxLogRelo2_init:
352 .xword 0x0060452301000484
353
354/************************************************************************/
355
356/************************************************************************
357 Test case data start
358 ************************************************************************/
359/* These initialization is temporary, as there looks some bug in mempli */
360
361SECTION SetRngConfig_init data_va=0x100000000
362attr_data {
363 Name = SetRngConfig_init,
364 hypervisor,
365 compressimage
366 }
367.data
368SetRngConfig_init:
369 .xword 0x0060452301000484
370/************************************************************************/
371
372SECTION SetTxRingKick_init data_va=0x100000100
373attr_data {
374 Name = SetTxRingKick_init,
375 hypervisor,
376 compressimage
377 }
378.data
379SetTxRingKick_init:
380 .xword 0x0060452301000484
381/************************************************************************/
382
383SECTION SetTxLPMask1_init data_va=0x100000200
384attr_data {
385 Name = SetTxLPMask1_init,
386 hypervisor,
387 compressimage
388 }
389.data
390SetTxLPMask1_init:
391 .xword 0x0060452301000484
392/************************************************************************/
393
394SECTION SetTxLPValue1_init data_va=0x100000300
395attr_data {
396 Name = SetTxLPValue1_init,
397 hypervisor,
398 compressimage
399 }
400.data
401SetTxLPValue1_init:
402 .xword 0x0060452301000484
403/************************************************************************/
404
405SECTION SetTxLPRELOC1_init data_va=0x100000400
406attr_data {
407 Name = SetTxLPRELOC1_init,
408 hypervisor,
409 compressimage
410 }
411.data
412SetTxLPRELOC1_init:
413 .xword 0x0060452301000484
414/************************************************************************/
415SECTION SetTxLPMask2_init data_va=0x100000500
416attr_data {
417 Name = SetTxLPMask2_init,
418 hypervisor,
419 compressimage
420 }
421.data
422SetTxLPMask2_init:
423 .xword 0x0060452301000484
424/************************************************************************/
425SECTION SetTxLPValue2_init data_va=0x100000600
426attr_data {
427 Name = SetTxLPValue2_init,
428 hypervisor,
429 compressimage
430 }
431.data
432SetTxLPValue2_init:
433 .xword 0x0060452301000484
434
435/************************************************************************/
436SECTION SetTxLPRELOC2_init data_va=0x100000700
437attr_data {
438 Name = SetTxLPRELOC2_init,
439 hypervisor,
440 compressimage
441 }
442.data
443SetTxLPRELOC2_init:
444 .xword 0x0060452301000484
445
446/************************************************************************/
447SECTION SetTxLPValid_init data_va=0x100000800
448attr_data {
449 Name = SetTxLPValid_init,
450 hypervisor,
451 compressimage
452 }
453.data
454SetTxLPValid_init:
455 .xword 0x0060452301000484
456
457/************************************************************************/
458