| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: spc_asi.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 | #include "defines.h" |
| 39 | #include "old_boot.s" |
| 40 | |
| 41 | /************************************************************************ |
| 42 | Test case code start |
| 43 | ************************************************************************/ |
| 44 | |
| 45 | .text |
| 46 | .global main |
| 47 | |
| 48 | main: /* test begin */ |
| 49 | |
| 50 | ta T_RD_THID |
| 51 | mov %o1, %l7 |
| 52 | umul %l7, 256, %l7 |
| 53 | |
| 54 | |
| 55 | !# Initialize registers .. |
| 56 | |
| 57 | !# Global registers |
| 58 | set 0xB, %g1 |
| 59 | set 0x5, %g2 |
| 60 | set 0x7, %g3 |
| 61 | set 0xE, %g4 |
| 62 | set 0x7, %g5 |
| 63 | set 0xB, %g6 |
| 64 | set 0x3, %g7 |
| 65 | !# Input registers |
| 66 | set -0x4, %i0 |
| 67 | set -0xC, %i1 |
| 68 | set -0x8, %i2 |
| 69 | set -0xF, %i3 |
| 70 | set -0x1, %i4 |
| 71 | set -0xB, %i5 |
| 72 | set -0x4, %i6 |
| 73 | set -0x0, %i7 |
| 74 | !# Local registers |
| 75 | set 0x08538AD0, %l0 |
| 76 | set 0x07398F35, %l1 |
| 77 | set 0x4B289E70, %l2 |
| 78 | set 0x0004A8EF, %l3 |
| 79 | set 0x7750ABA7, %l4 |
| 80 | set 0x0E460AC4, %l5 |
| 81 | set 0x7AA8D017, %l6 |
| 82 | !# Output registers |
| 83 | set 0x170F, %o0 |
| 84 | set 0x14E1, %o1 |
| 85 | set 0x1B1D, %o2 |
| 86 | set -0x0859, %o3 |
| 87 | set 0x0DF7, %o4 |
| 88 | set -0x112E, %o5 |
| 89 | set 0x1988, %o6 |
| 90 | set -0x0D3D, %o7 |
| 91 | |
| 92 | !# Execute some ALU ops .. |
| 93 | |
| 94 | !# set up operands for testing asi instructions |
| 95 | srl %i2, 0x06, %i4 |
| 96 | sth %l5, [%l7 + 0x08] |
| 97 | mova %xcc, 0x555, %i7 |
| 98 | mova %xcc, 0x2aa, %i6 |
| 99 | or %i5, 0xfff, %i5 |
| 100 | sethi %hi(0xabcd1234), %o1 |
| 101 | or %o1, 0x234, %o1 |
| 102 | sllx %o1, 0x20, %o1 |
| 103 | sethi %hi(0xabcd1234), %o2 |
| 104 | or %o2, 0x234, %o2 |
| 105 | or %o1, %o2, %o1 |
| 106 | sethi %hi(0x0), %o3 |
| 107 | |
| 108 | !# test reg form of wrsr |
| 109 | wr %i7, %i5, %y |
| 110 | rd %y, %i1 |
| 111 | wr %i6, %i5, %ccr |
| 112 | rd %ccr, %i2 |
| 113 | wr %o1, %o3, %gsr |
| 114 | rd %gsr, %i3 |
| 115 | wr %o5, %i5, %fprs |
| 116 | rd %fprs, %i7 |
| 117 | wr %o1, %o3, %asi |
| 118 | rd %asi, %i4 |
| 119 | |
| 120 | !# test immed form of wrsr |
| 121 | wr %o5,0x785, %ccr |
| 122 | wr %o1, 0x534, %y |
| 123 | wr %o1, 0x0, %gsr |
| 124 | wr %o1, 0x2, %fprs |
| 125 | wr %o1, 0x5a, %asi |
| 126 | rd %y, %i3 |
| 127 | rd %ccr, %i6 |
| 128 | rd %gsr, %i4 |
| 129 | rd %fprs, %i2 |
| 130 | rd %asi, %i0 |
| 131 | |
| 132 | ! test the PC |
| 133 | ! rd %pc, %g1 |
| 134 | |
| 135 | ! read & write the PICs |
| 136 | ta T_RD_THID |
| 137 | mov %o1, %l0 |
| 138 | !setx 0x01234567DEADBEEF, %g1, %l0 |
| 139 | wr %l0, %g0, %pic /* write to PIC */ |
| 140 | rd %pic, %l3 |
| 141 | cmp %l0, %l3 |
| 142 | bne bad |
| 143 | wr %l0, 0xff0, %pic |
| 144 | xor %l0, 0xff0, %l1 |
| 145 | rd %pic, %l2 |
| 146 | cmp %l2, %l1 |
| 147 | bne bad |
| 148 | |
| 149 | ! write the pcr |
| 150 | ! can't check read, since NAS doesn't model N2 PCRs yet... |
| 151 | wr %l0, 0xf0, %pcr |
| 152 | wr %l0, %g0, %pcr |
| 153 | |
| 154 | |
| 155 | loop_1057: |
| 156 | nop |
| 157 | |
| 158 | loop_1058: |
| 159 | nop |
| 160 | |
| 161 | |
| 162 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 163 | ! |
| 164 | ! Stats for Diag: |
| 165 | ! |
| 166 | ! Type f : 1800 |
| 167 | ! Type cti : 1058 |
| 168 | ! Type i : 1065 |
| 169 | ! Type l : 1077 |
| 170 | ! |
| 171 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 172 | |
| 173 | |
| 174 | EXIT_GOOD /* test finish */ |
| 175 | |
| 176 | |
| 177 | bad: |
| 178 | EXIT_BAD |
| 179 | |
| 180 | /************************************************************************ |
| 181 | Test case data start |
| 182 | ************************************************************************/ |
| 183 | .data |
| 184 | user_data_start: |
| 185 | .word 0x3C2D3A79 |
| 186 | .word 0xA4FF68F0 |
| 187 | .word 0x13C701A5 |
| 188 | .word 0xC99B6312 |
| 189 | .word 0xA4F4C560 |
| 190 | .word 0x5BABF289 |
| 191 | .word 0xFCE126DE |
| 192 | .word 0x192FB03E |
| 193 | .word 0x6E8EE4BD |
| 194 | .word 0x2B2C2E3E |
| 195 | .word 0xB6DED02A |
| 196 | .word 0xC01083B1 |
| 197 | .word 0x44988A1F |
| 198 | .word 0x9DE7EB5A |
| 199 | .word 0xB74AA760 |
| 200 | .word 0xE4BEBA23 |
| 201 | .word 0x91772362 |
| 202 | .word 0x0EFD27D4 |
| 203 | .word 0x0A6D28DF |
| 204 | .word 0x1E6E6B20 |
| 205 | .word 0x37CF0203 |
| 206 | .word 0x08A35333 |
| 207 | .word 0x37D2B902 |
| 208 | .word 0x40B11BA1 |
| 209 | .word 0x753FB53E |
| 210 | .word 0x915CE10C |
| 211 | .word 0xEA67753F |
| 212 | .word 0xAF5B00C5 |
| 213 | .word 0xBDB94A52 |
| 214 | .word 0x1D0FD9E3 |
| 215 | .word 0x9EA12949 |
| 216 | .word 0xF6D465AC |
| 217 | .word 0x3D702202 |
| 218 | .word 0x3142FEAE |
| 219 | .word 0x1C59D52C |
| 220 | .word 0xCFA86D05 |
| 221 | .word 0xE2CCEFBC |
| 222 | .word 0xB384E260 |
| 223 | .word 0x9479CC2D |
| 224 | .word 0x9F49FC0A |
| 225 | .word 0xFA0AFE12 |
| 226 | .word 0x9BADD844 |
| 227 | .word 0x7ABF68B6 |
| 228 | .word 0xD79B2787 |
| 229 | .word 0x2DABAA5B |
| 230 | .word 0x2A7D2369 |
| 231 | .word 0xEBC7D953 |
| 232 | .word 0xC91A563E |
| 233 | .word 0x21899566 |
| 234 | .word 0x5545E80A |
| 235 | .word 0xD551D8ED |
| 236 | .word 0xECBD2D1B |
| 237 | .word 0x5F55E84B |
| 238 | .word 0x51D80E1A |
| 239 | .word 0x8D1CE3BC |
| 240 | .word 0xD126CC9F |
| 241 | .word 0x3939976F |
| 242 | .word 0xD0E0B2D5 |
| 243 | .word 0xD7524BD8 |
| 244 | .word 0x86F9D052 |
| 245 | .word 0x005953F7 |
| 246 | .word 0xB834B88A |
| 247 | .word 0x0B2A90E3 |
| 248 | .word 0x0F749E26 |
| 249 | .end |