1/* 2 * Copyright (C) 2001 Broadcom Corporation 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 */ 18#include <linux/config.h> 19 20#include <asm/asm.h> 21#include <asm/regdef.h> 22#include <asm/mipsregs.h> 23#include <asm/stackframe.h> 24#include <asm/sibyte/board.h> 25 26 .text 27 /* Special Cache Error handler for SB1 for now */ 28 LEAF(except_vec2_sb1) 29 .set noat 30 .set mips0 31 /* 32 * This is a very bad place to be. Our cache error detection has 33 * triggered. If we have write-back data in the cache, we may not be 34 * able to recover. As a first-order desperate measure, turn off KSEG0 35 * cacheing. 36 */ 37 .set push 38 #.set mips64 39 .set mips4 40 .set reorder 41 mfc0 k1, $26 # mfc0 k1, $26, 0 42 # check if error was recoverable 43 # XXXKW - count them 44 bltz k1, leave_cerr 45#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 46 # look for signature of spurious CErr 47 lui k0, 0x4000 48 bne k0, k1, real_cerr 49 .word 0x401Bd801 # mfc0 k1, $27, 1 50 lui k0, 0xffe0 51 and k1, k0, k1 52 lui k0, 0x0200 53 beq k0, k1, leave_cerr 54 # XXXKW - count them 55#endif 56 57real_cerr: 58 mfc0 k0,CP0_CONFIG 59 li k1,~CONF_CM_CMASK 60 and k0,k0,k1 61 ori k0,k0,CONF_CM_UNCACHED 62 mtc0 k0,CP0_CONFIG 63 64 SSNOP 65 SSNOP 66 SSNOP 67 SSNOP 68 bnezl $0, 1f 691: 70 mfc0 k0, CP0_STATUS 71 sll k0, k0, 3 # check CU0 (kernel?) 72 bltz k0, 2f 73 GET_SAVED_SP 74 move sp, k0 # want Kseg SP (so uncached) 752: 76 j sb1_cache_error 77 78leave_cerr: 79 # clear/unlock the registers 80 mtc0 zero, $26 # mtc0 zero, $26, 0 81 mtc0 zero, $27 # mtc0 zero, $27, 0 82 .word 0x4080d801 # mtc0 zero, $27, 1 83 .word 0x4080d803 # mtc0 zero, $27, 3 84 eret 85 86 .set pop 87 END(except_vec2_sb1) 88