Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: ncu_xir.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 | #define My_External_Reset setx 0x200005000,%g7,%g1;add %g1,%o1,%g1;set 0x1,%g2;stb %g2,[%g1];done; | |
42 | ||
43 | #include "hboot.s" | |
44 | #include "asi_s.h" | |
45 | ||
46 | .text | |
47 | .global main | |
48 | ||
49 | main: | |
50 | ta T_CHANGE_HPRIV | |
51 | ||
52 | get_th_id: | |
53 | ta T_RD_THID | |
54 | ||
55 | cmp %o1,0x0 | |
56 | bne other_threads | |
57 | nop | |
58 | ||
59 | wr %g0,ASI_CMP_CORE,%asi | |
60 | ||
61 | ! Check that asi_xir_steering is correct | |
62 | setx 0xffffffffffffffff,%g7,%g1 | |
63 | ldxa [0x30]%asi,%g2 | |
64 | cmp %g1,%g2 | |
65 | bne %xcc,test_fail | |
66 | nop | |
67 | ||
68 | !! Need to disable some cores also | |
69 | ! Disable some cores | |
70 | !setx 0xffffff0000ffffff,%g7,%g1 | |
71 | !stxa %g1,[ASI_CMP_CORE_ENABLE]%asi | |
72 | ||
73 | ! Set asi_xir_steering | |
74 | setx 0x0006060000060606,%g7,%g1 | |
75 | stxa %g1,[0x30]%asi | |
76 | ||
77 | call sleep | |
78 | nop | |
79 | ||
80 | ! Check that XIR trap was not taken by thread yet | |
81 | setx xir_cnt,%g7,%g1 | |
82 | lduw [%g1],%g2 | |
83 | cmp %g2,%g0 | |
84 | bne test_fail | |
85 | nop | |
86 | ||
87 | ! XIR reset | |
88 | setx 0x8900000808,%g7,%g1 | |
89 | set 0x2,%g2 | |
90 | stx %g2,[%g1] | |
91 | ||
92 | ! Wait for threads to take the XIR trap | |
93 | setx xir_cnt,%g7,%g1 | |
94 | set 0xef,%g2 | |
95 | xirs_not_done: | |
96 | lduw [%g1],%g3 | |
97 | cmp %g3,%g2 | |
98 | bl xirs_not_done | |
99 | nop | |
100 | bne test_fail | |
101 | nop | |
102 | ||
103 | ! Wait a little longer in case something else took an xir trap | |
104 | call sleep | |
105 | nop | |
106 | lduw [%g1],%g3 | |
107 | cmp %g3,%g2 | |
108 | bne test_fail | |
109 | nop | |
110 | ||
111 | ! Check that RESET_GEN was cleared | |
112 | setx 0x8900000808,%g7,%g1 | |
113 | ldx [%g1],%g2 | |
114 | cmp %g2,%g0 | |
115 | bne test_fail | |
116 | nop | |
117 | ||
118 | ba test_pass | |
119 | nop | |
120 | ||
121 | other_threads: | |
122 | setx 0x200005000,%g7,%g1 | |
123 | add %g1,%o1,%g1 | |
124 | ||
125 | wait_for_xir: | |
126 | ldub [%g1],%g2 | |
127 | cmp %g2,0x1 | |
128 | bne wait_for_xir | |
129 | nop | |
130 | ||
131 | ! Get access to common cntrs | |
132 | set 0x1,%g2 | |
133 | setx xir_cnt_access,%g7,%g1 | |
134 | set 0x0,%g3 | |
135 | ||
136 | spin_lock_ot: | |
137 | cas [%g1],%g2,%g3 | |
138 | cmp %g3,0x1 | |
139 | bne spin_lock_ot | |
140 | nop | |
141 | ||
142 | setx xir_cnt,%g7,%g4 | |
143 | lduw [%g4],%g2 | |
144 | add %g2,%o1,%g2 | |
145 | stw %g2,[%g4] | |
146 | ||
147 | ! Release common cntrs | |
148 | stw %g3,[%g1] | |
149 | ||
150 | ba test_pass | |
151 | nop | |
152 | ||
153 | /****************************************************** | |
154 | * Subroutine code | |
155 | *******************************************************/ | |
156 | ||
157 | sleep: | |
158 | rd %tick,%l2 | |
159 | setx 0x00000000000000ff,%g7,%l1 | |
160 | add %l1,%l2,%l1 | |
161 | sleep_loop: | |
162 | rd %tick,%l2 | |
163 | cmp %l1,%l2 | |
164 | bpos %xcc,sleep_loop | |
165 | nop | |
166 | retl | |
167 | nop | |
168 | ||
169 | /****************************************************** | |
170 | * Exit code | |
171 | *******************************************************/ | |
172 | ||
173 | test_pass: | |
174 | EXIT_GOOD | |
175 | ||
176 | test_fail: | |
177 | EXIT_BAD | |
178 | ||
179 | .data | |
180 | xir_cnt_access: | |
181 | .word 0x00000001 | |
182 | xir_cnt: | |
183 | .word 0x00000000 | |
184 | .end | |
185 | ||
186 | SECTION my_xir_trap_handler DATA_VA=0x200005000 | |
187 | attr_data { | |
188 | Name = my_xir_trap_handler, | |
189 | hypervisor, | |
190 | compressimage | |
191 | } | |
192 | ||
193 | .data | |
194 | xir_trap_handler: | |
195 | .byte 0x00 | |
196 | .byte 0x00 | |
197 | .byte 0x00 | |
198 | .byte 0x00 | |
199 | .byte 0x00 | |
200 | .byte 0x00 | |
201 | .byte 0x00 | |
202 | .byte 0x00 | |
203 | .byte 0x00 | |
204 | .byte 0x00 | |
205 | .byte 0x00 | |
206 | .byte 0x00 | |
207 | .byte 0x00 | |
208 | .byte 0x00 | |
209 | .byte 0x00 | |
210 | .byte 0x00 | |
211 | .byte 0x00 | |
212 | .byte 0x00 | |
213 | .byte 0x00 | |
214 | .byte 0x00 | |
215 | .byte 0x00 | |
216 | .byte 0x00 | |
217 | .byte 0x00 | |
218 | .byte 0x00 | |
219 | .byte 0x00 | |
220 | .byte 0x00 | |
221 | .byte 0x00 | |
222 | .byte 0x00 | |
223 | .byte 0x00 | |
224 | .byte 0x00 | |
225 | .byte 0x00 | |
226 | .byte 0x00 | |
227 | .byte 0x00 | |
228 | .byte 0x00 | |
229 | .byte 0x00 | |
230 | .byte 0x00 | |
231 | .byte 0x00 | |
232 | .byte 0x00 | |
233 | .byte 0x00 | |
234 | .byte 0x00 | |
235 | .byte 0x00 | |
236 | .byte 0x00 | |
237 | .byte 0x00 | |
238 | .byte 0x00 | |
239 | .byte 0x00 | |
240 | .byte 0x00 | |
241 | .byte 0x00 | |
242 | .byte 0x00 | |
243 | .byte 0x00 | |
244 | .byte 0x00 | |
245 | .byte 0x00 | |
246 | .byte 0x00 | |
247 | .byte 0x00 | |
248 | .byte 0x00 | |
249 | .byte 0x00 | |
250 | .byte 0x00 | |
251 | .byte 0x00 | |
252 | .byte 0x00 | |
253 | .byte 0x00 | |
254 | .byte 0x00 | |
255 | .byte 0x00 | |
256 | .byte 0x00 | |
257 | .byte 0x00 | |
258 | .byte 0x00 | |
259 | .end |