Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_ras_vec_l2_da_ue.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 | ||
40 | ||
41 | #define L2_ENTRY_PA 0xa000000000 | |
42 | #define TEST_DATA1 0x5555555555555555 | |
43 | #define L2_ENTRY_PA0 0x30000008 | |
44 | #define L2_ES_W1C_VALUE 0xc03ffffc00000000 | |
45 | ||
46 | #define SPARC_ES_W1C_VALUE 0xefffffff | |
47 | #define TT_SW_Error 0x40 | |
48 | ||
49 | #define L2_ESR_MASK 0xf03ffffff0000000 | |
50 | #define L2_VEC 36 | |
51 | #define L2_LDWC 51 | |
52 | #define L2_LDAC 53 | |
53 | #define L2_VEU 35 | |
54 | #define L2_LDWU 50 | |
55 | #define L2_LDAU 52 | |
56 | ||
57 | #include "hboot.s" | |
58 | #include "asi_s.h" | |
59 | #include "err_defines.h" | |
60 | ||
61 | .text | |
62 | .global main | |
63 | ||
64 | main: | |
65 | ||
66 | ||
67 | ! Boot code does not provide TLB translation for IO address space | |
68 | ta T_CHANGE_HPRIV | |
69 | ||
70 | ||
71 | disable_l1_DCache: | |
72 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
73 | ! Remove bit 2 | |
74 | andn %l0, 0x2, %l0 | |
75 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
76 | ||
77 | set_L2_Directly_Mapped_Mode: | |
78 | setx L2CS_PA0, %l6, %g1 ! Bit 1 in L2 Control Status Register | |
79 | mov 0x2, %l0 | |
80 | stx %l0, [%g1] | |
81 | ||
82 | store_to_L2: | |
83 | setx TEST_DATA1, %l0, %g5 | |
84 | ||
85 | store_to_L2_way0: | |
86 | setx 0x3000aa00, %l0, %g2 ! bits [21:18] select way | |
87 | stx %g5, [%g2] | |
88 | stx %g5, [%g2+8] | |
89 | nop | |
90 | nop; nop; nop; nop; nop | |
91 | nop; nop; nop; nop; nop | |
92 | nop; nop; nop; nop; nop | |
93 | ||
94 | membar #Sync | |
95 | ||
96 | L2_diag_load: | |
97 | setx 0x3ffff8, %l0, %l2 ! Mask for extracting [21:3] | |
98 | setx L2_ENTRY_PA, %l0, %g4 | |
99 | and %g2, %l2, %g5 !g2 has L2 PA, | |
100 | or %g5, %g4, %g5 !g5 now has Diagnostic Data Array address | |
101 | ldx [%g5], %g6 | |
102 | membar #Sync | |
103 | ||
104 | ||
105 | ! Flip two bits | |
106 | xor %g6, 0x600, %g6 | |
107 | stx %g6, [%g5] | |
108 | membar #Sync | |
109 | ||
110 | reading_back_0: !Load to L2 again to get the error | |
111 | setx 0x3000aa00, %l0, %g2 | |
112 | ldx [%g2], %l6 | |
113 | membar #Sync | |
114 | ||
115 | ||
116 | check_l2_ESR: | |
117 | setx L2ES_PA0, %l6, %g1 | |
118 | ldx [%g1], %g2 | |
119 | ||
120 | setx L2_ESR_MASK, %g7, %g3 | |
121 | and %g2, %g3, %g4 | |
122 | ||
123 | mov 0x1, %i1 | |
124 | sllx %i1, L2_VEU, %i2 | |
125 | sllx %i1, L2_LDAU, %i3 | |
126 | or %i2, %i3, %i4 | |
127 | ||
128 | cmp %g4, %i4 | |
129 | bne %xcc, test_fail | |
130 | nop | |
131 | ||
132 | clear_l2_ESR: | |
133 | setx L2_ES_W1C_VALUE, %g7, %g2 | |
134 | stx %g2, [%g1] | |
135 | membar #Sync | |
136 | ||
137 | check_l2_EAR: | |
138 | setx L2EA_PA0, %g7, %g1 | |
139 | ldx [%g1], %g2 | |
140 | setx 0x3000aa00, %g7, %g3 | |
141 | cmp %g3, %g2 | |
142 | bne test_fail | |
143 | nop | |
144 | ||
145 | clear_l2_EAR: | |
146 | stx %g0, [%g1] | |
147 | membar #Sync | |
148 | ||
149 | membar #Sync | |
150 | ||
151 | ||
152 | /********************************************** | |
153 | LDWU | |
154 | ***********************************************/ | |
155 | write_back: | |
156 | setx 0x1000aa00, %l0, %g2 | |
157 | ldx [%g2], %l6 | |
158 | add %g2, 0x200, %g2 | |
159 | ldx [%g2], %l6 | |
160 | membar #Sync | |
161 | ||
162 | setx 0x2000aa00, %l0, %g2 | |
163 | ldx [%g2], %l6 | |
164 | ||
165 | ||
166 | check_l2_ESR_LDWU: | |
167 | setx L2ES_PA0, %l6, %g1 | |
168 | ldx [%g1], %g2 | |
169 | ||
170 | setx L2_ESR_MASK, %g7, %g3 | |
171 | and %g2, %g3, %g4 | |
172 | ||
173 | mov 0x1, %i1 | |
174 | sllx %i1, L2_VEU, %i2 | |
175 | sllx %i1, L2_LDWU, %i3 | |
176 | or %i2, %i3, %i4 | |
177 | ||
178 | cmp %g4, %i4 | |
179 | bne %xcc, test_fail | |
180 | nop | |
181 | ||
182 | check_l2_EAR_LDWU: | |
183 | setx L2EA_PA0, %g7, %g1 | |
184 | ldx [%g1], %g2 | |
185 | setx 0x3000aa00, %g7, %g3 | |
186 | cmp %g3, %g2 | |
187 | bne test_fail | |
188 | nop | |
189 | ||
190 | ||
191 | ba test_pass | |
192 | nop | |
193 | ||
194 | ||
195 | ||
196 | /******************************************************* | |
197 | * Exit code | |
198 | *******************************************************/ | |
199 | ||
200 | test_pass: | |
201 | ta T_GOOD_TRAP | |
202 | ||
203 | test_fail: | |
204 | ta T_BAD_TRAP |