| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: n2_err_siu_rx_trap.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 H_HT0_Hw_Corrected_Error_0x63 My_Corrected_ECC_error_trap |
| 39 | #define H_HT0_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap |
| 40 | |
| 41 | #define MAIN_PAGE_HV_ALSO |
| 42 | |
| 43 | #include "err_defines.h" |
| 44 | #include "hboot.s" |
| 45 | #include "niu_defines.h" |
| 46 | |
| 47 | /************************************************************************ |
| 48 | Test case code start |
| 49 | ************************************************************************/ |
| 50 | .text |
| 51 | .global main |
| 52 | .global My_Corrected_ECC_error_trap |
| 53 | .global My_Recoverable_Sw_error_trap |
| 54 | |
| 55 | main: |
| 56 | ta T_CHANGE_HPRIV |
| 57 | nop |
| 58 | |
| 59 | #include "niu_init_rx.h" ! Temporary added this initialization. Need to merg with niu_init.h |
| 60 | !#include "niu_init.h" |
| 61 | ! |
| 62 | ! Thread 0 Start |
| 63 | ! |
| 64 | ! |
| 65 | thread_0: |
| 66 | |
| 67 | Init_flow: |
| 68 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Init_flow)) -> RxGenConfig() |
| 69 | nop |
| 70 | |
| 71 | rx_begin: |
| 72 | nop ! $EV trig_pc_d(1, @VA(.MAIN.rx_begin)) -> printf("Configuration for Rx port",*,1) |
| 73 | |
| 74 | clear_esr_first: |
| 75 | setx SOC_ESR_REG, %l7, %i0 |
| 76 | stx %g0, [%i0] |
| 77 | |
| 78 | set_ejr: |
| 79 | set 0x1, %i1 |
| 80 | sllx %i1, ERR_FIELD, %i2 |
| 81 | setx SOC_EJR_REG, %l7, %i3 |
| 82 | stx %i2, [%i3] |
| 83 | membar 0x40 |
| 84 | |
| 85 | eie_reg_ones: |
| 86 | setx SOC_EIE_REG, %l7, %g5 |
| 87 | stx %i2, [%g5] |
| 88 | membar 0x40 |
| 89 | |
| 90 | Gen_Packet: |
| 91 | nop ! $EV trig_pc_d(1, @VA(.MAIN.Gen_Packet)) -> Rxpktgen(0,10) |
| 92 | |
| 93 | setx TX_CS, %g1, %g2 |
| 94 | nop |
| 95 | setx Rx_loop_count, %g1, %g4 |
| 96 | delay_loop: |
| 97 | ldx [%g2], %g5 |
| 98 | nop |
| 99 | nop |
| 100 | nop |
| 101 | nop |
| 102 | dec %g4 |
| 103 | brnz %g4, delay_loop |
| 104 | nop |
| 105 | |
| 106 | |
| 107 | ! ESR is cleared in INT |
| 108 | check_esr: |
| 109 | setx SOC_ESR_REG, %l7, %i0 |
| 110 | ldx [%i0], %i1 |
| 111 | sub %i1, %g0, %i5 |
| 112 | ! brnz %i5, test_failed |
| 113 | nop |
| 114 | |
| 115 | check_per: |
| 116 | setx SOC_PER_REG, %l7, %i0 |
| 117 | ldx [%i0], %i1 |
| 118 | nop |
| 119 | |
| 120 | setx 0x8000000000000000, %l7, %o3 !valid bit |
| 121 | set 0x1, %i2 |
| 122 | sllx %i2, ERR_FIELD, %i3 |
| 123 | or %i3, %o3, %i4 |
| 124 | sub %i1, %i4, %i5 |
| 125 | brnz %i5, test_failed |
| 126 | nop |
| 127 | |
| 128 | |
| 129 | ! Check if a Corrected ECC Trap happened |
| 130 | check_error_trap: |
| 131 | setx EXECUTED, %l1, %l0 |
| 132 | cmp %o6, %l0 |
| 133 | bne test_failed |
| 134 | nop |
| 135 | mov TT, %l0 |
| 136 | cmp %o7, %l0 |
| 137 | bne test_failed |
| 138 | nop |
| 139 | |
| 140 | test_passed: |
| 141 | EXIT_GOOD |
| 142 | nop |
| 143 | |
| 144 | test_failed: |
| 145 | EXIT_BAD |
| 146 | nop |
| 147 | |
| 148 | |
| 149 | /************************************************************************ |
| 150 | Trap Handlers |
| 151 | ************************************************************************/ |
| 152 | My_Recoverable_Sw_error_trap: |
| 153 | ! Signal trap taken |
| 154 | setx EXECUTED, %l0, %o6 |
| 155 | ! save trap type value |
| 156 | rdpr %tt, %o7 |
| 157 | retry |
| 158 | nop |
| 159 | |
| 160 | My_Corrected_ECC_error_trap: |
| 161 | ! Signal trap taken |
| 162 | setx EXECUTED, %l0, %o6 |
| 163 | ! save trap type value |
| 164 | rdpr %tt, %o7 |
| 165 | retry |
| 166 | nop |
| 167 | |
| 168 | |
| 169 | /************************************************************************ |
| 170 | Test case data start |
| 171 | ************************************************************************/ |
| 172 | SECTION descriptor data_va=0x100000200 |
| 173 | attr_data { |
| 174 | Name = descriptor, |
| 175 | hypervisor, |
| 176 | compressimage |
| 177 | } |
| 178 | .data |
| 179 | descriptor: |
| 180 | .xword 0x00008967452301 |
| 181 | .xword 0x08008967452301 |
| 182 | .xword 0x10008967452301 |
| 183 | .xword 0x18008967452301 |
| 184 | .xword 0x20008967452301 |
| 185 | .xword 0x28008967452301 |
| 186 | .xword 0x30008967452301 |
| 187 | .xword 0x38008967452301 |
| 188 | .xword 0x40008967452301 |
| 189 | .xword 0x48008967452301 |
| 190 | .xword 0x50008967452301 |
| 191 | .xword 0x58008967452301 |
| 192 | .xword 0x60008967452301 |
| 193 | .xword 0x68008967452301 |
| 194 | .xword 0x70008967452301 |
| 195 | .xword 0x78008967452301 |
| 196 | .xword 0x80008967452301 |
| 197 | .xword 0x88008967452301 |
| 198 | .xword 0x90008967452301 |
| 199 | .xword 0x98008967452301 |
| 200 | |
| 201 | /************************************************************************/ |