Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / ncu_xir_allth.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ncu_xir_allth.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
49main:
50 ta T_CHANGE_HPRIV
51
52get_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! Start all threads
69 stxa %g1,[ASI_CMP_CORE_RUNNING_RW]%asi
70
71! Wait for threads to finish boot
72 call sleep
73 nop
74 call sleep
75 nop
76
77! XIR reset
78 setx 0x8900000808,%g7,%g1
79 set 0x2,%g2
80 stx %g2,[%g1]
81
82other_threads:
83 setx 0x200005000,%g7,%g1
84 add %g1,%o1,%g1
85
86wait_for_xir:
87 ldub [%g1],%g2
88 cmp %g2,0x1
89 bne wait_for_xir
90 nop
91
92 ba test_pass
93 nop
94
95/******************************************************
96 * Subroutine code
97 *******************************************************/
98
99sleep:
100 rd %tick,%l2
101 setx 0x0000000000000fff,%g7,%l1
102 add %l1,%l2,%l1
103sleep_loop:
104 rd %tick,%l2
105 cmp %l1,%l2
106 bpos %xcc,sleep_loop
107 nop
108 retl
109 nop
110
111/******************************************************
112 * Exit code
113 *******************************************************/
114
115test_pass:
116EXIT_GOOD
117
118test_fail:
119EXIT_BAD
120
121SECTION my_xir_trap_handler DATA_VA=0x200005000
122 attr_data {
123 Name = my_xir_trap_handler,
124 hypervisor,
125 compressimage
126 }
127
128.data
129xir_trap_handler:
130 .byte 0x00
131 .byte 0x00
132 .byte 0x00
133 .byte 0x00
134 .byte 0x00
135 .byte 0x00
136 .byte 0x00
137 .byte 0x00
138 .byte 0x00
139 .byte 0x00
140 .byte 0x00
141 .byte 0x00
142 .byte 0x00
143 .byte 0x00
144 .byte 0x00
145 .byte 0x00
146 .byte 0x00
147 .byte 0x00
148 .byte 0x00
149 .byte 0x00
150 .byte 0x00
151 .byte 0x00
152 .byte 0x00
153 .byte 0x00
154 .byte 0x00
155 .byte 0x00
156 .byte 0x00
157 .byte 0x00
158 .byte 0x00
159 .byte 0x00
160 .byte 0x00
161 .byte 0x00
162 .byte 0x00
163 .byte 0x00
164 .byte 0x00
165 .byte 0x00
166 .byte 0x00
167 .byte 0x00
168 .byte 0x00
169 .byte 0x00
170 .byte 0x00
171 .byte 0x00
172 .byte 0x00
173 .byte 0x00
174 .byte 0x00
175 .byte 0x00
176 .byte 0x00
177 .byte 0x00
178 .byte 0x00
179 .byte 0x00
180 .byte 0x00
181 .byte 0x00
182 .byte 0x00
183 .byte 0x00
184 .byte 0x00
185 .byte 0x00
186 .byte 0x00
187 .byte 0x00
188 .byte 0x00
189 .byte 0x00
190 .byte 0x00
191 .byte 0x00
192 .byte 0x00
193 .byte 0x00
194.end