| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: memop_l2_data_access.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 MAIN_PAGE_NUCLEUS_ALSO |
| 39 | #define MAIN_PAGE_HV_ALSO |
| 40 | #define L2_DATA_ARRAY_BASE_ADDR 0xa000000000 |
| 41 | |
| 42 | #include "hboot.s" |
| 43 | #include "asi_s.h" |
| 44 | |
| 45 | /************************************************************************ |
| 46 | Test case code start |
| 47 | ************************************************************************/ |
| 48 | |
| 49 | .text |
| 50 | .global main |
| 51 | |
| 52 | main: |
| 53 | ta T_CHANGE_HPRIV |
| 54 | |
| 55 | ! Until the simulation evniorment gets updated to initialize |
| 56 | ! the data array in L2$, do it myself. |
| 57 | |
| 58 | ! Initialize first word in each bank of the L2 data array. |
| 59 | init0: |
| 60 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %o0 ! address to init. |
| 61 | set 0x40, %g3 ! Increment |
| 62 | set 8, %g4 ! # lines to initialize |
| 63 | |
| 64 | initloop: |
| 65 | call init_l2_line |
| 66 | sub %g4, 1, %g4 |
| 67 | cmp %g4, 0 |
| 68 | bne initloop |
| 69 | add %o0, %g3, %o0 |
| 70 | |
| 71 | ! Initialize first word in each set of bank 0 of the L2 data array. |
| 72 | init1: |
| 73 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %o0 |
| 74 | setx 0x00200, %g1, %g3 ! increment to get next set |
| 75 | setx 0x3fe00, %g1, %g4 |
| 76 | add %o0, %g4, %g4 ! addr for last set in bank 0 |
| 77 | initloop1: |
| 78 | call init_l2_line |
| 79 | cmp %o0, %g4 |
| 80 | bne initloop1 |
| 81 | add %o0, %g3, %o0 |
| 82 | |
| 83 | ! Init. first word in each way of set 0, bank 0 of the L2 data array. |
| 84 | init2: |
| 85 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %o0 |
| 86 | setx 0x040000, %g1, %g3 ! increment to get next way |
| 87 | setx 0x3c0000, %g1, %g4 |
| 88 | add %o0, %g4, %g4 ! addr for last way in bank 0, set 0 |
| 89 | initloop2: |
| 90 | call init_l2_line |
| 91 | cmp %o0, %g4 |
| 92 | bne initloop2 |
| 93 | add %o0, %g3, %o0 |
| 94 | |
| 95 | ! Initialize each word in way 0, set 0, bank 0 of L2 Data array. |
| 96 | init3: |
| 97 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %o0 |
| 98 | set 0x8, %g3 ! increment to get next word |
| 99 | set 0x20, %g4 |
| 100 | add %o0, %g4, %g4 ! addr for last word in bank 0, set 0, way 0 |
| 101 | initloop3: |
| 102 | call init_l2_line |
| 103 | cmp %o0, %g4 |
| 104 | bne initloop3 |
| 105 | add %o0, %g3, %o0 |
| 106 | |
| 107 | |
| 108 | ! Now check diagnostic accesses of the L2 data array. |
| 109 | |
| 110 | ! Check first word in each bank of the L2 data array. |
| 111 | |
| 112 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %g2 |
| 113 | bank0: |
| 114 | ldx [%g2], %l0 |
| 115 | membar #Sync |
| 116 | stx %l0, [%g2] |
| 117 | membar #Sync |
| 118 | bank1: |
| 119 | add %g2, 0x40, %g2 |
| 120 | ldx [%g2], %l0 |
| 121 | membar #Sync |
| 122 | stx %l0, [%g2] |
| 123 | membar #Sync |
| 124 | bank2: |
| 125 | add %g2, 0x40, %g2 |
| 126 | ldx [%g2], %l0 |
| 127 | membar #Sync |
| 128 | stx %l0, [%g2] |
| 129 | membar #Sync |
| 130 | bank3: |
| 131 | add %g2, 0x40, %g2 |
| 132 | ldx [%g2], %l0 |
| 133 | membar #Sync |
| 134 | stx %l0, [%g2] |
| 135 | membar #Sync |
| 136 | bank4: |
| 137 | add %g2, 0x40, %g2 |
| 138 | ldx [%g2], %l0 |
| 139 | membar #Sync |
| 140 | stx %l0, [%g2] |
| 141 | membar #Sync |
| 142 | bank5: |
| 143 | add %g2, 0x40, %g2 |
| 144 | ldx [%g2], %l0 |
| 145 | membar #Sync |
| 146 | stx %l0, [%g2] |
| 147 | membar #Sync |
| 148 | bank6: |
| 149 | add %g2, 0x40, %g2 |
| 150 | ldx [%g2], %l0 |
| 151 | membar #Sync |
| 152 | stx %l0, [%g2] |
| 153 | membar #Sync |
| 154 | bank7: |
| 155 | add %g2, 0x40, %g2 |
| 156 | ldx [%g2], %l0 |
| 157 | membar #Sync |
| 158 | stx %l0, [%g2] |
| 159 | membar #Sync |
| 160 | |
| 161 | ! Check first word in each set of bank 0 of the L2 data array. |
| 162 | sets: |
| 163 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %g2 |
| 164 | setx 0x00200, %g1, %g3 ! increment to get next set |
| 165 | setx 0x3fe00, %g1, %g4 |
| 166 | add %g2, %g4, %g4 ! addr for last set in bank 0 |
| 167 | setloop: |
| 168 | ldx [%g2], %l1 |
| 169 | stx %l1, [%g2] |
| 170 | cmp %g2, %g4 |
| 171 | bne setloop |
| 172 | add %g2, %g3, %g2 |
| 173 | |
| 174 | ! Check first word in each way of set 0, bank 0 of the L2 data array. |
| 175 | ways: |
| 176 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %g2 |
| 177 | setx 0x040000, %g1, %g3 ! increment to get next way |
| 178 | setx 0x3c0000, %g1, %g4 |
| 179 | add %g2, %g4, %g4 ! addr for last way in bank 0, set 0 |
| 180 | wayloop: |
| 181 | ldx [%g2], %l1 |
| 182 | stx %l1, [%g2] |
| 183 | cmp %g2, %g4 |
| 184 | bne wayloop |
| 185 | add %g2, %g3, %g2 |
| 186 | |
| 187 | ! Check each word in way 0, set 0, bank 0 of L2 Data array. |
| 188 | words: |
| 189 | setx L2_DATA_ARRAY_BASE_ADDR, %g1, %g2 |
| 190 | set 0x8, %g3 ! increment to get next word |
| 191 | set 0x20, %g4 |
| 192 | add %g2, %g4, %g4 ! addr for last word in bank 0, set 0, way 0 |
| 193 | setx 0x400000, %g1, %g5 ! Odd/Even word select bit |
| 194 | wordloop: |
| 195 | ldx [%g2], %l1 ! even word |
| 196 | stx %l1, [%g2] |
| 197 | or %g2, %g5, %g6 |
| 198 | ldx [%g6], %l1 ! odd word |
| 199 | stx %l1, [%g6] |
| 200 | cmp %g2, %g4 |
| 201 | bne wordloop |
| 202 | add %g2, %g3, %g2 |
| 203 | |
| 204 | ba test_passed |
| 205 | nop |
| 206 | |
| 207 | |
| 208 | /********************************************************************** |
| 209 | * Common code. |
| 210 | *********************************************************************/ |
| 211 | |
| 212 | ! Assumes that %o0 contains VA that maps to L2$ line to be initialized. |
| 213 | ! This is done by doing 16 stores from different addresses that alias |
| 214 | ! to that line. |
| 215 | |
| 216 | init_l2_line: |
| 217 | setx 0x3ffff, %o1, %o2 |
| 218 | and %o0, %o2, %o3 |
| 219 | setx alias1, %o1, %o4 |
| 220 | ldx [%o3+%o4], %g0 |
| 221 | setx 0x40000, %o1, %o5 |
| 222 | add %o4, %o5, %o4 |
| 223 | ldx [%o3+%o4], %g0 |
| 224 | add %o4, %o5, %o4 |
| 225 | ldx [%o3+%o4], %g0 |
| 226 | add %o4, %o5, %o4 |
| 227 | ldx [%o3+%o4], %g0 |
| 228 | add %o4, %o5, %o4 |
| 229 | ldx [%o3+%o4], %g0 |
| 230 | add %o4, %o5, %o4 |
| 231 | ldx [%o3+%o4], %g0 |
| 232 | add %o4, %o5, %o4 |
| 233 | ldx [%o3+%o4], %g0 |
| 234 | add %o4, %o5, %o4 |
| 235 | ldx [%o3+%o4], %g0 |
| 236 | add %o4, %o5, %o4 |
| 237 | ldx [%o3+%o4], %g0 |
| 238 | add %o4, %o5, %o4 |
| 239 | ldx [%o3+%o4], %g0 |
| 240 | add %o4, %o5, %o4 |
| 241 | ldx [%o3+%o4], %g0 |
| 242 | add %o4, %o5, %o4 |
| 243 | ldx [%o3+%o4], %g0 |
| 244 | add %o4, %o5, %o4 |
| 245 | ldx [%o3+%o4], %g0 |
| 246 | add %o4, %o5, %o4 |
| 247 | ldx [%o3+%o4], %g0 |
| 248 | add %o4, %o5, %o4 |
| 249 | ldx [%o3+%o4], %g0 |
| 250 | add %o4, %o5, %o4 |
| 251 | ldx [%o3+%o4], %o4 |
| 252 | membar #Sync |
| 253 | and %o4, %o3, %g0 |
| 254 | jmpl %o7+0x8, %g0 |
| 255 | nop |
| 256 | |
| 257 | test_passed: |
| 258 | EXIT_GOOD |
| 259 | |
| 260 | test_failed: |
| 261 | EXIT_BAD |
| 262 | |
| 263 | |
| 264 | /************************************************************************ |
| 265 | Test case data start |
| 266 | ************************************************************************/ |
| 267 | |
| 268 | SECTION .DATA DATA_VA=0x70000000 |
| 269 | attr_data { |
| 270 | Name = .DATA, |
| 271 | hypervisor, |
| 272 | compressimage |
| 273 | } |
| 274 | |
| 275 | .data |
| 276 | .global single_data |
| 277 | .global double_data |
| 278 | .global zero_data |
| 279 | .global block_data |
| 280 | .global result_area |
| 281 | .global alias1 |
| 282 | .global alias2 |
| 283 | .global alias3 |
| 284 | .global alias4 |
| 285 | .global alias5 |
| 286 | .global alias6 |
| 287 | .global alias7 |
| 288 | .global alias8 |
| 289 | .global alias9 |
| 290 | .global alias10 |
| 291 | .global alias11 |
| 292 | .global alias12 |
| 293 | .global alias13 |
| 294 | .global alias14 |
| 295 | .global alias15 |
| 296 | .global alias16 |
| 297 | |
| 298 | user_data_start: |
| 299 | zero_data: |
| 300 | .xword 0x0000000000000000 |
| 301 | .align 256 |
| 302 | |
| 303 | .align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line |
| 304 | alias1: |
| 305 | .skip 1024 |
| 306 | .align 0x40000 |
| 307 | alias2: |
| 308 | .skip 1024 |
| 309 | .align 0x40000 |
| 310 | alias3: |
| 311 | .skip 1024 |
| 312 | .align 0x40000 |
| 313 | alias4: |
| 314 | .skip 1024 |
| 315 | .align 0x40000 |
| 316 | alias5: |
| 317 | .skip 1024 |
| 318 | .align 0x40000 |
| 319 | alias6: |
| 320 | .skip 1024 |
| 321 | .align 0x40000 |
| 322 | alias7: |
| 323 | .skip 1024 |
| 324 | .align 0x40000 |
| 325 | alias8: |
| 326 | .skip 1024 |
| 327 | .align 0x40000 |
| 328 | alias9: |
| 329 | .skip 1024 |
| 330 | .align 0x40000 |
| 331 | alias10: |
| 332 | .skip 1024 |
| 333 | .align 0x40000 |
| 334 | alias11: |
| 335 | .skip 1024 |
| 336 | .align 0x40000 |
| 337 | alias12: |
| 338 | .skip 1024 |
| 339 | .align 0x40000 |
| 340 | alias13: |
| 341 | .skip 1024 |
| 342 | .align 0x40000 |
| 343 | alias14: |
| 344 | .skip 1024 |
| 345 | .align 0x40000 |
| 346 | alias15: |
| 347 | .skip 1024 |
| 348 | .align 0x40000 |
| 349 | alias16: |
| 350 | .skip 1024 |
| 351 | |
| 352 | user_data_end: |
| 353 | .end |
| 354 | |
| 355 | |
| 356 | |