ip27-berr.c 3.0 KB

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