Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / dmu / n2_err_dmu_dma_rd.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_dmu_dma_rd.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 ENABLE_PCIE_LINK_TRAINING
39/* #define MAIN_PAGE_NUCLEUS_ALSO */ /* Access main in priviledge mode */
40#define MAIN_PAGE_HV_ALSO
41
42#include "hboot.s"
43#include "peu_defines.h"
44
45#define MEM32_RD_ADDR mpeval(N2_PCIE_BASE_ADDR + MEM32_OFFSET_BASE_REG_DATA)
46
47#define DMA_DATA_ADDR 0x0000000123456700
48#define DMA_DATA_BYP_SADDR 0xfffc000123456700
49#define DMA_DATA_BYP_EADDR 0xfffc000123456800
50
51/************************************************************************
52 Test case code start
53 ************************************************************************/
54.text
55.global main
56
57main:
58 ta T_CHANGE_HPRIV
59 nop
60
61 ! enable bypass in IOMMU
62 setx FIRE_DLC_MMU_CSR_A_CTL_ADDR, %g1, %g2
63 setx FIRE_DLC_MMU_CSR_A_CTL__BYPASS_EN, %g1, %g3
64 stx %g3, [%g2]
65 ldx [%g2], %g3
66
67
68clear_esr_first:
69 setx SOC_ESR_REG, %l7, %i0
70 stx %g0, [%i0]
71
72set_ejr:
73 set 0x1, %i1
74 sllx %i1, ERR_FIELD, %i2
75 setx SOC_EJR_REG, %l7, %i3
76 stx %i2, [%i3]
77 membar 0x40
78
79
80! see if this user event works in a loop (multi-shot)
81
82 setx 0x02, %g1, %g4
83XmtUsrEvnt1:
84 nop ! $EV trig_pc_d(1, @VA(.MAIN.XmtUsrEvnt1)) -> EnablePCIeIgCmd ("DMARD", DMA_DATA_BYP_SADDR, DMA_DATA_BYP_EADDR, "64'h40", 1, *, * )
85 dec %g4
86 brnz %g4, XmtUsrEvnt1
87 nop
88 nop
89
90XmtUsrEvnt2:
91 ! $EV trig_pc_d(1, @VA(.MAIN.XmtUsrEvnt2)) -> EnablePCIeIgCmd ("DMARD", DMA_DATA_BYP_SADDR, DMA_DATA_BYP_EADDR, "64'h100", 1, *, * )
92
93 ! select a MEM32 address in PCI address range and transmit the command to NCU
94
95 setx MEM32_RD_ADDR, %g1, %g2
96 setx 0x04, %g1, %g4 ! loop 4 times
97
98 setx FIRE_PLC_TLU_CTB_TLR_CSR_A_TLU_CTL_ADDR, %g1, %g3
99
100delay_loop:
101 stx %g2, [%g2] ! MEM32 PIO Write
102 ldx [%g3], %l1 ! PIU CSR READ
103 ldx [%g2], %l0 ! MEM32 PIO READ
104 add %g2, 8, %g2 ! increment PIO address by 8
105
106 dec %g4
107 brnz %g4, delay_loop
108 nop
109
110check_esr:
111 setx SOC_ESR_REG, %l7, %i0
112 ldx [%i0], %i1
113 nop
114
115 setx 0x8000000000000000, %l7, %o3 !valid bit
116 set 0x1, %i2
117 sllx %i2, ERR_FIELD, %i3
118 or %i3, %o3, %i4
119 sub %i1, %i4, %i5
120 brnz %i5, test_failed
121 nop
122
123test_passed:
124 EXIT_GOOD
125
126
127test_failed:
128 EXIT_BAD
129
130
131
132/************************************************************************
133 Test case data start
134************************************************************************/
135
136SECTION .DATA DATA_VA=DMA_DATA_ADDR
137attr_data {
138 Name = .DATA,
139 hypervisor,
140 compressimage
141}
142
143.data
144 .xword 0x0001020304050607
145 .xword 0x08090a0b0c0d0e0f
146 .xword 0x1011121314151617
147 .xword 0x18191a1b1c1d1e1f
148 .xword 0x2021222324252627
149 .xword 0x28292a2b2c2d2e2f
150 .xword 0x3031323334353637
151 .xword 0x38393a3b3c3d3e3f
152
153 .xword 0x4041424344454647
154 .xword 0x48494a4b4c4d4e4f
155 .xword 0x5051525354555657
156 .xword 0x58595a5b5c5d5e5f
157 .xword 0x6061626364656667
158 .xword 0x68696a6b6c6d6e6f
159 .xword 0x7071727374757677
160 .xword 0x78797a7b7c7d7e7f
161
162 .xword 0x8081828384858687
163 .xword 0x88898a8b8c8d8e8f
164 .xword 0x9091929394959697
165 .xword 0x98999a9b9c9d9e9f
166 .xword 0xa0a1a2a3a4a5a6a7
167 .xword 0xa8a9aaabacadaeaf
168 .xword 0xb0b1b2b3b4b5b6b7
169 .xword 0xb8b9babbbcbdbebf
170
171 .xword 0xc0c1c2c3c4c5c6c7
172 .xword 0xc8c9cacbcccdcecf
173 .xword 0xd0d1d2d3d4d5d6d7
174 .xword 0xd8d9dadbdcdddedf
175 .xword 0xe0e1e2e3e4e5e6e7
176 .xword 0xe8e9eaebecedeeef
177 .xword 0xf0f1f2f3f4f5f6f7
178 .xword 0xf8f9fafbfcfdfeff
179
180 .xword 0x0001020304050607
181 .xword 0x08090a0b0c0d0e0f
182 .xword 0x1011121314151617
183 .xword 0x18191a1b1c1d1e1f
184 .xword 0x2021222324252627
185 .xword 0x28292a2b2c2d2e2f
186 .xword 0x3031323334353637
187 .xword 0x38393a3b3c3d3e3f
188
189 .xword 0x4041424344454647
190 .xword 0x48494a4b4c4d4e4f
191 .xword 0x5051525354555657
192 .xword 0x58595a5b5c5d5e5f
193 .xword 0x6061626364656667
194 .xword 0x68696a6b6c6d6e6f
195 .xword 0x7071727374757677
196 .xword 0x78797a7b7c7d7e7f
197
198 .xword 0x8081828384858687
199 .xword 0x88898a8b8c8d8e8f
200 .xword 0x9091929394959697
201 .xword 0x98999a9b9c9d9e9f
202 .xword 0xa0a1a2a3a4a5a6a7
203 .xword 0xa8a9aaabacadaeaf
204 .xword 0xb0b1b2b3b4b5b6b7
205 .xword 0xb8b9babbbcbdbebf
206
207 .xword 0xc0c1c2c3c4c5c6c7
208 .xword 0xc8c9cacbcccdcecf
209 .xword 0xd0d1d2d3d4d5d6d7
210 .xword 0xd8d9dadbdcdddedf
211 .xword 0xe0e1e2e3e4e5e6e7
212 .xword 0xe8e9eaebecedeeef
213 .xword 0xf0f1f2f3f4f5f6f7
214 .xword 0xf8f9fafbfcfdfeff
215
216/************************************************************************/