| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: n2_err_mcu_ios_ecc_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_Hw_Corrected_Error_0x63 My_Corrected_ECC_error_trap |
| 39 | #define H_HT0_Sw_Recoverable_Error_0x40 My_Recoverable_Sw_error_trap |
| 40 | |
| 41 | #define MAIN_PAGE_NUCLEUS_ALSO |
| 42 | #define MAIN_PAGE_HV_ALSO |
| 43 | |
| 44 | |
| 45 | #include "hboot.s" |
| 46 | #include "asi_s.h" |
| 47 | |
| 48 | #define L20 0x0002204000 |
| 49 | #define L21 0x0002204040 |
| 50 | |
| 51 | #define L22 0x0002204080 |
| 52 | #define L23 0x00022040c0 |
| 53 | |
| 54 | #define L24 0x0002204100 |
| 55 | #define L25 0x0002204140 |
| 56 | |
| 57 | #define L26 0x0002204180 |
| 58 | #define L27 0x00022041c0 |
| 59 | |
| 60 | #ifdef MCU0 |
| 61 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_0 |
| 62 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_0 |
| 63 | |
| 64 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_0 |
| 65 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_0 |
| 66 | |
| 67 | #define DRAM_ERR_INJ_REG 0x8400000290 |
| 68 | #define DRAM_ERR_STAT_REG 0x8400000280 |
| 69 | #define L2_ERR_STAT_REG 0xAB00000000 |
| 70 | #define L2_ERR_ADDR_REG 0xAC00000000 |
| 71 | #endif |
| 72 | |
| 73 | #ifdef MCU1 |
| 74 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_1 |
| 75 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_1 |
| 76 | |
| 77 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_1 |
| 78 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_1 |
| 79 | |
| 80 | #define DRAM_ERR_INJ_REG 0x8400001290 |
| 81 | #define DRAM_ERR_STAT_REG 0x8400001280 |
| 82 | #define L2_ERR_STAT_REG 0xAB00000080 |
| 83 | #define L2_ERR_ADDR_REG 0xAC00000080 |
| 84 | #endif |
| 85 | |
| 86 | #ifdef MCU2 |
| 87 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_2 |
| 88 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_2 |
| 89 | |
| 90 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_2 |
| 91 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_2 |
| 92 | |
| 93 | #define DRAM_ERR_INJ_REG 0x8400002290 |
| 94 | #define DRAM_ERR_STAT_REG 0x8400002280 |
| 95 | #define L2_ERR_STAT_REG 0xAB00000100 |
| 96 | #define L2_ERR_ADDR_REG 0xAC00000100 |
| 97 | #endif |
| 98 | |
| 99 | #ifdef MCU3 |
| 100 | #define DRAM_FBR_CNT_REG_PA DRAM_FBR_CNT_REG_PA_3 |
| 101 | #define DRAM_ERR_CNT_REG_PA DRAM_ERR_CNT_REG_PA_3 |
| 102 | |
| 103 | #define DRAM_FBD_ERR_SYND_REG_PA DRAM_FBD_ERR_SYND_REG_PA_3 |
| 104 | #define DRAM_FBD_INJ_ERR_SRC_REG_PA DRAM_FBD_INJ_ERR_SRC_REG_PA_3 |
| 105 | |
| 106 | |
| 107 | #define DRAM_ERR_INJ_REG 0x8400003290 |
| 108 | #define DRAM_ERR_STAT_REG 0x8400003280 |
| 109 | #define L2_ERR_STAT_REG 0xAB00000180 |
| 110 | #define L2_ERR_ADDR_REG 0xAC00000180 |
| 111 | #endif |
| 112 | |
| 113 | #define CMP_ECC_CNT 0x0 |
| 114 | |
| 115 | #ifdef L2_OFF |
| 116 | #define L2_ON_OFF_DM 0x1 |
| 117 | #else |
| 118 | #define L2_ON_OFF_DM 0x0 |
| 119 | #endif |
| 120 | |
| 121 | #define TT 0x63 |
| 122 | |
| 123 | .text |
| 124 | .global main |
| 125 | .global My_Corrected_ECC_error_trap |
| 126 | .global My_Recoverable_Sw_error_trap |
| 127 | |
| 128 | |
| 129 | main: |
| 130 | ta T_CHANGE_HPRIV |
| 131 | clr %i6 |
| 132 | clr %i7 |
| 133 | clr %i2 |
| 134 | clr %i0 |
| 135 | |
| 136 | write_mcu_fbr_count_reg: |
| 137 | set 0x10000, %g6 !<16>=countone=1 |
| 138 | setx DRAM_FBR_CNT_REG_PA, %l7, %o2 |
| 139 | stx %g6, [%o2] |
| 140 | ldx [%o2], %i1 |
| 141 | |
| 142 | set_error_count_reg: |
| 143 | set 0x1, %g6 !<16>=countone=1 |
| 144 | setx DRAM_ERR_CNT_REG_PA, %l7, %o2 |
| 145 | stx %g6, [%o2] |
| 146 | |
| 147 | clear_soc_esr: |
| 148 | setx SOC_ESR_REG, %l7, %g5 |
| 149 | stx %g0, [%g5] |
| 150 | |
| 151 | clear_soc_per: |
| 152 | setx SOC_PER_REG, %l7, %g5 |
| 153 | stx %g0, [%g5] |
| 154 | |
| 155 | clear_mcu_esr: |
| 156 | setx DRAM_ERR_STAT_REG, %l7, %g5 |
| 157 | stx %g0, [%g5] |
| 158 | |
| 159 | clear_l2_esr: |
| 160 | setx L2_ERR_STAT_REG, %l7, %g5 |
| 161 | stx %g0, [%g5] |
| 162 | |
| 163 | clear_l2_ear: |
| 164 | setx L2_ERR_ADDR_REG, %l7, %g5 |
| 165 | stx %g0, [%g5] |
| 166 | |
| 167 | set_ejr: |
| 168 | set 0x1, %g1 |
| 169 | sllx %g1, ERR_FIELD, %g2 |
| 170 | setx SOC_EJR_REG, %l7, %g3 |
| 171 | stx %g2, [%g3] |
| 172 | membar 0x40 |
| 173 | |
| 174 | set_eie: |
| 175 | setx SOC_EIE_REG, %l7, %g3 |
| 176 | stx %g2, [%g3] |
| 177 | membar 0x40 |
| 178 | |
| 179 | L2_Init: |
| 180 | setx L20, %g7, %l0 |
| 181 | setx L22, %g7, %l2 |
| 182 | setx L24, %g7, %l4 |
| 183 | setx L26, %g7, %l6 |
| 184 | |
| 185 | ! Each of the line should be a miss in L2 and Read from Memory |
| 186 | |
| 187 | #ifdef MCU0 |
| 188 | L2_0: |
| 189 | ldx [%l0], %g1 |
| 190 | #endif |
| 191 | |
| 192 | #ifdef MCU1 |
| 193 | L2_2: |
| 194 | ldx [%l2], %g1 |
| 195 | #endif |
| 196 | |
| 197 | #ifdef MCU2 |
| 198 | L2_4: |
| 199 | ldx [%l4], %g1 |
| 200 | #endif |
| 201 | |
| 202 | #ifdef MCU3 |
| 203 | L2_6: |
| 204 | ldx [%l6], %g1 |
| 205 | #endif |
| 206 | |
| 207 | membar 0x40 |
| 208 | |
| 209 | setx 0x400, %g1, %g4 |
| 210 | trap_delay_loop: |
| 211 | dec %g4 |
| 212 | brz %g4, test_fail |
| 213 | nop |
| 214 | |
| 215 | cmp %i7, %g0 |
| 216 | bne %xcc, check_error_trap |
| 217 | nop |
| 218 | |
| 219 | ba trap_delay_loop |
| 220 | nop |
| 221 | |
| 222 | |
| 223 | check_error_trap: |
| 224 | setx EXECUTED, %l1, %l0 |
| 225 | cmp %i2, %l0 |
| 226 | bne test_fail |
| 227 | nop |
| 228 | |
| 229 | mov TT, %l0 |
| 230 | cmp %i0, %l0 |
| 231 | bne test_fail |
| 232 | nop |
| 233 | |
| 234 | /****************************************************** |
| 235 | * Exit code |
| 236 | *******************************************************/ |
| 237 | |
| 238 | test_pass: |
| 239 | EXIT_GOOD |
| 240 | |
| 241 | test_fail: |
| 242 | EXIT_BAD |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | /************************************************************************ |
| 248 | Trap Handlers |
| 249 | ************************************************************************/ |
| 250 | My_Recoverable_Sw_error_trap: |
| 251 | nop |
| 252 | ba test_fail |
| 253 | nop |
| 254 | |
| 255 | !PER not cleared at the end of the TRAP Handler to avoid further Trap |
| 256 | My_Corrected_ECC_error_trap: |
| 257 | ! Signal trap taken |
| 258 | setx EXECUTED, %l0, %i2 |
| 259 | ! save trap type value |
| 260 | rdpr %tt, %i0 |
| 261 | |
| 262 | inc %i7 |
| 263 | |
| 264 | clear_ejr_tt63: |
| 265 | setx SOC_EJR_REG, %l7, %l0 |
| 266 | stx %g0, [%l0] |
| 267 | nop |
| 268 | |
| 269 | check_desr_tt63: |
| 270 | ldxa [%g0]0x4c, %g2 |
| 271 | nop |
| 272 | setx 0x8b00000000000000, %l0, %g3 |
| 273 | subcc %g2, %g3, %g4 |
| 274 | brnz %g4, test_fail |
| 275 | nop |
| 276 | |
| 277 | check_per_tt63: |
| 278 | setx SOC_PER_REG, %l7, %g5 |
| 279 | ldx [%g5], %i1 |
| 280 | nop |
| 281 | setx 0x8000000000000000, %l7, %g7 !valid bit |
| 282 | set 0x1, %g1 |
| 283 | sllx %g1, ERR_FIELD, %g2 |
| 284 | or %g7, %g2, %i3 |
| 285 | subcc %i1, %i3, %i4 |
| 286 | brnz %i4, test_fail |
| 287 | nop |
| 288 | |
| 289 | check_mcu_esr_tt63: |
| 290 | mov 0x1, %l1 |
| 291 | sllx %l1, DRAM_ES_DAC, %g2 |
| 292 | |
| 293 | /* |
| 294 | mov 0x1, %l1 |
| 295 | sllx %l1, DRAM_ES_MEC, %l2 |
| 296 | |
| 297 | or %l0, %l2, %l6 |
| 298 | */ |
| 299 | |
| 300 | setx DRAM_ERR_STAT_REG, %l3, %g5 |
| 301 | ldx [%g5], %l1 |
| 302 | |
| 303 | setx 0xbfffffffffff0000, %l3, %l0 |
| 304 | andcc %l0, %l1, %l5 ! Donot check SYND and MEC bits |
| 305 | |
| 306 | sub %l5, %g2, %i4 |
| 307 | brnz %i4, test_fail |
| 308 | nop |
| 309 | |
| 310 | |
| 311 | check_L2_ESR_tt63: |
| 312 | setx L2_ERR_STAT_REG, %l3, %g5 |
| 313 | ldx [%g5], %l6 |
| 314 | |
| 315 | setx 0xbffffffff0000000, %l3, %l0 |
| 316 | andcc %l0, %l6, %l5 ! Donot check L2ESR SYND and MEC bits |
| 317 | |
| 318 | mov 0x1, %l1 |
| 319 | sllx %l1, L2ES_DAC, %l0 |
| 320 | |
| 321 | mov 0x1, %l1 |
| 322 | sllx %l1, L2ES_VEC, %l2 |
| 323 | |
| 324 | or %l0, %l2, %i4 |
| 325 | |
| 326 | /* |
| 327 | mov 0x1, %l1 |
| 328 | sllx %l1, L2ES_MEC, %i3 |
| 329 | |
| 330 | or %i3, %i4, %i5 |
| 331 | */ |
| 332 | |
| 333 | cmp %l5, %i4 |
| 334 | bne %xcc, test_fail |
| 335 | nop |
| 336 | |
| 337 | Read_L2_addr_tt63: |
| 338 | setx L2_ERR_ADDR_REG, %l3, %g5 |
| 339 | ldx [%g5], %l1 |
| 340 | membar 0x40 |
| 341 | |
| 342 | check_fbr_cnt_reg_tt63: |
| 343 | setx DRAM_FBR_CNT_REG_PA, %l7, %o2 |
| 344 | ldx [%o2], %g1 |
| 345 | set 0x10000, %g6 !<16>=countone=1 |
| 346 | sub %g1, %g6, %i4 |
| 347 | brnz %i4, test_fail |
| 348 | nop |
| 349 | |
| 350 | read_err_cnt_reg_tt63: |
| 351 | setx DRAM_ERR_CNT_REG_PA, %l7, %o2 |
| 352 | ldx [%o2], %g1 |
| 353 | set CMP_ECC_CNT, %i1 |
| 354 | sub %g1, %i1, %i4 |
| 355 | brnz %i4, test_fail |
| 356 | nop |
| 357 | |
| 358 | clear_per_tt63: |
| 359 | setx SOC_PER_REG, %l7, %l0 |
| 360 | stx %g0, [%l0] |
| 361 | nop |
| 362 | |
| 363 | |
| 364 | done |
| 365 | nop |
| 366 | |