Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: cmp_park_all_rw.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_HV_ALSO | |
39 | ||
40 | #include "hboot.s" | |
41 | #include "ncu_defines.h" | |
42 | ||
43 | ||
44 | ||
45 | /************************************************************************ | |
46 | Test case code start | |
47 | ************************************************************************/ | |
48 | .text | |
49 | .global main | |
50 | ||
51 | main: | |
52 | ta T_CHANGE_HPRIV | |
53 | nop | |
54 | ||
55 | /* Get thread ID */ | |
56 | ||
57 | ta T_RD_THID | |
58 | ||
59 | /* Wait until this thread's turn to run. */ | |
60 | start_loop: | |
61 | setx 0x1000, %g1, %g7 | |
62 | setx user_data_start, %g1, %g2 | |
63 | ||
64 | start_loop_top: | |
65 | cmp %g7, 0 | |
66 | beq local_test_failed ! timeout failure | |
67 | dec %g7 | |
68 | ||
69 | ldx [%g2], %g6 | |
70 | cmp %o1, %g6 | |
71 | bne start_loop_top | |
72 | nop | |
73 | ||
74 | /* Attempt to park all threads. */ | |
75 | diag_0: | |
76 | setx ASI_CMP_CORE_RUNNING_RW, %g1, %g2 | |
77 | setx ASI_CMP_CORE_RUNNING_STATUS, %g1, %g3 | |
78 | stxa %g0, [%g2]ASI_CMP_CORE | |
79 | ||
80 | /* Wait to give time for threads to park. */ | |
81 | park_wait_loop: | |
82 | set 0x40, %g7 | |
83 | ||
84 | park_wait_loop_top: | |
85 | cmp %g7, 0 | |
86 | bne park_wait_loop_top | |
87 | dec %g7 | |
88 | ||
89 | /* Check CORE_RUNNING_RW and CORE_RUNNING_STATUS registers | |
90 | indicate that only this thread is running. */ | |
91 | diag_1: | |
92 | ta T_RD_THID | |
93 | set 1, %g4 | |
94 | sllx %g4, %o1, %g4 | |
95 | ||
96 | ldxa [%g2]ASI_CMP_CORE, %g5 ! CORE_RUNNING_RW | |
97 | ldxa [%g3]ASI_CMP_CORE, %g6 ! CORE_RUNNING_STATUS | |
98 | cmp %g5, %g6 | |
99 | bne local_test_failed ! should be same by now | |
100 | cmp %g6, %g4 | |
101 | bne local_test_failed ! should only be this thread unparked | |
102 | nop | |
103 | ||
104 | /* Unpark all threads. */ | |
105 | ||
106 | orn %g0, %g0, %g4 | |
107 | stxa %g4, [%g2]ASI_CMP_CORE ! CORE_RUNNING_RW | |
108 | ||
109 | /* Wait to give time for threads to unpark. */ | |
110 | unpark_wait_loop: | |
111 | set 0x40, %g7 | |
112 | ||
113 | unpark_wait_loop_top: | |
114 | cmp %g7, 0 | |
115 | bne unpark_wait_loop_top | |
116 | dec %g7 | |
117 | ||
118 | /* Check CORE_RUNNING_RW and CORE_RUNNING_STATUS registers | |
119 | indicated that only this thread is running. */ | |
120 | diag_2: | |
121 | ldxa [%g2]ASI_CMP_CORE, %g5 ! CORE_RUNNING_RW | |
122 | ldxa [%g3]ASI_CMP_CORE, %g6 ! CORE_RUNNING_STATUS | |
123 | cmp %g5, %g6 | |
124 | bne local_test_failed ! should be same by now | |
125 | orn %g0, %g0, %g4 | |
126 | cmp %g6, %g4 | |
127 | bne local_test_failed ! all threads should be running now | |
128 | nop | |
129 | ||
130 | /* Signal the next thread to do its testing. */ | |
131 | diag_3: | |
132 | setx user_data_start, %g1, %g5 | |
133 | ldx [%g5], %g6 | |
134 | inc %g6 | |
135 | stx %g6, [%g5] | |
136 | ||
137 | /* Wait until all threads are done. */ | |
138 | end_wait_loop: | |
139 | setx 0x1000, %g1, %g7 | |
140 | ||
141 | end_wait_loop_top: | |
142 | cmp %g7, 0 | |
143 | beq local_test_failed ! fail on a timeout | |
144 | dec %g7 | |
145 | ||
146 | ldx [%g5], %g4 | |
147 | cmp %g4, 64 ! 64 indicates all threads done | |
148 | bne end_wait_loop_top | |
149 | nop | |
150 | ||
151 | /* Done */ | |
152 | ||
153 | ba test_passed | |
154 | nop | |
155 | ||
156 | ||
157 | ||
158 | test_passed: | |
159 | EXIT_GOOD | |
160 | ||
161 | local_test_failed: | |
162 | EXIT_BAD | |
163 | ||
164 | ||
165 | ||
166 | /************************************************************************ | |
167 | Test case data start | |
168 | ************************************************************************/ | |
169 | ||
170 | .align 1024 | |
171 | .data | |
172 | user_data_start: | |
173 | .word 0x0 | |
174 | .word 0x0 | |
175 | .word 0x0 | |
176 | .word 0x0 |