Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / mcu / n2_err_dram_DAU_2L2banks.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_dram_DAU_2L2banks.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 H_HT0_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap
39
40
41#define MAIN_PAGE_NUCLEUS_ALSO
42#define MAIN_PAGE_HV_ALSO
43
44#define DRAM_ERR_INJ_REG 0x8400000290
45#define DRAM_ERR_STAT_REG 0x8400000280
46#define L2_ERR_STAT_REG 0xAB00000000
47#define L2_ERR_STAT_REG1 0xAB00000040
48#define L2_ERR_ADDR_REG 0xAC00000000
49
50#define TT_SW_Error 0x40
51
52
53#define ERROR_ADDR 0x20200000
54#define TEST_DATA0 0x1000100081c3e008
55#define TEST_DATA1 0x2000200081c3e008
56#define TEST_DATA2 0x3000300081c3e008
57#define L2_ES_W1C_VALUE 0xc03ffff800000000
58#define DRAM_ES_W1C_VALUE 0xfe00000000000000
59
60#include "hboot.s"
61#include "asi_s.h"
62#include "err_defines.h"
63
64
65.text
66.global main
67.global My_Recoverable_Sw_error_trap
68
69
70
71
72main:
73 ta T_CHANGE_HPRIV
74disable_l1:
75 ldxa [%g0] ASI_LSU_CONTROL, %l0
76 ! Remove the lower 2 bits (I-Cache and D-Cache enables)
77 andn %l0, 0x3, %l0
78 stxa %l0, [%g0] ASI_LSU_CONTROL
79
80
81clear_dram_esr_0:
82 ! Clear DRAM Error status register (Bit[63:57] write-1-clear)
83 setx DRAM_ES_W1C_VALUE, %l0, %g4
84 setx DRAM_ERR_STAT_REG, %l3, %g5
85 stx %g4, [%g5]
86
87set_DRAM_error_inject_ch0:
88 mov 0x606, %l1 ! ECC Mask (2-bit error)
89 mov 0x1, %l2
90 sllx %l2, DRAM_EI_SSHOT, %l3
91 Or %l1, %l3, %l1 ! Set single shot ;
92 mov 0x1, %l2
93 sllx %l2, DRAM_EI_ENB, %l3
94 or %l1, %l3, %l1 ! Enable error injection for the next write
95 setx DRAM_ERR_INJ_REG, %l3, %g6
96 stx %l1, [%g6]
97 membar 0x40
98
99enable_err_reporting:
100 setx L2EE_PA0, %l0, %l1
101 ldx [%l1], %l2
102 mov 0x3, %l0
103 or %l2, %l0, %l2
104 ! stx %l2, [%l1]
105
106 ! Write 1 to clear L2 Error status registers
107clear_l2_ESR:
108 setx L2ES_PA0, %l3, %l4
109 stx %g4, [%l4]
110 nop
111
112store_to_L2:
113 setx TEST_DATA1, %l0, %g5
114
115
116set_L2_Directly_Mapped_Mode:
117 setx L2CS_PA0, %l6, %g1
118 mov 0x2, %l0
119 stx %l0, [%g1]
120
121
122store_to_L2_way0:
123 setx 0x2020aa00, %l0, %g2 ! bits [21:18] select way
124 stx %g5, [%g2]
125 stx %g5, [%g2+8]
126 membar #Sync
127
128! Storing to same L2 way0 but different tag,this will write to mcu
129write_mcu_channel_0:
130 setx 0x2010aa00, %l0, %g3 ! bits [21:18] select way
131 stx %g5, [%g3]
132 stx %g5, [%g3+8]
133 membar #Sync
134
135
136read_error_address_L20:
137! stx %g5, [%g2]
138 ldx [%g2], %l1
139 membar #Sync
140
141read_error_address_L21:
142 setx 0x2020aa40, %l0, %g2 ! bits [21:18] select way
143 ldx [%g2], %l1
144 membar #Sync
145! ldx [%g3], %l2
146! membar #Sync
147
148
149check_DRAM_ESR:
150 setx DRAM_ERR_STAT_REG, %l3, %g5
151 ldx [%g5], %l6
152 setx 0xffc0000000000000, %l0,%o2
153 and %l6,%o2,%l6
154
155compute_dram_ESR:
156 mov 0x1, %l1
157 sllx %l1, DRAM_ES_DAU, %l0 ! %l0 has expected value
158
159verify_dram_ESR:
160 cmp %l0, %l6
161 bne %xcc, test_fail
162 nop
163
164check_L2_ESR_0:
165 setx L2_ERR_STAT_REG, %l3, %g5
166 ldx [%g5], %l6
167 setx L2_ERR_STAT_REG1, %l3, %g5
168 ldx [%g5], %l5
169
170compute_L2_ESR:
171 setx 0xfffffffff0000000, %l3, %l0
172 andcc %l0, %l6, %l5 ! Donot check L2ESR SYND bits
173 mov 0x1, %l1
174 sllx %l1, L2ES_DAU, %l0
175 mov 0x1, %l1
176 sllx %l1, L2ES_VEU, %l2
177 or %l0, %l2, %l3
178
179verify_L2_ESR:
180 cmp %l5, %l3
181 bne %xcc, test_fail
182 nop
183
184
185 setx L2EA_PA0, %l2, %l3
186check_l2_EAR:
187 ldx [%l3], %l4
188 ! Error address is the physical address of the cache line
189 setx 0x2020aa00, %l0, %l1 ! bits [21:18] select way
190 setx 0xffffffffc0, %l0,%o2
191 and %l4, %o2, %l4
192
193 cmp %l4, %l1
194 !bne %xcc, test_fail
195 nop
196
197
198check_sw_err_trap:
199 ! Check if a Software Recoverable Error Trap happened
200 set EXECUTED, %l0
201 cmp %o0, %l0
202 !bne test_fail
203 nop
204 mov TT_SW_Error, %l0
205 cmp %o1, %l0
206 !bne test_fail
207 nop
208
209
210 ba test_pass
211 nop
212
213
214My_Recoverable_Sw_error_trap:
215 ! Signal trap taken
216 setx EXECUTED, %l0, %o0
217 ! save trap type value
218 rdpr %tt, %o1
219 retry
220 nop
221
222/*******************************************************
223 * Exit code
224 *******************************************************/
225
226test_pass:
227ta T_GOOD_TRAP
228
229
230test_fail:
231ta T_BAD_TRAP
232
233
234