Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / l2 / n2_err_l2_LTC_4bnk_cecc_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_l2_LTC_4bnk_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
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
54main:
55
56 ! Boot code does not provide TLB translation for IO address space
57 ta T_CHANGE_HPRIV
58
59disable_l1_DCache:
60 ldxa [%g0] ASI_LSU_CONTROL, %l0
61 ! Remove bit 2
62 andn %l0, 0x2, %l0
63 stxa %l0, [%g0] ASI_LSU_CONTROL
64
65enable_err_reporting:
66 setx L2EE_PA0, %l0, %l1
67 ldx [%l1], %l2
68 mov 0x3, %l0
69 or %l2, %l0, %l2
70 stx %l2, [%l1]
71
72
73clear_l2_ESR:
74 setx L2_ES_W1C_VALUE, %l0, %l1
75 setx L2ES_PA0, %l6, %g1
76 stx %l1, [%g1]
77
78
79set_L2_Directly_Mapped_Mode:
80 setx L2CS_PA0, %l6, %g1 ! Bit 1 in L2 Control Status Register
81 mov 0x2, %l0
82 stx %l0, [%g1]
83
84store_to_L2:
85 setx TEST_DATA1, %l0, %g5
86
87store_to_L2_way0:
88 set 0xaa81f000, %g2 ! bits [16:8] select index in 4 bank mode
89 stx %g5, [%g2]
90 stx %g5, [%g2+8]
91 membar #Sync
92
93clr %g1
94mov 0x9,%l0
95loop:
96inc %g1
97cmp %g1,%l0
98bne loop
99nop
100
101
102L2_diag_load:
103 setx 0xa40003e000,%l0,%g5
104 ldx [%g5], %g6
105 membar #Sync
106
107! Flip one bits to inject error
108 xor %g6, 0x200, %g6
109 stx %g6, [%g5]
110 membar #Sync
111
112!This should cause LTC
113reading_back_0: !Load to L2 again to get the LTC logged in ESR
114 ldx [%g2], %l6
115 membar #Sync
116
117clr %g1
118mov 0x9,%l0
119loop1:
120inc %g1
121cmp %g1,%l0
122bne loop1
123nop
124
125
126end_of_first_LTC_inject:
127nop
128
129fill:
130 set 0xaaaff000, %g2 ! bits [16:8] select index in 4 bank mode
131 stx %g5, [%g2]
132 stx %g5, [%g2+8]
133 membar #Sync
134
135clr %g1
136mov 0x9,%l0
137loop2:
138inc %g1
139cmp %g1,%l0
140bne loop2
141nop
142
143ldx_to_same_index_no_LTC:
144 set 0xaa81f000, %g2 ! bits [16:8] select index in 4 bank mode
145 ldx [%g2],%g5
146 membar #Sync
147
148
149clr %g1
150mov 0x9,%l0
151loop3:
152inc %g1
153cmp %g1,%l0
154bne loop3
155nop
156
157compute_error:
158 mov 0x1, %l1
159 sllx %l1, L2ES_LTC, %l7
160 sllx %l1, L2ES_VEC, %l3
161 or %l7, %l3, %l7
162
163check_l2_ESR:
164 setx L2ES_PA0, %l6, %g1
165 ldx [%g1], %l4
166 membar #Sync
167
168 cmp %l7, %l4
169 bne test_fail
170 nop
171
172
173check_l2_EAR:
174 setx L2EA_PA0, %l6, %l3
175 ldx [%l3], %l4
176 membar #Sync
177
178 set 0xaa81f000, %g2 ! bits [16:8] select index in 4 bank mode
179 cmp %g2, %l4
180 bne test_fail
181 nop
182 ! Check if a Corrected ECC Trap happened
183check_error_trap:
184 setx EXECUTED, %l1, %l0
185 cmp %o0, %l0
186 bne test_fail
187 nop
188 mov TT_Corrected_ECC, %l0
189 cmp %o1, %l0
190 bne test_fail
191 nop
192
193 ba test_pass
194 nop
195
196
197
198/*******************************************************
199 * Exit code
200 *******************************************************/
201
202test_pass:
203ta T_GOOD_TRAP
204
205test_fail:
206ta T_BAD_TRAP