* ========== Copyright Header Begin ==========================================
* Hypervisor Software File: errors_soc.s
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* - Do no alter or remove copyright notices
* - Redistribution and use of this software in source and binary forms, with
* or without modification, are permitted provided that the following
* - Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistribution in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of Sun Microsystems, Inc. or the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* You acknowledge that this software is not designed, licensed or
* intended for use in the design, construction, operation or maintenance of
* ========== Copyright Header End ============================================
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
#pragma ident "@(#)errors_soc.s 1.6 07/08/17 SMI"
#include <sys/asm_linkage.h>
* SOC FBR Correctable Errrors require the DRAM ESRs to be included
GET_ERR_DIAG_DATA_BUF(%g1, %g2)
* Store L2 ESR for the bank in error into the DIAG_BUF
set (NO_L2_BANKS - 1), %g3
! skip banks which are disabled. causes hang.
SKIP_DISABLED_L2_BANK(%g3, %g4, %g5, .dump_soc_no_l2_error)
setx L2_ERROR_STATUS_REG, %g4, %g5
sllx %g3, L2_BANK_SHIFT, %g2
brz,pt %g4, .dump_soc_no_l2_error
stx %g3, [%g1 + ERR_DIAG_L2_BANK]
add %g1, ERR_DIAG_BUF_L2_CACHE_ESR, %g2
mulx %g3, ERR_DIAG_BUF_L2_CACHE_ESR_INCR, %g5
! %g2 diag_buf->l2_cache.esr
brgz,pt %g3, .dump_soc_l2_banks
* Store DRAM ESR/EAR/ND for the bank in error into the DIAG_BUF
set (NO_DRAM_BANKS - 1), %g3
! skip banks which are disabled. causes hang.
SKIP_DISABLED_DRAM_BANK(%g3, %g4, %g5, .dump_soc_no_dram_error)
! DRAM Error Status register
setx DRAM_ESR_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g2
add %g1, ERR_DIAG_BUF_DRAM_ESR, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_ESR_INCR, %g5
stx %g4, [%g2] ! store DRAM ESR
! DRAM Error Address register
add %g1, ERR_DIAG_BUF_DRAM_EAR, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_EAR_INCR, %g5
setx DRAM_EAR_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
! DRAM Error Location register
add %g1, ERR_DIAG_BUF_DRAM_LOC, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_LOC_INCR, %g5
setx DRAM_ELR_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
! DRAM Error Counter register
add %g1, ERR_DIAG_BUF_DRAM_CTR, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_CTR_INCR, %g5
setx DRAM_ECR_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
! DRAM FBD Syndrome register
add %g1, ERR_DIAG_BUF_DRAM_FBD, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_FBD_INCR, %g5
setx DRAM_FBD_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
! DRAM Error Retry register
add %g1, ERR_DIAG_BUF_DRAM_RETRY, %g2
mulx %g3, ERR_DIAG_BUF_DRAM_RETRY_INCR, %g5
setx DRAM_RETRY_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
brgz,pt %g3, .dump_soc_dram_banks
* Dump SOC diagnostic data
GET_ERR_DIAG_DATA_BUF(%g1, %g2)
add %g1, ERR_DIAG_BUF_DIAG_DATA, %g1
add %g1, ERR_DIAG_DATA_SOC, %g1
! SOC Error Status Register
setx SOC_ERROR_STATUS_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_ESR]
! SOC Pending Error Status Register
setx SOC_PENDING_ERROR_STATUS_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_PESR]
! SOC SII Syndrome Status Register
setx SOC_SII_ERROR_SYNDROME_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_SII_SYND]
! SOC NCU Syndrome Status Register
setx SOC_NCU_ERROR_SYNDROME_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_NCU_SYND]
! SOC Error Log Enable Register
setx SOC_ERROR_LOG_ENABLE, %g5, %g6
stx %g6, [%g1 + ERR_SOC_ELER]
! SOC Error Interrupt Enable Register
setx SOC_ERROR_TRAP_ENABLE, %g5, %g6
stx %g6, [%g1 + ERR_SOC_EIER]
! SOC Error Steering Register
setx SOC_ERRORSTEER_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_VCID]
stx %g0, [%g1 + ERR_SOC_VCID]
! SOC Fatal Error Enable Register
setx SOC_FATAL_ERROR_ENABLE, %g5, %g6
stx %g6, [%g1 + ERR_SOC_FEER]
! SOC Error Injection Register
setx SOC_ERROR_INJECTION_REG, %g5, %g6
stx %g6, [%g1 + ERR_SOC_EIR]
* Clear ESRs after SOC error
ALTENTRY(clear_soc_after_storm)
! SOC Error Status Register
setx SOC_ERROR_STATUS_REG, %g5, %g6
ldx [%g6], %g4 ! save for later
! SOC Pending Error Status Register
setx SOC_PENDING_ERROR_STATUS_REG, %g5, %g6
! SOC SII Syndrome Status Register
setx SOC_SII_ERROR_SYNDROME_REG, %g5, %g6
! SOC NCU Syndrome Status Register
setx SOC_NCU_ERROR_SYNDROME_REG, %g5, %g6
! if we got an MCU/FBD error, clear the MCU/FBD registers now
setx SOC_MCU0FBR|SOC_MCU0ECC, %g5, %g6
setx SOC_MCU1FBR|SOC_MCU1ECC, %g5, %g6
setx SOC_MCU2FBR|SOC_MCU2ECC, %g5, %g6
setx SOC_MCU3FBR|SOC_MCU3ECC, %g5, %g6
! skip banks which are disabled. causes hang.
SKIP_DISABLED_DRAM_BANK(%g3, %g4, %g5, 2f)
setx DRAM_ESR_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g2
stx %g4, [%g2] ! clear DRAM ESR RW1C
stx %g0, [%g2] ! clear DRAM ESR RW
setx DRAM_FBD_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
stx %g0, [%g4] ! clear DRAM FBD SYND RW
SET_SIZE(clear_soc_after_storm)
! first verify that storm prevention is enabled
CHECK_BLACKOUT_INTERVAL(%g4)
* save our return address
STORE_ERR_RETURN_ADDR(%g7, %g4, %g5)
setx SOC_ERROR_TRAP_ENABLE, %g4, %g3
setx SOC_CORRECTABLE_ERRORS, %g5, %g6
bz,pn %xcc, 9f ! SOC CEs already disabled
setx SOC_ERROR_LOG_ENABLE, %g4, %g3
* Set up a cyclic on this strand to re-enable the SOC CE bits
* after an interval of 6 seconds. Set a flag in the
* strand struct to indicate that the cyclic has been set
mov STRAND_ERR_FLAG_SOC, %g4
lduw [%g6 + STRAND_ERR_FLAG], %g2 ! installed flags
btst %g4, %g2 ! handler installed?
STRAND2CONFIG_STRUCT(%g6, %g4)
ldx [%g4 + CONFIG_CE_BLACKOUT], %g1
brz,a,pn %g1, 9f ! zero: blackout disabled
SET_STRAND_ERR_FLAG(%g6, STRAND_ERR_FLAG_SOC, %g5)
setx soc_set_error_bits, %g5, %g2
sub %g2, %g5, %g2 ! g2 = handler address
setx SOC_CORRECTABLE_ERRORS, %g4, %g3 ! g3 = arg 0 : bit(s) to set
mov STRAND_ERR_FLAG_SOC, %g4 ! g4 = arg 1 : cpu flags to clear
HVCALL(cyclic_add_rel) /* ( del_tick, address, arg0, arg1 ) */
GET_ERR_RETURN_ADDR(%g7, %g2)
* cyclic function used to re-enable SOC_TRAP_ENABLE bits
* %g1 SOC_TRAP_ENABLE bits to set
* %g2 CPU->err_flags to clear
ENTRY(soc_set_error_bits)
CLEAR_STRAND_ERR_FLAG(%g6, %g2, %g5)
setx SOC_ERROR_TRAP_ENABLE, %g4, %g5
setx SOC_ERROR_LOG_ENABLE, %g4, %g5
* We need to clear the SOC ESRs in case they were
* set while the error traps were disabled
ba,a clear_soc_after_storm ! tail call
SET_SIZE(soc_set_error_bits)
GET_ERR_SUN4V_RPRT_BUF(%g2, %g3)
brz,pn %g2, soc_sun4v_report_exit
! workaround for SOC ESRs always reading as 0
setx SOC_NCU_ERROR_SYNDROME_REG, %g3, %g4
! has a valid syndrome been logged ?
setx SOC_NCU_ESR_V, %g3, %g5
bz,pn %xcc, soc_sun4v_report_exit
! has a valid strandid been logged ?
setx SOC_NCU_ESR_S, %g3, %g5
bz,pn %xcc, soc_sun4v_report_exit
! has a valid PA been logged ?
setx SOC_NCU_ESR_P, %g3, %g5
bz,pn %xcc, soc_sun4v_report_exit
srlx %g4, SOC_NCU_ESR_STRANDID_SHIFT, %g5
and %g5, SOC_NCU_ESR_STRANDID_MASK, %g5
stuh %g5, [%g2 + ERR_SUN4V_RPRT_G_CPUID]
setx SOC_NCU_ESR_PA_MASK, %g3, %g5
CPU_ERR_IO_PA_TO_RA(%g6, %g5, %g5)
! %g5 raddr (need PA -> RA)
RANGE_CHECK_IO(%g6, %g5, %g3, soc_pa_good, soc_pa_bad, %g4, %g1)
mov CPU_ERR_INVALID_RA, %g5
stx %g5, [%g2 + ERR_SUN4V_RPRT_ADDR]
* SZ is 8 bytes for a single ASI VA
st %g5, [%g2 + ERR_SUN4V_RPRT_SZ]
SET_SIZE(soc_sun4v_report)
STORE_ERR_RETURN_ADDR(%g7, %g4, %g5)
GET_ERR_DIAG_DATA_BUF(%g1, %g2)
* print the D-SFSR/D-SFAR
PRINT_NOTRAP("SOCU error: D-SFSR : ");
ldx [%g6 + ERR_DIAG_BUF_SPARC_DSFSR], %g3
PRINT_NOTRAP("\r\nSOCU error: D-SFAR : ");
ldx [%g6 + ERR_DIAG_BUF_SPARC_DSFAR], %g3
PRINT_NOTRAP("\r\nSOCU error: DESR: ");
add %g6, ERR_DIAG_BUF_DIAG_DATA, %g6
add %g6, ERR_DIAG_DATA_SOC, %g6
! SOC Error Status Register
PRINT_NOTRAP("\r\nSOCU error: SOC ESR: ");
ldx [%g6 + ERR_SOC_ESR], %g3
! SOC Pending Error Status Register
PRINT_NOTRAP("\r\nSOCU error: SOC PENDING ESR: ");
ldx [%g6 + ERR_SOC_PESR], %g3
! SOC SII Syndrome Status Register
PRINT_NOTRAP("\r\nSOCU error: SOC SII ESR: ");
ldx [%g6 + ERR_SOC_SII_SYND], %g3
! SOC NCU Syndrome Status Register
PRINT_NOTRAP("\r\nSOCU error: SOC NCU SYND : ");
ldx [%g6 + ERR_SOC_NCU_SYND], %g3
GET_ERR_RETURN_ADDR(%g7, %g2)
* Set the DRAM FBR Error Count registers
ENTRY(reset_fbr_counters)
set (NO_DRAM_BANKS - 1), %g3
! skip banks which are disabled. causes hang.
SKIP_DISABLED_DRAM_BANK(%g3, %g4, %g5, 2f)
setx DRAM_FBR_COUNT_BASE, %g4, %g5
sllx %g3, DRAM_BANK_SHIFT, %g4
mov DRAM_ERROR_COUNTER_FBR_RATIO, %g4
SET_SIZE(reset_fbr_counters)
* Clean up after FBR errors
* DSU errata (N2 erratum 190) means we must check whether
* the FBR has caused a bogus DSU error to be logged.
STRAND_PUSH(%g7, %g3, %g4)
GET_ERR_TABLE_ENTRY(%g3, %g4)
ld [%g3 + ERR_FLAGS], %g4
HVCALL(reset_fbr_counters)
HVCALL(clear_dram_l2c_esr_regs)