ip27-berr.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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