Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_L2_LVC_cecc_trap.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 | #define L2_ENTRY_PA 0x517590000 | |
41 | #define TEST_DATA 0x555555555555555 | |
42 | #define L2_ES_W1C_VALUE 0xc03ffff800000000 | |
43 | #define L2ES_LVC 34 | |
44 | ||
45 | ||
46 | #include "hboot.s" | |
47 | #include "asi_s.h" | |
48 | #include "err_defines.h" | |
49 | ||
50 | .text | |
51 | .global main | |
52 | .global My_Corrected_ECC_error_trap | |
53 | ||
54 | ||
55 | main: | |
56 | ||
57 | ||
58 | ! Boot code does not provide TLB translation for IO address space | |
59 | ta T_CHANGE_HPRIV | |
60 | ||
61 | setx L2_ES_W1C_VALUE, %l0, %g4 | |
62 | ||
63 | ! Now access L2 control and status registers | |
64 | disable_l1: | |
65 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
66 | ! Remove the lower 2 bits (I-Cache and D-Cache enables) | |
67 | andn %l0, 0x3, %l0 | |
68 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
69 | ||
70 | ! Write 1 to clear L2 Error status registers | |
71 | ||
72 | enable_err_reporting: | |
73 | setx L2EE_PA0, %l0, %l1 | |
74 | ldx [%l1], %l2 | |
75 | mov 0x1, %l0 | |
76 | or %l2, %l0, %l2 | |
77 | stx %l2, [%l1] | |
78 | ||
79 | clear_l2_ESR: | |
80 | setx L2ES_PA0, %l3, %l4 | |
81 | stx %g4, [%l4] | |
82 | nop | |
83 | ||
84 | ||
85 | set_L2_Directly_Mapped_Mode: | |
86 | setx L2CS_PA0, %l6, %g1 | |
87 | mov 0x2, %l0 | |
88 | stx %l0, [%g1] | |
89 | ||
90 | ||
91 | store_to_L2_way0: | |
92 | setx TEST_DATA, %l0, %g5 | |
93 | setx 0x2200aa00, %l0, %g1 | |
94 | stx %g5, [%g1] | |
95 | stx %g5, [%g1+8] | |
96 | membar #Sync | |
97 | ||
98 | ||
99 | generate_VD_addr: | |
100 | ! Generate L2 VD Diag read address | |
101 | ! Addressing: [39:32] See PRM, [22] 1 for V/D, [17:8] set, [7:6] bank, [2:0] = 0 | |
102 | setx 0x3ffc0, %l0, %l2 ! Mask for extracting [17:6] | |
103 | and %g1, %l2, %l7 | |
104 | ||
105 | mov 0xb6, %l0 | |
106 | sllx %l0, 32, %l0 ! Bits [39:32] | |
107 | or %l7, %l0, %l7 | |
108 | ||
109 | mov 0x1, %l0 | |
110 | sllx %l0, 22, %l0 ! Bit [22] | |
111 | or %l7, %l0, %l7 | |
112 | ||
113 | read_l2_VD_diag: | |
114 | ldx [%l7], %l6 | |
115 | ||
116 | ! Now confirm it is stored to way 0 | |
117 | setx 0xffff, %l0, %l2 ! Mask for [16:0] | |
118 | and %l6, %l2, %l6 ! Valid bits at [31:16] | |
119 | ||
120 | clr %g2 ! %g2 will store the "way" | |
121 | ||
122 | ! Direct comparison - avoid loops to save run time | |
123 | cmp %l6, 0x1 | |
124 | !bne test_fail | |
125 | nop | |
126 | ||
127 | way_found: | |
128 | ! Read L2 Data Diag - %g2 has the "way" | |
129 | ! Addressing: [39:32] See PRM, [22] odd/even word, [21:18] way, [17:8] set, [7:6] bank, [5:3] D-word, [2:0] = 0 | |
130 | setx 0x3fff8, %l0, %l2 ! Mask for extracting [17:3] | |
131 | and %g1, %l2, %g5 | |
132 | ||
133 | sllx %g2, 18, %l0 ! Position Way | |
134 | or %g5, %l0, %g5 | |
135 | ||
136 | mov 0xa3, %l0 | |
137 | sllx %l0, 32, %l0 ! Bits [39:32] | |
138 | or %g5, %l0, %g5 ! %g5 has L2 Data Diag addressing | |
139 | ||
140 | ||
141 | read_l2_data_diag: | |
142 | ldx [%g5], %g6 | |
143 | ||
144 | ! Flip one bit from the data field | |
145 | xor %g6, 0x80, %g6 ! save on %g6 for future reference | |
146 | write_back_with_error: | |
147 | stx %g6, [%g5] | |
148 | ||
149 | ! Now set allocate bits for all other 15 ways (to ensure a write-back later) | |
150 | set_allocate: | |
151 | mov 0x1, %l0 | |
152 | sllx %l0, 22, %l1 ! L2_VD and L2_UA addressing differ on bit 22 | |
153 | xor %l7, %l1, %l7 ! change %l7 from L2_VD to L2_UA address | |
154 | ||
155 | read_l2_UA_diag: | |
156 | ldx [%l7], %l6 | |
157 | ||
158 | sllx %l0, %g2, %l1 ! Shift "way" into its bit position | |
159 | not %l1 | |
160 | setx 0xffff,%l5, %g2 | |
161 | and %l1, %g2 , %l1 ! Allocate bits on [15:0] | |
162 | or %l6, %l1, %l6 ! Write 1 to all other 15 ways' allocate bits | |
163 | ||
164 | ! also need to set ECC bits for Allocate bits (Bits [38:32]) | |
165 | set_ECC_Allocate: | |
166 | mov 0x7f, %l0 | |
167 | sllx %l0, 32, %l0 | |
168 | xor %l6, %l0, %l1 | |
169 | or %l6, %l1, %l6 | |
170 | ||
171 | write_l2_UA_diag: | |
172 | stx %l6, [%l7] | |
173 | ||
174 | ||
175 | ! Now do another store with the same index but different tag - to force a Write-Back | |
176 | error_address: | |
177 | mov 0x1, %l0 | |
178 | sllx %l0, 28, %l0 | |
179 | xor %g1, %l0, %l1 ! Flip bit 28 of previous L2 entry PA | |
180 | ||
181 | ! This should cause L2 LDWC (bit 51) | |
182 | store_to_L2_with_error: | |
183 | st %g3, [%l1] | |
184 | membar #Sync | |
185 | ||
186 | enable_l1: | |
187 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
188 | or %l0, 0x3, %l0 | |
189 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
190 | ||
191 | ||
192 | ! Compute expected value of L2 error status register | |
193 | compute_expected_L2_ESR: | |
194 | mov 0x1, %l1 | |
195 | sllx %l1, L2ES_LVC, %l0 | |
196 | sllx %l1, L2ES_VEC, %l3 ! VEC bit | |
197 | or %l0, %l3, %l0 | |
198 | ||
199 | ||
200 | setx L2ES_PA0, %l2, %l3 | |
201 | ||
202 | ||
203 | check_l2_ESR: | |
204 | ldx [%l3], %l4 | |
205 | ||
206 | setx 0xff00000000, %l5,%g2 | |
207 | and %l4, %g2, %l4 | |
208 | cmp %l4, %l0 | |
209 | bne test_fail | |
210 | nop | |
211 | ||
212 | setx L2EA_PA0, %l2, %l3 | |
213 | check_l2_EAR: | |
214 | ldx [%l3], %l4 | |
215 | ||
216 | ! Error address is the physical address of the cache line (PA[5:0] 0) | |
217 | ! comparison to be added | |
218 | andn %g1, 0x3f, %l1 | |
219 | nop | |
220 | ||
221 | ||
222 | ! Check if a Corrected ECC Trap happened | |
223 | check_error_trap: | |
224 | setx EXECUTED, %l1, %l0 | |
225 | cmp %o0, %l0 | |
226 | bne test_fail | |
227 | nop | |
228 | mov TT_Corrected_ECC, %l0 | |
229 | cmp %o1, %l0 | |
230 | bne test_fail | |
231 | nop | |
232 | ||
233 | ba test_pass | |
234 | nop | |
235 | ||
236 | My_Corrected_ECC_error_trap: | |
237 | ! Signal trap taken | |
238 | setx EXECUTED, %l0, %o0 | |
239 | ! save trap type value | |
240 | rdpr %tt, %o1 | |
241 | // retry | |
242 | done | |
243 | nop | |
244 | ||
245 | /******************************************************* | |
246 | * Exit code | |
247 | *******************************************************/ | |
248 | ||
249 | test_pass: | |
250 | ta T_GOOD_TRAP | |
251 | ||
252 | test_fail: | |
253 | ta T_BAD_TRAP | |
254 | ||
255 |