^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* These get patched into the trap table at boot time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * once we know we have a cheetah processor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) .globl cheetah_fecc_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) .type cheetah_fecc_trap_vector,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) cheetah_fecc_trap_vector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) andn %g1, DCU_DC | DCU_IC, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) stxa %g1, [%g0] ASI_DCU_CONTROL_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) sethi %hi(cheetah_fast_ecc), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) jmpl %g2 + %lo(cheetah_fast_ecc), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) mov 0, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) .size cheetah_fecc_trap_vector,.-cheetah_fecc_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .globl cheetah_fecc_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .type cheetah_fecc_trap_vector_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) cheetah_fecc_trap_vector_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) andn %g1, DCU_DC | DCU_IC, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) stxa %g1, [%g0] ASI_DCU_CONTROL_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) sethi %hi(cheetah_fast_ecc), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) jmpl %g2 + %lo(cheetah_fast_ecc), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) mov 1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .size cheetah_fecc_trap_vector_tl1,.-cheetah_fecc_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .globl cheetah_cee_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .type cheetah_cee_trap_vector,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) cheetah_cee_trap_vector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) andn %g1, DCU_IC, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) stxa %g1, [%g0] ASI_DCU_CONTROL_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) sethi %hi(cheetah_cee), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) jmpl %g2 + %lo(cheetah_cee), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) mov 0, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .size cheetah_cee_trap_vector,.-cheetah_cee_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .globl cheetah_cee_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .type cheetah_cee_trap_vector_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) cheetah_cee_trap_vector_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) andn %g1, DCU_IC, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) stxa %g1, [%g0] ASI_DCU_CONTROL_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) sethi %hi(cheetah_cee), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) jmpl %g2 + %lo(cheetah_cee), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) mov 1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .size cheetah_cee_trap_vector_tl1,.-cheetah_cee_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .globl cheetah_deferred_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .type cheetah_deferred_trap_vector,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) cheetah_deferred_trap_vector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) andn %g1, DCU_DC | DCU_IC, %g1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) membar #Sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) sethi %hi(cheetah_deferred_trap), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) jmpl %g2 + %lo(cheetah_deferred_trap), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) mov 0, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .size cheetah_deferred_trap_vector,.-cheetah_deferred_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) .globl cheetah_deferred_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .type cheetah_deferred_trap_vector_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) cheetah_deferred_trap_vector_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) membar #Sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) andn %g1, DCU_DC | DCU_IC, %g1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) membar #Sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) sethi %hi(cheetah_deferred_trap), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) jmpl %g2 + %lo(cheetah_deferred_trap), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) mov 1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .size cheetah_deferred_trap_vector_tl1,.-cheetah_deferred_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Cheetah+ specific traps. These are for the new I/D cache parity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * error traps. The first argument to cheetah_plus_parity_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * is encoded as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * Bit0: 0=dcache,1=icache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * Bit1: 0=recoverable,1=unrecoverable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) .globl cheetah_plus_dcpe_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) .type cheetah_plus_dcpe_trap_vector,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) cheetah_plus_dcpe_trap_vector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) sethi %hi(do_cheetah_plus_data_parity), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) jmpl %g7 + %lo(do_cheetah_plus_data_parity), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) .size cheetah_plus_dcpe_trap_vector,.-cheetah_plus_dcpe_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) .type do_cheetah_plus_data_parity,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) do_cheetah_plus_data_parity:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) rdpr %pil, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) wrpr %g0, PIL_NORMAL_MAX, %pil
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) ba,pt %xcc, etrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) rd %pc, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #ifdef CONFIG_TRACE_IRQFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) call trace_hardirqs_off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) mov 0x0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) call cheetah_plus_parity_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) add %sp, PTREGS_OFF, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) ba,a,pt %xcc, rtrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) .size do_cheetah_plus_data_parity,.-do_cheetah_plus_data_parity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) .globl cheetah_plus_dcpe_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) .type cheetah_plus_dcpe_trap_vector_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) cheetah_plus_dcpe_trap_vector_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) sethi %hi(do_dcpe_tl1), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) jmpl %g3 + %lo(do_dcpe_tl1), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) .size cheetah_plus_dcpe_trap_vector_tl1,.-cheetah_plus_dcpe_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) .globl cheetah_plus_icpe_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) .type cheetah_plus_icpe_trap_vector,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) cheetah_plus_icpe_trap_vector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) sethi %hi(do_cheetah_plus_insn_parity), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) jmpl %g7 + %lo(do_cheetah_plus_insn_parity), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) .size cheetah_plus_icpe_trap_vector,.-cheetah_plus_icpe_trap_vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) .type do_cheetah_plus_insn_parity,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) do_cheetah_plus_insn_parity:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) rdpr %pil, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) wrpr %g0, PIL_NORMAL_MAX, %pil
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ba,pt %xcc, etrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) rd %pc, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #ifdef CONFIG_TRACE_IRQFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) call trace_hardirqs_off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) mov 0x1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) call cheetah_plus_parity_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) add %sp, PTREGS_OFF, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) ba,a,pt %xcc, rtrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) .size do_cheetah_plus_insn_parity,.-do_cheetah_plus_insn_parity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .globl cheetah_plus_icpe_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) .type cheetah_plus_icpe_trap_vector_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) cheetah_plus_icpe_trap_vector_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) sethi %hi(do_icpe_tl1), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) jmpl %g3 + %lo(do_icpe_tl1), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) .size cheetah_plus_icpe_trap_vector_tl1,.-cheetah_plus_icpe_trap_vector_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /* If we take one of these traps when tl >= 1, then we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * jump to interrupt globals. If some trap level above us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * was also using interrupt globals, we cannot recover.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * We may use all interrupt global registers except %g6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .globl do_dcpe_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) .type do_dcpe_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) do_dcpe_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) rdpr %tl, %g1 ! Save original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) mov 1, %g2 ! Setup TSTATE checking loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 1: wrpr %g2, %tl ! Set trap level to check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) rdpr %tstate, %g4 ! Read TSTATE for this level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) andcc %g4, %g3, %g0 ! Interrupt globals in use?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) bne,a,pn %xcc, do_dcpe_tl1_fatal ! Yep, irrecoverable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) wrpr %g1, %tl ! Restore original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) add %g2, 1, %g2 ! Next trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) cmp %g2, %g1 ! Hit them all yet?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ble,pt %icc, 1b ! Not yet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) wrpr %g1, %tl ! Restore original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) sethi %hi(dcache_parity_tl1_occurred), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) add %g1, 1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /* Reset D-cache parity */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) sethi %hi(1 << 16), %g1 ! D-cache size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) mov (1 << 5), %g2 ! D-cache line size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) sub %g1, %g2, %g1 ! Move down 1 cacheline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 1: srl %g1, 14, %g3 ! Compute UTAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) stxa %g3, [%g1] ASI_DCACHE_UTAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) sub %g2, 8, %g3 ! 64-bit data word within line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 2: membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) stxa %g0, [%g1 + %g3] ASI_DCACHE_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) subcc %g3, 8, %g3 ! Next 64-bit data word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) bge,pt %icc, 2b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) subcc %g1, %g2, %g1 ! Next cacheline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) bge,pt %icc, 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) ba,a,pt %xcc, dcpe_icpe_tl1_common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) do_dcpe_tl1_fatal:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) sethi %hi(1f), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ba,pt %xcc, etraptl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 1: or %g7, %lo(1b), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) mov 0x2, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) call cheetah_plus_parity_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) add %sp, PTREGS_OFF, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) ba,a,pt %xcc, rtrap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) .size do_dcpe_tl1,.-do_dcpe_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .globl do_icpe_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) .type do_icpe_tl1,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) do_icpe_tl1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) rdpr %tl, %g1 ! Save original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) mov 1, %g2 ! Setup TSTATE checking loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 1: wrpr %g2, %tl ! Set trap level to check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) rdpr %tstate, %g4 ! Read TSTATE for this level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) andcc %g4, %g3, %g0 ! Interrupt globals in use?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) bne,a,pn %xcc, do_icpe_tl1_fatal ! Yep, irrecoverable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) wrpr %g1, %tl ! Restore original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) add %g2, 1, %g2 ! Next trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) cmp %g2, %g1 ! Hit them all yet?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ble,pt %icc, 1b ! Not yet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) wrpr %g1, %tl ! Restore original trap level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) sethi %hi(icache_parity_tl1_occurred), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) add %g1, 1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* Flush I-cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) sethi %hi(1 << 15), %g1 ! I-cache size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) mov (1 << 5), %g2 ! I-cache line size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) sub %g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 1: or %g1, (2 << 3), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) stxa %g0, [%g3] ASI_IC_TAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) subcc %g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) bge,pt %icc, 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ba,a,pt %xcc, dcpe_icpe_tl1_common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) do_icpe_tl1_fatal:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) sethi %hi(1f), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) ba,pt %xcc, etraptl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 1: or %g7, %lo(1b), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) mov 0x3, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) call cheetah_plus_parity_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) add %sp, PTREGS_OFF, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) ba,a,pt %xcc, rtrap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) .size do_icpe_tl1,.-do_icpe_tl1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .type dcpe_icpe_tl1_common,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) dcpe_icpe_tl1_common:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /* Flush D-cache, re-enable D/I caches in DCU and finally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * retry the trapping instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) sethi %hi(1 << 16), %g1 ! D-cache size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) mov (1 << 5), %g2 ! D-cache line size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) sub %g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 1: stxa %g0, [%g1] ASI_DCACHE_TAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) subcc %g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) bge,pt %icc, 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) or %g1, (DCU_DC | DCU_IC), %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) stxa %g1, [%g0] ASI_DCU_CONTROL_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) retry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) .size dcpe_icpe_tl1_common,.-dcpe_icpe_tl1_common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) /* Capture I/D/E-cache state into per-cpu error scoreboard.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) * %g1: (TL>=0) ? 1 : 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) * %g2: scratch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * %g3: scratch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) * %g4: AFSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * %g5: AFAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * %g6: unused, will have current thread ptr after etrap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * %g7: scratch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) .type __cheetah_log_error,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) __cheetah_log_error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /* Put "TL1" software bit into AFSR. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) and %g1, 0x1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) sllx %g1, 63, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) or %g4, %g2, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) /* Get log entry pointer for this cpu at this trap level. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) BRANCH_IF_JALAPENO(g2,g3,50f)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) ldxa [%g0] ASI_SAFARI_CONFIG, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) srlx %g2, 17, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) ba,pt %xcc, 60f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) and %g2, 0x3ff, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 50: ldxa [%g0] ASI_JBUS_CONFIG, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) srlx %g2, 17, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) and %g2, 0x1f, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 60: sllx %g2, 9, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) sethi %hi(cheetah_error_log), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) ldx [%g3 + %lo(cheetah_error_log)], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) brz,pn %g3, 80f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) add %g3, %g2, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) sllx %g1, 8, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) add %g3, %g1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /* %g1 holds pointer to the top of the logging scoreboard */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) ldx [%g1 + 0x0], %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) cmp %g7, -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) bne,pn %xcc, 80f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) stx %g4, [%g1 + 0x0]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) stx %g5, [%g1 + 0x8]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) add %g1, 0x10, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* %g1 now points to D-cache logging area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) set 0x3ff8, %g2 /* DC_addr mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) and %g5, %g2, %g2 /* DC_addr bits of AFAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) srlx %g5, 12, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) or %g3, 1, %g3 /* PHYS tag + valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 10: ldxa [%g2] ASI_DCACHE_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) cmp %g3, %g7 /* TAG match? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) bne,pt %xcc, 13f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) /* Yep, what we want, capture state. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) stx %g2, [%g1 + 0x20]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) stx %g7, [%g1 + 0x28]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /* A membar Sync is required before and after utag access. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) ldxa [%g2] ASI_DCACHE_UTAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) stx %g7, [%g1 + 0x30]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) ldxa [%g2] ASI_DCACHE_SNOOP_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) stx %g7, [%g1 + 0x38]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) clr %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 12: ldxa [%g2 + %g3] ASI_DCACHE_DATA, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) stx %g7, [%g1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) add %g3, (1 << 5), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) cmp %g3, (4 << 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) bl,pt %xcc, 12b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) add %g1, 0x8, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) ba,pt %xcc, 20f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) add %g1, 0x20, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 13: sethi %hi(1 << 14), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) add %g2, %g7, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) srlx %g2, 14, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) cmp %g7, 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) bl,pt %xcc, 10b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) add %g1, 0x40, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /* %g1 now points to I-cache logging area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 20: set 0x1fe0, %g2 /* IC_addr mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) and %g5, %g2, %g2 /* IC_addr bits of AFAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) sllx %g2, 1, %g2 /* IC_addr[13:6]==VA[12:5] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) srlx %g5, (13 - 8), %g3 /* Make PTAG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) andn %g3, 0xff, %g3 /* Mask off undefined bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 21: ldxa [%g2] ASI_IC_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) andn %g7, 0xff, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) cmp %g3, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) bne,pt %xcc, 23f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) /* Yep, what we want, capture state. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) stx %g2, [%g1 + 0x40]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) stx %g7, [%g1 + 0x48]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) add %g2, (1 << 3), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) ldxa [%g2] ASI_IC_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) add %g2, (1 << 3), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) stx %g7, [%g1 + 0x50]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) ldxa [%g2] ASI_IC_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) add %g2, (1 << 3), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) stx %g7, [%g1 + 0x60]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) ldxa [%g2] ASI_IC_TAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) stx %g7, [%g1 + 0x68]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) sub %g2, (3 << 3), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) ldxa [%g2] ASI_IC_STAG, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) stx %g7, [%g1 + 0x58]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) clr %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) srlx %g2, 2, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 22: ldxa [%g2 + %g3] ASI_IC_INSTR, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) stx %g7, [%g1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) add %g3, (1 << 3), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) cmp %g3, (8 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) bl,pt %xcc, 22b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) add %g1, 0x8, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) ba,pt %xcc, 30f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) add %g1, 0x30, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 23: sethi %hi(1 << 14), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) add %g2, %g7, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) srlx %g2, 14, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) cmp %g7, 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) bl,pt %xcc, 21b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) add %g1, 0x70, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) /* %g1 now points to E-cache logging area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 30: andn %g5, (32 - 1), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) stx %g2, [%g1 + 0x20]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) ldxa [%g2] ASI_EC_TAG_DATA, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) stx %g7, [%g1 + 0x28]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ldxa [%g2] ASI_EC_R, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) clr %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 31: ldxa [%g3] ASI_EC_DATA, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) stx %g7, [%g1 + %g3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) add %g3, 0x8, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) cmp %g3, 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) bl,pt %xcc, 31b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 80:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) rdpr %tt, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) cmp %g2, 0x70
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) be c_fast_ecc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) cmp %g2, 0x63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) be c_cee
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) ba,a,pt %xcc, c_deferred
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) .size __cheetah_log_error,.-__cheetah_log_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) * in the trap table. That code has done a memory barrier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) * and has disabled both the I-cache and D-cache in the DCU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) * control register. The I-cache is disabled so that we may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) * capture the corrupted cache line, and the D-cache is disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * because corrupt data may have been placed there and we don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) * want to reference it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) * %g1 is one if this trap occurred at %tl >= 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) * Next, we turn off error reporting so that we don't recurse.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) .globl cheetah_fast_ecc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) .type cheetah_fast_ecc,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) cheetah_fast_ecc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /* Fetch and clear AFSR/AFAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) ldxa [%g0] ASI_AFSR, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) ldxa [%g0] ASI_AFAR, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) stxa %g4, [%g0] ASI_AFSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) ba,pt %xcc, __cheetah_log_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) .size cheetah_fast_ecc,.-cheetah_fast_ecc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) .type c_fast_ecc,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) c_fast_ecc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) rdpr %pil, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) wrpr %g0, PIL_NORMAL_MAX, %pil
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) ba,pt %xcc, etrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) rd %pc, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) #ifdef CONFIG_TRACE_IRQFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) call trace_hardirqs_off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) mov %l4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) mov %l5, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) call cheetah_fecc_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) add %sp, PTREGS_OFF, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) ba,a,pt %xcc, rtrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) .size c_fast_ecc,.-c_fast_ecc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) /* Our caller has disabled I-cache and performed membar Sync. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) .globl cheetah_cee
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) .type cheetah_cee,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) cheetah_cee:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) andn %g2, ESTATE_ERROR_CEEN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) /* Fetch and clear AFSR/AFAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) ldxa [%g0] ASI_AFSR, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) ldxa [%g0] ASI_AFAR, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) stxa %g4, [%g0] ASI_AFSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) ba,pt %xcc, __cheetah_log_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .size cheetah_cee,.-cheetah_cee
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) .type c_cee,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) c_cee:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) rdpr %pil, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) wrpr %g0, PIL_NORMAL_MAX, %pil
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) ba,pt %xcc, etrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) rd %pc, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) #ifdef CONFIG_TRACE_IRQFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) call trace_hardirqs_off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) mov %l4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) mov %l5, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) call cheetah_cee_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) add %sp, PTREGS_OFF, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) ba,a,pt %xcc, rtrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) .size c_cee,.-c_cee
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) .globl cheetah_deferred_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) .type cheetah_deferred_trap,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) cheetah_deferred_trap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) /* Fetch and clear AFSR/AFAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) ldxa [%g0] ASI_AFSR, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) ldxa [%g0] ASI_AFAR, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) stxa %g4, [%g0] ASI_AFSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) membar #Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) ba,pt %xcc, __cheetah_log_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) .size cheetah_deferred_trap,.-cheetah_deferred_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) .type c_deferred,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) c_deferred:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) rdpr %pil, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) wrpr %g0, PIL_NORMAL_MAX, %pil
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) ba,pt %xcc, etrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) rd %pc, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) #ifdef CONFIG_TRACE_IRQFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) call trace_hardirqs_off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) mov %l4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) mov %l5, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) call cheetah_deferred_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) add %sp, PTREGS_OFF, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) ba,a,pt %xcc, rtrap_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) .size c_deferred,.-c_deferred