p5.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * P5 specific Machine Check Exception Reporting
  3. * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
  4. */
  5. #include <linux/interrupt.h>
  6. #include <linux/kernel.h>
  7. #include <linux/types.h>
  8. #include <linux/init.h>
  9. #include <linux/smp.h>
  10. #include <asm/processor.h>
  11. #include <asm/mce.h>
  12. #include <asm/msr.h>
  13. /* By default disabled */
  14. int mce_p5_enabled __read_mostly;
  15. /* Machine check handler for Pentium class Intel CPUs: */
  16. static void pentium_machine_check(struct pt_regs *regs, long error_code)
  17. {
  18. u32 loaddr, hi, lotype;
  19. rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
  20. rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
  21. printk(KERN_EMERG
  22. "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
  23. smp_processor_id(), loaddr, lotype);
  24. if (lotype & (1<<5)) {
  25. printk(KERN_EMERG
  26. "CPU#%d: Possible thermal failure (CPU on fire ?).\n",
  27. smp_processor_id());
  28. }
  29. add_taint(TAINT_MACHINE_CHECK);
  30. }
  31. /* Set up machine check reporting for processors with Intel style MCE: */
  32. void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
  33. {
  34. u32 l, h;
  35. /* Default P5 to off as its often misconnected: */
  36. if (!mce_p5_enabled)
  37. return;
  38. /* Check for MCE support: */
  39. if (!cpu_has(c, X86_FEATURE_MCE))
  40. return;
  41. machine_check_vector = pentium_machine_check;
  42. /* Make sure the vector pointer is visible before we enable MCEs: */
  43. wmb();
  44. /* Read registers before enabling: */
  45. rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
  46. rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
  47. printk(KERN_INFO
  48. "Intel old style machine check architecture supported.\n");
  49. /* Enable MCE: */
  50. set_in_cr4(X86_CR4_MCE);
  51. printk(KERN_INFO
  52. "Intel old style machine check reporting enabled on CPU#%d.\n",
  53. smp_processor_id());
  54. }