| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: tso_n2_ncrdwr3.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_HV_ALSO |
| 39 | #define ENABLE_PCIE_LINK_TRAINING |
| 40 | #include "hboot.s" |
| 41 | |
| 42 | .text |
| 43 | .global main |
| 44 | main: |
| 45 | ta T_CHANGE_HPRIV |
| 46 | nop |
| 47 | |
| 48 | wr %g0, 0x4, %fprs /* make sure fef is 1 */ |
| 49 | |
| 50 | setx 0xc100beef00, %g1, %g3 ! MEM32 address space |
| 51 | |
| 52 | setx user_data_start, %l0, %o0 ! user_data_start |
| 53 | |
| 54 | !===================== |
| 55 | ! Now some NC writes and reads mixed with cacheable writes and reads |
| 56 | !===================== |
| 57 | mov %g0, %g4 |
| 58 | set 0x1, %g2 |
| 59 | set 0x10, %g5 |
| 60 | |
| 61 | stloop0: |
| 62 | stx %g2, [%g3 + %g4] ! NonCacheable |
| 63 | stx %g2, [%o0 + %g4] ! Cacheable |
| 64 | inc %g2 |
| 65 | add 0x8, %g4, %g4 |
| 66 | deccc %g5 |
| 67 | bne stloop0 |
| 68 | nop |
| 69 | |
| 70 | mov 0x78, %g4 |
| 71 | set 0x10, %g2 |
| 72 | set 0x10, %g5 |
| 73 | |
| 74 | ldloop0: |
| 75 | ldx [%o0 + %g4], %g1 ! Cacheable |
| 76 | ldx [%g3 + %g4], %g1 ! NonCacheable |
| 77 | subcc %g2, %g1, %g0 |
| 78 | bne h_bad_end |
| 79 | nop |
| 80 | dec %g2 |
| 81 | sub %g4, 0x8, %g4 |
| 82 | deccc %g5 |
| 83 | bne ldloop0 |
| 84 | nop |
| 85 | |
| 86 | !================================ |
| 87 | ldda [%o0]ASI_BLK_P, %f0 |
| 88 | add %g3, 0x40, %g3 |
| 89 | ldd [%g3], %f16 |
| 90 | |
| 91 | std %f0, [%g3] |
| 92 | sub %g3, 0x40, %g3 |
| 93 | stda %f16, [%o0]ASI_BLK_P |
| 94 | membar 0x40 |
| 95 | !================================ |
| 96 | |
| 97 | !================================ |
| 98 | add %g3, 0x40, %g3 |
| 99 | ldd [%g3], %f0 |
| 100 | add %g3, 0x40, %g3 |
| 101 | ldd [%g3], %f16 |
| 102 | std %f0, [%g3] |
| 103 | stda %f0, [%o0]ASI_BLK_PL |
| 104 | add %g3, 8, %g3 |
| 105 | std %f0, [%g3] |
| 106 | stda %f0, [%o0]ASI_BLK_PL |
| 107 | add %g3, 8, %g3 |
| 108 | std %f0, [%g3] |
| 109 | stda %f0, [%o0]ASI_BLK_P |
| 110 | add %g3, 8, %g3 |
| 111 | std %f0, [%g3] |
| 112 | stda %f0, [%o0]ASI_BLK_P |
| 113 | stda %f0, [%o0]ASI_BLK_P |
| 114 | stda %f0, [%o0]ASI_BLK_PL |
| 115 | add %g3, 8, %g3 |
| 116 | std %f0, [%g3] |
| 117 | add %g3, 8, %g3 |
| 118 | std %f0, [%g3] |
| 119 | sub %g3, 0x40, %g3 |
| 120 | std %f16, [%g3] |
| 121 | !================================ |
| 122 | |
| 123 | set 0x10, %g5 |
| 124 | mov %g3, %g4 |
| 125 | mov %o0, %o1 |
| 126 | |
| 127 | loop6: |
| 128 | ldx [%g4], %l0 |
| 129 | inc %l0 |
| 130 | inc %l1 |
| 131 | add %g4, 0x8, %g4 |
| 132 | add %o1, 0x8, %o1 |
| 133 | stx %l0, [%g4] |
| 134 | add %g4, 0x8, %g4 |
| 135 | stx %l1, [%g4] |
| 136 | stxa %l0, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P |
| 137 | add %o1, 0x8, %o1 |
| 138 | stxa %l1, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P |
| 139 | |
| 140 | deccc %g5 |
| 141 | bne loop6 |
| 142 | nop |
| 143 | |
| 144 | !================================ |
| 145 | set 0x10, %g5 |
| 146 | mov %g3, %g4 |
| 147 | mov %o0, %o1 |
| 148 | |
| 149 | loop8: |
| 150 | ldx [%g4], %l0 |
| 151 | inc %l0 |
| 152 | inc %l1 |
| 153 | add %g4, 0x8, %g4 |
| 154 | add %o1, 0x8, %o1 |
| 155 | stx %l0, [%g4] |
| 156 | add %g4, 0x8, %g4 |
| 157 | stx %l1, [%g4] |
| 158 | stxa %l0, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P_LITTLE |
| 159 | add %o1, 0x8, %o1 |
| 160 | stxa %l1, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P_LITTLE |
| 161 | |
| 162 | deccc %g5 |
| 163 | bne loop8 |
| 164 | nop |
| 165 | |
| 166 | !================================ |
| 167 | set 0x10, %g5 |
| 168 | mov %g3, %g4 |
| 169 | mov %o0, %o1 |
| 170 | |
| 171 | loop11: |
| 172 | ldx [%g4], %l0 |
| 173 | inc %l0 |
| 174 | inc %l1 |
| 175 | add %g4, 0x8, %g4 |
| 176 | add %o1, 0x8, %o1 |
| 177 | stx %l0, [%g4] |
| 178 | add %g4, 0x8, %g4 |
| 179 | stx %l1, [%g4] |
| 180 | stxa %l0, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P |
| 181 | add %o1, 0x8, %o1 |
| 182 | stxa %l1, [%o1]ASI_BLK_INIT_ST_QUAD_LDD_P |
| 183 | |
| 184 | deccc %g5 |
| 185 | bne loop11 |
| 186 | nop |
| 187 | |
| 188 | normal_end: |
| 189 | ta T_GOOD_TRAP |
| 190 | h_bad_end: |
| 191 | ta T_BAD_TRAP |
| 192 | |
| 193 | |
| 194 | /******************************************************************/ |
| 195 | /* |
| 196 | * Data section |
| 197 | */ |
| 198 | |
| 199 | .data |
| 200 | user_data_start: |
| 201 | .word 0xD6B3479D |
| 202 | .word 0xDB28926C |
| 203 | .end |
| 204 | |