| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: spc_pmu_asr.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 | srl %i2, 0x06, %i4 |
| 95 | sth %l5, [%l7 + 0x08] |
| 96 | |
| 97 | !# Try to read and write the PIC |
| 98 | ta T_RD_THID |
| 99 | mov %o1, %l0 |
| 100 | !setx 0x01234567DEADBEEF, %g1, %l0 |
| 101 | wr %l0, %g0, %pic /* write to PIC */ |
| 102 | rd %pic, %l3 |
| 103 | cmp %l0, %l3 |
| 104 | bne bad |
| 105 | nop |
| 106 | |
| 107 | sllx %l0, 0x4, %l2 /* generate different value to write to PCR */ |
| 108 | setx 0xffffffffffffffcf, %g1, %l3 |
| 109 | and %l3, %l2, %l2 /* ... make sure to turn off TOE bits PCR[5:4]*/ |
| 110 | |
| 111 | wr %l2, %g0, %pcr |
| 112 | rd %pcr, %l4 |
| 113 | and %g0, %l5, %l5 |
| 114 | or %g0, 0xFF, %l5 /* Only compare lower 8 bits of PCR, since NAS only implements them now. */ |
| 115 | and %l4, %l5, %l4 |
| 116 | cmp %l2, %l4 |
| 117 | bne bad |
| 118 | nop |
| 119 | |
| 120 | |
| 121 | loop_1057: |
| 122 | nop |
| 123 | |
| 124 | loop_1058: |
| 125 | nop |
| 126 | |
| 127 | |
| 128 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 129 | ! |
| 130 | ! Stats for Diag: |
| 131 | ! |
| 132 | ! Type f : 1800 |
| 133 | ! Type cti : 1058 |
| 134 | ! Type i : 1065 |
| 135 | ! Type l : 1077 |
| 136 | ! |
| 137 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 138 | |
| 139 | |
| 140 | EXIT_GOOD /* test finish */ |
| 141 | nop |
| 142 | nop |
| 143 | |
| 144 | |
| 145 | bad: EXIT_BAD |
| 146 | /************************************************************************ |
| 147 | Test case data start |
| 148 | ************************************************************************/ |
| 149 | .data |
| 150 | user_data_start: |
| 151 | .word 0x3C2D3A79 |
| 152 | .word 0xA4FF68F0 |
| 153 | .word 0x13C701A5 |
| 154 | .word 0xC99B6312 |
| 155 | .word 0xA4F4C560 |
| 156 | .word 0x5BABF289 |
| 157 | .word 0xFCE126DE |
| 158 | .word 0x192FB03E |
| 159 | .word 0x6E8EE4BD |
| 160 | .word 0x2B2C2E3E |
| 161 | .word 0xB6DED02A |
| 162 | .word 0xC01083B1 |
| 163 | .word 0x44988A1F |
| 164 | .word 0x9DE7EB5A |
| 165 | .word 0xB74AA760 |
| 166 | .word 0xE4BEBA23 |
| 167 | .word 0x91772362 |
| 168 | .word 0x0EFD27D4 |
| 169 | .word 0x0A6D28DF |
| 170 | .word 0x1E6E6B20 |
| 171 | .word 0x37CF0203 |
| 172 | .word 0x08A35333 |
| 173 | .word 0x37D2B902 |
| 174 | .word 0x40B11BA1 |
| 175 | .word 0x753FB53E |
| 176 | .word 0x915CE10C |
| 177 | .word 0xEA67753F |
| 178 | .word 0xAF5B00C5 |
| 179 | .word 0xBDB94A52 |
| 180 | .word 0x1D0FD9E3 |
| 181 | .word 0x9EA12949 |
| 182 | .word 0xF6D465AC |
| 183 | .word 0x3D702202 |
| 184 | .word 0x3142FEAE |
| 185 | .word 0x1C59D52C |
| 186 | .word 0xCFA86D05 |
| 187 | .word 0xE2CCEFBC |
| 188 | .word 0xB384E260 |
| 189 | .word 0x9479CC2D |
| 190 | .word 0x9F49FC0A |
| 191 | .word 0xFA0AFE12 |
| 192 | .word 0x9BADD844 |
| 193 | .word 0x7ABF68B6 |
| 194 | .word 0xD79B2787 |
| 195 | .word 0x2DABAA5B |
| 196 | .word 0x2A7D2369 |
| 197 | .word 0xEBC7D953 |
| 198 | .word 0xC91A563E |
| 199 | .word 0x21899566 |
| 200 | .word 0x5545E80A |
| 201 | .word 0xD551D8ED |
| 202 | .word 0xECBD2D1B |
| 203 | .word 0x5F55E84B |
| 204 | .word 0x51D80E1A |
| 205 | .word 0x8D1CE3BC |
| 206 | .word 0xD126CC9F |
| 207 | .word 0x3939976F |
| 208 | .word 0xD0E0B2D5 |
| 209 | .word 0xD7524BD8 |
| 210 | .word 0x86F9D052 |
| 211 | .word 0x005953F7 |
| 212 | .word 0xB834B88A |
| 213 | .word 0x0B2A90E3 |
| 214 | .word 0x0F749E26 |
| 215 | .end |