Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / peu / PCIeDMARd.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: PCIeDMARd.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
68! see if this user event works in a loop (multi-shot)
69
70 setx 0x02, %g1, %g4
71XmtUsrEvnt1:
72 nop ! $EV trig_pc_d(1, @VA(.MAIN.XmtUsrEvnt1)) -> EnablePCIeIgCmd ("DMARD", DMA_DATA_BYP_SADDR, DMA_DATA_BYP_EADDR, "64'h40", 1, *, * )
73 dec %g4
74 brnz %g4, XmtUsrEvnt1
75 nop
76 nop
77
78XmtUsrEvnt2:
79 ! $EV trig_pc_d(1, @VA(.MAIN.XmtUsrEvnt2)) -> EnablePCIeIgCmd ("DMARD", DMA_DATA_BYP_SADDR, DMA_DATA_BYP_EADDR, "64'h100", 1, *, * )
80
81 ! select a MEM32 address in PCI address range and transmit the command to NCU
82
83 setx MEM32_RD_ADDR, %g1, %g2
84 setx 0x04, %g1, %g4 ! loop 4 times
85
86 setx FIRE_PLC_TLU_CTB_TLR_CSR_A_TLU_CTL_ADDR, %g1, %g3
87
88delay_loop:
89 stx %g2, [%g2] ! MEM32 PIO Write
90 ldx [%g3], %l1 ! PIU CSR READ
91 ldx [%g2], %l0 ! MEM32 PIO READ
92 add %g2, 8, %g2 ! increment PIO address by 8
93
94 dec %g4
95 brnz %g4, delay_loop
96 nop
97
98
99test_passed:
100 EXIT_GOOD
101
102
103test_failed:
104 EXIT_BAD
105
106
107
108/************************************************************************
109 Test case data start
110************************************************************************/
111
112SECTION .DATA DATA_VA=DMA_DATA_ADDR
113attr_data {
114 Name = .DATA,
115 hypervisor,
116 compressimage
117}
118
119.data
120 .xword 0x0001020304050607
121 .xword 0x08090a0b0c0d0e0f
122 .xword 0x1011121314151617
123 .xword 0x18191a1b1c1d1e1f
124 .xword 0x2021222324252627
125 .xword 0x28292a2b2c2d2e2f
126 .xword 0x3031323334353637
127 .xword 0x38393a3b3c3d3e3f
128
129 .xword 0x4041424344454647
130 .xword 0x48494a4b4c4d4e4f
131 .xword 0x5051525354555657
132 .xword 0x58595a5b5c5d5e5f
133 .xword 0x6061626364656667
134 .xword 0x68696a6b6c6d6e6f
135 .xword 0x7071727374757677
136 .xword 0x78797a7b7c7d7e7f
137
138 .xword 0x8081828384858687
139 .xword 0x88898a8b8c8d8e8f
140 .xword 0x9091929394959697
141 .xword 0x98999a9b9c9d9e9f
142 .xword 0xa0a1a2a3a4a5a6a7
143 .xword 0xa8a9aaabacadaeaf
144 .xword 0xb0b1b2b3b4b5b6b7
145 .xword 0xb8b9babbbcbdbebf
146
147 .xword 0xc0c1c2c3c4c5c6c7
148 .xword 0xc8c9cacbcccdcecf
149 .xword 0xd0d1d2d3d4d5d6d7
150 .xword 0xd8d9dadbdcdddedf
151 .xword 0xe0e1e2e3e4e5e6e7
152 .xword 0xe8e9eaebecedeeef
153 .xword 0xf0f1f2f3f4f5f6f7
154 .xword 0xf8f9fafbfcfdfeff
155
156 .xword 0x0001020304050607
157 .xword 0x08090a0b0c0d0e0f
158 .xword 0x1011121314151617
159 .xword 0x18191a1b1c1d1e1f
160 .xword 0x2021222324252627
161 .xword 0x28292a2b2c2d2e2f
162 .xword 0x3031323334353637
163 .xword 0x38393a3b3c3d3e3f
164
165 .xword 0x4041424344454647
166 .xword 0x48494a4b4c4d4e4f
167 .xword 0x5051525354555657
168 .xword 0x58595a5b5c5d5e5f
169 .xword 0x6061626364656667
170 .xword 0x68696a6b6c6d6e6f
171 .xword 0x7071727374757677
172 .xword 0x78797a7b7c7d7e7f
173
174 .xword 0x8081828384858687
175 .xword 0x88898a8b8c8d8e8f
176 .xword 0x9091929394959697
177 .xword 0x98999a9b9c9d9e9f
178 .xword 0xa0a1a2a3a4a5a6a7
179 .xword 0xa8a9aaabacadaeaf
180 .xword 0xb0b1b2b3b4b5b6b7
181 .xword 0xb8b9babbbcbdbebf
182
183 .xword 0xc0c1c2c3c4c5c6c7
184 .xword 0xc8c9cacbcccdcecf
185 .xword 0xd0d1d2d3d4d5d6d7
186 .xword 0xd8d9dadbdcdddedf
187 .xword 0xe0e1e2e3e4e5e6e7
188 .xword 0xe8e9eaebecedeeef
189 .xword 0xf0f1f2f3f4f5f6f7
190 .xword 0xf8f9fafbfcfdfeff
191
192/************************************************************************/