Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / ncu_park_by_running_rw1c.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ncu_park_by_running_rw1c.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.text
45.global main
46
47
48main:
49 ta T_CHANGE_HPRIV
50
51get_th_id:
52 ta T_RD_THID
53 wr %g0,ASI_CMP_CORE,%asi
54
55 cmp %o1,0x0
56 be t_0
57 nop
58 cmp %o1,0x3f
59 be t_63
60 nop
61
62! Just halt all other threads
63halt:
64 ba halt
65 nop
66
67t_0:
68
69! Enable/disable other threads and check status to see if
70! these threads were correctly parked/unparked
71
72 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %g2
73 set 0x1,%g1
74 cmp %g2,%g1
75 bne %xcc,test_fail
76 nop
77
78 setx 0x7fffffffffffffff,%l0,%g7
79 setx asi_running_rw1c_mask,%l0,%g6
80 set 0x20,%g5
81
82loop:
83 stxa %g7,[ASI_CMP_CORE_RUNNING_RW]%asi
84 call sleep
85 nop
86 ldx [%g6],%g1
87 stxa %g1,[ASI_CMP_CORE_RUNNING_W1C]%asi
88 call sleep
89 nop
90
91 xor %g1,%g7,%g1
92 and %g1,%g7,%g1
93 cmp %g1,%g0
94 bne %xcc,skip
95 nop
96 or %g1,0x1,%g1
97
98skip:
99 ldxa [ASI_CMP_CORE_RUNNING_RW]%asi, %g2
100 cmp %g1,%g2
101 bne %xcc,test_fail
102 nop
103 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %g2
104 cmp %g1,%g2
105 bne %xcc,test_fail
106 nop
107
108 subcc %g5,1,%g5
109 bnz loop
110 add %g6,0x8,%g6
111
112! Special case of disabling self
113 setx 0xffffffffffffffff,%l0,%g7
114 stxa %g7,[ASI_CMP_CORE_RUNNING_RW]%asi
115 call sleep
116 nop
117 setx 0x7fffffffffffffff,%l0,%g1
118 stxa %g1,[ASI_CMP_CORE_RUNNING_W1C]%asi
119 call sleep
120 nop
121
122 ba test_pass
123 nop
124
125t_63:
126 setx 0x8000000000000000,%l0,%g1
127 ldxa [ASI_CMP_CORE_RUNNING_RW]%asi, %g2
128 cmp %g1,%g2
129 bne %xcc,test_fail
130 nop
131 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %g2
132 cmp %g1,%g2
133 bne %xcc,test_fail
134 nop
135
136 ba test_pass
137 nop
138
139sleep:
140 rd %tick,%l2
141 setx 0x04ff,%l0,%l1
142 add %l1,%l2,%l1
143sleep_loop:
144 rd %tick,%l2
145 cmp %l1,%l2
146 bpos %xcc,sleep_loop
147 nop
148 retl
149 nop
150
151/******************************************************
152 * Exit code
153 *******************************************************/
154
155test_pass:
156EXIT_GOOD
157
158test_fail:
159EXIT_BAD
160
161.data
162asi_running_rw1c_mask:
163 .xword 0x9849543973ffacea
164 .xword 0x9873423420976290
165 .xword 0x6876cedec243baa0
166 .xword 0xafccafcafadeafcc
167 .xword 0x9876234524000004
168 .xword 0xe23287634bcafed8
169 .xword 0x94cad5362ddcec98
170 .xword 0x20027373bced6940
171 .xword 0x58cde0de5438b098
172 .xword 0x9763245926423460
173 .xword 0x998bcade2345326a
174 .xword 0x876324c2de739290
175 .xword 0xbacedceafdbffbec
176 .xword 0x52823c3de3cfade2
177 .xword 0xbace420789988672
178 .xword 0x9849543973ffacec
179 .xword 0x987342342097629e
180 .xword 0x6876cedec243baa0
181 .xword 0xafccafcafadeafcc
182 .xword 0x9876234524000008
183 .xword 0x0000000000000000
184 .xword 0x8000000000000000
185 .xword 0x0040000000000000
186 .xword 0x0000200000000000
187 .xword 0x0000001000000000
188 .xword 0x0000000000000000
189 .xword 0x00000000ff000000
190 .xword 0x0000000000770000
191 .xword 0x000000000000ff00
192 .xword 0x0000000000000022
193 .xword 0xffffffffffffffff
194 .xword 0x8000000000000000
195.end