0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/init.h>
0011 #include <linux/kernel.h>
0012 #include <linux/signal.h> /* for SIGBUS */
0013 #include <linux/sched.h> /* schow_regs(), force_sig() */
0014 #include <linux/sched/debug.h>
0015 #include <linux/sched/signal.h>
0016
0017 #include <asm/ptrace.h>
0018 #include <asm/sn/addrs.h>
0019 #include <asm/sn/agent.h>
0020 #include <asm/sn/arch.h>
0021 #include <asm/tlbdebug.h>
0022 #include <asm/traps.h>
0023 #include <linux/uaccess.h>
0024
0025 static void dump_hub_information(unsigned long errst0, unsigned long errst1)
0026 {
0027 static char *err_type[2][8] = {
0028 { NULL, "Uncached Partial Read PRERR", "DERR", "Read Timeout",
0029 NULL, NULL, NULL, NULL },
0030 { "WERR", "Uncached Partial Write", "PWERR", "Write Timeout",
0031 NULL, NULL, NULL, NULL }
0032 };
0033 union pi_err_stat0 st0;
0034 union pi_err_stat1 st1;
0035
0036 st0.pi_stat0_word = errst0;
0037 st1.pi_stat1_word = errst1;
0038
0039 if (!st0.pi_stat0_fmt.s0_valid) {
0040 pr_info("Hub does not contain valid error information\n");
0041 return;
0042 }
0043
0044 pr_info("Hub has valid error information:\n");
0045 if (st0.pi_stat0_fmt.s0_ovr_run)
0046 pr_info("Overrun is set. Error stack may contain additional "
0047 "information.\n");
0048 pr_info("Hub error address is %08lx\n",
0049 (unsigned long)st0.pi_stat0_fmt.s0_addr);
0050 pr_info("Incoming message command 0x%lx\n",
0051 (unsigned long)st0.pi_stat0_fmt.s0_cmd);
0052 pr_info("Supplemental field of incoming message is 0x%lx\n",
0053 (unsigned long)st0.pi_stat0_fmt.s0_supl);
0054 pr_info("T5 Rn (for RRB only) is 0x%lx\n",
0055 (unsigned long)st0.pi_stat0_fmt.s0_t5_req);
0056 pr_info("Error type is %s\n", err_type[st1.pi_stat1_fmt.s1_rw_rb]
0057 [st0.pi_stat0_fmt.s0_err_type] ? : "invalid");
0058 }
0059
0060 int ip27_be_handler(struct pt_regs *regs, int is_fixup)
0061 {
0062 unsigned long errst0, errst1;
0063 int data = regs->cp0_cause & 4;
0064 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
0065
0066 if (is_fixup)
0067 return MIPS_BE_FIXUP;
0068
0069 printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i',
0070 regs->cp0_epc);
0071 printk("Hub information:\n");
0072 printk("ERR_INT_PEND = 0x%06llx\n", LOCAL_HUB_L(PI_ERR_INT_PEND));
0073 errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A);
0074 errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A);
0075 dump_hub_information(errst0, errst1);
0076 show_regs(regs);
0077 dump_tlb_all();
0078 while(1);
0079 force_sig(SIGBUS);
0080 }
0081
0082 void __init ip27_be_init(void)
0083 {
0084
0085 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
0086 int cpuoff = cpu << 8;
0087
0088 mips_set_be_handler(ip27_be_handler);
0089
0090 LOCAL_HUB_S(PI_ERR_INT_PEND,
0091 cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
0092 LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0);
0093 LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0);
0094 LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0);
0095 LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL);
0096 }