Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / cmp / n2_cmp_upk_pk_upk.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_cmp_upk_pk_upk.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
42#include "hboot.s"
43#include "asi_s.h"
44
45#define L20 0x0000134000
46#define L21 0x0000134040
47
48#define L22 0x0000134080
49#define L23 0x00001340c0
50
51#define L24 0x0000134100
52#define L25 0x0000134140
53
54#define L26 0x0000134180
55#define L27 0x00001341c0
56
57.text
58.global main
59
60
61main:
62 ta T_CHANGE_HPRIV
63 nop
64
65get_th_id_o0:
66 ta T_RD_THID
67
68 cmp %o1, 0x0
69 be main_t0
70 nop
71
72 cmp %o1, 0x1
73 be main_t1
74 nop
75
76 /**************************************
77 THREAD 0
78 **************************************/
79
80main_t0:
81 nop
82 nop
83
84unpark_thread1_t0:
85 wr %g0, ASI_CMP_CORE, %asi
86 set 0x2, %g4
87 stxa %g4, [ASI_CMP_CORE_RUNNING_W1S]%asi ! Start thread1
88 nop
89
90wait_for_th1_to_be_unparked_t0:
91 wr %g0, ASI_CMP_CORE, %asi
92 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %l0
93 set 0x3, %g1
94 sub %l0, %g1, %i4
95 brnz %i4, wait_for_th1_to_be_unparked_t0
96 nop
97
98wait_for_th1_to_be_parked_t0:
99 !TH0 to park itself
100 wr %g0, ASI_CMP_CORE, %asi
101 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %l0
102 set 0x1, %g1
103 sub %l0, %g1, %i4
104 brnz %i4, wait_for_th1_to_be_parked_t0
105 nop
106
107unpark_thread1_again_t0:
108 wr %g0, ASI_CMP_CORE, %asi
109 set 0x2, %g4
110 stxa %g4, [ASI_CMP_CORE_RUNNING_W1S]%asi ! Start thread1
111 nop
112
113wait_for_th1_to_be_unparked_again_t0:
114 wr %g0, ASI_CMP_CORE, %asi
115 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %l0
116 set 0x3, %g1
117 sub %l0, %g1, %i4
118 brnz %i4, wait_for_th1_to_be_parked_t0
119 nop
120
121 ba test_pass
122 nop
123
124
125 /**************************************
126 THREAD 1
127 **************************************/
128main_t1:
129 nop
130 nop
131 nop
132
133park_itself_t1:
134 wr %g0, ASI_CMP_CORE, %asi
135 set 0x2, %g4
136 stxa %g4, [ASI_CMP_CORE_RUNNING_W1C]%asi ! TH1 parks itself
137! membar 0x40
138
139thread1_unparked_t1:
140 wr %g0, ASI_CMP_CORE, %asi
141 ldxa [ASI_CMP_CORE_RUNNING_STATUS]%asi, %l0
142 set 0x3, %g1
143 subcc %l0, %g1, %i4
144 brnz %i4, test_fail
145 nop
146
147 ba test_pass
148 nop
149
150
151/******************************************************
152 * Exit code
153 *******************************************************/
154
155test_pass:
156EXIT_GOOD
157
158test_fail:
159EXIT_BAD
160