ip27-berr.c 3.0 KB

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