Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_L2_LVF_uecc_WrmRst.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 L2ES_LVC 34 | |
44 | ||
45 | ||
46 | #include "hboot.s" | |
47 | #include "asi_s.h" | |
48 | #include "err_defines.h" | |
49 | ||
50 | .text | |
51 | .global main | |
52 | ||
53 | ||
54 | main: | |
55 | ||
56 | ||
57 | ! Boot code does not provide TLB translation for IO address space | |
58 | ta T_CHANGE_HPRIV | |
59 | ||
60 | ! Check if Warm Reset is done, or first time entering diag | |
61 | setx warm_reset_done, %g1, %g2 | |
62 | ldx [%g2], %g3 | |
63 | brnz %g3, Warm_Reset_Complt | |
64 | nop | |
65 | ||
66 | ! First time thru, Store a non-zero value there | |
67 | dec %g3 | |
68 | stx %g3, [%g2] | |
69 | ||
70 | ||
71 | setx L2_ES_W1C_VALUE, %l0, %g4 | |
72 | ||
73 | ! Now access L2 control and status registers | |
74 | disable_l1: | |
75 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
76 | ! Remove the lower 2 bits (I-Cache and D-Cache enables) | |
77 | andn %l0, 0x3, %l0 | |
78 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
79 | ||
80 | ! Write 1 to clear L2 Error status registers | |
81 | ||
82 | enable_err_reporting: | |
83 | setx L2EE_PA0, %l0, %l1 | |
84 | ldx [%l1], %l2 | |
85 | mov 0x1, %l0 | |
86 | or %l2, %l0, %l2 | |
87 | stx %l2, [%l1] | |
88 | ||
89 | clear_l2_ESR: | |
90 | setx L2ES_PA0, %l3, %l4 | |
91 | stx %g4, [%l4] | |
92 | nop | |
93 | ||
94 | ||
95 | set_L2_Directly_Mapped_Mode: | |
96 | setx L2CS_PA0, %l6, %g1 | |
97 | mov 0x2, %l0 | |
98 | stx %l0, [%g1] | |
99 | ||
100 | ||
101 | store_to_L2_way0: | |
102 | setx TEST_DATA, %l0, %g5 | |
103 | setx 0x22000000, %l0, %g1 | |
104 | stx %g5, [%g1] | |
105 | stx %g5, [%g1+8] | |
106 | membar #Sync | |
107 | ||
108 | ||
109 | generate_VD_addr: | |
110 | ! Generate L2 VD Diag read address | |
111 | ! Addressing: [39:32] See PRM, [22] 1 for V/D, [17:8] set, [7:6] bank, [2:0] = 0 | |
112 | setx 0x3ffc0, %l0, %l2 ! Mask for extracting [17:6] | |
113 | and %g1, %l2, %l7 | |
114 | ||
115 | mov 0xb6, %l0 | |
116 | sllx %l0, 32, %l0 ! Bits [39:32] | |
117 | or %l7, %l0, %l7 | |
118 | ||
119 | mov 0x1, %l0 | |
120 | sllx %l0, 22, %l0 ! Bit [22] | |
121 | or %l7, %l0, %l7 | |
122 | ||
123 | read_l2_VD_diag: | |
124 | ldx [%l7], %l6 | |
125 | xor %l6, 0xc,%l6 | |
126 | stx %l6,[%l7] | |
127 | ||
128 | store_to_L2_way0_wb: | |
129 | setx TEST_DATA, %l0, %g5 | |
130 | setx 0x22000000, %l0, %g1 | |
131 | setx 0x22000000, %l1, %g2 | |
132 | stx %g5, [%g1] | |
133 | membar #Sync | |
134 | stx %g5, [%g2] | |
135 | membar #Sync | |
136 | ||
137 | ||
138 | enable_l1: | |
139 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
140 | or %l0, 0x3, %l0 | |
141 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
142 | ||
143 | Warm_Reset_Complt: | |
144 | nop | |
145 | ||
146 | ! Compute expected value of L2 error status register | |
147 | compute_expected_L2_ESR: | |
148 | mov 0x1, %l1 | |
149 | sllx %l1, L2ES_LVU, %l0 | |
150 | sllx %l1, L2ES_VEU, %l3 ! VEC bit | |
151 | or %l0, %l3, %l0 | |
152 | setx L2ES_PA0, %l2, %l3 | |
153 | ||
154 | ||
155 | check_l2_ESR: | |
156 | ldx [%l3], %l4 | |
157 | ||
158 | setx 0xfc00000000, %l5,%g2 | |
159 | and %l4, %g2, %l4 | |
160 | cmp %l4, %l0 | |
161 | bne test_fail | |
162 | nop | |
163 | ||
164 | setx L2EA_PA0, %l2, %l3 | |
165 | check_l2_EAR: | |
166 | ldx [%l3], %l4 ! Error address is the physical address of the cache line (PA[5:0] 0) | |
167 | cmp %g1,%l4 | |
168 | bne test_fail | |
169 | nop | |
170 | ||
171 | ||
172 | ||
173 | clr %g2 | |
174 | set 0x77, %g3 | |
175 | loop: | |
176 | inc %g2 | |
177 | cmp %g2,%g3 | |
178 | bne loop | |
179 | nop | |
180 | ||
181 | ||
182 | ba test_pass | |
183 | nop | |
184 | ||
185 | ||
186 | /******************************************************* | |
187 | * Exit code | |
188 | *******************************************************/ | |
189 | ||
190 | test_pass: | |
191 | ta T_GOOD_TRAP | |
192 | ||
193 | test_fail: | |
194 | ta T_BAD_TRAP | |
195 | ||
196 | ||
197 | .align 64 | |
198 | warm_reset_done: | |
199 | .xword 0 | |
200 |