Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / l2 / n2_err_l2_LDAU_MEU_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_l2_LDAU_MEU_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 H_HT0_Data_access_error_0x32 My_Precise_data_access_error_trap
39
40
41#define MAIN_PAGE_HV_ALSO
42
43
44#define L2_ENTRY_PA 0xa000000000
45#define TEST_DATA1 0x5555555555555555
46#define L2_ENTRY_PA0 0x2020000008
47#define L2_ES_W1C_VALUE 0xc03ffff800000000
48
49#include "hboot.s"
50#include "asi_s.h"
51#include "err_defines.h"
52
53.text
54.global main
55.global My_Precise_data_access_error_trap
56
57main:
58
59
60 ! Boot code does not provide TLB translation for IO address space
61 ta T_CHANGE_HPRIV
62
63disable_l1_DCache:
64 ldxa [%g0] ASI_LSU_CONTROL, %l0
65 ! Remove bit 2
66 andn %l0, 0x2, %l0
67 stxa %l0, [%g0] ASI_LSU_CONTROL
68
69enable_err_reporting:
70 setx L2EE_PA0, %l0, %l1
71! ldx [%l1], %l2
72 mov 0x3, %l0
73 or %l2, %l0, %l2
74! stx %l2, [%l1]
75
76clear_l2_ESR:
77 setx L2_ES_W1C_VALUE, %l0, %l1
78 setx L2ES_PA0, %l6, %g1
79 stx %l1, [%g1]
80
81
82set_L2_Directly_Mapped_Mode:
83 setx L2CS_PA0, %l6, %g1
84 mov 0x2, %l0
85 stx %l0, [%g1]
86
87store_to_L2:
88 setx TEST_DATA1, %l0, %g5
89
90store_to_L2_way0:
91 setx 0x202000aa00, %l0, %g2
92 stx %g5, [%g2]
93 stx %g5, [%g2+8]
94 membar #Sync
95
96L2_diag_load:
97 setx 0x3ffff8, %l0, %l2 ! Mask for extracting [21:3]
98 setx L2_ENTRY_PA, %l0, %g4
99 and %g2, %l2, %g5
100 or %g5, %g4, %g5
101 ldx [%g5], %g6
102 membar #Sync
103
104! Flip two bits
105 xor %g6, 0x600, %g6
106 stx %g6, [%g5]
107 membar #Sync
108
109reading_back_0:
110 setx 0x202000aa00, %l0, %g2
111 ldx [%g2], %l6
112
113ldsw:
114 nop; !$EV trig_pc_d(0,@VA(.MAIN.ldsw)) -> siuDmaRd(202000aa00,2,0)
115 ldx [%g2], %l6
116 membar #Sync
117
118check_sw_err_trap:
119 ! Check if a Software Recoverable Error Trap happened
120 set EXECUTED, %l0
121 cmp %o0, %l0
122 bne test_fail
123 nop
124 mov TT_Data_Access_Error, %l0
125 cmp %o1, %l0
126 bne test_fail
127 nop
128
129
130enable_l1_DCache:
131 ldxa [%g0] ASI_LSU_CONTROL, %l0
132 or %l0, 0x2, %l0
133 stxa %l0, [%g0] ASI_LSU_CONTROL
134
135compute_error:
136 mov 0x1, %l1
137 sllx %l1, L2ES_MEU, %l7
138 sllx %l1, L2ES_VEU, %l3
139 or %l7, %l3, %l7
140 !mov 0x46, %l1 ! 7-bit Syndrome
141 !sllx %l1, 21, %l3 ! Syndrome for [127:96] at [27:21]
142 !or %l7, %l3, %l7
143 !sllx %g4, L2ES_TID, %l3 ! ID of thread that encountered error
144 !or %l7, %l3, %l7 ! %l7 has expected value
145 membar #Sync
146
147
148check_l2_ESR:
149 setx L2ES_PA0, %l6, %g1
150 ldx [%g1], %l4
151 membar #Sync
152
153! Not Checking SYND in this test
154 set 0xffffffff, %l3
155 andn %l4, %l3, %l4
156 cmp %l7, %l4
157 bne test_fail
158 nop
159 nop
160
161
162check_l2_EAR:
163 setx L2EA_PA0, %l6, %l3
164 ldx [%l3], %l4
165 membar #Sync
166
167
168load_DESR_L2C:
169 set 0x18, %g3
170 ldxa [%g3] 0x58, %g2
171
172verify_DESR:
173 set 0xf, %l1
174 and %g2, %l1, %l3
175 mov 0x1, %l5
176 cmp %l5, %l3
177 bne test_fail
178 nop
179
180
181 ba test_pass
182 nop
183
184My_Precise_data_access_error_trap:
185 ! Signal trap taken
186 setx EXECUTED, %l0, %o0
187 ! save trap type value
188 rdpr %tt, %o1
189 ba check_sw_err_trap
190 nop
191
192
193
194/*******************************************************
195 * Exit code
196 *******************************************************/
197
198test_pass:
199ta T_GOOD_TRAP
200
201test_fail:
202ta T_BAD_TRAP
203