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