| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: PCIeMem32QuadLoad.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_NUCLEUS_ALSO */ /* Access main in priviledge mode */ |
| 40 | #define MAIN_PAGE_HV_ALSO |
| 41 | |
| 42 | #include "hboot.s" |
| 43 | #include "peu_defines.h" |
| 44 | |
| 45 | #define MEM_RD_ADDR mpeval(N2_PCIE_BASE_ADDR + MEM32_OFFSET_BASE_REG_DATA) |
| 46 | |
| 47 | #ifndef NO_SELF_CHECK |
| 48 | #define BNE_TEST_FAIL bne test_failed |
| 49 | #else |
| 50 | #define BNE_TEST_FAIL nop |
| 51 | #endif |
| 52 | |
| 53 | /************************************************************************ |
| 54 | Test case code start |
| 55 | ************************************************************************/ |
| 56 | .text |
| 57 | .global main |
| 58 | |
| 59 | main: |
| 60 | ta T_CHANGE_HPRIV |
| 61 | nop |
| 62 | |
| 63 | ! select a MEM address in PCIe address range |
| 64 | setx MEM_RD_ADDR, %g1, %g2 |
| 65 | |
| 66 | ! Load quad word (16 bytes), using asi 0x27 |
| 67 | wr %g0, ASI_NUCLEUS_BLK_INIT_ST_QUAD_LDD, %asi |
| 68 | ldda [%g2+32] %asi, %l0 |
| 69 | |
| 70 | ! check the data that came back |
| 71 | setx 0x3031323334353637, %g1, %g4 |
| 72 | setx 0x38393a3b3c3d3e3f, %g1, %g3 |
| 73 | cmp %l0, %g4 |
| 74 | BNE_TEST_FAIL |
| 75 | nop |
| 76 | cmp %l1, %g3 |
| 77 | BNE_TEST_FAIL |
| 78 | nop |
| 79 | |
| 80 | ! Load quad word (16 bytes), using asi 0xE2 |
| 81 | wr %g0, ASI_BLK_INIT_ST_QUAD_LDD_P, %asi |
| 82 | ldda [%g2+48] %asi, %l0 |
| 83 | |
| 84 | ! check the data that came back |
| 85 | setx 0x4041424344454647, %g1, %g4 |
| 86 | setx 0x48494a4b4c4d4e4f, %g1, %g3 |
| 87 | cmp %l0, %g4 |
| 88 | BNE_TEST_FAIL |
| 89 | nop |
| 90 | cmp %l1, %g3 |
| 91 | BNE_TEST_FAIL |
| 92 | nop |
| 93 | |
| 94 | ! Load quad word (16 bytes), using asi 0xE3 |
| 95 | wr %g0, ASI_BLK_INIT_ST_QUAD_LDD_S, %asi |
| 96 | ldda [%g2+64] %asi, %l0 |
| 97 | |
| 98 | ! check the data that came back |
| 99 | setx 0x5051525354555657, %g1, %g4 |
| 100 | setx 0x58595a5b5c5d5e5f, %g1, %g3 |
| 101 | cmp %l0, %g4 |
| 102 | BNE_TEST_FAIL |
| 103 | nop |
| 104 | cmp %l1, %g3 |
| 105 | BNE_TEST_FAIL |
| 106 | nop |
| 107 | |
| 108 | ! Load quad word (16 bytes), using asi 0x22 |
| 109 | ldda [%g2] ASI_AS_IF_USER_BLK_INIT_PRIMARY, %l0 |
| 110 | |
| 111 | ! check the data that came back |
| 112 | setx 0x1011121314151617, %g1, %g4 |
| 113 | setx 0x18191a1b1c1d1e1f, %g1, %g3 |
| 114 | cmp %l0, %g4 |
| 115 | BNE_TEST_FAIL |
| 116 | nop |
| 117 | cmp %l1, %g3 |
| 118 | BNE_TEST_FAIL |
| 119 | nop |
| 120 | !! |
| 121 | ! Load quad word (16 bytes), using asi 0x23 |
| 122 | wr %g0, ASI_AS_IF_USER_BLK_INIT_SECONDARY, %asi |
| 123 | ldda [%g2+16] %asi, %l0 |
| 124 | |
| 125 | ! check the data that came back |
| 126 | setx 0x2021222324252627, %g1, %g4 |
| 127 | setx 0x28292a2b2c2d2e2f, %g1, %g3 |
| 128 | cmp %l0, %g4 |
| 129 | BNE_TEST_FAIL |
| 130 | nop |
| 131 | cmp %l1, %g3 |
| 132 | BNE_TEST_FAIL |
| 133 | nop |
| 134 | |
| 135 | |
| 136 | test_passed: |
| 137 | EXIT_GOOD |
| 138 | !! |
| 139 | test_failed: ! get some PEU status registers before bailing out |
| 140 | EXIT_BAD |
| 141 | |
| 142 | |
| 143 | /************************************************************************ |
| 144 | Test case data start |
| 145 | ************************************************************************/ |
| 146 | |
| 147 | SECTION .DATA DATA_VA=MEM_RD_ADDR |
| 148 | attr_data { |
| 149 | Name = .DATA, |
| 150 | hypervisor, |
| 151 | compressimage |
| 152 | } |
| 153 | |
| 154 | .data |
| 155 | .global PCIAddr9 |
| 156 | |
| 157 | data0: .xword 0x1011121314151617 |
| 158 | .xword 0x18191a1b1c1d1e1f |
| 159 | data1: .xword 0x2021222324252627 |
| 160 | .xword 0x28292a2b2c2d2e2f |
| 161 | data2: .xword 0x3031323334353637 |
| 162 | .xword 0x38393a3b3c3d3e3f |
| 163 | data3: .xword 0x4041424344454647 |
| 164 | .xword 0x48494a4b4c4d4e4f |
| 165 | data4: .xword 0x5051525354555657 |
| 166 | .xword 0x58595a5b5c5d5e5f |
| 167 | data5: .xword 0x6061626364656667 |
| 168 | .xword 0x68696a6b6c6d6e6f |
| 169 | |
| 170 | /************************************************************************/ |