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