Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: n2_err_dram_DAU_st_trap.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_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap | |
39 | ||
40 | ||
41 | #define MAIN_PAGE_NUCLEUS_ALSO | |
42 | #define MAIN_PAGE_HV_ALSO | |
43 | ||
44 | #define DRAM_ERR_INJ_REG 0x8400000290 | |
45 | #define DRAM_ERR_STAT_REG 0x8400000280 | |
46 | #define L2_ERR_STAT_REG 0xAB00000000 | |
47 | #define L2_ERR_ADDR_REG 0xAC00000000 | |
48 | ||
49 | #define TT_SW_Error 0x40 | |
50 | ||
51 | ||
52 | #define ERROR_ADDR 0x20200000 | |
53 | #define TEST_DATA0 0x1000100081c3e008 | |
54 | #define TEST_DATA1 0x2000200081c3e008 | |
55 | #define TEST_DATA2 0x3000300081c3e008 | |
56 | #define L2_ES_W1C_VALUE 0xc03ffff800000000 | |
57 | #define DRAM_ES_W1C_VALUE 0xfe00000000000000 | |
58 | ||
59 | #include "hboot.s" | |
60 | #include "asi_s.h" | |
61 | #include "err_defines.h" | |
62 | ||
63 | ||
64 | .text | |
65 | .global main | |
66 | .global My_Recoverable_Sw_error_trap | |
67 | ||
68 | ||
69 | ||
70 | ||
71 | main: | |
72 | ta T_CHANGE_HPRIV | |
73 | disable_l1: | |
74 | ldxa [%g0] ASI_LSU_CONTROL, %l0 | |
75 | ! Remove the lower 2 bits (I-Cache and D-Cache enables) | |
76 | andn %l0, 0x3, %l0 | |
77 | stxa %l0, [%g0] ASI_LSU_CONTROL | |
78 | ||
79 | ||
80 | clear_dram_esr_0: | |
81 | ! Clear DRAM Error status register (Bit[63:57] write-1-clear) | |
82 | setx DRAM_ES_W1C_VALUE, %l0, %g4 | |
83 | setx DRAM_ERR_STAT_REG, %l3, %g5 | |
84 | stx %g4, [%g5] | |
85 | ||
86 | set_DRAM_error_inject_ch0: | |
87 | mov 0x606, %l1 ! ECC Mask (2-bit error) | |
88 | mov 0x1, %l2 | |
89 | sllx %l2, DRAM_EI_SSHOT, %l3 | |
90 | Or %l1, %l3, %l1 ! Set single shot ; | |
91 | mov 0x1, %l2 | |
92 | sllx %l2, DRAM_EI_ENB, %l3 | |
93 | or %l1, %l3, %l1 ! Enable error injection for the next write | |
94 | setx DRAM_ERR_INJ_REG, %l3, %g6 | |
95 | stx %l1, [%g6] | |
96 | membar 0x40 | |
97 | ||
98 | enable_err_reporting: | |
99 | setx L2EE_PA0, %l0, %l1 | |
100 | ldx [%l1], %l2 | |
101 | mov 0x3, %l0 | |
102 | or %l2, %l0, %l2 | |
103 | stx %l2, [%l1] | |
104 | ||
105 | ! Write 1 to clear L2 Error status registers | |
106 | clear_l2_ESR: | |
107 | setx L2ES_PA0, %l3, %l4 | |
108 | stx %g4, [%l4] | |
109 | nop | |
110 | ||
111 | store_to_L2: | |
112 | setx TEST_DATA1, %l0, %g5 | |
113 | ||
114 | ||
115 | set_L2_Directly_Mapped_Mode: | |
116 | setx L2CS_PA0, %l6, %g1 | |
117 | mov 0x2, %l0 | |
118 | stx %l0, [%g1] | |
119 | ||
120 | ||
121 | store_to_L2_way0: | |
122 | setx 0x202000aa00, %l0, %g2 ! bits [21:18] select way | |
123 | stx %g5, [%g2] | |
124 | stx %g5, [%g2+8] | |
125 | membar #Sync | |
126 | ||
127 | ! Storing to same L2 way0 but different tag,this will write to mcu | |
128 | write_mcu_channel_0: | |
129 | setx 0x201000aa00, %l0, %g3 ! bits [21:18] select way | |
130 | stx %g5, [%g3] | |
131 | stx %g5, [%g3+8] | |
132 | membar #Sync | |
133 | ||
134 | ||
135 | read_error_address_ch0: | |
136 | stx %g5, [%g2] | |
137 | ! ldx [%g2], %l1 | |
138 | membar #Sync | |
139 | ! ldx [%g3], %l2 | |
140 | ! membar #Sync | |
141 | ||
142 | ||
143 | check_DRAM_ESR: | |
144 | setx DRAM_ERR_STAT_REG, %l3, %g5 | |
145 | ldx [%g5], %l6 | |
146 | setx 0xffc0000000000000, %l0,%o2 | |
147 | and %l6,%o2,%l6 | |
148 | ||
149 | compute_dram_ESR: | |
150 | mov 0x1, %l1 | |
151 | sllx %l1, DRAM_ES_DAU, %l0 ! %l0 has expected value | |
152 | ||
153 | verify_dram_ESR: | |
154 | cmp %l0, %l6 | |
155 | bne %xcc, test_fail | |
156 | nop | |
157 | ||
158 | check_L2_ESR_0: | |
159 | setx L2_ERR_STAT_REG, %l3, %g5 | |
160 | ldx [%g5], %l6 | |
161 | ||
162 | compute_L2_ESR: | |
163 | setx 0xfffffffff0000000, %l3, %l0 | |
164 | andcc %l0, %l6, %l5 ! Donot check L2ESR SYND bits | |
165 | mov 0x1, %l1 | |
166 | sllx %l1, L2ES_DAU, %l0 | |
167 | mov 0x1, %l1 | |
168 | sllx %l1, L2ES_VEU, %l2 | |
169 | or %l0, %l2, %l3 | |
170 | ||
171 | verify_L2_ESR: | |
172 | cmp %l5, %l3 | |
173 | bne %xcc, test_fail | |
174 | nop | |
175 | ||
176 | ||
177 | setx L2EA_PA0, %l2, %l3 | |
178 | check_l2_EAR: | |
179 | ldx [%l3], %l4 | |
180 | ! Error address is the physical address of the cache line | |
181 | setx 0x202000aa00, %l0, %l1 ! bits [21:18] select way | |
182 | setx 0xffffffffc0, %l0,%o2 | |
183 | and %l4, %o2, %l4 | |
184 | ||
185 | cmp %l4, %l1 | |
186 | bne %xcc, test_fail | |
187 | nop | |
188 | ||
189 | ||
190 | check_sw_err_trap: | |
191 | ! Check if a Software Recoverable Error Trap happened | |
192 | set EXECUTED, %l0 | |
193 | cmp %o0, %l0 | |
194 | bne test_fail | |
195 | nop | |
196 | mov TT_SW_Error, %l0 | |
197 | cmp %o1, %l0 | |
198 | bne test_fail | |
199 | nop | |
200 | ||
201 | ||
202 | ba test_pass | |
203 | nop | |
204 | ||
205 | ||
206 | My_Recoverable_Sw_error_trap: | |
207 | ! Signal trap taken | |
208 | setx EXECUTED, %l0, %o0 | |
209 | ! save trap type value | |
210 | rdpr %tt, %o1 | |
211 | retry | |
212 | nop | |
213 | ||
214 | /******************************************************* | |
215 | * Exit code | |
216 | *******************************************************/ | |
217 | ||
218 | test_pass: | |
219 | ta T_GOOD_TRAP | |
220 | ||
221 | ||
222 | test_fail: | |
223 | ta T_BAD_TRAP | |
224 | ||
225 | ||
226 |