Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / adv / n2_err_adv_ncuctague.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_adv_ncuctague.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#define ENABLE_PCIE_LINK_TRAINING
41#define MAIN_PAGE_HV_ALSO
42#define SOC_EST_REG 0x9001041000
43
44#include "err_defines.h"
45#include "hboot.s"
46#include "peu_defines.h"
47
48
49#define IO_RD_ADDR mpeval((N2_PCIE_BASE_ADDR + (IOCFG_OFFSET_BASE_REG_DATA & 0x7fffffffffffffff)) | IO_ACCESS_PA)
50
51#define MEM_LOC1 0x42400000
52
53/************************************************************************
54 Test case code start
55 ************************************************************************/
56.text
57.global main
58.global My_Recoverable_Sw_error_trap
59
60
61main:
62 ta T_CHANGE_HPRIV
63 nop
64
65
66get_th_id_o0:
67 ta T_RD_THID
68
69 cmp %o1, 0x0
70 be main_t0
71 nop
72
73 cmp %o1, 0x1
74 be main_t1
75 nop
76
77
78 /**************************************
79 THREAD 0
80 **************************************/
81main_t0:
82 nop
83 setx MEM_LOC1, %g1, %g3
84 st %g0, [%g3]
85
86clear_esr_first:
87 setx SOC_ESR_REG, %l7, %i0
88 stx %g0, [%i0]
89
90
91set_ejr:
92 set 0x1, %i1
93 sllx %i1, ERR_FIELD, %i2
94 setx SOC_EJR_REG, %l7, %i3
95 stx %i2, [%i3]
96
97pio_addr:
98 ! select an IO address in PCI address range and transmit the command to NCU
99 setx IO_RD_ADDR, %g1, %g2
100
101st_mem1:
102 set 0x1, %g4
103 st %g4, [%g3]
104
105pio:
106 ! load byte - all byte offsets within an octlet
107 ldub [%g2 + 1*8 + 0], %l0
108 nop ! ld hangs and not completes
109
110 ba test_failed
111 nop
112
113
114
115 /**************************************
116 THREAD 1
117 **************************************/
118main_t1:
119 nop
120
121read_mem_loc:
122 setx MEM_LOC1, %l7, %i3
123 ldx [%i3], %o0
124 cmp %o0, %g0
125 be %xcc, read_mem_loc
126 nop
127
128delay:
129 ld [%i3+0x8], %o0
130 ld [%i3+0x10], %o0
131 ld [%i3+0x18], %o0
132 ld [%i3+0x20], %o0
133 ld [%i3+0x28], %o0
134 ld [%i3+0x30], %o0
135 ld [%i3+0x40], %o0
136
137
138 setx 0x8000000000000000, %g7, %g3 !valid bit
139 set 0x1, %g2
140 sllx %g2, ERR_FIELD, %g4
141 or %g3, %g4, %g5
142
143 set 0x100, %g1
144read_esr:
145 cmp %g1, %g0
146 be %xcc, test_failed ! Timeout check
147 nop
148
149 setx SOC_ESR_REG, %g7, %g3
150 ldx [%g3], %g6
151
152 dec %g1
153
154 cmp %g6, %g5
155 bne %xcc, read_esr
156 nop
157
158
159est_reg:
160 setx SOC_EST_REG, %g3, %g2
161 set 0x1, %g1
162 stx %g1, [%g2]
163 membar 0x40
164
165
166eie_reg_ones:
167 setx SOC_EIE_REG, %g3, %g2
168 set 0x1, %i1
169 sllx %i1, ERR_FIELD, %g1
170 stx %g1, [%g2]
171 membar 0x40
172
173 setx 0x40, %g7, %g6
174 set 0x1, %g1 ! 1 Trap
175err_trap_loop:
176 cmp %g6, %g0
177 be %xcc, test_failed
178 nop
179
180 cmp %g1, %i7
181 be %xcc, check_tt
182 nop
183
184 ba err_trap_loop
185 nop
186
187check_tt:
188 mov 0x40, %l0
189 cmp %o7, %l0
190 bne %xcc, test_failed
191 nop
192
193 /********************************/
194
195test_passed:
196 EXIT_GOOD
197
198test_failed:
199 EXIT_BAD
200
201
202
203/************************************************************************
204 RAS
205 Trap Handlers
206 ************************************************************************/
207My_Recoverable_Sw_error_trap:
208 ! Signal trap taken
209 setx EXECUTED, %l0, %o6
210 ! save trap type value
211 rdpr %tt, %o7
212
213 inc %i7
214
215check_desr_tt40:
216 ldxa [%g0]0x4c, %g2
217 nop
218 setx 0xb300000000000000, %l0, %g3
219 subcc %g2, %g3, %g4
220 brnz %g4, test_failed
221 nop
222
223check_DSFSR_tt32:
224 set 0x18, %g1
225 ldxa [%g1]0x58, %g2
226/*
227 nop
228 set 0x4, %g3
229 subcc %g2, %g3, %g4
230 brnz %g4, test_failed
231 nop
232*/
233
234check_per_tt40:
235 setx SOC_PER_REG, %l7, %g1
236 ldx [%g1], %g2
237 setx 0x8000000000000000, %g7, %g1
238 set 0x1, %g3
239 sllx %g3, ERR_FIELD, %g4
240 or %g1, %g4, %g3
241 sub %g2, %g3, %g5
242 brnz %g5, test_failed
243 nop
244
245clear_per_tt40:
246 setx SOC_PER_REG, %l7, %g1
247 stx %g0, [%g1]
248 nop
249
250clear_ejr_tt40:
251 setx SOC_EJR_REG, %l7, %g1
252 stx %g0, [%g1]
253 nop
254
255clear_eie_tt40:
256 setx SOC_EIE_REG, %l7, %g1
257 stx %g0, [%g1]
258 nop
259
260trap_done_tt40:
261 done
262 nop
263
264
265/************************************************************************
266 Test case data start
267************************************************************************/
268
269SECTION .DATA DATA_VA=IO_RD_ADDR
270attr_data {
271 Name = .DATA,
272 hypervisor,
273 compressimage
274}
275
276.data
277 .xword 0xdeadbeefdeadbeef
278
279 .xword 0x1101010101010101
280 .xword 0x0122010101010101
281 .xword 0x0101330101010101
282 .xword 0x0101014401010101
283 .xword 0x0101010155010101
284 .xword 0x0101010101660101
285 .xword 0x0101010101017701
286 .xword 0x0101010101010188
287
288 .xword 0x1122010101010101
289 .xword 0x0101334401010101
290 .xword 0x0101010155660101
291 .xword 0x0101010101017788
292
293 .xword 0x1122334401010101
294 .xword 0x0101010155667788
295
296 .xword 0xdeadbeefdeadbeef
297
298/************************************************************************/