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