| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: n2_err_siu.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 "err_defines.h" |
| 41 | #include "hboot.s" |
| 42 | #include "niu_defines.h" |
| 43 | |
| 44 | /************************************************************************ |
| 45 | Test case code start |
| 46 | ************************************************************************/ |
| 47 | .text |
| 48 | .global main |
| 49 | |
| 50 | main: |
| 51 | ta T_CHANGE_HPRIV |
| 52 | nop |
| 53 | |
| 54 | #include "niu_init.h" |
| 55 | ! |
| 56 | ! Thread 0 Start |
| 57 | ! |
| 58 | ! |
| 59 | thread_0: |
| 60 | |
| 61 | Init_flow: |
| 62 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Init_flow)) -> pktGenConfig(MAC_ID) |
| 63 | |
| 64 | P_TxDMAActivate: |
| 65 | setx MAC_ID, %g1, %o0 ! 1st Parameter |
| 66 | setx SetTxDMAActive_list, %g1, %o1 ! 2st parameter |
| 67 | call SetTxDMAActive |
| 68 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_TxDMAActivate)) -> NIU_TxDMAActivate (MAC_ID, TxDmaActive_list) |
| 69 | |
| 70 | P_AddTxChannels : |
| 71 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_AddTxChannels)) -> NIU_AddTxChannels(MAC_ID, NIU_TxDmaNoUE) |
| 72 | |
| 73 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for delay |
| 74 | nop |
| 75 | |
| 76 | P_SetTxMaxBurst : |
| 77 | setx NIU_TxDmaNo, %g1, %o0 ! 1st parameter : |
| 78 | setx SetTxMaxBurst_Data, %g1, %o1 ! 2nd parameter |
| 79 | call SetTxMaxBurst |
| 80 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_SetTxMaxBurst)) -> NIU_SetTxMaxBurst (MAC_ID, NIU_TxDmaNoUE, TxMaxBurst_Data) |
| 81 | |
| 82 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for delay |
| 83 | nop |
| 84 | |
| 85 | P_InitTxDma: |
| 86 | setx NIU_TxDmaNo, %g1, %o0 ! 1st parameter : |
| 87 | nop ! $EV trig_pc_d(1, @VA(.MAIN.P_InitTxDma)) -> NIU_InitTxDma (MAC_ID, NIU_TxDmaNoUE) |
| 88 | call InitTxDma |
| 89 | nop |
| 90 | |
| 91 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for delay |
| 92 | nop |
| 93 | |
| 94 | |
| 95 | clear_esr_first: |
| 96 | setx SOC_ESR_REG, %l7, %i0 |
| 97 | stx %g0, [%i0] |
| 98 | |
| 99 | set_ejr: |
| 100 | set 0x1, %i1 |
| 101 | sllx %i1, ERR_FIELD, %i2 |
| 102 | setx SOC_EJR_REG, %l7, %i3 |
| 103 | stx %i2, [%i3] |
| 104 | membar 0x40 |
| 105 | |
| 106 | Gen_Packet: |
| 107 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Gen_Packet)) -> TxPktGen(MAC_ID, NIU_TxDmaNoUE,NiuTxPktCountUE) |
| 108 | nop |
| 109 | |
| 110 | setx 0x5, %g1, %g4 |
| 111 | delay_loop_tmp: |
| 112 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 113 | nop |
| 114 | nop |
| 115 | nop |
| 116 | nop |
| 117 | dec %g4 |
| 118 | brnz %g4, delay_loop_tmp |
| 119 | nop |
| 120 | |
| 121 | |
| 122 | SetTxRingKick: |
| 123 | setx 0x100000100, %g1, %g2 ! $EV trig_pc_d(1, @VA(.MAIN.SetTxRingKick)) -> NIU_SetTxRingKick(MAC_ID, NIU_TxDmaNoUE) |
| 124 | setx NIU_TxDmaNo, %g1, %o0 |
| 125 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g3 |
| 126 | nop |
| 127 | mulx %o0, 0x200, %g5 |
| 128 | setx TX_RING_KICK_Addr, %g1, %g2 |
| 129 | add %g2, %g5, %g2 |
| 130 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 131 | nop |
| 132 | |
| 133 | SetTxCs : |
| 134 | setx NIU_TxDmaNo, %g1, %o0 |
| 135 | setx TX_CS_Data, %g1, %g3 |
| 136 | mulx %o0, 0x200, %g5 |
| 137 | setx TX_CS_Addr, %g1, %g2 |
| 138 | add %g2, %g5, %g2 |
| 139 | stxa %g3, [%g2]ASI_PRIMARY_LITTLE |
| 140 | nop |
| 141 | |
| 142 | |
| 143 | setx loop_count, %g1, %g4 |
| 144 | delay_loop: |
| 145 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 146 | nop |
| 147 | nop |
| 148 | nop |
| 149 | nop |
| 150 | dec %g4 |
| 151 | brnz %g4, delay_loop |
| 152 | nop |
| 153 | |
| 154 | read_esr: |
| 155 | setx SOC_ESR_REG, %l7, %i0 |
| 156 | ldx [%i0], %i1 |
| 157 | nop |
| 158 | |
| 159 | setx 0x8000000000000000, %l7, %o3 !valid bit |
| 160 | set 0x1, %i2 |
| 161 | sllx %i2, ERR_FIELD, %i3 |
| 162 | or %i3, %o3, %i4 |
| 163 | sub %i1, %i4, %i5 |
| 164 | brnz %i5, test_failed |
| 165 | nop |
| 166 | |
| 167 | |
| 168 | test_passed: |
| 169 | nop |
| 170 | EXIT_GOOD |
| 171 | |
| 172 | test_failed: |
| 173 | EXIT_BAD |
| 174 | |
| 175 | |
| 176 | /************************************************************************ |
| 177 | Test case data start |
| 178 | ************************************************************************/ |
| 179 | /* These initialization is temporary, as there looks some bug in mempli */ |
| 180 | |
| 181 | SECTION SetRngConfig_init data_va=0x100000000 |
| 182 | attr_data { |
| 183 | Name = SetRngConfig_init, |
| 184 | hypervisor, |
| 185 | compressimage |
| 186 | } |
| 187 | .data |
| 188 | SetRngConfig_init: |
| 189 | .xword 0x0060452301000484 |
| 190 | /************************************************************************/ |
| 191 | |
| 192 | SECTION SetTxRingKick_init data_va=0x100000100 |
| 193 | attr_data { |
| 194 | Name = SetTxRingKick_init, |
| 195 | hypervisor, |
| 196 | compressimage |
| 197 | } |
| 198 | .data |
| 199 | SetTxRingKick_init: |
| 200 | .xword 0x0060452301000484 |
| 201 | /************************************************************************/ |
| 202 | |
| 203 | SECTION SetTxLPMask1_init data_va=0x100000200 |
| 204 | attr_data { |
| 205 | Name = SetTxLPMask1_init, |
| 206 | hypervisor, |
| 207 | compressimage |
| 208 | } |
| 209 | .data |
| 210 | SetTxLPMask1_init: |
| 211 | .xword 0x0060452301000484 |
| 212 | /************************************************************************/ |
| 213 | |
| 214 | SECTION SetTxLPValue1_init data_va=0x100000300 |
| 215 | attr_data { |
| 216 | Name = SetTxLPValue1_init, |
| 217 | hypervisor, |
| 218 | compressimage |
| 219 | } |
| 220 | .data |
| 221 | SetTxLPValue1_init: |
| 222 | .xword 0x0060452301000484 |
| 223 | /************************************************************************/ |
| 224 | |
| 225 | SECTION SetTxLPRELOC1_init data_va=0x100000400 |
| 226 | attr_data { |
| 227 | Name = SetTxLPRELOC1_init, |
| 228 | hypervisor, |
| 229 | compressimage |
| 230 | } |
| 231 | .data |
| 232 | SetTxLPRELOC1_init: |
| 233 | .xword 0x0060452301000484 |
| 234 | /************************************************************************/ |
| 235 | SECTION SetTxLPMask2_init data_va=0x100000500 |
| 236 | attr_data { |
| 237 | Name = SetTxLPMask2_init, |
| 238 | hypervisor, |
| 239 | compressimage |
| 240 | } |
| 241 | .data |
| 242 | SetTxLPMask2_init: |
| 243 | .xword 0x0060452301000484 |
| 244 | /************************************************************************/ |
| 245 | SECTION SetTxLPValue2_init data_va=0x100000600 |
| 246 | attr_data { |
| 247 | Name = SetTxLPValue2_init, |
| 248 | hypervisor, |
| 249 | compressimage |
| 250 | } |
| 251 | .data |
| 252 | SetTxLPValue2_init: |
| 253 | .xword 0x0060452301000484 |
| 254 | |
| 255 | /************************************************************************/ |
| 256 | SECTION SetTxLPRELOC2_init data_va=0x100000700 |
| 257 | attr_data { |
| 258 | Name = SetTxLPRELOC2_init, |
| 259 | hypervisor, |
| 260 | compressimage |
| 261 | } |
| 262 | .data |
| 263 | SetTxLPRELOC2_init: |
| 264 | .xword 0x0060452301000484 |
| 265 | |
| 266 | /************************************************************************/ |
| 267 | SECTION SetTxLPValid_init data_va=0x100000800 |
| 268 | attr_data { |
| 269 | Name = SetTxLPValid_init, |
| 270 | hypervisor, |
| 271 | compressimage |
| 272 | } |
| 273 | .data |
| 274 | SetTxLPValid_init: |
| 275 | .xword 0x0060452301000484 |
| 276 | |
| 277 | /************************************************************************/ |
| 278 | |