Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / common / swreset.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: swreset.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#define SPU_TIMEOUT 0x100
41
42#define H_HT0_Interrupt_0x60
43#define My_HT0_Interrupt_0x60 \
44 call my_trap_code; \
45 nop; \
46 retry; \
47 nop;
48
49#include "hboot.s"
50#include "asi_s.h"
51
52/************************************************************************
53 Test case code start
54 ************************************************************************/
55
56.text
57.global main
58
59main:
60 ta T_CHANGE_HPRIV
61
62!
63! Thread 0 Start
64!
65thread_0:
66
67 ! PCX Load, CPX Load Return
68
69 setx user_data_start, %g1, %g2
70 setx 0x8900000808, %g3, %g4
71
72load:
73 ldx [%g2], %l6
74 brz %l6, swreset
75 add %l6, 1, %l6
76 ba test_passed
77
78swreset:
79 stx %l6, [%g2]
80 set 0x1, %g5
81 stx %g5, [%g4]
82 ldx [%g4], %g6
83 nop
84
85
86
87/**********************************************************************
88 * Common code.
89 *********************************************************************/
90
91test_passed:
92 EXIT_GOOD
93
94test_failed:
95 EXIT_BAD
96
97 ! Assumes that %o0 contains VA that maps to L2$ line to be flushed,
98 ! and %o7 contains the return address. The flush is done by
99 ! doing 16 loads from different addresses that alias to that line.
100 ! Note that this will cause a writeback if the L2$ line is dirty.
101 ! The registers %o1, %o2, %o3, %o4 and %o5 are used.
102
103**********************************************************************/
104
105.global my_trap_code
106
107my_trap_code:
108 ! Increment the count
109
110 setx my_trap_count, %g6, %g7
111 ld [%g7], %g5
112 add %g5, 1, %g5
113 st %g5, [%g7]
114 membar #Sync
115
116 ! Clear the interrupt
117
118 ldxa [%g0]ASI_SWVR_INTR_R, %g3
119
120 jmpl %o7+0x8, %g0
121 nop
122
123
124/************************************************************************
125 Test case data start
126 ************************************************************************/
127.data
128user_data_start:
129 .xword 0x0000000000000000
130
131my_trap_count:
132 .xword 0x0
133
134user_data_end:
135
136
137
138 .align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line
139alias1:
140 .skip 1024
141
142.end
143
144