1 /* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1994, 1995, 1996, 1999, 2000 by Ralf Baechle 7 * Copyright (C) 1999, 2000 by Silicon Graphics 8 * Copyright (C) 2002 Maciej W. Rozycki 9 */ 10 #include <linux/init.h> 11 #include <linux/kernel.h> 12 #include <linux/module.h> 13 #include <linux/signal.h> /* for SIGBUS */ 14 15 #include <asm/module.h> 16 #include <asm/sn/addrs.h> 17 #include <asm/sn/arch.h> 18 #include <asm/sn/sn0/hub.h> 19 #include <asm/tlbdebug.h> 20 #include <asm/traps.h> 21 #include <asm/uaccess.h> 22 23 extern void dump_tlb_addr(unsigned long addr); 24 extern void dump_tlb_all(void); 25 26 static void dump_hub_information(unsigned long errst0, unsigned long errst1) 27 { 28 static char *err_type[2][8] = { 29 { NULL, "Uncached Partial Read PRERR", "DERR", "Read Timeout", 30 NULL, NULL, NULL, NULL }, 31 { "WERR", "Uncached Partial Write", "PWERR", "Write Timeout", 32 NULL, NULL, NULL, NULL } 33 }; 34 int wrb = errst1 & PI_ERR_ST1_WRBRRB_MASK; 35 36 if (!(errst0 & PI_ERR_ST0_VALID_MASK)) { 37 printk("Hub does not contain valid error information\n"); 38 return; 39 } 40 41 42 printk("Hub has valid error information:\n"); 43 if (errst0 & PI_ERR_ST0_OVERRUN_MASK) 44 printk("Overrun is set. Error stack may contain additional " 45 "information.\n"); 46 printk("Hub error address is %08lx\n", 47 (errst0 & PI_ERR_ST0_ADDR_MASK) >> (PI_ERR_ST0_ADDR_SHFT - 3)); 48 printk("Incoming message command 0x%lx\n", 49 (errst0 & PI_ERR_ST0_CMD_MASK) >> PI_ERR_ST0_CMD_SHFT); 50 printk("Supplemental field of incoming message is 0x%lx\n", 51 (errst0 & PI_ERR_ST0_SUPPL_MASK) >> PI_ERR_ST0_SUPPL_SHFT); 52 printk("T5 Rn (for RRB only) is 0x%lx\n", 53 (errst0 & PI_ERR_ST0_REQNUM_MASK) >> PI_ERR_ST0_REQNUM_SHFT); 54 printk("Error type is %s\n", err_type[wrb] 55 [(errst0 & PI_ERR_ST0_TYPE_MASK) >> PI_ERR_ST0_TYPE_SHFT] 56 ? : "invalid"); 57 } 58 59 int ip27_be_handler(struct pt_regs *regs, int is_fixup) 60 { 61 unsigned long errst0, errst1; 62 int data = regs->cp0_cause & 4; 63 int cpu = LOCAL_HUB_L(PI_CPU_NUM); 64 65 if (is_fixup) 66 return MIPS_BE_FIXUP; 67 68 printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i', 69 regs->cp0_epc); 70 printk("Hub information:\n"); 71 printk("ERR_INT_PEND = 0x%06lx\n", LOCAL_HUB_L(PI_ERR_INT_PEND)); 72 errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A); 73 errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A); 74 dump_hub_information(errst0, errst1); 75 show_regs(regs); 76 dump_tlb_all(); 77 while(1); 78 force_sig(SIGBUS, current); 79 } 80 81 void __init ip27_be_init(void) 82 { 83 /* XXX Initialize all the Hub & Bridge error handling here. */ 84 int cpu = LOCAL_HUB_L(PI_CPU_NUM); 85 int cpuoff = cpu << 8; 86 87 board_be_handler = ip27_be_handler; 88 89 LOCAL_HUB_S(PI_ERR_INT_PEND, 90 cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A); 91 LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0); 92 LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0); 93 LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0); /* Disable error stack */ 94 LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL); 95 } 96