* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: mcu_trap.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
My_H_HT0_Hw_Corrected_Error_0x63:
inc %o7 !keep count of traps taken
clr %g5 !use as intermediate register for setx
ldxa [%g0] 0x4c, %g1 !read DESR
srlx %g1, 61, %g2 !check if SWR or HWC
ble %xcc, 1f ! branch to I$
ble %xcc, 2f ! branch to D$
ba 3f ! branch normal, first check L2 esr, then check MCU esr
sllx %g2, 6, %g2 !index is in bits 11:6 of load_addr
ldxa [%g2] 0x67, %g3 !ASI_ICACHE_TAG
ldxa [%g2] 0x66, %g3 !ASI_ICACHE_INSTR
sllx %g2, 4, %g2 !index is in bits 10:4 of load_addr
ldxa [%g2] 0x47, %g3 !ASI_DCACHE_TAG
ldxa [%g2+%g4] 0x46, %g3 !ASI_DCACHE_DATA
ldxa [%g2+%g4] 0x46, %g3 !ASI_DCACHE_DATA
! find which L2 bank logged error
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
mov %g4, %o0 !copy to be used later
setx L2_LAST_ERROR_STATUS_REGISTER, %g5, %g6
! find which MCU logged error
and %o1, 0x180, %g2 !which MCU it is coming from
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
setx 0xffff, %g5, %g2 !check MCU ECC synd
cmp %g0, %g1 ! MSA 11/30/06: confirm that MCU SYND is non Zero
setx DRAM_ERROR_RETRY_REGISTER, %g5, %g2
!bne test_fail ! MSA 11/30/06 DRAM_ERROR_RETRY_REGISTER check is disabled
check_fbd_synd_reg_0x63: ! MSA 11/30/06; added label
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
!11/30/06 setx VALID_BIT, %g5, %g1
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
clear_fbd_Synd_reg_0x63: ! MSA 11/30/06
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
setx DRAM_ERROR_ADDRESS_REGISTER, %g5, %g2
setx L2_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
setx DRAM_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
! ***************************************************************************
My_H_HT0_Sw_Recoverable_Error_0x40:
inc %o7 !keep count of traps taken
clr %g5 !use as intermediate register for setx
ldxa [%g0] 0x4c, %g1 !DESR
mov %g1, %o0 !copy to be used later
be %xcc, 4f ! branch if you see notdata in DESR, clear L2 notdata register
ble %xcc, 2f ! branch normal, check which L2 esr logged, which MCU esr logged
be %xcc, 2f ! branch normal, check which L2 esr logged, which MCU esr logged
clear_l2_notdata_error_register_0x40:
setx L2_NOTDATA_REGISTER_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_NOTDATA_REGISTER, %g5, %g4
ba 2f ! MSA: 12/04/06; it was bypassing all check to almost end of the handler with "ba 3f"
! find which L2 bank esr is logged
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
mov %g4, %o1 !copy to be used later
setx L2_LAST_ERROR_STATUS_REGISTER, %g5, %g6
! find which MCU esr is logged
and %o2, 0x180, %g2 !which MCU it is coming from
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
! if L2 writes data to MCU with UE in it, MCU marks it by inverting bits at 8221 for ECC,
! so when MCU reads the data back from that address on future read requests, it will know
! it already has UE error in it, known as poison syndrome. once L2 encounters the 0x8221 syndrome
! it will continuously treat it as notdata, so we do a block store of all zeros
! to the L2 line and a subsequent write/read to that address will then evict the zeros to memory
! and the poison ECC bit will be wiped out
check_mcu_esr_for_poison_syndrome_8221_0x40:
setx DRAM_ERROR_RETRY_REGISTER, %g5, %g2
setx DRAM_ERROR_RETRY_REGISTER, %g5, %g2
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
! MSA 12/04/06 setx VALID_BIT, %g5, %g1
! stx %g0, [%g2] ! MSA 12/04/06; SYND Reg is Write 0 to clear; 12/08/06: move it after AMB Reg Clear
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
clear_fbd_Synd_reg_0x40_FBR: ! MSA 11/30/06
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
! stx %g0, [%g2] ! MSA 12/08/06 : move it after AMB Reg Clear
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
clear_fbd_Synd_reg_0x40_FBU: ! MSA 11/30/06
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
setx DRAM_ERROR_ADDRESS_REGISTER, %g5, %g2
! we need to prefetch ICE (invalidate cache entry) for instruction that had uncorrectable error.
! eventually we need to re-fetch/retrieve the orig. instruction with no errors because we need it
! as it is part of program code. prefetch ice will require doing prefetch of L2 line with prefetch_fcn
! of 0x18 (which is N2 implementation dependent).
! doing prefetch ICE means we will wipe out the entry in L2 cacheline with the dirty bit unset
! so we can then re-fetch the instruction after core issues a retry specified at the end of this trap
! handler routine. also note that bits [39:37] has to be 011 and way,index,bank will be
! inside bits [21:18],[17:9],[8:6]
! as such, after we clear out all of the L2 and MCU error status registers, we will issue a retry
! which means we will fetch the instruction once again, assuming that this time verilog injector
! did not inject an uncorrectable error. that is being decided within the injector where we do NOT inject on
! every read (or write) transaction that comes to MCU
setx L2_ERROR_ADDRESS_REGISTER, %g5, %o3
setx PREFETCH_ICE_BASE_ADDRESS, %g5, %g3
! do 8 block stores to clear out data in L2 cacheline, we will issue a retry at the end
! of trap handler because we have wiped out the orig. "uncorrectable" data with all zeros.
! at least, all zeros means it has no more UE associated with it, we will be
! fine the next time around when a write/read comes to that address
setx L2_ERROR_ADDRESS_REGISTER, %g5, %g2
setx 0xffffffffc0, %g5, %g2
setx L2_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
setx DRAM_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
! ***************************************************************************
!My_H_HT0_Instruction_Access_MMU_Error_0x71:
! inc %o7 !keep count of traps taken
! clr %g5 !use as intermediate register for setx
! ldxa [%g2] 0x50, %g1 !ISFSR
! ***************************************************************************
My_H_HT0_Instruction_access_error_0x0a:
inc %o7 !keep count of traps taken
clr %g5 !use as intermediate register for setx
ldxa [%g2] 0x50, %g1 !ISFSR
ldxa [%g0] 0x4c, %g4 !DESR
be %xcc, 2f ! branch normal, first check MCU esr, then check L2 esr
be %xcc, 3f ! branch if you see notdata in DESR, clear L2 notdata register
clear_l2_notdata_error_register_0x0a:
setx L2_NOTDATA_REGISTER_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_NOTDATA_REGISTER, %g5, %g4
ba 2f ! MSA: 12/04/06; it was bypassing all check to almost end of the handler with "ba 3f"
! find which MCU logged error
and %g1, 0x180, %g2 !which MCU it is coming from
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
setx DRAM_ERROR_RETRY_REGISTER, %g5, %g2
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
! stx %g0, [%g2] ! MSA 12/08/06: moving at after AMB Reg Clear
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
clear_fbd_Synd_reg_0x0a: ! MSA 11/30/06
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
! now find which L2 bank logged error
and %o2, 0x1c0, %g2 !which L2 bank it is coming from
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
! CRC unrecoverable error gives DSU if on SB, but DAU if on NB
! we need to prefetch ICE (invalidate cache entry) for instruction that had uncorrectable error.
! eventually we need to re-fetch/retrieve the orig. instruction with no errors because we need it
! as it is part of program code. prefetch ice will require doing prefetch of L2 line with prefetch_fcn
! of 0x18 (which is N2 implementation dependent).
! doing prefetch ICE means we will wipe out the entry in L2 cacheline with the dirty bit unset
! so we can then re-fetch the instruction after core issues a retry specified at the end of this trap
! handler routine. also note that bits [39:37] has to be 011 and way,index,bank will be
! inside bits [21:18],[17:9],[8:6]
! as such, after we clear out all of the L2 and MCU error status registers, we will issue a retry
! which means we will fetch the instruction once again, assuming that this time verilog injector
! did not inject an uncorrectable error. that is being decided within the injector where we do NOT inject on
! every read (or write) transaction that comes to MCU
setx PREFETCH_ICE_BASE_ADDRESS, %g5, %g3
setx L2_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
setx DRAM_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
! ***************************************************************************
!My_H_HT0_Data_Access_MMU_Error_0x72:
! inc %o7 !keep count of traps taken
! clr %g5 !use as intermediate register for setx
! ldxa [%g2] 0x58, %g1 !DSFSR
! ***************************************************************************
My_H_HT0_Data_access_error_0x32:
inc %o7 !keep count of traps taken
clr %g5 !use as intermediate register for setx
ldxa [%g2] 0x58, %g1 !DSFSR
ldxa [%g0] 0x4c, %g4 !DESR
be %xcc, 2f ! branch normal, first check L2 esr, then check MCU esr
be %xcc, 4f ! branch if you see notdata in DESR, clear L2 notdata register
clear_l2_notdata_error_register_0x32:
setx L2_NOTDATA_REGISTER_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_NOTDATA_REGISTER, %g5, %g4
ba 2f ! MSA: 12/04/06; it was bypassing all check to almost end of the handler with "ba 3f"
! find which L2 bank logged error
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
mov %g4, %o0 !copy to be used later
setx L2_LAST_ERROR_STATUS_REGISTER, %g5, %g6
! CRC unrecoverable error gives DSU if on SB, but DAU if on NB
! now find which MCU logged error
and %o1, 0x180, %g2 !which MCU it is coming from
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
setx DRAM_ERROR_RETRY_REGISTER, %g5, %g2
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2 !clear valid bit for FBD
! stx %g0, [%g2] ! MSA 12/08/06: moving it after AMB Reg clearing
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
setx 0x8400000900, %g5, %g3
setx 0x8400000908, %g5, %g3
clear_fbd_Synd_reg_0x32: ! MSA 11/30/06
setx DRAM_FBD_ERROR_SYNDROME_REGISTER, %g5, %g2
! do 8 block stores to clear out data in L2 cacheline, we will issue a retry at the end
! of trap handler because we have wiped out the orig. "uncorrectable" data with all zeros.
! at least, all zeros means it has no more UE associated with it, so we will be
! fine the next time around when a write/read comes to that address
setx L2_ERROR_ADDRESS_REGISTER, %g5, %g2
setx 0xffffffffc0, %g5, %g2
setx L2_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx L2_ERROR_STATUS_REGISTER, %g5, %g4
setx DRAM_ESR_WRITE_1_TO_CLEAR, %g5, %g3
setx DRAM_ERROR_STATUS_REGISTER, %g5, %g6
! ***************************************************************************
! ***************************************************************************