ip27-berr.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/agent.h>
  19. #include <asm/sn/arch.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. union pi_err_stat0 st0;
  32. union pi_err_stat1 st1;
  33. st0.pi_stat0_word = errst0;
  34. st1.pi_stat1_word = errst1;
  35. if (!st0.pi_stat0_fmt.s0_valid) {
  36. pr_info("Hub does not contain valid error information\n");
  37. return;
  38. }
  39. pr_info("Hub has valid error information:\n");
  40. if (st0.pi_stat0_fmt.s0_ovr_run)
  41. pr_info("Overrun is set. Error stack may contain additional "
  42. "information.\n");
  43. pr_info("Hub error address is %08lx\n",
  44. (unsigned long)st0.pi_stat0_fmt.s0_addr);
  45. pr_info("Incoming message command 0x%lx\n",
  46. (unsigned long)st0.pi_stat0_fmt.s0_cmd);
  47. pr_info("Supplemental field of incoming message is 0x%lx\n",
  48. (unsigned long)st0.pi_stat0_fmt.s0_supl);
  49. pr_info("T5 Rn (for RRB only) is 0x%lx\n",
  50. (unsigned long)st0.pi_stat0_fmt.s0_t5_req);
  51. pr_info("Error type is %s\n", err_type[st1.pi_stat1_fmt.s1_rw_rb]
  52. [st0.pi_stat0_fmt.s0_err_type] ? : "invalid");
  53. }
  54. int ip27_be_handler(struct pt_regs *regs, int is_fixup)
  55. {
  56. unsigned long errst0, errst1;
  57. int data = regs->cp0_cause & 4;
  58. int cpu = LOCAL_HUB_L(PI_CPU_NUM);
  59. if (is_fixup)
  60. return MIPS_BE_FIXUP;
  61. printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i',
  62. regs->cp0_epc);
  63. printk("Hub information:\n");
  64. printk("ERR_INT_PEND = 0x%06llx\n", LOCAL_HUB_L(PI_ERR_INT_PEND));
  65. errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A);
  66. errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A);
  67. dump_hub_information(errst0, errst1);
  68. show_regs(regs);
  69. dump_tlb_all();
  70. while(1);
  71. force_sig(SIGBUS);
  72. }
  73. void __init ip27_be_init(void)
  74. {
  75. /* XXX Initialize all the Hub & Bridge error handling here. */
  76. int cpu = LOCAL_HUB_L(PI_CPU_NUM);
  77. int cpuoff = cpu << 8;
  78. mips_set_be_handler(ip27_be_handler);
  79. LOCAL_HUB_S(PI_ERR_INT_PEND,
  80. cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
  81. LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0);
  82. LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0);
  83. LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0); /* Disable error stack */
  84. LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL);
  85. }