Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: tlu_halt_cwqint_cancel.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 | ||
42 | /************************************************************************ | |
43 | Test case code start | |
44 | ************************************************************************/ | |
45 | ||
46 | .text | |
47 | .global main | |
48 | ||
49 | main: /* test begin */ | |
50 | ||
51 | ||
52 | ta T_CHANGE_HPRIV | |
53 | ||
54 | ! If MT, then park all threads based on park_mask | |
55 | ! Unpark the next thread when finished with this one.. | |
56 | ! %l1 contains is_mt, %l2 contains address of is_mt | |
57 | ! %l3 contains park_mask, %l4 contains address of park_mask | |
58 | ! % l5 is mutex address | |
59 | ||
60 | setup_for_mt: ! {{{ | |
61 | setx is_mt, %g1, %l2 | |
62 | add %l2, 8, %l4 | |
63 | add %l4, 8, %l5 | |
64 | ldx [%l5], %g1 | |
65 | ldstub [%l5], %g1 | |
66 | get_mutex: | |
67 | ldx [%l5], %g2 | |
68 | brnz,a %g1, get_mutex | |
69 | ldstub [%l5], %g1 | |
70 | ||
71 | check_is_mt_set: | |
72 | ldx [%l2], %l1 | |
73 | brnz %l1, continue | |
74 | mov 0x58, %g3 | |
75 | is_mt_not_set: | |
76 | ldxa [%g3]0x41, %l1 | |
77 | popc %l1, %l1 | |
78 | dec %l1 | |
79 | brz %l1, continue | |
80 | nop | |
81 | is_mt_and_first: | |
82 | mov 0x50, %g3 | |
83 | stxa %g0, [%g3] 0x41 ! Park all threads | |
84 | mov 50, %g1 | |
85 | wait: | |
86 | brnz,a %g1, wait | |
87 | dec %g1 | |
88 | ||
89 | stx %l1, [%l2] ! Set the MT flag | |
90 | mov 1, %g1 | |
91 | stx %g0, [%l5] ! release mutex | |
92 | stxa %g1, [%g3] 0x41 ! Start with T0 | |
93 | ||
94 | continue: | |
95 | stx %g0, [%l5] ! release mutex | |
96 | ||
97 | ! }}} | |
98 | ||
99 | test1: | |
100 | wrpr %g0, 0x0, %pstate ! disable IE | |
101 | ||
102 | ||
103 | wr %g0, 0x40, %asi | |
104 | stxa %g0, [%g0 + ASI_SPU_CWQ_CSR] %asi | |
105 | !# allocate control word queue (e.g., setup head/tail/first/last registers) | |
106 | set CWQ_BASE, %g6 | |
107 | ||
108 | !# write base addr to first, head, and tail ptr | |
109 | !# first store to first | |
110 | stxa %g6, [%g0 + ASI_SPU_CWQ_FIRST] %asi !# first store to first | |
111 | ||
112 | stxa %g6, [%g0 + ASI_SPU_CWQ_HEAD] %asi !# then to head | |
113 | stxa %g6, [%g0 + ASI_SPU_CWQ_TAIL] %asi !# then to tail | |
114 | setx CWQ_LAST, %g1, %g5 !# then end of CWQ region to LAST | |
115 | stxa %g5, [%g0 + ASI_SPU_CWQ_LAST] %asi | |
116 | ||
117 | !# set CWQ control word ([39:37] is strand ID ..) | |
118 | best_set_reg(0x20610000, %g1, %g2) !# Control Word | |
119 | ldxa [%g0]0x63, %g1 ! get my TID for interrupt steering .. | |
120 | sllx %g1, 5, %g1 | |
121 | or %g2, %g1, %g2 | |
122 | sllx %g2, 32, %g2 | |
123 | ||
124 | !# write CWQ entry (%g6 points to CWQ) | |
125 | stx %g2, [%g6 + 0x0] | |
126 | ||
127 | setx msg, %g1, %g2 | |
128 | stx %g2, [%g6 + 0x8] !# source address | |
129 | ||
130 | stx %g0, [%g6 + 0x10] !# Authentication Key Address (40-bit) | |
131 | stx %g0, [%g6 + 0x18] !# Authentication IV Address (40-bit) | |
132 | stx %g0, [%g6 + 0x20] !# Authentication FSAS Address (40-bit) | |
133 | stx %g0, [%g6 + 0x28] !# Encryption Key Address (40-bit) | |
134 | stx %g0, [%g6 + 0x30] !# Encryption Initialization Vector Address (40-bit) | |
135 | ||
136 | setx results, %g1, %o3 | |
137 | stx %o3, [%g6 + 0x38] !# Destination Address (40-bit) | |
138 | ||
139 | membar #Sync | |
140 | ||
141 | ldxa [%g0 + ASI_SPU_CWQ_TAIL] %asi, %g2 | |
142 | add %g2, 0x40, %g2 | |
143 | stxa %g2, [%g0 + ASI_SPU_CWQ_TAIL] %asi | |
144 | ||
145 | !# Kick off the CWQ operation by writing to the CWQ_CSR | |
146 | !# Set the enabled bit and reset the other bits | |
147 | or %g0, 0x1, %g1 | |
148 | stxa %g1, [%g0 + ASI_SPU_CWQ_CSR] %asi | |
149 | ||
150 | ||
151 | mov 100, %g1 | |
152 | wait_for_int: | |
153 | brnz,a %g1, wait_for_int | |
154 | dec %g1 | |
155 | ||
156 | halt1: | |
157 | rdhpr %halt, %g7 | |
158 | ||
159 | wrpr %g0, 0x2, %pstate ! enable IE | |
160 | ||
161 | ! Finish if not MT | |
162 | brz %l1, done_thread | |
163 | nop | |
164 | ||
165 | ! If MT, shift mask, unpark next thread and finish | |
166 | ldx [%l4], %l3 | |
167 | sllx %l3, 1, %l3 | |
168 | mov 0x60, %g1 | |
169 | stxa %l3, [%g1]0x41 | |
170 | stx %l3, [%l4] | |
171 | nop | |
172 | ||
173 | ||
174 | /******************************************************* | |
175 | * Exit code | |
176 | *******************************************************/ | |
177 | ||
178 | done_thread: | |
179 | nop | |
180 | ta T_GOOD_TRAP | |
181 | nop | |
182 | ||
183 | /************************************************************************ | |
184 | Test case data start | |
185 | ************************************************************************/ | |
186 | .data | |
187 | is_mt : | |
188 | .xword 0x0 | |
189 | park_mask: | |
190 | .xword 0x1 | |
191 | mutex: | |
192 | .xword 0 | |
193 | ||
194 | SECTION .CWQ_DATA DATA_VA =0x4000 | |
195 | attr_data { | |
196 | Name = .CWQ_DATA | |
197 | hypervisor | |
198 | } | |
199 | ||
200 | .data | |
201 | .align 16 | |
202 | .global msg | |
203 | msg: | |
204 | .xword 0xad32fa52374cc6ba | |
205 | .xword 0x4cbf52280549003a | |
206 | ||
207 | .align 16 | |
208 | .global results | |
209 | results: | |
210 | .xword 0xDEADBEEFDEADBEEF | |
211 | .xword 0xDEADBEEFDEADBEEF | |
212 | !# CWQ data area | |
213 | .align 64 | |
214 | .global CWQ_BASE | |
215 | CWQ_BASE: | |
216 | .xword 0xAAAAAAAAAAAAAAA | |
217 | .xword 0xAAAAAAAAAAAAAAA | |
218 | .xword 0xAAAAAAAAAAAAAAA | |
219 | .xword 0xAAAAAAAAAAAAAAA | |
220 | .xword 0xAAAAAAAAAAAAAAA | |
221 | .xword 0xAAAAAAAAAAAAAAA | |
222 | .xword 0xAAAAAAAAAAAAAAA | |
223 | .xword 0xAAAAAAAAAAAAAAA | |
224 | .xword 0xAAAAAAAAAAAAAAA | |
225 | .xword 0xAAAAAAAAAAAAAAA | |
226 | .xword 0xAAAAAAAAAAAAAAA | |
227 | .xword 0xAAAAAAAAAAAAAAA | |
228 | .xword 0xAAAAAAAAAAAAAAA | |
229 | .xword 0xAAAAAAAAAAAAAAA | |
230 | .xword 0xAAAAAAAAAAAAAAA | |
231 | .xword 0xAAAAAAAAAAAAAAA | |
232 | .xword 0xAAAAAAAAAAAAAAA | |
233 | .xword 0xAAAAAAAAAAAAAAA | |
234 | .xword 0xAAAAAAAAAAAAAAA | |
235 | .xword 0xAAAAAAAAAAAAAAA | |
236 | .xword 0xAAAAAAAAAAAAAAA | |
237 | .xword 0xAAAAAAAAAAAAAAA | |
238 | .xword 0xAAAAAAAAAAAAAAA | |
239 | .xword 0xAAAAAAAAAAAAAAA | |
240 | .global CWQ_LAST | |
241 | .align 64 | |
242 | CWQ_LAST: | |
243 | .word 0x0 | |
244 |