| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: n2_err_siu_rx.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 | nop |
| 61 | |
| 62 | /****************************** |
| 63 | Error Injection |
| 64 | ******************************/ |
| 65 | clear_esr_first: |
| 66 | setx SOC_ESR_REG, %l7, %i0 |
| 67 | stx %g0, [%i0] |
| 68 | |
| 69 | set_ejr: |
| 70 | set 0x1, %i1 |
| 71 | sllx %i1, ERR_FIELD, %i2 |
| 72 | setx SOC_EJR_REG, %l7, %i3 |
| 73 | stx %i2, [%i3] |
| 74 | membar 0x40 |
| 75 | /********************************/ |
| 76 | |
| 77 | /************************************************************************ |
| 78 | First call the Vera, so that values are updated in Memory and |
| 79 | then read those values from assembly and program the registers |
| 80 | ************************************************************************/ |
| 81 | P_NIU_RxInitDma: |
| 82 | nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxInitDma)) -> NIU_InitRxDma(RXDMA_CHNL_UE, RX_DESC_RING_LENGTH_UE, RX_RING_START_ADDRESS_UE, RBR_CONFIG_B_DATA_UE, RX_INITIAL_KICK_UE) |
| 83 | |
| 84 | setx 0x5, %g1, %g4 ! Delay for Vera to complete |
| 85 | delay_loop_Rx: |
| 86 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 87 | nop |
| 88 | nop |
| 89 | nop |
| 90 | nop |
| 91 | dec %g4 |
| 92 | brnz %g4, delay_loop_Rx |
| 93 | nop |
| 94 | |
| 95 | nop |
| 96 | setx RXDMA_CHNL, %g1, %o0 |
| 97 | setx RX_DESC_RING_LENGTH, %g1, %o1 |
| 98 | setx RX_RING_START_ADDRESS, %g1, %o2 |
| 99 | setx RBR_CONFIG_B_DATA, %g1, %o3 |
| 100 | setx RX_INITIAL_KICK, %g1, %o4 |
| 101 | call NiuInitRxDma |
| 102 | nop |
| 103 | |
| 104 | P_NIU_RxPkt_Conf: |
| 105 | nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxPkt_Conf)) -> NIU_RxPktConf(RXMAC_PKTCNT_UE) |
| 106 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for Delay |
| 107 | nop |
| 108 | |
| 109 | |
| 110 | P_NIU_Rx_GenPkt: |
| 111 | setx RXMAC_PKTCNT, %g1, %g6 ! Packet count |
| 112 | nop |
| 113 | Rx_pktcnt_loop: |
| 114 | nop !$EV trig_pc_d(1, @VA(.MAIN.Rx_pktcnt_loop)) -> NIU_RxGenPkt(MAC_ID, RXDMA_CHNL_UE, 1, MAC_PKT_LEN_UE, 1) |
| 115 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! just for delay |
| 116 | nop |
| 117 | dec %g6 |
| 118 | brnz %g6, Rx_pktcnt_loop |
| 119 | nop |
| 120 | |
| 121 | setx 0x40, %g1, %g4 |
| 122 | delay_loop: |
| 123 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 124 | nop |
| 125 | nop |
| 126 | nop |
| 127 | nop |
| 128 | dec %g4 |
| 129 | brnz %g4, delay_loop |
| 130 | nop |
| 131 | |
| 132 | /****************************** |
| 133 | Error Check |
| 134 | ******************************/ |
| 135 | read_esr: |
| 136 | setx SOC_ESR_REG, %l7, %i0 |
| 137 | ldx [%i0], %i1 |
| 138 | nop |
| 139 | |
| 140 | setx 0x8000000000000000, %l7, %o3 !valid bit |
| 141 | set 0x1, %i2 |
| 142 | sllx %i2, ERR_FIELD, %i3 |
| 143 | or %i3, %o3, %i4 |
| 144 | sub %i1, %i4, %i5 |
| 145 | brnz %i5, test_failed |
| 146 | nop |
| 147 | /********************************/ |
| 148 | |
| 149 | |
| 150 | test_passed: |
| 151 | nop |
| 152 | EXIT_GOOD |
| 153 | |
| 154 | test_failed: |
| 155 | EXIT_BAD |
| 156 | |
| 157 | |
| 158 | /************************************************************************ |
| 159 | Test case data start |
| 160 | ************************************************************************/ |
| 161 | /* These initialization is temporary, as there looks some bug in mempli */ |
| 162 | |
| 163 | SECTION SetRngConfig_init data_va=0x100000000 |
| 164 | attr_data { |
| 165 | Name = SetRngConfig_init, |
| 166 | hypervisor, |
| 167 | compressimage |
| 168 | } |
| 169 | .data |
| 170 | SetRngConfig_init: |
| 171 | .xword 0x0060452301000484 |
| 172 | /************************************************************************/ |
| 173 | |
| 174 | SECTION SetRxLogMask1_init data_va=0x200000100 |
| 175 | attr_data { |
| 176 | Name = SetRxLogMask1_init, |
| 177 | hypervisor, |
| 178 | compressimage |
| 179 | } |
| 180 | .data |
| 181 | SetRxLogMask1_init: |
| 182 | .xword 0x0060452301000484 |
| 183 | /************************************************************************/ |
| 184 | |
| 185 | SECTION SetRxLogVal1_init data_va=0x200000200 |
| 186 | attr_data { |
| 187 | Name = SetRxLogVal1_init, |
| 188 | hypervisor, |
| 189 | compressimage |
| 190 | } |
| 191 | .data |
| 192 | SetRxLogVal1_init: |
| 193 | .xword 0x0060452301000484 |
| 194 | /************************************************************************/ |
| 195 | |
| 196 | SECTION SetRxLogRelo1_init data_va=0x200000300 |
| 197 | attr_data { |
| 198 | Name = SetRxLogRelo1_init, |
| 199 | hypervisor, |
| 200 | compressimage |
| 201 | } |
| 202 | .data |
| 203 | SetRxLogRelo1_init: |
| 204 | .xword 0x0060452301000484 |
| 205 | /************************************************************************/ |
| 206 | |
| 207 | SECTION SetRxLogPgVld_init data_va=0x200000400 |
| 208 | attr_data { |
| 209 | Name = SetRxLogPgVld_init, |
| 210 | hypervisor, |
| 211 | compressimage |
| 212 | } |
| 213 | .data |
| 214 | SetRxLogPgVld_init: |
| 215 | .xword 0x0060452301000484 |
| 216 | /************************************************************************/ |
| 217 | SECTION SetRbrConfig_A_init data_va=0x200000500 |
| 218 | attr_data { |
| 219 | Name = SetRbrConfig_A_init, |
| 220 | hypervisor, |
| 221 | compressimage |
| 222 | } |
| 223 | .data |
| 224 | SetRbrConfig_A_init: |
| 225 | .xword 0x0060452301000484 |
| 226 | /************************************************************************/ |
| 227 | SECTION SetRbrConfig_B_init data_va=0x200000600 |
| 228 | attr_data { |
| 229 | Name = SetRbrConfig_B_init, |
| 230 | hypervisor, |
| 231 | compressimage |
| 232 | } |
| 233 | .data |
| 234 | SetRbrConfig_B_init: |
| 235 | .xword 0x0060452301000484 |
| 236 | /************************************************************************/ |
| 237 | SECTION SetRcrConfig_A_init data_va=0x200000700 |
| 238 | attr_data { |
| 239 | Name = SetRcrConfig_A_init, |
| 240 | hypervisor, |
| 241 | compressimage |
| 242 | } |
| 243 | .data |
| 244 | SetRcrConfig_A_init: |
| 245 | .xword 0x0060452301000484 |
| 246 | /************************************************************************/ |
| 247 | SECTION SetRxDmaCfig_1_0_init data_va=0x200000800 |
| 248 | attr_data { |
| 249 | Name = SetRxDmaCfig_1_0_init, |
| 250 | hypervisor, |
| 251 | compressimage |
| 252 | } |
| 253 | .data |
| 254 | SetRxDmaCfig_1_0_init: |
| 255 | .xword 0x0060452301000484 |
| 256 | /************************************************************************/ |
| 257 | SECTION SetRxdmaCfig2Start_init data_va=0x200000900 |
| 258 | attr_data { |
| 259 | Name = SetRxdmaCfig2Start_init, |
| 260 | hypervisor, |
| 261 | compressimage |
| 262 | } |
| 263 | .data |
| 264 | SetRxdmaCfig2Start_init: |
| 265 | .xword 0x0060452301000484 |
| 266 | /************************************************************************/ |
| 267 | SECTION SetRxDmaCfig_1_1_init data_va=0x200000a00 |
| 268 | attr_data { |
| 269 | Name = SetRxDmaCfig_1_1_init, |
| 270 | hypervisor, |
| 271 | compressimage |
| 272 | } |
| 273 | .data |
| 274 | SetRxDmaCfig_1_1_init: |
| 275 | .xword 0x0060452301000484 |
| 276 | |
| 277 | /************************************************************************/ |
| 278 | |
| 279 | SECTION SetRxRingKick_init data_va=0x200000b00 |
| 280 | attr_data { |
| 281 | Name = SetRxRingKick_init, |
| 282 | hypervisor, |
| 283 | compressimage |
| 284 | } |
| 285 | .data |
| 286 | SetRxRingKick_init: |
| 287 | .xword 0x0060452301000484 |
| 288 | /************************************************************************/ |
| 289 | |
| 290 | SECTION SetRxLogMask2_init data_va=0x200000c00 |
| 291 | attr_data { |
| 292 | Name = SetRxLogMask2_init, |
| 293 | hypervisor, |
| 294 | compressimage |
| 295 | } |
| 296 | .data |
| 297 | SetRxLogMask2_init: |
| 298 | .xword 0x0060452301000484 |
| 299 | /************************************************************************/ |
| 300 | |
| 301 | SECTION SetRxLogVal2_init data_va=0x200000d00 |
| 302 | attr_data { |
| 303 | Name = SetRxLogVal2_init, |
| 304 | hypervisor, |
| 305 | compressimage |
| 306 | } |
| 307 | .data |
| 308 | SetRxLogVal2_init: |
| 309 | .xword 0x0060452301000484 |
| 310 | /************************************************************************/ |
| 311 | |
| 312 | SECTION SetRxLogRelo2_init data_va=0x200000e00 |
| 313 | attr_data { |
| 314 | Name = SetRxLogRelo2_init, |
| 315 | hypervisor, |
| 316 | compressimage |
| 317 | } |
| 318 | .data |
| 319 | SetRxLogRelo2_init: |
| 320 | .xword 0x0060452301000484 |
| 321 | |
| 322 | /************************************************************************/ |