| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: tx_MULTI_PORT_DMA_rand_0101.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 | #define FAIR_PKT_CNT (NIU_TX_PKT_CNT / 2) |
| 43 | !#define FAIR_PKT_CNT ((NIU_TX_PKT_CNT) - (NIU_TX_PKT_CNT%8)) |
| 44 | |
| 45 | .text |
| 46 | .global main |
| 47 | |
| 48 | main: |
| 49 | ta T_CHANGE_HPRIV |
| 50 | nop |
| 51 | # 85 "diag.j.pp" |
| 52 | ! |
| 53 | ! Thread 0 Start |
| 54 | ! |
| 55 | ! |
| 56 | !thread_0: |
| 57 | |
| 58 | Init_flow: |
| 59 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Init_flow)) -> pktGenConfig(MAC_ID, FRAME_TYPE, FRAME_CLASS, 40, NIU_TX_MULTI_PORT, 90) |
| 60 | |
| 61 | P_TxDMAActivate: |
| 62 | setx MAC_ID, %g1, %o0 |
| 63 | setx 0x1, %g1, %o1 |
| 64 | setx NIU_TX_MULTI_PORT, %g1, %o2 |
| 65 | setx NIU_TX_MULTI_DMA_P0, %g1, %o3 |
| 66 | setx NIU_TX_MULTI_DMA_P1, %g1, %o4 |
| 67 | call SetTxDMAActive |
| 68 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_TxDMAActivate)) -> NIU_TxDMAActivate (MAC_ID, 1, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 69 | |
| 70 | |
| 71 | P_AddTxChannels: |
| 72 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_AddTxChannels)) -> NIU_AddTxChannels(MAC_ID, 0, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 73 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 74 | nop |
| 75 | |
| 76 | P_SetTxMaxBurst: |
| 77 | setx 0x0, %g1, %o0 |
| 78 | setx SetTxMaxBurst_Data, %g1, %o1 |
| 79 | setx NIU_TX_MULTI_PORT, %g1, %o2 |
| 80 | setx NIU_TX_MULTI_DMA_P0, %g1, %o3 |
| 81 | setx NIU_TX_MULTI_DMA_P1, %g1, %o4 |
| 82 | call SetTxMaxBurst |
| 83 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_SetTxMaxBurst)) -> NIU_SetTxMaxBurst (MAC_ID, 0, TxMaxBurst_Data, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 84 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 85 | nop |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | nop |
| 94 | setx NIU_TX_MULTI_PORT, %g1, %o2 |
| 95 | setx NIU_TX_MULTI_DMA_P0, %g1, %o3 |
| 96 | setx NIU_TX_MULTI_DMA_P1, %g1, %o4 |
| 97 | call InitTxDma |
| 98 | nop |
| 99 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 100 | nop |
| 101 | |
| 102 | Gen_Packet: |
| 103 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Gen_Packet)) -> TxPktGen(MAC_ID, 0, NIU_TX_PKT_CNT, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 104 | nop |
| 105 | |
| 106 | setx 0x5, %g1, %g4 |
| 107 | delay_loop_tmp: |
| 108 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 109 | nop |
| 110 | nop |
| 111 | nop |
| 112 | nop |
| 113 | dec %g4 |
| 114 | brnz %g4, delay_loop_tmp |
| 115 | nop |
| 116 | |
| 117 | SetTxRingKick_0: |
| 118 | setx NIU_PKTGEN_CSR_EV2A_TX_RNG_KICK, %g1, %g2 ! $EV trig_pc_d(1, @VA(.MAIN.SetTxRingKick_0)) -> NIU_SetTxRingKick(0, 0, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 119 | setx 0x0, %g1, %o0 |
| 120 | ! setx NIU_TX_MULTI_PORT, %g1, %o2 |
| 121 | ! setx NIU_TX_MULTI_DMA_P0, %g1, %o3 |
| 122 | ldx [%g2] , %g3 |
| 123 | nop |
| 124 | mulx %o0, 0x200, %g5 |
| 125 | setx TX_RING_KICK_Addr, %g1, %g2 |
| 126 | add %g2, %g5, %g2 |
| 127 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 128 | nop |
| 129 | |
| 130 | SetTxCs_0: |
| 131 | setx 0x0, %g1, %o0 |
| 132 | setx TX_CS_Data, %g1, %g3 |
| 133 | mulx %o0, 0x200, %g5 |
| 134 | setx TX_CS_Addr, %g1, %g2 |
| 135 | add %g2, %g5, %g2 |
| 136 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 137 | nop |
| 138 | |
| 139 | SetTxRingKick_1: |
| 140 | setx NIU_PKTGEN_CSR_EV2A_TX_RNG_KICK, %g1, %g2 ! $EV trig_pc_d(1, @VA(.MAIN.SetTxRingKick_1)) -> NIU_SetTxRingKick(1, 8, NIU_TX_MULTI_PORT, NIU_TX_MULTI_DMA_P0, NIU_TX_MULTI_DMA_P1) |
| 141 | setx 0x8, %g1, %o0 |
| 142 | ! setx NIU_TX_MULTI_PORT, %g1, %o2 |
| 143 | ! setx NIU_TX_MULTI_DMA_P1, %g1, %o4 |
| 144 | ldx [%g2] , %g3 |
| 145 | nop |
| 146 | mulx %o0, 0x200, %g5 |
| 147 | setx TX_RING_KICK_Addr, %g1, %g2 |
| 148 | add %g2, %g5, %g2 |
| 149 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 150 | nop |
| 151 | |
| 152 | SetTxCs_8: |
| 153 | setx 0x8, %g1, %o0 |
| 154 | setx TX_CS_Data, %g1, %g3 |
| 155 | mulx %o0, 0x200, %g5 |
| 156 | setx TX_CS_Addr, %g1, %g2 |
| 157 | add %g2, %g5, %g2 |
| 158 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 159 | nop |
| 160 | |
| 161 | #ifdef JUMBO_FRAME_EN |
| 162 | setx loop_count, %g1, %g4 |
| 163 | delay_loop: |
| 164 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 165 | nop |
| 166 | nop |
| 167 | nop |
| 168 | nop |
| 169 | dec %g4 |
| 170 | brnz %g4, delay_loop |
| 171 | nop |
| 172 | #endif |
| 173 | |
| 174 | |
| 175 | NIUTx_Pkt_Cnt_Chk_P0: |
| 176 | setx 0x0, %g1, %o0 ! MAC PORT |
| 177 | ! setx 0x8, %g1, %o1 ! PKT CNT |
| 178 | setx FAIR_PKT_CNT, %g1, %o1 ! PKT CNT |
| 179 | call NiuTx_check_pkt_cnt |
| 180 | nop |
| 181 | |
| 182 | setx loop_count, %g1, %g4 |
| 183 | delay_loop_end_p0: |
| 184 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 185 | nop |
| 186 | nop |
| 187 | nop |
| 188 | nop |
| 189 | dec %g4 |
| 190 | brnz %g4, delay_loop_end_p0 |
| 191 | nop |
| 192 | |
| 193 | NIUTx_Pkt_Cnt_Chk_P1: |
| 194 | setx 0x1, %g1, %o0 ! MAC PORT |
| 195 | ! setx 0x8, %g1, %o1 ! PKT CNT |
| 196 | setx FAIR_PKT_CNT, %g1, %o1 ! PKT CNT |
| 197 | call NiuTx_check_pkt_cnt |
| 198 | nop |
| 199 | |
| 200 | setx loop_count, %g1, %g4 |
| 201 | delay_loop_end_p1: |
| 202 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 203 | nop |
| 204 | nop |
| 205 | nop |
| 206 | nop |
| 207 | dec %g4 |
| 208 | brnz %g4, delay_loop_end_p1 |
| 209 | nop |
| 210 | |
| 211 | test_passed: |
| 212 | nop ! $EV trig_pc_d(1, @VA(.MAIN.test_passed)) -> NIU_EXIT_chk(0) |
| 213 | nop ! $EV trig_pc_d(1, @VA(.MAIN.test_passed)) -> NIU_EXIT_chk(1) |
| 214 | EXIT_GOOD |
| 215 | |
| 216 | |
| 217 | /************************************************************************ |
| 218 | Test case data start |
| 219 | ************************************************************************/ |
| 220 | SECTION SetRngConfig_init data_va=0x100000000 |
| 221 | attr_data { |
| 222 | Name = SetRngConfig_init, |
| 223 | hypervisor, |
| 224 | compressimage |
| 225 | } |
| 226 | .data |
| 227 | SetRngConfig_init: |
| 228 | .xword 0x0060452301000484 |
| 229 | |
| 230 | SECTION SetTxRingKick_init data_va=0x100000100 |
| 231 | attr_data { |
| 232 | Name = SetTxRingKick_init, |
| 233 | hypervisor, |
| 234 | compressimage |
| 235 | } |
| 236 | .data |
| 237 | SetTxRingKick_init: |
| 238 | .xword 0x0060452301000484 |
| 239 | |
| 240 | SECTION SetTxLPMask1_init data_va=0x100000200 |
| 241 | attr_data { |
| 242 | Name = SetTxLPMask1_init, |
| 243 | hypervisor, |
| 244 | compressimage |
| 245 | } |
| 246 | .data |
| 247 | SetTxLPMask1_init: |
| 248 | .xword 0x0060452301000484 |
| 249 | |
| 250 | SECTION SetTxLPValue1_init data_va=0x100000300 |
| 251 | attr_data { |
| 252 | Name = SetTxLPValue1_init, |
| 253 | hypervisor, |
| 254 | compressimage |
| 255 | } |
| 256 | .data |
| 257 | SetTxLPValue1_init: |
| 258 | .xword 0x0060452301000484 |
| 259 | |
| 260 | SECTION SetTxLPRELOC1_init data_va=0x100000400 |
| 261 | attr_data { |
| 262 | Name = SetTxLPRELOC1_init, |
| 263 | hypervisor, |
| 264 | compressimage |
| 265 | } |
| 266 | .data |
| 267 | SetTxLPRELOC1_init: |
| 268 | .xword 0x0060452301000484 |
| 269 | SECTION SetTxLPMask2_init data_va=0x100000500 |
| 270 | attr_data { |
| 271 | Name = SetTxLPMask2_init, |
| 272 | hypervisor, |
| 273 | compressimage |
| 274 | } |
| 275 | .data |
| 276 | SetTxLPMask2_init: |
| 277 | .xword 0x0060452301000484 |
| 278 | SECTION SetTxLPValue2_init data_va=0x100000600 |
| 279 | attr_data { |
| 280 | Name = SetTxLPValue2_init, |
| 281 | hypervisor, |
| 282 | compressimage |
| 283 | } |
| 284 | .data |
| 285 | SetTxLPValue2_init: |
| 286 | .xword 0x0060452301000484 |
| 287 | |
| 288 | SECTION SetTxLPRELOC2_init data_va=0x100000700 |
| 289 | attr_data { |
| 290 | Name = SetTxLPRELOC2_init, |
| 291 | hypervisor, |
| 292 | compressimage |
| 293 | } |
| 294 | .data |
| 295 | SetTxLPRELOC2_init: |
| 296 | .xword 0x0060452301000484 |
| 297 | |
| 298 | SECTION SetTxLPValid_init data_va=0x100000800 |
| 299 | attr_data { |
| 300 | Name = SetTxLPValid_init, |
| 301 | hypervisor, |
| 302 | compressimage |
| 303 | } |
| 304 | .data |
| 305 | SetTxLPValid_init: |
| 306 | .xword 0x0060452301000484 |
| 307 | # 315 "diag.j.pp" |
| 308 | |
| 309 | #if 0 |
| 310 | #endif |