Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / uarch / tlu / diag / err_tcc_stick_halt_diag.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: err_tcc_stick_halt_diag.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_HV_ALSO
39#define MAIN_PAGE_NUCLEUS_ALSO
40#define CETER_DE 0x2000000000000000
41#define ASI_CETER 0x4C
42#define CETER_VA 0x18
43#define ASI_CERER 0x4C
44#define CERER_VA 0x10
45#define TCCU_ERR_EN 0x80400000
46
47
48!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
49
50! Interrupt trap handler
51
52#define H_HT0_Interrupt_Level_14_0x4e
53#define My_HT0_Interrupt_Level_14_0x4e \
54 rd %sys_tick, %l0; \
55 add %g0, 1, %i0; \
56 retry; \
57 nop
58
59#define H_HT0_Sw_Recoverable_Error_0x40
60#define SUN_H_HT0_Sw_Recoverable_Error_0x40 \
61 rd %sys_tick, %l0; \
62 ldxa [%g0]0x4C, %l7; \
63 add %g0, 1, %i1; \
64 retry; \
65 nop
66
67#include "hboot.s"
68
69/************************************************************************
70 Test case code start
71 ************************************************************************/
72
73.text
74.global main
75
76main: /* test begin */
77
78 ta T_CHANGE_HPRIV
79 mov %g0, %i0
80 mov %g0, %i1
81! Enable tccd errors.
82 add %g0, 0x80, %o2
83 add %g0, CERER_VA, %g3
84 stxa %o2, [%g3]ASI_CERER
85
86! Turn off IE bit so the sw_recoverable err trap is not taken
87!again and again
88 rdpr %pstate, %l1
89 wrpr %l1, 0x2, %pstate
90
91
92 !! set CETER.DE
93 setx CETER_DE, %l0, %o2
94 add %g0, CETER_VA, %g3
95 stxa %o2, [%g3]ASI_CETER
96
97!! Enable error injection
98 setx TCCU_ERR_EN, %l0, %l5
99 or %l5, 0x1, %l5 ! set mask bit 0 t
100 stxa %l5, [%g0]ASI_ERR_INJ
101
102set_stick:
103 setx 0x50000000, %g1, %g2
104 add %g2, 0x200, %g3
105 wr %g2, %g0, %sys_tick
106
107set_stick_cmpr:
108 wr %g0, %g3, %sys_tick_cmpr !! err will be injected
109
110 wrhpr %g0, 0x0, %halt
111
112! set the priv bit to read the softint register
113 rdpr %pstate, %l1
114 wrpr %l1, 0x4, %pstate
115
116!! get out of hp mode since the int 14 trap won't be taken in hpriv mode
117 rdhpr %hpstate, %l1
118 wrhpr %l1, 0x4, %hpstate
119
120 add %i2, 10, %i3
121 add %i2, 10, %i3
122 add %i2, 10, %i3
123 add %i2, 10, %i3
124
125
126 brnz %i0, FAIL ! chk int_14 trap not taken
127 brz %i1, FAIL !chk sw_recoverable trap is taken
128 nop
129
130!! Chk softint register is clear. We can chk for only SM bit not being set, but
131!! since there is nothing in the diag to set the TM or int_level bits, the register
132!! shd be clear.
133 rd %softint, %l1
134 brnz %l1, FAIL
135 nop
136
137
138 EXIT_GOOD
139 nop
140
141FAIL:
142 EXIT_BAD
143 nop
144
145/************************************************************************
146 Test case data start
147 ************************************************************************/
148.data
149user_data_start:
150.word 0xB52E8698
151.end
152
153
154
155
156
157
158