machine_check.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version
  5. * 2 of the License, or (at your option) any later version.
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/printk.h>
  9. #include <linux/ptrace.h>
  10. #include <asm/reg.h>
  11. int machine_check_440A(struct pt_regs *regs)
  12. {
  13. unsigned long reason = regs->dsisr;
  14. printk("Machine check in kernel mode.\n");
  15. if (reason & ESR_IMCP){
  16. printk("Instruction Synchronous Machine Check exception\n");
  17. mtspr(SPRN_ESR, reason & ~ESR_IMCP);
  18. }
  19. else {
  20. u32 mcsr = mfspr(SPRN_MCSR);
  21. if (mcsr & MCSR_IB)
  22. printk("Instruction Read PLB Error\n");
  23. if (mcsr & MCSR_DRB)
  24. printk("Data Read PLB Error\n");
  25. if (mcsr & MCSR_DWB)
  26. printk("Data Write PLB Error\n");
  27. if (mcsr & MCSR_TLBP)
  28. printk("TLB Parity Error\n");
  29. if (mcsr & MCSR_ICP){
  30. flush_instruction_cache();
  31. printk("I-Cache Parity Error\n");
  32. }
  33. if (mcsr & MCSR_DCSP)
  34. printk("D-Cache Search Parity Error\n");
  35. if (mcsr & MCSR_DCFP)
  36. printk("D-Cache Flush Parity Error\n");
  37. if (mcsr & MCSR_IMPE)
  38. printk("Machine Check exception is imprecise\n");
  39. /* Clear MCSR */
  40. mtspr(SPRN_MCSR, mcsr);
  41. }
  42. return 0;
  43. }
  44. #ifdef CONFIG_PPC_47x
  45. int machine_check_47x(struct pt_regs *regs)
  46. {
  47. unsigned long reason = regs->dsisr;
  48. u32 mcsr;
  49. printk(KERN_ERR "Machine check in kernel mode.\n");
  50. if (reason & ESR_IMCP) {
  51. printk(KERN_ERR "Instruction Synchronous Machine Check exception\n");
  52. mtspr(SPRN_ESR, reason & ~ESR_IMCP);
  53. return 0;
  54. }
  55. mcsr = mfspr(SPRN_MCSR);
  56. if (mcsr & MCSR_IB)
  57. printk(KERN_ERR "Instruction Read PLB Error\n");
  58. if (mcsr & MCSR_DRB)
  59. printk(KERN_ERR "Data Read PLB Error\n");
  60. if (mcsr & MCSR_DWB)
  61. printk(KERN_ERR "Data Write PLB Error\n");
  62. if (mcsr & MCSR_TLBP)
  63. printk(KERN_ERR "TLB Parity Error\n");
  64. if (mcsr & MCSR_ICP) {
  65. flush_instruction_cache();
  66. printk(KERN_ERR "I-Cache Parity Error\n");
  67. }
  68. if (mcsr & MCSR_DCSP)
  69. printk(KERN_ERR "D-Cache Search Parity Error\n");
  70. if (mcsr & PPC47x_MCSR_GPR)
  71. printk(KERN_ERR "GPR Parity Error\n");
  72. if (mcsr & PPC47x_MCSR_FPR)
  73. printk(KERN_ERR "FPR Parity Error\n");
  74. if (mcsr & PPC47x_MCSR_IPR)
  75. printk(KERN_ERR "Machine Check exception is imprecise\n");
  76. /* Clear MCSR */
  77. mtspr(SPRN_MCSR, mcsr);
  78. return 0;
  79. }
  80. #endif /* CONFIG_PPC_47x */