Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p5.c
Go to the documentation of this file.
1 /*
2  * P5 specific Machine Check Exception Reporting
3  * (C) Copyright 2002 Alan Cox <[email protected]>
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 
11 #include <asm/processor.h>
12 #include <asm/mce.h>
13 #include <asm/msr.h>
14 
15 /* By default disabled */
16 int mce_p5_enabled __read_mostly;
17 
18 /* Machine check handler for Pentium class Intel CPUs: */
19 static void pentium_machine_check(struct pt_regs *regs, long error_code)
20 {
21  u32 loaddr, hi, lotype;
22 
23  rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
24  rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
25 
27  "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
28  smp_processor_id(), loaddr, lotype);
29 
30  if (lotype & (1<<5)) {
32  "CPU#%d: Possible thermal failure (CPU on fire ?).\n",
34  }
35 
37 }
38 
39 /* Set up machine check reporting for processors with Intel style MCE: */
41 {
42  u32 l, h;
43 
44  /* Default P5 to off as its often misconnected: */
45  if (!mce_p5_enabled)
46  return;
47 
48  /* Check for MCE support: */
49  if (!cpu_has(c, X86_FEATURE_MCE))
50  return;
51 
52  machine_check_vector = pentium_machine_check;
53  /* Make sure the vector pointer is visible before we enable MCEs: */
54  wmb();
55 
56  /* Read registers before enabling: */
60  "Intel old style machine check architecture supported.\n");
61 
62  /* Enable MCE: */
63  set_in_cr4(X86_CR4_MCE);
65  "Intel old style machine check reporting enabled on CPU#%d.\n",
67 }