Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_l2_LTC_cecc.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 0xa400000000 | |
42 | #define TEST_DATA1 0x5555555555555555 | |
43 | #define L2_ENTRY_PA0 0x2020000008 | |
44 | #define L2_ES_W1C_VALUE 0xc03ffff800000000 | |
45 | ||
46 | #include "hboot.s" | |
47 | #include "asi_s.h" | |
48 | #include "err_defines.h" | |
49 | ||
50 | .text | |
51 | .global main | |
52 | ||
53 | main: | |
54 | ||
55 | ! Boot code does not provide TLB translation for IO address space | |
56 | ta T_CHANGE_HPRIV | |
57 | ||
58 | disable_l1_DCache: | |
59 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
60 | ! Remove bit 2 | |
61 | andn %l0, 0x2, %l0 | |
62 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
63 | ||
64 | clear_l2_ESR: | |
65 | setx L2_ES_W1C_VALUE, %l0, %l1 | |
66 | setx L2ES_PA0, %l6, %g1 | |
67 | stx %l1, [%g1] | |
68 | ||
69 | ||
70 | set_L2_Directly_Mapped_Mode: | |
71 | setx L2CS_PA0, %l6, %g1 ! Bit 1 in L2 Control Status Register | |
72 | mov 0x2, %l0 | |
73 | stx %l0, [%g1] | |
74 | ||
75 | store_to_L2: | |
76 | setx TEST_DATA1, %l0, %g5 | |
77 | ||
78 | store_to_L2_way0: | |
79 | setx 0x202000aa00, %l0, %g2 ! bits [21:18] select way | |
80 | stx %g5, [%g2] | |
81 | stx %g5, [%g2+8] | |
82 | membar #Sync | |
83 | ||
84 | clr %l6 | |
85 | set 0x9, %l5 | |
86 | loop: | |
87 | inc %l6 | |
88 | cmp %l6,%l5 | |
89 | bne loop | |
90 | nop | |
91 | ||
92 | ||
93 | ||
94 | L2_diag_load: | |
95 | setx 0x3ffff8, %l0, %l2 ! Mask for extracting [21:3] | |
96 | setx L2_ENTRY_PA, %l0, %g4 | |
97 | and %g2, %l2, %g5 !g2 has L2 PA, | |
98 | or %g5, %g4, %g5 !g5 now has Diagnostic Data Array address | |
99 | ldx [%g5], %g6 | |
100 | membar #Sync | |
101 | ||
102 | ! Flip one bits to inject error | |
103 | xor %g6, 0x200, %g6 | |
104 | stx %g6, [%g5] | |
105 | membar #Sync | |
106 | ||
107 | reading_back_0: !Load to L2 again to get the error | |
108 | setx 0x202000aa00, %l0, %g2 | |
109 | ldx [%g2], %l6 | |
110 | membar #Sync | |
111 | ||
112 | compute_error: | |
113 | mov 0x1, %l1 | |
114 | sllx %l1, L2ES_LTC, %l7 | |
115 | sllx %l1, L2ES_VEC, %l3 | |
116 | or %l7, %l3, %l7 | |
117 | ||
118 | ||
119 | check_l2_ESR: | |
120 | setx L2ES_PA0, %l6, %g1 | |
121 | ldx [%g1], %l4 | |
122 | membar #Sync | |
123 | ||
124 | cmp %l7, %l4 | |
125 | bne %xcc, test_fail | |
126 | ||
127 | ||
128 | check_l2_EAR: | |
129 | setx L2EA_PA0, %l6, %l3 | |
130 | ldx [%l3], %l4 | |
131 | membar #Sync | |
132 | ||
133 | setx 0x202000aa00, %l0, %g2 ! bits [21:18] select way | |
134 | cmp %g2, %l4 | |
135 | bne %xcc, test_fail | |
136 | nop | |
137 | ||
138 | setx TEST_DATA1, %l0, %g5 | |
139 | ||
140 | store_to_L2_mec: | |
141 | setx 0x303000aa00, %l0, %g2 ! bits [21:18] select way | |
142 | stx %g5, [%g2] | |
143 | stx %g5, [%g2+8] | |
144 | membar #Sync | |
145 | ||
146 | clr %l6 | |
147 | set 0x9, %l5 | |
148 | loop_mec: | |
149 | inc %l6 | |
150 | cmp %l6,%l5 | |
151 | bne loop_mec | |
152 | nop | |
153 | ||
154 | ||
155 | ||
156 | L2_diag_load_mec: | |
157 | setx 0x3ffff8, %l0, %l2 ! Mask for extracting [21:3] | |
158 | setx L2_ENTRY_PA, %l0, %g4 | |
159 | and %g2, %l2, %g5 !g2 has L2 PA, | |
160 | or %g5, %g4, %g5 !g5 now has Diagnostic Data Array address | |
161 | ldx [%g5], %g6 | |
162 | membar #Sync | |
163 | ||
164 | ! Flip one bits to inject error | |
165 | xor %g6, 0x200, %g6 | |
166 | stx %g6, [%g5] | |
167 | membar #Sync | |
168 | ||
169 | reading_back_For_mec: !Load to L2 again to get the error | |
170 | setx 0x303000aa00, %l0, %g2 | |
171 | ldx [%g2], %l6 | |
172 | membar #Sync | |
173 | ||
174 | enable_l1_DCache: | |
175 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
176 | or %l0, 0x2, %l0 | |
177 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
178 | ||
179 | compute_error_mec: | |
180 | mov 0x1, %l1 | |
181 | sllx %l1, L2ES_LTC, %l7 | |
182 | sllx %l1, L2ES_VEC, %l3 | |
183 | or %l7, %l3, %l7 | |
184 | sllx %l1, L2ES_MEC, %l3 | |
185 | or %l7, %l3, %l7 | |
186 | ||
187 | ||
188 | !Since L2 ESR is not cleared, the err will log MEC. | |
189 | check_l2_ESR_mec: | |
190 | setx L2ES_PA0, %l6, %g1 | |
191 | ldx [%g1], %l4 | |
192 | membar #Sync | |
193 | ||
194 | cmp %l7, %l4 | |
195 | bne %xcc, test_fail | |
196 | ||
197 | ! Since the EAR is not cleared it should have old err addr. | |
198 | check_l2_EAR_mec: | |
199 | setx L2EA_PA0, %l6, %l3 | |
200 | ldx [%l3], %l4 | |
201 | membar #Sync | |
202 | ||
203 | setx 0x202000aa00, %l0, %g2 ! bits [21:18] select way | |
204 | cmp %g2, %l4 | |
205 | bne %xcc, test_fail | |
206 | nop | |
207 | ||
208 | ba %xcc, test_pass | |
209 | nop | |
210 | ||
211 | ||
212 | /******************************************************* | |
213 | * Exit code | |
214 | *******************************************************/ | |
215 | ||
216 | test_pass: | |
217 | ta T_GOOD_TRAP | |
218 | ||
219 | test_fail: | |
220 | ta T_BAD_TRAP |