Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / ncu_park_unpark_by_running_rw.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ncu_park_unpark_by_running_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_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 asi_running_rw_mask,%l0,%g7
79 set 0x20,%g5
80
81loop:
82 ldx [%g7],%g1
83 stxa %g1,[ASI_CMP_CORE_RUNNING_RW]%asi
84 call sleep
85 nop
86
87 cmp %g1,%g0
88 bne skip
89 nop
90 or %g1,0x1,%g1
91
92skip:
93 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %g2
94 cmp %g1,%g2
95 bne test_fail
96 nop
97
98 subcc %g5,1,%g5
99 bnz loop
100 add %g7,0x8,%g7
101
102 ba test_pass
103 nop
104
105t_63:
106 setx 0xaaaaaaaaaaaaaaaa,%l0,%g1
107 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %g2
108 cmp %g1,%g2
109 bne test_fail
110 nop
111
112 ba test_pass
113 nop
114
115sleep:
116 rd %tick,%l2
117 setx 0x04ff,%l0,%l1
118 add %l1,%l2,%l1
119sleep_loop:
120 rd %tick,%l2
121 cmp %l1,%l2
122 bpos sleep_loop
123 nop
124 retl
125 nop
126
127/******************************************************
128 * Exit code
129 *******************************************************/
130
131test_pass:
132EXIT_GOOD
133
134test_fail:
135EXIT_BAD
136
137.data
138asi_running_rw_mask:
139 .xword 0x6849543973ffaceb
140 .xword 0x3873423420976291
141 .xword 0x0876cedec243baa1
142 .xword 0x2fccafcafadeafcd
143 .xword 0x7876234524000005
144 .xword 0x423287634bcafed9
145 .xword 0x54cad5362ddcec99
146 .xword 0x10027373bced6941
147 .xword 0x58cde0de5438b099
148 .xword 0x6763245926423463
149 .xword 0x398bcade2345326b
150 .xword 0x376324c2de739295
151 .xword 0x0acedceafdbffbed
152 .xword 0x12823c3de3cfade3
153 .xword 0x72bacfed35384767
154 .xword 0x5555555555555555
155 .xword 0x787342342097629f
156 .xword 0x4876cedec243baa1
157 .xword 0x2fccafcafadeafcd
158 .xword 0x2876234524000009
159 .xword 0x0000000000000001
160 .xword 0x6000000000000001
161 .xword 0x0040000000000001
162 .xword 0x0000200000000001
163 .xword 0x0000001000000001
164 .xword 0x0000000000000001
165 .xword 0x00000000ff000001
166 .xword 0x0000000000770001
167 .xword 0x000000000000ff01
168 .xword 0x0000000000000023
169 .xword 0x7fffffffffffffff
170 .xword 0xaaaaaaaaaaaaaaaa
171.end