Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / niu / NIU_Tx_Rx / txrxrand_1082076.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: txrxrand_1082076.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#define RCRSTAT_A_Addr mpeval(DMC_ADDRESS_RANGE+0x00050)
40#define RBR_STAT_Addr mpeval(DMC_ADDRESS_RANGE+0x00028)
41
42#include "hboot.s"
43#include "niu_defines.h"
44.text
45.global main
46main:
47 ta T_CHANGE_HPRIV
48 nop
49! branch to main by comparing thread id.
50
51 ta T_RD_THID
52 mov 0x1, %g2
53
54 setx 0x0000000000000001, %o0, %g3 ! thread-group bits for the template
55 cmp %g2, %o1
56 be _FcN1_main
57 nop
58
59 setx 0x0000000000000010, %o0, %g3 ! thread-group bits for the template
60 brz %o1, _FcN0_main
61 and %o1, %g3, %g1
62 nop
63
64!
65! Thread 0 Start
66!
67!
68_FcN0_main:
69
70Init_flow:
71 nop ! $EV trig_pc_d(1, @VA(.MAIN.Init_flow)) -> pktGenConfig(MAC_ID, FRAME_TYPE, FRAME_CLASS, c8)
72
73P_TxDMAActivate:
74 setx MAC_ID, %g1, %o0
75 setx 0x8000, %g1, %o1
76 call SetTxDMAActive
77 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_TxDMAActivate)) -> NIU_TxDMAActivate (MAC_ID, 8000)
78
79
80P_AddTxChannels:
81 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_AddTxChannels)) -> NIU_AddTxChannels(MAC_ID, f)
82 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
83 nop
84
85P_SetTxMaxBurst:
86 setx 0xf, %g1, %o0
87 setx SetTxMaxBurst_Data, %g1, %o1
88 call SetTxMaxBurst
89 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_SetTxMaxBurst)) -> NIU_SetTxMaxBurst (MAC_ID, f, TxMaxBurst_Data)
90 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
91 nop
92
93P_InitTxDma:
94 setx 0xf, %g1, %o0
95 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_InitTxDma)) -> NIU_InitTxDma (MAC_ID, f, NIU_Xlate_On)
96 call InitTxDma
97 nop
98 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
99 nop
100
101Gen_Packet:
102 nop ! $EV trig_pc_d(1, @VA(.MAIN.Gen_Packet)) -> TxPktGen(MAC_ID, f, 0x40)
103 nop
104
105 setx 0x5, %g1, %g4
106delay_loop_tmp:
107 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
108 nop
109 nop
110 nop
111 nop
112 dec %g4
113 brnz %g4, delay_loop_tmp
114 nop
115
116SetTxRingKick:
117 setx 0x100000100, %g1, %g2 ! $EV trig_pc_d(1, @VA(.MAIN.SetTxRingKick)) -> NIU_SetTxRingKick(MAC_ID, f)
118 setx 0xf, %g1, %o0
119 ldxa [%g2]ASI_PRIMARY_LITTLE, %g3
120 nop
121 mulx %o0, 0x200, %g5
122 setx TX_RING_KICK_Addr, %g1, %g2
123 add %g2, %g5, %g2
124 stxa %g3, [%g2]ASI_PRIMARY_LITTLE
125 nop
126
127SetTxCs:
128 setx 0xf, %g1, %o0
129 setx TX_CS_Data, %g1, %g3
130 mulx %o0, 0x200, %g5
131 setx TX_CS_Addr, %g1, %g2
132 add %g2, %g5, %g2
133 stxa %g3, [%g2]ASI_PRIMARY_LITTLE
134 nop
135
136#ifdef JUMBO_FRAME_EN
137 setx loop_count, %g1, %g4
138delay_loop:
139 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
140 nop
141 nop
142 nop
143 nop
144 dec %g4
145 brnz %g4, delay_loop
146 nop
147#endif
148
149
150NIUTx_Pkt_Cnt_Chk:
151 setx MAC_ID, %g1, %o0
152 setx 0x40, %g1, %o1
153 call NiuTx_check_pkt_cnt
154 nop
155
156 setx loop_count, %g1, %g4
157delay_loop_end:
158 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
159 nop
160 nop
161 nop
162 nop
163 dec %g4
164 brnz %g4, delay_loop_end
165 nop
166
167test_passed_tx:
168 nop ! $EV trig_pc_d(1, @VA(.MAIN.test_passed_tx)) -> NIU_EXIT_chk(MAC_ID)
169 EXIT_GOOD
170
171
172_FcN1_main:
173
174P_NIU_RxInitDma:
175 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxInitDma)) -> NIU_InitRxDma(1, RX_DESC_RING_LENGTH, RX_COMPL_RING_LEN, RBR_CONFIG_B_DATA, RX_INITIAL_KICK, NIU_Xlate_On)
176 setx NIU_PKTGEN_CSR_EV2A_RBR_KICK, %g7, %g2
177delay_loop_Rx:
178 ldx [%g2], %g5
179 cmp %g5, RX_INITIAL_KICK
180 bne delay_loop_Rx
181 nop
182
183 setx 0x1, %g1, %o0
184 setx RX_DESC_RING_LENGTH, %g1, %o1
185 setx RX_COMPL_RING_LEN, %g1, %o2
186 setx RBR_CONFIG_B_DATA, %g1, %o3
187 setx RX_INITIAL_KICK, %g1, %o4
188 call NiuInitRxDma
189 nop
190P_NIU_RxPkt_Conf:
191 nop ! $EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxPkt_Conf)) -> NIU_RxPktConf(RXMAC_PKTCNT)
192 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
193 nop
194 setx RXMAC_PKTCNT, %g1, %g6
195 mulx %o0, 0x200, %g5
196 setx RBR_STAT_Addr, %g7, %g2
197 add %g2, %g5, %g2
198P_NIU_Rx_GenPkt:
199 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
200 brz %g5, P_NIU_Rx_GenPkt
201 nop
202 cmp %g5, %o4
203 be P_NIU_Rx_GenPkt
204 nop
205Rx_pktcnt_loop:
206 nop ! $EV trig_pc_d(1, @VA(.MAIN.Rx_pktcnt_loop)) -> NIU_RxGenPkt(MAC_ID, 1, RXMAC_PKTCNT, 0x64, 0x0, RX_NIU_MULTI_DMA, 1)
207 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
208 nop
209
210 mulx %o0, 0x200, %g5
211 setx RCRSTAT_A_Addr, %g7, %g2
212 add %g2, %g5, %g2
213delay_loop:
214 ldxa [%g2]ASI_PRIMARY_LITTLE, %g5
215 cmp %g5, RXMAC_PKTCNT - RXMAC_PKTCNT%8
216 bne delay_loop
217 nop
218
219
220test_passed:
221 nop
222 EXIT_GOOD
223# 247 "diag.j.pp"
224
225#if 0
226#endif
227