Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / include / niu_pktgen.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: niu_pktgen.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*/
38SECTION .HTRAPS
39.text
40#ifdef ENABLE_NIU_BG_TX
41.global NIU_PktGenTx
42NIU_PktGenTx:
43 save
44
45NIU_PktGenTx_Initflow:
46! $EV trig_pc_d(1, @VA(.HTRAPS.NIU_PktGenTx_Initflow)) -> pktGenConfig(NIU_BG_TX_MAC_ID, FRAME_TYPE, FRAME_CLASS,NIU_BG_TX_PKT_LEN,0,0,1)
47 nop
48
49NIU_PktGenTx_Gen_Packet:
50! $EV trig_pc_d(1, @VA(.HTRAPS.NIU_PktGenTx_Gen_Packet)) -> TxPktGen(NIU_BG_TX_MAC_ID, NIU_BG_TX_DMA_NUM_HEX, NIU_BG_TX_PKT_COUNT, 0, 0, 0, 1)
51 /* Small delay loop to wait for packets to be written to DRAM */
52 best_set_reg(NIU_BG_TX_PKT_COUNT, %l7, %l0)
53NIU_PktGenTx_Gen_Packet_loop:
54 brnz %l0, NIU_PktGenTx_Gen_Packet_loop
55 dec %l0
56
57NIU_PktGenTx_SetTxRingKick:
58! $EV trig_pc_d(1, @VA(.HTRAPS.NIU_PktGenTx_SetTxRingKick)) -> NIU_SetTxRingKick(NIU_BG_TX_MAC_ID, NIU_BG_TX_DMA_NUM_HEX, 0, 0, 0, 1)
59 best_set_reg(NIU_PKTGEN_CSR_EV2A_TX_RNG_KICK, %l7, %l2)
60#ifdef FC_NO_PEU_VERA
61 ! PEP does not support 64-bit access, so use two 32-bit loads
62 lduw [%l2], %l3
63 lduw [%l2+4], %l7
64 sllx %l3, 32, %l3
65 add %l7, %l3, %l3
66#else // FC_NO_PEU_VERA
67 ldx [%l2], %l3
68#endif // FC_NO_PEU_VERA
69 best_set_reg(mpeval(TX_RING_KICK_Addr+(INTR0x60_NIU_TX_DMA_0*0x200)), %l7, %l2)
70 stxa %l3, [%l2]ASI_PRIMARY_LITTLE
71
72NIU_PktGenTx_SetTxCs:
73 best_set_reg(TX_CS_Data, %l7, %l3)
74 best_set_reg(mpeval(TX_CS_Addr+(INTR0x60_NIU_TX_DMA_0*0x200)), %l7, %l2)
75 stxa %l3, [%l2]ASI_PRIMARY_LITTLE
76 ret
77 restore
78#endif /* ENABLE_NIU_BG_TX */
79
80
81
82/***************************************************************************
83* NIU_PktRcv:
84* Kick off another set of RX packets
85***************************************************************************/
86
87NIU_PktRcv:
88 nop
89
90P_NIU_Rx_GenPkt:
91!$EV trig_pc_d(1, @VA(.HTRAPS.P_NIU_Rx_GenPkt)) -> NIU_RxGenPkt(MAC_ID, RXDMA_CHNL, RXMAC_PKTCNT, MAC_PKT_LEN, 0, 0, 1)
92
93 retl
94 nop