Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / vec / n2_ras_vec_l2_notdata_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_ras_vec_l2_notdata_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_NUCLEUS_ALSO
39#define MAIN_PAGE_HV_ALSO
40
41#define L2_ERR_STAT_REG 0xAB00000000
42#define L2_ERR_ADDR_REG 0xAC00000000
43#define L2_NDDM_REG 0xAE00000000
44
45#define TT_SW_Error 0x40
46
47
48#define ERROR_ADDR 0x20200000
49#define TEST_DATA0 0x1000100081c3e008
50#define TEST_DATA1 0x2000200081c3e008
51#define TEST_DATA2 0x3000300081c3e008
52#define L2_ES_W1C_VALUE 0xc03ffffc00000000
53#define DRAM_ES_W1C_VALUE 0xfe00000000000000
54
55#ifdef L20
56#define L2_BANK_ADDR 0x0
57#define DRAM_ERR_INJ_REG 0x8400000290
58#define DRAM_ERR_STAT_REG 0x8400000280
59#endif
60
61#ifdef L21
62#define L2_BANK_ADDR 0x40
63#define DRAM_ERR_INJ_REG 0x8400000290
64#define DRAM_ERR_STAT_REG 0x8400000280
65#endif
66
67#ifdef L22
68#define L2_BANK_ADDR 0x80
69#define DRAM_ERR_INJ_REG 0x8400001290
70#define DRAM_ERR_STAT_REG 0x8400001280
71#endif
72
73#ifdef L23
74#define L2_BANK_ADDR 0xc0
75#define DRAM_ERR_INJ_REG 0x8400001290
76#define DRAM_ERR_STAT_REG 0x8400001280
77#endif
78#ifdef L24
79#define L2_BANK_ADDR 0x100
80#define DRAM_ERR_INJ_REG 0x8400002290
81#define DRAM_ERR_STAT_REG 0x8400002280
82#endif
83#ifdef L25
84#define L2_BANK_ADDR 0x140
85#define DRAM_ERR_INJ_REG 0x8400002290
86#define DRAM_ERR_STAT_REG 0x8400002280
87
88#endif
89
90#ifdef L26
91#define L2_BANK_ADDR 0x180
92#define DRAM_ERR_INJ_REG 0x8400003290
93#define DRAM_ERR_STAT_REG 0x8400003280
94
95#endif
96
97#ifdef L27
98#define L2_BANK_ADDR 0x1c0
99#define DRAM_ERR_INJ_REG 0x8400003290
100#define DRAM_ERR_STAT_REG 0x8400003280
101
102#endif
103
104#include "hboot.s"
105#include "asi_s.h"
106#include "err_defines.h"
107
108
109.text
110.global main
111
112
113
114
115main:
116
117 ta T_CHANGE_HPRIV
118
119
120disable_l1:
121 ldxa [%g0] ASI_LSU_CONTROL, %l0
122 ! Remove the lower 2 bits (I-Cache and D-Cache enables)
123 andn %l0, 0x3, %l0
124 stxa %l0, [%g0] ASI_LSU_CONTROL
125
126 setx 0x20040000, %l0, %g6
127
128
129clear_dram_esr_0:
130 ! Clear DRAM Error status register (Bit[63:57] write-1-clear)
131 setx DRAM_ES_W1C_VALUE, %l0, %g4
132 setx DRAM_ERR_STAT_REG, %l3, %g5
133 stx %g4, [%g5]
134
135set_DRAM_error_inject_ch0:
136 mov 0x602, %l1 ! ECC Mask (2-bit error)
137 mov 0x1, %l2
138 sllx %l2, DRAM_EI_SSHOT, %l3
139 Or %l1, %l3, %l1 ! Set single shot ;
140 mov 0x1, %l2
141 sllx %l2, DRAM_EI_ENB, %l3
142 or %l1, %l3, %l1 ! Enable error injection for the next write
143 setx DRAM_ERR_INJ_REG, %l3, %g5
144 stx %l1, [%g5]
145 membar 0x40
146
147!enable_err_reporting:
148! setx L2EE_PA0, %l0, %l1
149! ldx [%l1], %l2
150! mov 0x3, %l0
151! or %l2, %l0, %l2
152! stx %l2, [%l1]
153
154 ! Write 1 to clear L2 Error status registers
155clear_l2_ESR:
156 setx L2ES_PA0, %l3, %l4
157 add %l4, L2_BANK_ADDR, %l4
158 stx %g4, [%l4]
159 nop
160
161store_to_L2:
162 setx TEST_DATA1, %l0, %g5
163
164
165set_L2_Directly_Mapped_Mode_errorsteer:
166 setx L2CS_PA0, %l6, %g1
167 ldx [%g1], %o6
168
169 mov 0x2, %o5 ! L2_CSR_REG<1>=1 => DM mode
170
171 ldxa [%g0]ASI_INTR_ID, %o4 ! get the thread id; for core-portable
172 sllx %o4, 15, %o4 ! L2_CSR_REG<21:15> = ERROR_STEER
173
174 or %o5, %o4, %o5
175
176 or %o6, %o5, %o6
177
178 stx %o6, [%g1]
179 membar 0x40
180
181
182store_to_L2_way0:
183 setx 0x2000aa00, %l0, %g2 ! bits [21:18] select way
184 add %g2, L2_BANK_ADDR, %g2
185 stx %g5, [%g2]
186 stx %g5, [%g2+8]
187 membar #Sync
188
189! Storing to same L2 way0 but different tag,this will write to mcu
190write_mcu_channel_0:
191 setx 0x1000aa00, %l0, %g3 ! bits [21:18] select way
192 add %g3, L2_BANK_ADDR, %g3
193 stx %g5, [%g3]
194 stx %g5, [%g3+8]
195 membar #Sync
196
197read_error_address_ch0:
198 ldx [%g2], %l1
199 membar #Sync
200
201enable_err_reporting:
202 setx L2EE_PA0, %l0, %l1
203 add %l1, L2_BANK_ADDR, %l1
204 ldx [%l1], %l2
205 mov 0x3, %l0
206 or %l2, %l0, %l2
207 stx %l2, [%l1]
208
209
210clr %i7
211set 0xf,%l7
212loop:
213 inc %i7
214 cmp %i7,%l7
215 bne loop
216 nop
217
218
219read_error_address_ch0_meu:
220 ldx [%g2], %l1
221 membar #Sync
222
223miss_for_trap:
224 setx 0x3000ca00, %l3, %g5
225 add %g5, L2_BANK_ADDR, %g5
226 ldx [%g5],%g4 ! Store miss to create fill, thus an error trap
227 membar #Sync
228
229
230check_DRAM_ESR_0:
231 setx DRAM_ERR_STAT_REG, %l3, %g5
232 ldx [%g5], %l6
233
234compute_dram_ESR:
235 setx 0xffffffffffff0000, %l0,%o2
236 and %l6,%o2,%l6
237 mov 0x1, %l1
238 sllx %l1, DRAM_ES_DAU, %l0
239
240verify_dram_ESR:
241 cmp %l0, %l6
242 bne %xcc, test_fail
243 nop
244
245check_L2_ESR_0:
246 setx L2_ERR_STAT_REG, %l3, %g5
247 add %g5, L2_BANK_ADDR, %g5
248 ldx [%g5], %l6
249
250compute_L2_ESR:
251 setx 0xf1fffffff0000000, %l3, %l0 ! MSA; ignore CoreID -> <59:57>; TH_ID <56:54> should be OK
252 andcc %l0, %l6, %l5 ! Donot check L2ESR SYND bits
253
254 mov 0x1, %l1
255 sllx %l1, L2ES_DAU, %l0
256 mov 0x1, %l1
257 sllx %l1, L2ES_VEU, %l2
258 or %l0, %l2, %l3
259
260verify_L2_ESR:
261 cmp %l5, %l3
262 bne %xcc, test_fail
263 nop
264
265check_notData_reg:
266 setx L2_NDDM_REG, %l3, %g5
267 add %g5, L2_BANK_ADDR, %g5
268 ldx [%g5], %l6
269
270compute_notData_reg:
271 setx 0xa00002000aa00, %l0, %l1
272 add %l1, L2_BANK_ADDR, %l1
273 setx 0xfc7fffffffff0, %l0,%o2 ! MSA; ignore CoreID -> <45:43>; TH_ID <42:40> should be OK
274 and %l6, %o2, %l6
275 cmp %l6, %l1
276 bne %xcc, test_fail
277 nop
278
279 setx L2EA_PA0, %l2, %l3
280 add %l3, L2_BANK_ADDR, %l3
281check_l2_EAR:
282 ldx [%l3], %l4
283 setx 0x2000aa00, %l0, %l1 ! bits [21:18] select way
284 add %l1, L2_BANK_ADDR, %l1
285
286 setx 0xffffffffc0, %l0,%o2 ! Error address is the physical address of the cache line (PA[39:6])
287 and %l4, %o2, %l4
288 cmp %l4, %l1
289 bne %xcc, test_fail
290 nop
291
292
293 ba test_pass
294 nop
295
296/*******************************************************
297 * Exit code
298 *******************************************************/
299
300test_pass:
301ta T_GOOD_TRAP
302
303
304test_fail:
305ta T_BAD_TRAP
306