Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: memop_all_mcu_banks.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 MAIN_PAGE_NUCLEUS_ALSO | |
39 | #define MAIN_PAGE_HV_ALSO | |
40 | ||
41 | #include "hboot.s" | |
42 | #include "asi_s.h" | |
43 | ||
44 | /************************************************************************ | |
45 | Test case code start | |
46 | ************************************************************************/ | |
47 | ||
48 | .text | |
49 | .global main | |
50 | ||
51 | main: | |
52 | ta T_CHANGE_HPRIV | |
53 | ||
54 | ! Get the data to be used. | |
55 | ||
56 | setx user_data_start, %g1, %g2 | |
57 | ldx [%g2], %l0 | |
58 | ldx [%g2+0x8], %l1 | |
59 | ldx [%g2+0x10], %l2 | |
60 | ldx [%g2+0x18], %l3 | |
61 | ||
62 | ! Write data to a location in each MCU bank | |
63 | ||
64 | setx data, %g1, %g2 | |
65 | stx %l0, [%g2] ! L2 bank 0 | |
66 | stx %l1, [%g2+0x40] ! L2 bank 1 | |
67 | stx %l2, [%g2+0x80] ! L2 bank 2 | |
68 | stx %l3, [%g2+0xc0] ! L2 bank 3 | |
69 | ||
70 | ! Now flush each of these L2 cache lines | |
71 | ||
72 | mov %g2, %o0 | |
73 | call flush_l2_line | |
74 | nop | |
75 | mov %g2, %o0 | |
76 | add %o0, 0x40, %o0 | |
77 | call flush_l2_line | |
78 | nop | |
79 | mov %g2, %o0 | |
80 | add %o0, 0x80, %o0 | |
81 | call flush_l2_line | |
82 | nop | |
83 | mov %g2, %o0 | |
84 | add %o0, 0xc0, %o0 | |
85 | call flush_l2_line | |
86 | nop | |
87 | ||
88 | ! Finally read the data from memory and check it. | |
89 | ||
90 | ldx [%g2], %i1 | |
91 | cmp %i1, %l0 | |
92 | bne test_failed | |
93 | nop | |
94 | ||
95 | ldx [%g2+0x40], %i1 | |
96 | cmp %i1, %l1 | |
97 | bne test_failed | |
98 | nop | |
99 | ||
100 | ldx [%g2+0x80], %i1 | |
101 | cmp %i1, %l2 | |
102 | bne test_failed | |
103 | nop | |
104 | ||
105 | ldx [%g2+0xc0], %i1 | |
106 | cmp %i1, %l3 | |
107 | bne test_failed | |
108 | nop | |
109 | ||
110 | ba test_passed | |
111 | nop | |
112 | ||
113 | /********************************************************************** | |
114 | * Common code. | |
115 | *********************************************************************/ | |
116 | ||
117 | ! Assumes that %o0 contains VA that maps to L2$ line to be flushed. | |
118 | ! This is done by doing 16 loads from different addresses that alias | |
119 | ! to that line. Note that this will cause a writeback if the L2$ | |
120 | ! line is dirty. | |
121 | ||
122 | flush_l2_line: | |
123 | setx 0x3ffff, %o1, %o2 | |
124 | and %o0, %o2, %o3 | |
125 | setx alias1, %o1, %o4 | |
126 | ld [%o3+%o4], %o5 | |
127 | setx alias2, %o1, %o4 | |
128 | ld [%o3+%o4], %o5 | |
129 | setx alias3, %o1, %o4 | |
130 | ld [%o3+%o4], %o5 | |
131 | setx alias4, %o1, %o4 | |
132 | ld [%o3+%o4], %o5 | |
133 | setx alias5, %o1, %o4 | |
134 | ld [%o3+%o4], %o5 | |
135 | setx alias6, %o1, %o4 | |
136 | ld [%o3+%o4], %o5 | |
137 | setx alias7, %o1, %o4 | |
138 | ld [%o3+%o4], %o5 | |
139 | setx alias8, %o1, %o4 | |
140 | ld [%o3+%o4], %o5 | |
141 | setx alias9, %o1, %o4 | |
142 | ld [%o3+%o4], %o5 | |
143 | setx alias10, %o1, %o4 | |
144 | ld [%o3+%o4], %o5 | |
145 | setx alias11, %o1, %o4 | |
146 | ld [%o3+%o4], %o5 | |
147 | setx alias12, %o1, %o4 | |
148 | ld [%o3+%o4], %o5 | |
149 | setx alias13, %o1, %o4 | |
150 | ld [%o3+%o4], %o5 | |
151 | setx alias14, %o1, %o4 | |
152 | ld [%o3+%o4], %o5 | |
153 | setx alias15, %o1, %o4 | |
154 | ld [%o3+%o4], %o5 | |
155 | setx alias16, %o1, %o4 | |
156 | ld [%o3+%o4], %o5 | |
157 | jmpl %o7+0x8, %g0 | |
158 | nop | |
159 | ||
160 | test_passed: | |
161 | EXIT_GOOD | |
162 | ||
163 | test_failed: | |
164 | EXIT_BAD | |
165 | ||
166 | ||
167 | /************************************************************************ | |
168 | Test case data start | |
169 | ************************************************************************/ | |
170 | ||
171 | SECTION .DATA DATA_VA=0x70000000 | |
172 | attr_data { | |
173 | Name = .DATA, | |
174 | hypervisor, | |
175 | compressimage | |
176 | } | |
177 | ||
178 | .data | |
179 | .global user_data_start | |
180 | .global data | |
181 | .global alias1 | |
182 | .global alias2 | |
183 | .global alias3 | |
184 | .global alias4 | |
185 | .global alias5 | |
186 | .global alias6 | |
187 | .global alias7 | |
188 | .global alias8 | |
189 | .global alias9 | |
190 | .global alias10 | |
191 | .global alias11 | |
192 | .global alias12 | |
193 | .global alias13 | |
194 | .global alias14 | |
195 | .global alias15 | |
196 | .global alias16 | |
197 | ||
198 | user_data_start: | |
199 | .xword 0x1111111111111111 | |
200 | .xword 0x2222222222222222 | |
201 | .xword 0x3333333333333333 | |
202 | .xword 0x4444444444444444 | |
203 | .xword 0x5555555555555555 | |
204 | .xword 0x6666666666666666 | |
205 | .xword 0x7777777777777777 | |
206 | .xword 0x8888888888888888 | |
207 | .xword 0x9999999999999999 | |
208 | .align 512 | |
209 | data: .skip 512 | |
210 | ||
211 | .align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line | |
212 | alias1: | |
213 | .skip 1024 | |
214 | .align 0x40000 | |
215 | alias2: | |
216 | .skip 1024 | |
217 | .align 0x40000 | |
218 | alias3: | |
219 | .skip 1024 | |
220 | .align 0x40000 | |
221 | alias4: | |
222 | .skip 1024 | |
223 | .align 0x40000 | |
224 | alias5: | |
225 | .skip 1024 | |
226 | .align 0x40000 | |
227 | alias6: | |
228 | .skip 1024 | |
229 | .align 0x40000 | |
230 | alias7: | |
231 | .skip 1024 | |
232 | .align 0x40000 | |
233 | alias8: | |
234 | .skip 1024 | |
235 | .align 0x40000 | |
236 | alias9: | |
237 | .skip 1024 | |
238 | .align 0x40000 | |
239 | alias10: | |
240 | .skip 1024 | |
241 | .align 0x40000 | |
242 | alias11: | |
243 | .skip 1024 | |
244 | .align 0x40000 | |
245 | alias12: | |
246 | .skip 1024 | |
247 | .align 0x40000 | |
248 | alias13: | |
249 | .skip 1024 | |
250 | .align 0x40000 | |
251 | alias14: | |
252 | .skip 1024 | |
253 | .align 0x40000 | |
254 | alias15: | |
255 | .skip 1024 | |
256 | .align 0x40000 | |
257 | alias16: | |
258 | .skip 1024 | |
259 | ||
260 | user_data_end: | |
261 | .end | |
262 | ||
263 |