Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / vec / n2_ras_vec_ncu_peu_piord_trap.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_ras_vec_ncu_peu_piord_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_Data_access_error_trap
39
40#define ENABLE_PCIE_LINK_TRAINING
41#define MAIN_PAGE_HV_ALSO
42
43#define SOC_ERR_STEERING_REG 0x9001041000
44
45#include "err_defines.h"
46#include "hboot.s"
47#include "peu_defines.h"
48
49
50#define IO_RD_ADDR mpeval((N2_PCIE_BASE_ADDR + (IOCFG_OFFSET_BASE_REG_DATA & 0x7fffffffffffffff)) | IO_ACCESS_PA)
51
52
53/************************************************************************
54 Test case code start
55 ************************************************************************/
56.text
57.global main
58.global My_Data_access_error_trap
59
60main:
61 ta T_CHANGE_HPRIV
62 nop
63
64
65errorsteer:
66 ldxa [%g0]ASI_INTR_ID, %o4 ! get the thread id; for core-portable
67 setx SOC_ERR_STEERING_REG, %g7, %g1
68 stx %o4, [%g1]
69
70 membar 0x40
71
72
73
74clear_esr_first:
75 setx SOC_ESR_REG, %l7, %i0
76 stx %g0, [%i0]
77
78
79set_err_field:
80 set 0x1, %i1
81 sllx %i1, ERR_FIELD, %i2
82 setx SOC_EIE_REG, %l7, %i3
83
84#ifdef EIE
85set_eie:
86 stx %i2, [%i3]
87 membar 0x40
88#endif
89
90set_ejr:
91 setx SOC_EJR_REG, %l7, %i3
92 stx %i2, [%i3]
93 membar 0x40
94
95pio:
96 ! select an IO address in PCI address range and transmit the command to NCU
97 setx IO_RD_ADDR, %g1, %g2
98
99 ! load byte - all byte offsets within an octlet
100 ldub [%g2 + 1*8 + 0], %l0
101
102 setx 0x40, %l1, %g4
103delay_loop:
104 nop
105 nop
106 nop
107 dec %g4
108 brnz %g4, delay_loop
109 nop
110
111
112
113 /******************************
114 Error Check
115 ******************************/
116err_check:
117 nop
118
119check_esr:
120 setx SOC_ESR_REG, %l7, %i0
121 ldx [%i0], %i1
122 nop
123
124 setx 0x8000000000000000, %l7, %o3 !valid bit
125 set 0x1, %i2
126 sllx %i2, ERR_FIELD, %i3
127 or %i3, %o3, %i4
128
129 /* It will take trap whether EIE enabled or not as ld return data has the error bit set
130 But if EIE is not set ESR data will not be copied to PER
131 If EIE is set ESR data will be copied to ESR
132
133 But for EIE set, ESR data might not be zero if followed by transaction
134 again causes the error to be set; though in this case ESR should be zero
135 as we dont have any following DMU PIO transaction, so no more error and esr is zero
136 */
137
138#ifdef EIE
139 sub %i1, %g0, %i5
140 brnz %i5, test_failed
141 nop
142#else
143 sub %i1, %i4, %i5
144 brnz %i5, test_failed
145 nop
146#endif
147
148
149
150 ! Check if a Corrected ECC Trap happened
151check_error_trap:
152 setx EXECUTED, %l1, %l0
153 cmp %o0, %l0
154 bne test_failed
155 nop
156 mov TT, %l0
157 cmp %o1, %l0
158 bne test_failed
159 nop
160 /*************************************/
161
162 /********************************/
163
164test_passed:
165 EXIT_GOOD
166
167test_failed:
168 EXIT_BAD
169
170
171My_Data_access_error_trap:
172 ! Signal trap taken
173 setx EXECUTED, %l0, %o0
174 ! save trap type value
175 rdpr %tt, %o1
176
177 /******************************************************************************************
178 When EIE enabled 2 Int sent to Core: one is for precise trap; next for SoCErrorPkt
179 So both DESR and DSFSR are expected to be set but when EIE not set only DSFSR is to be set
180 *******************************************************************************************/
181#ifdef EIE
182check_desr_tt32:
183 ldxa [%g0]0x4c, %g2
184 nop
185 setx 0xb300000000000000, %l0, %g3
186 subcc %g2, %g3, %g4
187 brnz %g4, test_failed
188 nop
189#endif
190check_DSFSR_tt32:
191 set 0x18, %g1
192 ldxa [%g1]0x58, %g2
193 nop
194 set 0x4, %g3
195 subcc %g2, %g3, %g4
196 brnz %g4, test_failed
197 nop
198
199#ifdef EIE
200check_per_tt32:
201 setx SOC_PER_REG, %l7, %i0
202 ldx [%i0], %i1
203 setx 0x8000000000000000, %l7, %o3 !valid bit
204 set 0x1, %i2
205 sllx %i2, ERR_FIELD, %i3
206 or %i3, %o3, %i4
207 sub %i1, %i4, %i5
208 brnz %i5, test_failed
209 nop
210
211clear_per_tt32:
212 setx SOC_PER_REG, %l7, %i0
213 stx %g0, [%i0]
214 nop
215#endif
216
217 done
218 nop
219
220
221
222/************************************************************************
223 Test case data start
224************************************************************************/
225
226SECTION .DATA DATA_VA=IO_RD_ADDR
227attr_data {
228 Name = .DATA,
229 hypervisor,
230 compressimage
231}
232
233.data
234 .xword 0xdeadbeefdeadbeef
235
236 .xword 0x1101010101010101
237 .xword 0x0122010101010101
238 .xword 0x0101330101010101
239 .xword 0x0101014401010101
240 .xword 0x0101010155010101
241 .xword 0x0101010101660101
242 .xword 0x0101010101017701
243 .xword 0x0101010101010188
244
245 .xword 0x1122010101010101
246 .xword 0x0101334401010101
247 .xword 0x0101010155660101
248 .xword 0x0101010101017788
249
250 .xword 0x1122334401010101
251 .xword 0x0101010155667788
252
253 .xword 0xdeadbeefdeadbeef
254
255/************************************************************************/