Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / ncu_asi_core_en_wptect.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ncu_asi_core_en_wptect.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#ifndef CORE_AVAIL
45#define CORE_AVAIL 0xff
46#endif
47
48.text
49.global main
50
51
52main:
53 ta T_CHANGE_HPRIV
54
55get_th_id:
56 ta T_RD_THID
57 wr %g0,ASI_CMP_CORE,%asi
58
59! Check that core_avail and asi_core_enable are correct
60 setx CORE_AVAIL,%g7,%g2
61 call compute_core_avail ! return in %g2
62 nop
63 setx 0x8000001010,%g7,%g3
64 ldx [%g3],%g4
65 cmp %g2,%g4
66 bne %xcc,test_fail
67 nop
68
69 setx 0xffffff0000,%g7,%g1
70 setx test_comb,%g7,%g3
71 ldub [%g1],%g6
72 cmp %g6,0x8
73 be end_diag
74 nop
75 cmp %g6,0x9
76 be test_pass
77 nop
78 cmp %g6,0x0
79 be %xcc,program
80 nop
81
82 sllx %g6,3,%g6
83 add %g3,%g6,%g3
84 srlx %g6,3,%g6
85 ldx [%g3],%g4
86 andcc %g4,%g2,%g4
87 call compute_core_en ! return in %g4
88 nop
89 bz program
90 nop
91 ldxa [ASI_CMP_CORE_ENABLED]%asi,%g5
92 cmp %g4,%g5
93 bne %xcc,test_fail
94 nop
95
96program:
97! Program asi_core_enable
98 add %g6,1,%g6
99 stb %g6,[%g1]
100 ldub [%g1],%g7
101 add %g3,8,%g3
102 ldx [%g3],%g4
103 and %g4,%g2,%g4
104 stxa %g4,[ASI_CMP_CORE_ENABLE]%asi
105
106warm_reset:
107 setx 0x8900000808,%g7,%g2
108 set 0x1,%g1
109 stx %g1,[%g2]
110
111halt:
112 ba halt
113 nop
114
115end_diag:
116 setx 0xffffff0000,%g7,%g1
117 ldub [%g1],%g3
118 add %g3,1,%g3
119 stb %g3,[%g1]
120 ldub [%g1],%g3
121
122 stxa %g4,[ASI_CMP_CORE_ENABLE]%asi
123 ba warm_reset
124 nop
125
126/******************************************************
127 * Subroutine code
128 *******************************************************/
129
130compute_core_avail:
131 or %g0,%g2,%l0
132 or %g0,%g0,%g2
133 set 0x8,%l1
134comp_loop:
135 sllx %g2,8,%g2
136 andcc %l0,0x80,%l2
137 bz skip
138 nop
139 or %g2,0xff,%g2
140skip:
141 sllx %l0,1,%l0
142 subcc %l1,1,%l1
143 bnz comp_loop
144 nop
145 retl
146 nop
147
148compute_core_en:
149 set 0x8,%l1
150 setx 0xffffffffffffff00,%g7,%l7
151 setx 0x00000000000000ff,%g7,%l6
152comp_en_loop:
153 and %g4,%l6,%l2
154 cmp %l2,%l6
155 be %xcc,skip_en
156 nop
157 and %g4,%l7,%g4
158skip_en:
159 sllx %l7,8,%l7
160 or %l7,0xff,%l7
161 sllx %l6,8,%l6
162 subcc %l1,1,%l1
163 bnz comp_en_loop
164 nop
165 retl
166 nop
167
168/******************************************************
169 * Exit code
170 *******************************************************/
171
172test_pass:
173EXIT_GOOD
174
175test_fail:
176EXIT_BAD
177
178.data
179.align 0x10
180test_comb:
181 .xword 0xfffeffffca2345ff
182 .xword 0x8976923023ccff99
183 .xword 0xffffffffffffffff
184 .xword 0x4232300109124058
185 .xword 0xfedcedaefecdebbb
186 .xword 0xbcffade538ffecfe
187 .xword 0xfffff903034ecdff
188 .xword 0x010018fff09824ff
189 .xword 0x01becaffffffff00
190 .xword 0xceff35ffbcff09ff
191 .xword 0xff89ffbcff5affc2
192 .xword 0xff10923479ffff91
193 .xword 0x3cffffc255374ff3
194 .xword 0x223f3ffecffff779
195 .xword 0xfcfffecedffeffff
196 .xword 0x6768ffff989fff29
197 .xword 0xbcbf09ff0292ffff
198.end