Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: memop_all_l2_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 | ldx [%g2+0x20], %l4 | |
62 | ldx [%g2+0x28], %l5 | |
63 | ldx [%g2+0x30], %l6 | |
64 | ldx [%g2+0x38], %l7 | |
65 | ||
66 | ! Write data to a location in each L2 cache bank | |
67 | ||
68 | setx data, %g1, %g2 | |
69 | stx %l0, [%g2] ! L2 bank 0 | |
70 | stx %l1, [%g2+0x40] ! L2 bank 1 | |
71 | stx %l2, [%g2+0x80] ! L2 bank 2 | |
72 | stx %l3, [%g2+0xc0] ! L2 bank 3 | |
73 | stx %l4, [%g2+0x100] ! L2 bank 4 | |
74 | stx %l5, [%g2+0x140] ! L2 bank 5 | |
75 | stx %l6, [%g2+0x180] ! L2 bank 6 | |
76 | stx %l7, [%g2+0x1c0] ! L2 bank 7 | |
77 | ||
78 | ! Now flush each of these L2 cache lines | |
79 | ||
80 | mov %g2, %o0 | |
81 | call flush_l2_line | |
82 | nop | |
83 | mov %g2, %o0 | |
84 | add %o0, 0x40, %o0 | |
85 | call flush_l2_line | |
86 | nop | |
87 | mov %g2, %o0 | |
88 | add %o0, 0x80, %o0 | |
89 | call flush_l2_line | |
90 | nop | |
91 | mov %g2, %o0 | |
92 | add %o0, 0xc0, %o0 | |
93 | call flush_l2_line | |
94 | nop | |
95 | mov %g2, %o0 | |
96 | add %o0, 0x100, %o0 | |
97 | call flush_l2_line | |
98 | nop | |
99 | mov %g2, %o0 | |
100 | add %o0, 0x140, %o0 | |
101 | call flush_l2_line | |
102 | nop | |
103 | mov %g2, %o0 | |
104 | add %o0, 0x180, %o0 | |
105 | call flush_l2_line | |
106 | nop | |
107 | mov %g2, %o0 | |
108 | add %o0, 0x1c0, %o0 | |
109 | call flush_l2_line | |
110 | nop | |
111 | ||
112 | ! Finally read the data from memory and check it. | |
113 | ||
114 | ldx [%g2], %i1 | |
115 | cmp %i1, %l0 | |
116 | bne test_failed | |
117 | nop | |
118 | ||
119 | ldx [%g2+0x40], %i1 | |
120 | cmp %i1, %l1 | |
121 | bne test_failed | |
122 | nop | |
123 | ||
124 | ldx [%g2+0x80], %i1 | |
125 | cmp %i1, %l2 | |
126 | bne test_failed | |
127 | nop | |
128 | ||
129 | ldx [%g2+0xc0], %i1 | |
130 | cmp %i1, %l3 | |
131 | bne test_failed | |
132 | nop | |
133 | ||
134 | ldx [%g2+0x100], %i1 | |
135 | cmp %i1, %l4 | |
136 | bne test_failed | |
137 | nop | |
138 | ||
139 | ldx [%g2+0x140], %i1 | |
140 | cmp %i1, %l5 | |
141 | bne test_failed | |
142 | nop | |
143 | ||
144 | ldx [%g2+0x180], %i1 | |
145 | cmp %i1, %l6 | |
146 | bne test_failed | |
147 | nop | |
148 | ||
149 | ldx [%g2+0x1c0], %i1 | |
150 | cmp %i1, %l7 | |
151 | bne test_failed | |
152 | nop | |
153 | ||
154 | ba test_passed | |
155 | nop | |
156 | ||
157 | /********************************************************************** | |
158 | * Common code. | |
159 | *********************************************************************/ | |
160 | ||
161 | ! Assumes that %o0 contains VA that maps to L2$ line to be flushed. | |
162 | ! This is done by doing 16 loads from different addresses that alias | |
163 | ! to that line. Note that this will cause a writeback if the L2$ | |
164 | ! line is dirty. | |
165 | ||
166 | flush_l2_line: | |
167 | setx 0x3ffff, %o1, %o2 | |
168 | and %o0, %o2, %o3 | |
169 | setx alias1, %o1, %o4 | |
170 | ld [%o3+%o4], %o5 | |
171 | setx alias2, %o1, %o4 | |
172 | ld [%o3+%o4], %o5 | |
173 | setx alias3, %o1, %o4 | |
174 | ld [%o3+%o4], %o5 | |
175 | setx alias4, %o1, %o4 | |
176 | ld [%o3+%o4], %o5 | |
177 | setx alias5, %o1, %o4 | |
178 | ld [%o3+%o4], %o5 | |
179 | setx alias6, %o1, %o4 | |
180 | ld [%o3+%o4], %o5 | |
181 | setx alias7, %o1, %o4 | |
182 | ld [%o3+%o4], %o5 | |
183 | setx alias8, %o1, %o4 | |
184 | ld [%o3+%o4], %o5 | |
185 | setx alias9, %o1, %o4 | |
186 | ld [%o3+%o4], %o5 | |
187 | setx alias10, %o1, %o4 | |
188 | ld [%o3+%o4], %o5 | |
189 | setx alias11, %o1, %o4 | |
190 | ld [%o3+%o4], %o5 | |
191 | setx alias12, %o1, %o4 | |
192 | ld [%o3+%o4], %o5 | |
193 | setx alias13, %o1, %o4 | |
194 | ld [%o3+%o4], %o5 | |
195 | setx alias14, %o1, %o4 | |
196 | ld [%o3+%o4], %o5 | |
197 | setx alias15, %o1, %o4 | |
198 | ld [%o3+%o4], %o5 | |
199 | setx alias16, %o1, %o4 | |
200 | ld [%o3+%o4], %o5 | |
201 | jmpl %o7+0x8, %g0 | |
202 | nop | |
203 | ||
204 | test_passed: | |
205 | EXIT_GOOD | |
206 | ||
207 | test_failed: | |
208 | EXIT_BAD | |
209 | ||
210 | ||
211 | /************************************************************************ | |
212 | Test case data start | |
213 | ************************************************************************/ | |
214 | ||
215 | SECTION .DATA DATA_VA=0x70000000 | |
216 | attr_data { | |
217 | Name = .DATA, | |
218 | hypervisor, | |
219 | compressimage | |
220 | } | |
221 | ||
222 | .data | |
223 | .global user_data_start | |
224 | .global data | |
225 | .global alias1 | |
226 | .global alias2 | |
227 | .global alias3 | |
228 | .global alias4 | |
229 | .global alias5 | |
230 | .global alias6 | |
231 | .global alias7 | |
232 | .global alias8 | |
233 | .global alias9 | |
234 | .global alias10 | |
235 | .global alias11 | |
236 | .global alias12 | |
237 | .global alias13 | |
238 | .global alias14 | |
239 | .global alias15 | |
240 | .global alias16 | |
241 | ||
242 | user_data_start: | |
243 | .xword 0x1111111111111111 | |
244 | .xword 0x2222222222222222 | |
245 | .xword 0x3333333333333333 | |
246 | .xword 0x4444444444444444 | |
247 | .xword 0x5555555555555555 | |
248 | .xword 0x6666666666666666 | |
249 | .xword 0x7777777777777777 | |
250 | .xword 0x8888888888888888 | |
251 | .xword 0x9999999999999999 | |
252 | .align 512 | |
253 | data: .skip 512 | |
254 | ||
255 | .align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line | |
256 | alias1: | |
257 | .skip 1024 | |
258 | .align 0x40000 | |
259 | alias2: | |
260 | .skip 1024 | |
261 | .align 0x40000 | |
262 | alias3: | |
263 | .skip 1024 | |
264 | .align 0x40000 | |
265 | alias4: | |
266 | .skip 1024 | |
267 | .align 0x40000 | |
268 | alias5: | |
269 | .skip 1024 | |
270 | .align 0x40000 | |
271 | alias6: | |
272 | .skip 1024 | |
273 | .align 0x40000 | |
274 | alias7: | |
275 | .skip 1024 | |
276 | .align 0x40000 | |
277 | alias8: | |
278 | .skip 1024 | |
279 | .align 0x40000 | |
280 | alias9: | |
281 | .skip 1024 | |
282 | .align 0x40000 | |
283 | alias10: | |
284 | .skip 1024 | |
285 | .align 0x40000 | |
286 | alias11: | |
287 | .skip 1024 | |
288 | .align 0x40000 | |
289 | alias12: | |
290 | .skip 1024 | |
291 | .align 0x40000 | |
292 | alias13: | |
293 | .skip 1024 | |
294 | .align 0x40000 | |
295 | alias14: | |
296 | .skip 1024 | |
297 | .align 0x40000 | |
298 | alias15: | |
299 | .skip 1024 | |
300 | .align 0x40000 | |
301 | alias16: | |
302 | .skip 1024 | |
303 | ||
304 | user_data_end: | |
305 | .end | |
306 | ||
307 |