]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/mips/sgi-ip27/ip27-berr.c
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / arch / mips / sgi-ip27 / ip27-berr.c
CommitLineData
1da177e4
LT
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>
4e57b681 12#include <linux/signal.h> /* for SIGBUS */
de25968c 13#include <linux/sched.h> /* schow_regs(), force_sig() */
1da177e4 14
1da177e4
LT
15#include <asm/sn/addrs.h>
16#include <asm/sn/arch.h>
17#include <asm/sn/sn0/hub.h>
18#include <asm/tlbdebug.h>
19#include <asm/traps.h>
7c0f6ba6 20#include <linux/uaccess.h>
1da177e4 21
1da177e4
LT
22static void dump_hub_information(unsigned long errst0, unsigned long errst1)
23{
24 static char *err_type[2][8] = {
25 { NULL, "Uncached Partial Read PRERR", "DERR", "Read Timeout",
26 NULL, NULL, NULL, NULL },
27 { "WERR", "Uncached Partial Write", "PWERR", "Write Timeout",
28 NULL, NULL, NULL, NULL }
29 };
30 int wrb = errst1 & PI_ERR_ST1_WRBRRB_MASK;
31
32 if (!(errst0 & PI_ERR_ST0_VALID_MASK)) {
33 printk("Hub does not contain valid error information\n");
34 return;
35 }
36
37
38 printk("Hub has valid error information:\n");
39 if (errst0 & PI_ERR_ST0_OVERRUN_MASK)
70342287 40 printk("Overrun is set. Error stack may contain additional "
1da177e4
LT
41 "information.\n");
42 printk("Hub error address is %08lx\n",
43 (errst0 & PI_ERR_ST0_ADDR_MASK) >> (PI_ERR_ST0_ADDR_SHFT - 3));
44 printk("Incoming message command 0x%lx\n",
45 (errst0 & PI_ERR_ST0_CMD_MASK) >> PI_ERR_ST0_CMD_SHFT);
46 printk("Supplemental field of incoming message is 0x%lx\n",
47 (errst0 & PI_ERR_ST0_SUPPL_MASK) >> PI_ERR_ST0_SUPPL_SHFT);
48 printk("T5 Rn (for RRB only) is 0x%lx\n",
49 (errst0 & PI_ERR_ST0_REQNUM_MASK) >> PI_ERR_ST0_REQNUM_SHFT);
50 printk("Error type is %s\n", err_type[wrb]
51 [(errst0 & PI_ERR_ST0_TYPE_MASK) >> PI_ERR_ST0_TYPE_SHFT]
52 ? : "invalid");
53}
54
55int ip27_be_handler(struct pt_regs *regs, int is_fixup)
56{
57 unsigned long errst0, errst1;
58 int data = regs->cp0_cause & 4;
59 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
60
61 if (is_fixup)
62 return MIPS_BE_FIXUP;
63
64 printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i',
65 regs->cp0_epc);
66 printk("Hub information:\n");
12e22e8e 67 printk("ERR_INT_PEND = 0x%06llx\n", LOCAL_HUB_L(PI_ERR_INT_PEND));
1da177e4
LT
68 errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A);
69 errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A);
70 dump_hub_information(errst0, errst1);
71 show_regs(regs);
72 dump_tlb_all();
73 while(1);
74 force_sig(SIGBUS, current);
75}
76
77void __init ip27_be_init(void)
78{
79 /* XXX Initialize all the Hub & Bridge error handling here. */
80 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
81 int cpuoff = cpu << 8;
82
83 board_be_handler = ip27_be_handler;
84
85 LOCAL_HUB_S(PI_ERR_INT_PEND,
70342287 86 cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
1da177e4
LT
87 LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0);
88 LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0);
89 LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0); /* Disable error stack */
90 LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL);
91}