| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: isa3_mmu_htw_0.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 PART_0_BASE 0x0000000000 |
| 39 | #define PART_1_BASE 0x0000000000 |
| 40 | #define PART_2_BASE 0x0000000000 |
| 41 | #define PART_3_BASE 0x0000000000 |
| 42 | #define PART_4_BASE 0x0000000000 |
| 43 | #define PART_5_BASE 0x0000000000 |
| 44 | #define PART_6_BASE 0x0000000000 |
| 45 | #define PART_7_BASE 0x0000000000 |
| 46 | |
| 47 | !!! Note: RANOTPA is 0 (default) |
| 48 | #define PART0_Z_RANOTPA_0 0 |
| 49 | #define PART0_Z_RANOTPA_1 0 |
| 50 | #define PART0_Z_RANOTPA_2 0 |
| 51 | #define PART0_Z_RANOTPA_3 0 |
| 52 | #define PART0_NZ_RANOTPA_0 0 |
| 53 | #define PART0_NZ_RANOTPA_1 0 |
| 54 | #define PART0_NZ_RANOTPA_2 0 |
| 55 | #define PART0_NZ_RANOTPA_3 0 |
| 56 | |
| 57 | |
| 58 | #include "hboot.s" |
| 59 | |
| 60 | /************************************************************************ |
| 61 | Test case code start |
| 62 | ************************************************************************/ |
| 63 | |
| 64 | .text |
| 65 | .global main |
| 66 | |
| 67 | main: /* test begin */ |
| 68 | |
| 69 | |
| 70 | |
| 71 | !# Execute Main Diag .. |
| 72 | |
| 73 | |
| 74 | ! ! Set translation for miss handler |
| 75 | ! ! |
| 76 | ! setx HTBA, %l1, %i4 |
| 77 | ! ! Zero out lower 13 bits |
| 78 | ! srlx %i4, 13, %i0 |
| 79 | ! sllx %i0, 13, %i0 |
| 80 | ! ! Write it to itlb_tag_access register |
| 81 | ! ! ASI 0x50, addr 0x30 |
| 82 | ! setx 0x30, %l1, %i1 |
| 83 | ! stxa %i0, [%i1 + %g0] 0x50 |
| 84 | ! ! Create tte_data in %i2 |
| 85 | ! ! sun4v format |
| 86 | ! ! Field V NFO L PA IE E CP P W Size |
| 87 | ! ! Bit 63 62 61 39:13 12 11 10 8 6 2:0 |
| 88 | ! ! |
| 89 | ! ! First set valid and locked bits |
| 90 | ! setx 0xA000000000000000, %l1, %i2 |
| 91 | ! ! Now set up PA |
| 92 | ! setx 0x000000FFFFFFE000, %l1, %i5 |
| 93 | ! and %i4, %i5, %i5 |
| 94 | ! ! Now merge them |
| 95 | ! or %i2, %i5, %i2 |
| 96 | ! ! Write it to itlb_data_in register |
| 97 | ! ! ASI 0x54, address with bit 10 set (for sun4v) |
| 98 | ! setx 0x400, %l1, %i3 |
| 99 | ! stxa %i2, [%i3 + %g0] 0x54 |
| 100 | |
| 101 | |
| 102 | !! Create tte_tag in %i0 |
| 103 | !! Field Context VA |
| 104 | !! 60:48 41:0 |
| 105 | !! Assume context of 0 for now |
| 106 | !! |
| 107 | !! First get PC |
| 108 | !rd %pc, %i4 |
| 109 | !! Zero out lower 13 bits |
| 110 | !srlx %i4, 13, %i0 |
| 111 | !sllx %i0, 13, %i0 |
| 112 | ! |
| 113 | !! Write it to itlb_tag_access register |
| 114 | !! ASI 0x50, addr 0x30 |
| 115 | !setx 0x30, %l1, %i1 |
| 116 | !stxa %i0, [%i1 + %g0] 0x50 |
| 117 | ! |
| 118 | !! Create tte_data in %i2 |
| 119 | !! sun4v format |
| 120 | !! Field V NFO L PA IE E CP P W Size |
| 121 | !! Bit 63 62 61 39:13 12 11 10 8 6 2:0 |
| 122 | !! |
| 123 | !! First set valid bit |
| 124 | !setx 0x8000000000000000, %l1, %i2 |
| 125 | !! Now set up PA |
| 126 | !setx 0x000000FFFFFFE000, %l1, %i5 |
| 127 | !and %i4, %i5, %i5 |
| 128 | !! Now merge them |
| 129 | !or %i2, %i5, %i2 |
| 130 | ! |
| 131 | ! |
| 132 | !! Write it to itlb_data_in register |
| 133 | !! ASI 0x54, address with bit 10 set (for sun4v) |
| 134 | !setx 0x400, %l1, %i3 |
| 135 | !stxa %i2, [%i3 + %g0] 0x54 |
| 136 | |
| 137 | !! Now activate translation |
| 138 | !! Reset HPSTATE.ENB (bit 11) |
| 139 | !rdhpr %hpstate, %i7 |
| 140 | !and %i7, 0x17FF, %i7 |
| 141 | !wrhpr %i7, %hpstate |
| 142 | !! Set lsu_control_reg.im (bit 2 in ASI 0x45, VA 0x0) |
| 143 | !setx 0x4, %l1, %i6 |
| 144 | !stxa %i6, [%g0 + %g0] 0x45 |
| 145 | |
| 146 | ! Fetch and execute some stuff... |
| 147 | |
| 148 | add %i1, %i2, %o1 |
| 149 | add %i2, %i3, %o2 |
| 150 | add %i3, %i4, %o3 |
| 151 | add %i4, %i5, %o4 |
| 152 | add %i5, %i6, %o5 |
| 153 | add %i6, %i7, %o6 |
| 154 | add %o7, %o1, %o7 |
| 155 | add %o1, %o2, %l1 |
| 156 | add %o2, %o3, %l2 |
| 157 | add %o3, %o4, %l3 |
| 158 | add %o4, %o5, %l4 |
| 159 | add %o5, %o6, %l5 |
| 160 | add %o6, %o7, %l6 |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | EXIT_GOOD /* test finish */ |
| 171 | |
| 172 | /************************************************************************ |
| 173 | Test case data start |
| 174 | ************************************************************************/ |
| 175 | .data |
| 176 | user_data_start: |
| 177 | scratch_area: |
| 178 | .word 0x04BAEE04 |
| 179 | .word 0xA26211E7 |
| 180 | .word 0xC46CE935 |
| 181 | .word 0xD086C0FA |
| 182 | .word 0x95181468 |
| 183 | .word 0xA561DA01 |
| 184 | .word 0x66B600B3 |
| 185 | .word 0x3DDF304B |
| 186 | .word 0xD59B63E9 |
| 187 | .word 0x69CD7744 |
| 188 | .word 0x93D976FD |
| 189 | .word 0x632A2A09 |
| 190 | .word 0xD21BB7C3 |
| 191 | .word 0x6D4AA3F7 |
| 192 | .word 0x1FB493C2 |
| 193 | .word 0xA8132A6B |
| 194 | .word 0x5D211FF0 |
| 195 | .word 0x819A5EF5 |
| 196 | .word 0x73B3D78A |
| 197 | .word 0x979BCD1A |
| 198 | .word 0x88730AC3 |
| 199 | .word 0xBD87189E |
| 200 | .word 0x372CA055 |
| 201 | .word 0x87AD6A47 |
| 202 | .word 0x1EC56408 |
| 203 | .word 0x19156A2C |
| 204 | .word 0x188A924A |
| 205 | .word 0xE21AB83D |
| 206 | .word 0xAC4488B1 |
| 207 | .word 0x34AF2861 |
| 208 | .word 0x90E27A07 |
| 209 | .word 0x7ECBAD34 |
| 210 | .word 0x0D0C9AD8 |
| 211 | .word 0xCD68A2C2 |
| 212 | .word 0x744F3CF8 |
| 213 | .word 0x8BF0C9D3 |
| 214 | .word 0xB6232F4D |
| 215 | .word 0x16EEB7FF |
| 216 | .word 0x2CE4DC96 |
| 217 | .word 0x086BC9ED |
| 218 | .word 0x87757CAE |
| 219 | .word 0xF207ACCA |
| 220 | .word 0xE25E65DB |
| 221 | .word 0x8189486F |
| 222 | .word 0x00156704 |
| 223 | .word 0x0E78970C |
| 224 | .word 0x00B22AFF |
| 225 | .word 0x5EA3DBAD |
| 226 | .word 0x091EEE20 |
| 227 | .word 0x067AF9AB |
| 228 | .word 0x68CC189A |
| 229 | .word 0xAEE0946E |
| 230 | .word 0x24E3D750 |
| 231 | .word 0x704AC16A |
| 232 | .word 0xA3F11926 |
| 233 | .word 0xE63276D1 |
| 234 | .word 0xDD91CC43 |
| 235 | .word 0x87772648 |
| 236 | .word 0x2983F7D2 |
| 237 | .word 0xD99DB0E4 |
| 238 | .word 0x96D7B61B |
| 239 | .word 0x29F098FC |
| 240 | .word 0xCA413B16 |
| 241 | .word 0x506B0706 |
| 242 | .end |