| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: FcNiuBasicRx.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 | |
| 43 | /************************************************************************ |
| 44 | Test case code start |
| 45 | ************************************************************************/ |
| 46 | .text |
| 47 | .global main |
| 48 | |
| 49 | main: |
| 50 | ta T_CHANGE_HPRIV |
| 51 | nop |
| 52 | |
| 53 | #include "niu_init.h" |
| 54 | ! |
| 55 | ! Thread 0 Start |
| 56 | ! |
| 57 | ! |
| 58 | thread_0: |
| 59 | |
| 60 | /************************************************************************ |
| 61 | First call the Vera, so that values are updated in Memory and |
| 62 | then read those values from assembly and program the registers |
| 63 | ************************************************************************/ |
| 64 | P_NIU_RxInitDma: |
| 65 | 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) |
| 66 | |
| 67 | setx 0x5, %g1, %g4 ! Delay for Vera to complete |
| 68 | delay_loop_Rx: |
| 69 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 70 | nop |
| 71 | nop |
| 72 | nop |
| 73 | nop |
| 74 | dec %g4 |
| 75 | brnz %g4, delay_loop_Rx |
| 76 | nop |
| 77 | |
| 78 | nop |
| 79 | setx RXDMA_CHNL, %g1, %o0 |
| 80 | setx RX_DESC_RING_LENGTH, %g1, %o1 |
| 81 | setx RX_RING_START_ADDRESS, %g1, %o2 |
| 82 | setx RBR_CONFIG_B_DATA, %g1, %o3 |
| 83 | setx RX_INITIAL_KICK, %g1, %o4 |
| 84 | call NiuInitRxDma |
| 85 | nop |
| 86 | |
| 87 | P_NIU_RxPkt_Conf: |
| 88 | nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_RxPkt_Conf)) -> NIU_RxPktConf(RXMAC_PKTCNT_UE) |
| 89 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 ! Just for Delay |
| 90 | nop |
| 91 | |
| 92 | |
| 93 | P_NIU_Rx_GenPkt: |
| 94 | nop !$EV trig_pc_d(1, @VA(.MAIN.P_NIU_Rx_GenPkt)) -> NIU_RxGenPkt(MAC_ID, RXDMA_CHNL_UE, RXMAC_PKTCNT_UE, MAC_PKT_LEN_UE) |
| 95 | |
| 96 | setx loop_count, %g1, %g4 |
| 97 | delay_loop: |
| 98 | ldxa [%g2]ASI_PRIMARY_LITTLE, %g5 |
| 99 | nop |
| 100 | nop |
| 101 | nop |
| 102 | nop |
| 103 | dec %g4 |
| 104 | brnz %g4, delay_loop |
| 105 | nop |
| 106 | |
| 107 | |
| 108 | test_passed: |
| 109 | nop |
| 110 | EXIT_GOOD |
| 111 | |
| 112 | test_failed: |
| 113 | EXIT_BAD |
| 114 | |
| 115 | |
| 116 | /************************************************************************ |
| 117 | Test case data start |
| 118 | ************************************************************************/ |
| 119 | /* These initialization is temporary, as there looks some bug in mempli */ |
| 120 | |
| 121 | SECTION SetRngConfig_init data_va=0x100000000 |
| 122 | attr_data { |
| 123 | Name = SetRngConfig_init, |
| 124 | hypervisor, |
| 125 | compressimage |
| 126 | } |
| 127 | .data |
| 128 | SetRngConfig_init: |
| 129 | .xword 0x0060452301000484 |
| 130 | /************************************************************************/ |
| 131 | |
| 132 | SECTION SetRxLogMask1_init data_va=0x200000100 |
| 133 | attr_data { |
| 134 | Name = SetRxLogMask1_init, |
| 135 | hypervisor, |
| 136 | compressimage |
| 137 | } |
| 138 | .data |
| 139 | SetRxLogMask1_init: |
| 140 | .xword 0x0060452301000484 |
| 141 | /************************************************************************/ |
| 142 | |
| 143 | SECTION SetRxLogVal1_init data_va=0x200000200 |
| 144 | attr_data { |
| 145 | Name = SetRxLogVal1_init, |
| 146 | hypervisor, |
| 147 | compressimage |
| 148 | } |
| 149 | .data |
| 150 | SetRxLogVal1_init: |
| 151 | .xword 0x0060452301000484 |
| 152 | /************************************************************************/ |
| 153 | |
| 154 | SECTION SetRxLogRelo1_init data_va=0x200000300 |
| 155 | attr_data { |
| 156 | Name = SetRxLogRelo1_init, |
| 157 | hypervisor, |
| 158 | compressimage |
| 159 | } |
| 160 | .data |
| 161 | SetRxLogRelo1_init: |
| 162 | .xword 0x0060452301000484 |
| 163 | /************************************************************************/ |
| 164 | |
| 165 | SECTION SetRxLogPgVld_init data_va=0x200000400 |
| 166 | attr_data { |
| 167 | Name = SetRxLogPgVld_init, |
| 168 | hypervisor, |
| 169 | compressimage |
| 170 | } |
| 171 | .data |
| 172 | SetRxLogPgVld_init: |
| 173 | .xword 0x0060452301000484 |
| 174 | /************************************************************************/ |
| 175 | SECTION SetRbrConfig_A_init data_va=0x200000500 |
| 176 | attr_data { |
| 177 | Name = SetRbrConfig_A_init, |
| 178 | hypervisor, |
| 179 | compressimage |
| 180 | } |
| 181 | .data |
| 182 | SetRbrConfig_A_init: |
| 183 | .xword 0x0060452301000484 |
| 184 | /************************************************************************/ |
| 185 | SECTION SetRbrConfig_B_init data_va=0x200000600 |
| 186 | attr_data { |
| 187 | Name = SetRbrConfig_B_init, |
| 188 | hypervisor, |
| 189 | compressimage |
| 190 | } |
| 191 | .data |
| 192 | SetRbrConfig_B_init: |
| 193 | .xword 0x0060452301000484 |
| 194 | /************************************************************************/ |
| 195 | SECTION SetRcrConfig_A_init data_va=0x200000700 |
| 196 | attr_data { |
| 197 | Name = SetRcrConfig_A_init, |
| 198 | hypervisor, |
| 199 | compressimage |
| 200 | } |
| 201 | .data |
| 202 | SetRcrConfig_A_init: |
| 203 | .xword 0x0060452301000484 |
| 204 | /************************************************************************/ |
| 205 | SECTION SetRxDmaCfig_1_0_init data_va=0x200000800 |
| 206 | attr_data { |
| 207 | Name = SetRxDmaCfig_1_0_init, |
| 208 | hypervisor, |
| 209 | compressimage |
| 210 | } |
| 211 | .data |
| 212 | SetRxDmaCfig_1_0_init: |
| 213 | .xword 0x0060452301000484 |
| 214 | /************************************************************************/ |
| 215 | SECTION SetRxdmaCfig2Start_init data_va=0x200000900 |
| 216 | attr_data { |
| 217 | Name = SetRxdmaCfig2Start_init, |
| 218 | hypervisor, |
| 219 | compressimage |
| 220 | } |
| 221 | .data |
| 222 | SetRxdmaCfig2Start_init: |
| 223 | .xword 0x0060452301000484 |
| 224 | /************************************************************************/ |
| 225 | SECTION SetRxDmaCfig_1_1_init data_va=0x200000a00 |
| 226 | attr_data { |
| 227 | Name = SetRxDmaCfig_1_1_init, |
| 228 | hypervisor, |
| 229 | compressimage |
| 230 | } |
| 231 | .data |
| 232 | SetRxDmaCfig_1_1_init: |
| 233 | .xword 0x0060452301000484 |
| 234 | |
| 235 | /************************************************************************/ |
| 236 | |
| 237 | SECTION SetRxRingKick_init data_va=0x200000b00 |
| 238 | attr_data { |
| 239 | Name = SetRxRingKick_init, |
| 240 | hypervisor, |
| 241 | compressimage |
| 242 | } |
| 243 | .data |
| 244 | SetRxRingKick_init: |
| 245 | .xword 0x0060452301000484 |
| 246 | /************************************************************************/ |
| 247 | |
| 248 | SECTION SetRxLogMask2_init data_va=0x200000c00 |
| 249 | attr_data { |
| 250 | Name = SetRxLogMask2_init, |
| 251 | hypervisor, |
| 252 | compressimage |
| 253 | } |
| 254 | .data |
| 255 | SetRxLogMask2_init: |
| 256 | .xword 0x0060452301000484 |
| 257 | /************************************************************************/ |
| 258 | |
| 259 | SECTION SetRxLogVal2_init data_va=0x200000d00 |
| 260 | attr_data { |
| 261 | Name = SetRxLogVal2_init, |
| 262 | hypervisor, |
| 263 | compressimage |
| 264 | } |
| 265 | .data |
| 266 | SetRxLogVal2_init: |
| 267 | .xword 0x0060452301000484 |
| 268 | /************************************************************************/ |
| 269 | |
| 270 | SECTION SetRxLogRelo2_init data_va=0x200000e00 |
| 271 | attr_data { |
| 272 | Name = SetRxLogRelo2_init, |
| 273 | hypervisor, |
| 274 | compressimage |
| 275 | } |
| 276 | .data |
| 277 | SetRxLogRelo2_init: |
| 278 | .xword 0x0060452301000484 |
| 279 | |
| 280 | /************************************************************************/ |