Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / l2 / n2_err_l2_LDAU_uecc_2thrds_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_l2_LDAU_uecc_2thrds_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
41#define L2_ENTRY_PA 0xa000000000
42#define TEST_DATA1 0x5555555555555555
43#define L2_ENTRY_PA0 0x2020000008
44#define L2_ES_W1C_VALUE 0xc03ffff800000000
45#define TT_Data_Access_Error 0x32
46
47#include "hboot.s"
48#include "asi_s.h"
49#include "err_defines.h"
50
51.text
52.global main
53
54main:
55
56
57 ! Boot code does not provide TLB translation for IO address space
58 ta T_CHANGE_HPRIV
59
60get_th_id_o0:
61 ta T_RD_THID
62
63 cmp %o1, 0x0
64 be main_t0
65 nop
66
67 cmp %o1, 0x1
68 be main_t1
69 nop
70
71ba test_pass
72nop
73
74main_t0:
75 ba L20_Init
76 nop
77
78
79main_t1:
80 nop
81 nop
82 nop
83 ba L21_Init
84 nop
85nop
86
87L20_Init:
88disable_l1_DCache:
89 ldxa [%g0] ASI_LSU_CONTROL, %l0
90 ! Remove bit 2
91 andn %l0, 0x2, %l0
92 stxa %l0, [%g0] ASI_LSU_CONTROL
93
94enable_err_reporting:
95 setx L2EE_PA0, %l0, %l1
96 ldx [%l1], %l2
97 mov 0x3, %l0
98 or %l2, %l0, %l2
99 stx %l2, [%l1]
100
101clear_l2_ESR:
102 setx L2_ES_W1C_VALUE, %l0, %l1
103 setx L2ES_PA0, %l6, %g1
104 stx %l1, [%g1]
105
106
107set_L2_Directly_Mapped_Mode:
108 setx L2CS_PA0, %l6, %g1
109 mov 0x2, %l0
110 stx %l0, [%g1]
111 set 0x100,%l1
112 add %g1,%l1,%g1
113 stx %l0, [%g1]
114
115
116check_th1_out_of_boot_code:
117 set 0x20040100, %g3
118 ldx [%g3],%l2
119 membar #Sync
120 set 0x11,%l1
121 cmp %l1,%l2
122 bne check_th1_out_of_boot_code
123 nop
124
125
126store_to_L2:
127 setx TEST_DATA1, %l0, %g5
128
129store_to_L2_way0:
130 set 0x2000aa08, %g2
131 stx %g5, [%g2]
132 membar #Sync
133
134 set 0x1e,%l1
135 clr %l2
136loop:
137 inc %l2
138 cmp %l1,%l2
139 bne loop
140 nop
141
142L2_diag_load:
143 set 0x3ffff8, %l2 ! Mask for extracting [21:3]
144 setx L2_ENTRY_PA, %l0, %g4
145 and %g2, %l2, %g5
146 or %g5, %g4, %g5
147 ldx [%g5], %g6
148 membar #Sync
149
150! Flip two bits
151 xor %g6, 0x600, %g6
152 stx %g6, [%g5]
153 membar #Sync
154
155 set 0x1e,%l1
156 clr %l2
157loop1:
158 inc %l2
159 cmp %l1,%l2
160 bne loop1
161 nop
162
163
164reading_back_0:
165 set 0x2000aa00, %g2
166 ldx [%g2], %l6
167 membar #Sync
168
169 set 0x1e,%l1
170 clr %l2
171loop2:
172 inc %l2
173 cmp %l1,%l2
174 bne loop2
175 nop
176
177
178indicate_err_injected:
179 set 0x200c0100, %g3
180 set 0x222,%l2
181 stx %l2,[%g3]
182
183
184check_dataAc_err_trap:
185 ! Check if a Software Recoverable Error Trap happened
186 set EXECUTED, %l0
187 cmp %o0, %l0
188 bne test_fail
189 nop
190 mov TT_Data_Access_Error, %l0
191 cmp %o1, %l0
192 bne test_fail
193 nop
194
195
196compute_error:
197 mov 0x1, %l1
198 sllx %l1, L2ES_LDAU, %l7
199 sllx %l1, L2ES_VEU, %l3
200 or %l7, %l3, %l7
201 sllx %l1, L2ES_MEU, %l3
202 or %l7, %l3, %l7
203
204check_l2_ESR:
205 setx L2ES_PA0, %l6, %g1
206 ldx [%g1], %l4
207 membar #Sync
208
209! Not Checking SYND in this test
210 set 0xffffffff, %l3
211 andn %l4, %l3, %l4
212 cmp %l7, %l4
213 bne test_fail
214 nop
215 nop
216
217
218check_l2_EAR:
219 setx L2EA_PA0, %l6, %l3
220 ldx [%l3], %l4
221 membar #Sync
222
223 ba test_pass
224nop
225
226! Thread 1 starts here
227/*********** Thread 1 *********/
228
229L21_Init:
230
231
232indicate_out_of_boot:
233 set 0x20040100, %g3
234 set 0x11,%l2
235 stx %l2,[%g3]
236
237check_th0_err_injected:
238 set 0x200c0100, %g3
239 ldx [%g3],%l2
240 membar #Sync
241 set 0x222,%l1
242 cmp %l1,%l2
243 bne check_th0_err_injected
244 nop
245
246reading_back_th1:
247 set 0x2000aa08, %g2
248 ldx [%g2], %l6
249 membar #Sync
250
251 set 0x1e,%l1
252 clr %l2
253loop3:
254 inc %l2
255 cmp %l1,%l2
256 bne loop3
257 nop
258
259check_dataAc_err_trap_th1:
260 ! Check if a Software Recoverable Error Trap happened
261 set EXECUTED, %l0
262 cmp %o0, %l0
263 bne test_fail
264 nop
265 mov TT_Data_Access_Error, %l0
266 cmp %o1, %l0
267 bne test_fail
268 nop
269
270compute_error_th1:
271 mov 0x1, %l1
272 sllx %l1, L2ES_LDAU, %l7
273 sllx %l1, L2ES_VEU, %l3
274 or %l7, %l3, %l7
275 sllx %l1, L2ES_MEU, %l3
276 or %l7, %l3, %l7
277
278check_l2_ESR_th1:
279 setx L2ES_PA0, %l6, %g1
280 ldx [%g1], %l4
281 membar #Sync
282
283! Not Checking SYND in this test
284 set 0xffffffff, %l3
285 andn %l4, %l3, %l4
286 cmp %l7, %l4
287 bne test_fail
288 nop
289 nop
290
291
292check_l2_EAR_th1:
293 setx L2EA_PA0, %l6, %l3
294 ldx [%l3], %l4
295 membar #Sync
296
297
298 ba test_pass
299 nop
300
301
302/*******************************************************
303 * Exit code
304 *******************************************************/
305
306test_pass:
307ta T_GOOD_TRAP
308
309test_fail:
310ta T_BAD_TRAP
311
312