| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: n2_err_NcuCtagUe.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 ENABLE_PCIE_LINK_TRAINING |
| 39 | #define MAIN_PAGE_HV_ALSO |
| 40 | |
| 41 | #include "err_defines.h" |
| 42 | #include "hboot.s" |
| 43 | #include "peu_defines.h" |
| 44 | |
| 45 | |
| 46 | #define IO_RD_ADDR mpeval((N2_PCIE_BASE_ADDR + (IOCFG_OFFSET_BASE_REG_DATA & 0x7fffffffffffffff)) | IO_ACCESS_PA) |
| 47 | |
| 48 | #define MEM_LOC1 0x42400000 |
| 49 | |
| 50 | /************************************************************************ |
| 51 | Test case code start |
| 52 | ************************************************************************/ |
| 53 | .text |
| 54 | .global main |
| 55 | |
| 56 | main: |
| 57 | ta T_CHANGE_HPRIV |
| 58 | nop |
| 59 | |
| 60 | |
| 61 | get_th_id_o0: |
| 62 | ta T_RD_THID |
| 63 | |
| 64 | cmp %o1, 0x0 |
| 65 | be main_t0 |
| 66 | nop |
| 67 | |
| 68 | cmp %o1, 0x1 |
| 69 | be main_t1 |
| 70 | nop |
| 71 | |
| 72 | |
| 73 | /************************************** |
| 74 | THREAD 0 |
| 75 | **************************************/ |
| 76 | main_t0: |
| 77 | nop |
| 78 | setx MEM_LOC1, %g1, %g3 |
| 79 | st %g0, [%g3] |
| 80 | |
| 81 | set_eie: |
| 82 | setx SOC_EIE_REG, %l7, %i3 |
| 83 | |
| 84 | setx 0x7ffffffffff,%l1,%i2 |
| 85 | stx %i2, [%i3] |
| 86 | membar #Sync |
| 87 | |
| 88 | |
| 89 | L2_err_enable: |
| 90 | set 0x3, %l1 |
| 91 | mov 0xaa, %g2 |
| 92 | sllx %g2, 32, %g2 |
| 93 | stx %l1, [%g2] |
| 94 | stx %l1, [%g2 + 0x40] |
| 95 | stx %l1, [%g2 + 0x80] |
| 96 | stx %l1, [%g2 + 0xc0] |
| 97 | stx %l1, [%g2 + 0x100] |
| 98 | stx %l1, [%g2 + 0x140] |
| 99 | stx %l1, [%g2 + 0x180] |
| 100 | stx %l1, [%g2 + 0x1c0] |
| 101 | |
| 102 | clear_esr_first: |
| 103 | setx SOC_ESR_REG, %l7, %i0 |
| 104 | stx %g0, [%i0] |
| 105 | |
| 106 | |
| 107 | |
| 108 | set_ejr: |
| 109 | set 0x1, %i1 |
| 110 | sllx %i1, ERR_FIELD, %i2 |
| 111 | setx SOC_EJR_REG, %l7, %i3 |
| 112 | stx %i2, [%i3] |
| 113 | |
| 114 | pio_addr: |
| 115 | ! select an IO address in PCI address range and transmit the command to NCU |
| 116 | setx IO_RD_ADDR, %g1, %g2 |
| 117 | |
| 118 | st_mem1: |
| 119 | set 0x1, %g4 |
| 120 | st %g4, [%g3] |
| 121 | |
| 122 | pio: |
| 123 | ! load byte - all byte offsets within an octlet |
| 124 | ldub [%g2 + 1*8 + 0], %l0 |
| 125 | nop ! ld hangs and not completes |
| 126 | |
| 127 | ba test_failed |
| 128 | nop |
| 129 | |
| 130 | |
| 131 | |
| 132 | /************************************** |
| 133 | THREAD 1 |
| 134 | **************************************/ |
| 135 | main_t1: |
| 136 | nop |
| 137 | |
| 138 | read_mem_loc: |
| 139 | setx MEM_LOC1, %l7, %i3 |
| 140 | ldx [%i3], %o0 |
| 141 | cmp %o0, %g0 |
| 142 | be %xcc, read_mem_loc |
| 143 | nop |
| 144 | |
| 145 | delay: |
| 146 | ld [%i3+0x8], %o0 |
| 147 | ld [%i3+0x10], %o0 |
| 148 | ld [%i3+0x18], %o0 |
| 149 | ld [%i3+0x20], %o0 |
| 150 | ld [%i3+0x28], %o0 |
| 151 | ld [%i3+0x30], %o0 |
| 152 | ld [%i3+0x40], %o0 |
| 153 | |
| 154 | set 0x20,%g1 |
| 155 | read_esr: |
| 156 | cmp %g1,%g0 |
| 157 | be test_failed |
| 158 | nop |
| 159 | dec %g1 |
| 160 | nop |
| 161 | setx SOC_ESR_REG, %l7, %i0 |
| 162 | ldx [%i0], %i1 |
| 163 | nop |
| 164 | setx SOC_PER_REG, %l7, %g2 |
| 165 | ldx [%g2], %g3 |
| 166 | nop |
| 167 | |
| 168 | |
| 169 | setx 0x8000000000000000, %l7, %o3 !valid bit |
| 170 | set 0x1, %i2 |
| 171 | sllx %i2, ERR_FIELD, %i3 |
| 172 | or %i3, %o3, %i4 |
| 173 | sub %i1, %i4, %i5 |
| 174 | cmp %i4, %g3 |
| 175 | be check_ncu_synd_reg |
| 176 | nop |
| 177 | brnz %i5, read_esr |
| 178 | nop |
| 179 | |
| 180 | check_ncu_synd_reg: |
| 181 | setx SOC_NCU_SYN_REG,%l1,%l2 |
| 182 | ldx [%l2], %l3 |
| 183 | setx 0xc0b0000000000000,%l1,%l4 |
| 184 | andcc %l3, %l4, %l5 |
| 185 | cmp %l5, %l4 |
| 186 | bne test_failed |
| 187 | nop |
| 188 | |
| 189 | test_passed: |
| 190 | EXIT_GOOD |
| 191 | |
| 192 | test_failed: |
| 193 | EXIT_BAD |
| 194 | |
| 195 | /************************************************************************ |
| 196 | Test case data start |
| 197 | ************************************************************************/ |
| 198 | |
| 199 | SECTION .DATA DATA_VA=IO_RD_ADDR |
| 200 | attr_data { |
| 201 | Name = .DATA, |
| 202 | hypervisor, |
| 203 | compressimage |
| 204 | } |
| 205 | |
| 206 | .data |
| 207 | .xword 0xdeadbeefdeadbeef |
| 208 | |
| 209 | .xword 0x1101010101010101 |
| 210 | .xword 0x0122010101010101 |
| 211 | .xword 0x0101330101010101 |
| 212 | .xword 0x0101014401010101 |
| 213 | .xword 0x0101010155010101 |
| 214 | .xword 0x0101010101660101 |
| 215 | .xword 0x0101010101017701 |
| 216 | .xword 0x0101010101010188 |
| 217 | |
| 218 | .xword 0x1122010101010101 |
| 219 | .xword 0x0101334401010101 |
| 220 | .xword 0x0101010155660101 |
| 221 | .xword 0x0101010101017788 |
| 222 | |
| 223 | .xword 0x1122334401010101 |
| 224 | .xword 0x0101010155667788 |
| 225 | |
| 226 | .xword 0xdeadbeefdeadbeef |
| 227 | |
| 228 | /************************************************************************/ |
| 229 | |