^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2006 Cavium Networks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Cache error handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/asm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/regdef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/mipsregs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/stackframe.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Handle cache error. Indicate to the second level handler whether
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * the exception is recoverable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) LEAF(except_vec2_octeon)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .set push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .set mips64r2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) .set noreorder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .set noat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* due to an errata we need to read the COP0 CacheErr (Dcache)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * before any cache/DRAM access */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) rdhwr k0, $0 /* get core_id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) PTR_LA k1, cache_err_dcache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) sll k0, k0, 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) PTR_ADDU k1, k0, k1 /* k1 = &cache_err_dcache[core_id] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) dmfc0 k0, CP0_CACHEERR, 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) sd k0, (k1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) dmtc0 $0, CP0_CACHEERR, 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) /* check whether this is a nested exception */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) mfc0 k1, CP0_STATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) andi k1, k1, ST0_EXL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) beqz k1, 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) j cache_parity_error_octeon_non_recoverable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* exception is recoverable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 1: j handle_cache_err
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .set pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) END(except_vec2_octeon)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /* We need to jump to handle_cache_err so that the previous handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * can fit within 0x80 bytes. We also move from 0xFFFFFFFFAXXXXXXX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * space (uncached) to the 0xFFFFFFFF8XXXXXXX space (cached). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) LEAF(handle_cache_err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .set push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .set noreorder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .set noat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) KMODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) jal cache_parity_error_octeon_recoverable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) j ret_from_exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) .set pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) END(handle_cache_err)