Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / mcu / n2_err_dram_Mem_Poisn.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_dram_Mem_Poisn.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_SW_Error 0x40
46#define DRAM_ERR_STAT_REG 0x8400000280
47#ifdef L2_0
48#define L2_BANK_ADDR 0x00
49#endif
50#ifdef L2_1
51#define L2_BANK_ADDR 0x40
52#endif
53
54
55
56#include "hboot.s"
57#include "asi_s.h"
58#include "err_defines.h"
59
60.text
61.global main
62.global My_Recoverable_Sw_error_trap
63
64
65main:
66
67
68 ! Boot code does not provide TLB translation for IO address space
69 ta T_CHANGE_HPRIV
70
71disable_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
78#ifdef MEM_POISN_Trap
79enable_err_reporting:
80 setx L2EE_PA0, %l0, %l1
81 ldx [%l1], %l2
82 mov 0x3, %l0
83 or %l2, %l0, %l2
84 stx %l2, [%l1]
85#endif
86
87clear_l2_ESR:
88 setx L2_ES_W1C_VALUE, %l0, %l1
89 setx L2ES_PA0, %l6, %g1
90 stx %l1, [%g1]
91
92
93set_L2_Direct_Mapped_Mode:
94 setx L2CS_PA0, %l6, %g1
95 add %g1,L2_BANK_ADDR,%g1
96 mov 0x2, %l0
97 stx %l0, [%g1]
98
99store_to_L2:
100 setx TEST_DATA1, %l0, %g5
101
102store_to_L2_way0:
103 setx 0x22000000, %l0, %g2
104 add %g2,L2_BANK_ADDR,%g2
105 stx %g5, [%g2]
106 membar #Sync
107
108clr %i7
109set 0x1f,%l7
110loop:
111inc %i7
112cmp %i7,%l7
113bne loop
114nop
115
116L2_diag_load:
117 setx 0x3ffff8, %l0, %l2 ! Mask for extracting [21:3]
118 setx L2_ENTRY_PA, %l0, %g4
119 and %g2, %l2, %g5
120 or %g5, %g4, %g5
121 ldx [%g5], %g6
122 membar #Sync
123
124! Flip two bits
125 xor %g6, 0x600, %g6
126 stx %g6, [%g5]
127 membar #Sync
128
129clr %i7
130set 0x7,%l7
131loop_diag:
132inc %i7
133cmp %i7,%l7
134bne loop_diag
135nop
136
137
138store_to_mem:
139 setx 0x33000000, %l0, %g2
140 add %g2,L2_BANK_ADDR,%g2
141 stx %g5, [%g2]
142 membar #Sync
143
144clr %i7
145set 0xf,%l7
146loop_mem:
147inc %i7
148cmp %i7,%l7
149bne loop_mem
150nop
151
152load_UEdata:
153 setx 0x22000000, %l0, %g2
154 add %g2,L2_BANK_ADDR,%g2
155 ldx [%g2], %g3
156 membar #Sync
157
158clr %i7
159set 0xf,%l7
160loop_UE:
161inc %i7
162cmp %i7,%l7
163bne loop_UE
164nop
165
166
167enable_l1_DCache:
168 ldxa [%g0] ASI_LSU_CONTROL, %l0
169 or %l0, 0x2, %l0
170 stxa %l0, [%g0] ASI_LSU_CONTROL
171
172compute_error:
173 mov 0x1, %l1
174 sllx %l1, L2ES_LDWU, %l7
175 sllx %l1, L2ES_VEU, %l3
176 or %l7, %l3, %l7
177 ! sllx %l1, L2ES_RW, %l3
178 ! or %l7, %l3, %l7
179 membar #Sync
180
181
182check_l2_ESR:
183 setx L2ES_PA0, %l6, %g1
184 add %g1,L2_BANK_ADDR,%g1
185 ldx [%g1], %l4
186 membar #Sync
187
188! Not Checking SYND in this test
189 set 0xffffffff, %l3
190 andn %l4, %l3, %l4
191
192verify_ESR:
193 cmp %l7, %l4
194 bne test_fail
195 nop
196 nop
197
198
199check_l2_EAR:
200 setx L2EA_PA0, %l6, %l3
201 add %l3,L2_BANK_ADDR,%l3
202 ldx [%l3], %l4
203 membar #Sync
204
205
206verify_EAR:
207 setx 0x22000000, %l0, %g2
208 add %g2,L2_BANK_ADDR,%g2
209
210 cmp %g2, %l4
211 bne test_fail
212 nop
213
214check_DRAM_ESR_0:
215 setx DRAM_ERR_STAT_REG, %l3, %g5
216 ldx [%g5], %l6
217 setx 0xffc000000000ffff, %l0,%o2
218 and %l6,%o2,%l6
219
220compute_dram_ESR:
221 mov 0x1, %l1
222 sllx %l1, DRAM_ES_DAU, %l0 ! %l0 has expected value
223 set 0x8221,%l3
224 or %l0,%l3,%l0
225
226verify_dram_ESR:
227 cmp %l0, %l6
228 bne %xcc, test_fail
229 nop
230
231#ifdef MEM_POISN_Trap
232 ! Check if a Software Recoverable Error Trap happened
233 set EXECUTED, %l0
234 cmp %o0, %l0
235 bne test_fail
236 nop
237 mov TT_SW_Error, %l0
238 cmp %o1, %l0
239 bne test_fail
240 nop
241#endif
242
243 ba test_pass
244 nop
245
246My_Recoverable_Sw_error_trap:
247 ! Signal trap taken
248 setx EXECUTED, %l0, %o0
249 ! save trap type value
250 rdpr %tt, %o1
251// retry
252 done
253 nop
254
255
256
257/*******************************************************
258 * Exit code
259 *******************************************************/
260
261test_pass:
262ta T_GOOD_TRAP
263
264test_fail:
265ta T_BAD_TRAP
266
267