p5.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * P5 specific Machine Check Exception Reporting
  3. * (C) Copyright 2002 Alan Cox <alan@redhat.com>
  4. */
  5. #include <linux/init.h>
  6. #include <linux/types.h>
  7. #include <linux/kernel.h>
  8. #include <linux/irq.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/smp.h>
  11. #include <asm/processor.h>
  12. #include <asm/system.h>
  13. #include <asm/msr.h>
  14. #include "mce.h"
  15. /* Machine check handler for Pentium class Intel */
  16. static fastcall 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 "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n", smp_processor_id(), loaddr, lotype);
  22. if(lotype&(1<<5))
  23. printk(KERN_EMERG "CPU#%d: Possible thermal failure (CPU on fire ?).\n", smp_processor_id());
  24. add_taint(TAINT_MACHINE_CHECK);
  25. }
  26. /* Set up machine check reporting for processors with Intel style MCE */
  27. void __devinit intel_p5_mcheck_init(struct cpuinfo_x86 *c)
  28. {
  29. u32 l, h;
  30. /*Check for MCE support */
  31. if( !cpu_has(c, X86_FEATURE_MCE) )
  32. return;
  33. /* Default P5 to off as its often misconnected */
  34. if(mce_disabled != -1)
  35. return;
  36. machine_check_vector = pentium_machine_check;
  37. wmb();
  38. /* Read registers before enabling */
  39. rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
  40. rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
  41. printk(KERN_INFO "Intel old style machine check architecture supported.\n");
  42. /* Enable MCE */
  43. set_in_cr4(X86_CR4_MCE);
  44. printk(KERN_INFO "Intel old style machine check reporting enabled on CPU#%d.\n", smp_processor_id());
  45. }