Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / error / l2 / n2_err_l2_LDWU_uecc.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: n2_err_l2_LDWU_uecc.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
40#define L2_ENTRY_PA 0x517590000
41#define TEST_DATA 0x555555555555555
42#define L2_ES_W1C_VALUE 0xc03ffff800000000
43#define TT_SW_Error 0x40
44
45
46#include "hboot.s"
47#include "asi_s.h"
48#include "err_defines.h"
49
50.text
51.global main
52
53
54main:
55
56
57 ! Boot code does not provide TLB translation for IO address space
58 ta T_CHANGE_HPRIV
59
60 setx L2_ES_W1C_VALUE, %l0, %g4
61
62 ! Now access L2 control and status registers
63disable_l1:
64 ldxa [%g0] ASI_LSU_CONTROL, %l0
65 ! Remove the lower 2 bits (I-Cache and D-Cache enables)
66 andn %l0, 0x3, %l0
67 stxa %l0, [%g0] ASI_LSU_CONTROL
68
69 ! Write 1 to clear L2 Error status registers
70
71clear_l2_ESR:
72 setx L2ES_PA0, %l3, %l4
73 stx %g4, [%l4]
74 nop
75
76
77set_L2_Directly_Mapped_Mode:
78 setx L2CS_PA0, %l6, %g1
79 mov 0x2, %l0
80 stx %l0, [%g1]
81
82
83store_to_L2_way0:
84 setx TEST_DATA, %l0, %g5
85 setx 0x202000aa00, %l0, %g1
86 stx %g5, [%g1]
87 stx %g5, [%g1+8]
88 membar #Sync
89
90
91generate_VD_addr:
92 ! Generate L2 VD Diag read address
93 ! Addressing: [39:32] See PRM, [22] 1 for V/D, [17:8] set, [7:6] bank, [2:0] = 0
94 setx 0x3ffc0, %l0, %l2 ! Mask for extracting [17:6]
95 and %g1, %l2, %l7
96
97 mov 0xb6, %l0
98 sllx %l0, 32, %l0 ! Bits [39:32]
99 or %l7, %l0, %l7
100
101 mov 0x1, %l0
102 sllx %l0, 22, %l0 ! Bit [22]
103 or %l7, %l0, %l7
104
105
106 ! Now find out which way it is being stored
107 setx 0xffff, %l0, %l2 ! Mask for [16:0]
108 and %l6, %l2, %l6 ! Valid bits at [31:16]
109
110 clr %g2 ! %g2 will store the "way"
111
112
113way_found:
114 ! Read L2 Data Diag - %g2 has the "way"
115 ! Addressing: [39:32] See PRM, [22] odd/even word, [21:18] way, [17:8] set, [7:6] bank, [5:3] D-word, [2:0] = 0
116 setx 0x3fff8, %l0, %l2 ! Mask for extracting [17:3]
117 and %g1, %l2, %g5
118
119 sllx %g2, 18, %l0 ! Position Way
120 or %g5, %l0, %g5
121
122 mov 0xa3, %l0
123 sllx %l0, 32, %l0 ! Bits [39:32]
124 or %g5, %l0, %g5 ! %g5 has L2 Data Diag addressing
125
126
127read_l2_data_diag:
128 ldx [%g5], %g6
129
130 ! Flip one bit from the data field
131 xor %g6, 0xc0, %g6 ! save on %g6 for future reference
132write_back_with_error:
133 stx %g6, [%g5]
134
135 ! Now set allocate bits for all other 15 ways (to ensure a write-back later)
136set_allocate:
137 mov 0x1, %l0
138 sllx %l0, 22, %l1 ! L2_VD and L2_UA addressing differ on bit 22
139 xor %l7, %l1, %l7 ! change %l7 from L2_VD to L2_UA address
140
141 sllx %l0, %g2, %l1 ! Shift "way" into its bit position
142 not %l1
143 setx 0xffff,%l5, %g2
144 and %l1, %g2 , %l1 ! Allocate bits on [15:0]
145 or %l6, %l1, %l6 ! Write 1 to all other 15 ways' allocate bits
146
147 ! also need to set ECC bits for Allocate bits (Bits [38:32])
148set_ECC_Allocate:
149 mov 0x7f, %l0
150 sllx %l0, 32, %l0
151 xor %l6, %l0, %l1
152 or %l6, %l1, %l6
153
154
155 ! Now do another store with the same index but different tag - to force a Write-Back
156error_address:
157 mov 0x1, %l0
158 sllx %l0, 28, %l0
159 xor %g1, %l0, %l1 ! Flip bit 28 of previous L2 entry PA
160
161 ! This should cause L2 LDWU (bit 51)
162store_to_L2_with_error:
163 st %g5, [%l1]
164 membar #Sync
165
166
167enable_l1:
168 ldxa [%g0] ASI_LSU_CONTROL, %l0
169 or %l0, 0x3, %l0
170 stxa %l0, [%g0] ASI_LSU_CONTROL
171
172
173 ! Compute expected value of L2 error status register
174compute_expected_L2_ESR:
175 mov 0x1, %l1
176 sllx %l1, L2ES_LDWU, %l0
177 sllx %l1, L2ES_VEU, %l3 ! VEU bit
178 or %l0, %l3, %l0
179 ! No RW bit or Syndrome field for LDWU - %l0 has expected value
180
181 setx L2ES_PA0, %l2, %l3
182
183
184check_l2_ESR:
185 ldx [%l3], %l4
186
187 cmp %l4, %l0
188 bne %xcc, test_fail
189 nop
190
191 setx L2EA_PA0, %l2, %l3
192check_l2_EAR:
193 ldx [%l3], %l4
194
195 ! Error address is the physical address of the cache line (PA[5:0] 0)
196 andn %g1, 0x3f, %l1
197 cmp %l4, %l1
198 bne %xcc, test_fail
199 nop
200
201 ba test_pass
202 nop
203
204
205
206/*******************************************************
207 * Exit code
208 *******************************************************/
209
210test_pass:
211ta T_GOOD_TRAP
212
213test_fail:
214ta T_BAD_TRAP
215