Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / vec / n2_ras_vec_mcu_dau.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_ras_vec_mcu_dau.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 DRAM_ERR_INJ_REG 0x8400000290
42#define DRAM_ERR_STAT_REG 0x8400000280
43#define L2_ERR_STAT_REG 0xAB00000000
44#define L2_ERR_ADDR_REG 0xAC00000000
45
46#define ERROR_ADDR 0x20200000
47#define TEST_DATA0 0x1000100081c3e008
48#define TEST_DATA1 0x2000200081c3e008
49#define TEST_DATA2 0x3000300081c3e008
50#define L2_ES_W1C_VALUE 0xc03ffffc00000000
51#define DRAM_ES_W1C_VALUE 0xfe00000000000000
52
53#include "hboot.s"
54#include "asi_s.h"
55#include "err_defines.h"
56
57
58.text
59.global main
60
61
62main:
63 ta T_CHANGE_HPRIV
64disable_l1:
65 ldxa [%g0] ASI_LSU_CONTROL, %l0
66 ! Remove the lower 2 bits (I-Cache and D-Cache enables)
67 andn %l0, 0x3, %l0
68 stxa %l0, [%g0] ASI_LSU_CONTROL
69
70
71clear_dram_esr_0:
72 ! Clear DRAM Error status register (Bit[63:57] write-1-clear)
73 setx DRAM_ES_W1C_VALUE, %l0, %g4
74 setx DRAM_ERR_STAT_REG, %l3, %g5
75 stx %g4, [%g5]
76
77set_DRAM_error_inject_ch0:
78 mov 0x606, %l1 ! ECC Mask (2-bit error)
79 mov 0x1, %l2
80 sllx %l2, DRAM_EI_SSHOT, %l3
81 Or %l1, %l3, %l1 ! Set single shot ;
82 mov 0x1, %l2
83 sllx %l2, DRAM_EI_ENB, %l3
84 or %l1, %l3, %l1 ! Enable error injection for the next write
85 setx DRAM_ERR_INJ_REG, %l3, %g6
86 stx %l1, [%g6]
87 membar 0x40
88
89 ! Write 1 to clear L2 Error status registers
90clear_l2_ESR:
91 setx L2ES_PA0, %l3, %l4
92 stx %g4, [%l4]
93 nop
94
95store_to_L2:
96 setx TEST_DATA1, %l0, %g5
97
98
99set_L2_Directly_Mapped_Mode:
100 setx L2CS_PA0, %l6, %g1
101 mov 0x2, %l0
102 stx %l0, [%g1]
103
104
105store_to_L2_way0:
106 setx 0x2200aa00, %l0, %g2 ! bits [21:18] select way
107 stx %g5, [%g2]
108 stx %g5, [%g2+8]
109 membar #Sync
110
111! Storing to same L2 way0 but different tag,this will write to mcu
112write_mcu_channel_0:
113 setx 0x44000aa00, %l0, %g3 ! bits [21:18] select way
114 stx %g5, [%g3]
115 stx %g5, [%g3+8]
116 membar #Sync
117
118
119read_error_address_ch0:
120 stx %g5, [%g2]
121 membar #Sync
122! ldx [%g3], %l2
123! membar #Sync
124
125
126check_DRAM_ESR_0:
127 setx DRAM_ERR_STAT_REG, %l3, %g5
128 ldx [%g5], %l6
129 setx 0xffc0000000000000, %l0,%o2
130 and %l6,%o2,%l6
131
132compute_dram_ESR:
133 mov 0x1, %l1
134 sllx %l1, DRAM_ES_DAU, %l0 ! %l0 has expected value
135
136verify_dram_ESR:
137 cmp %l0, %l6
138 bne %xcc, test_fail
139 nop
140
141check_L2_ESR_0:
142 setx L2_ERR_STAT_REG, %l3, %g5
143 ldx [%g5], %l6
144
145compute_L2_ESR:
146 setx 0xf03ffffff0000000, %l3, %l0 ! excluding VCID check
147 andcc %l0, %l6, %l5 ! Donot check L2ESR SYND bits
148 mov 0x1, %l1
149 sllx %l1, L2ES_DAU, %l0
150 mov 0x1, %l1
151 sllx %l1, L2ES_VEU, %l2
152 or %l0, %l2, %l3
153
154verify_L2_ESR:
155 cmp %l5, %l3
156 bne %xcc, test_fail
157 nop
158
159
160 setx L2EA_PA0, %l2, %l3
161check_l2_EAR:
162 ldx [%l3], %l4
163 ! Error address is the physical address of the cache line
164 setx 0x2200aa00, %l0, %l1 ! bits [21:18] select way
165 setx 0xffffffffc0, %l0,%o2
166 and %l4, %o2, %l4
167 cmp %l4, %l1
168 bne %xcc, test_fail
169 nop
170
171
172
173 ba test_pass
174 nop
175
176/*******************************************************
177 * Exit code
178 *******************************************************/
179
180test_pass:
181ta T_GOOD_TRAP
182
183
184test_fail:
185ta T_BAD_TRAP
186
187
188