p5.c 1.7 KB

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