Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / arch / i386 / kernel / cpu / mcheck / mce.c
1 /*
2  * mce.c - x86 Machine Check Exception Reporting
3  * (c) 2002 Alan Cox <alan@redhat.com>, Dave Jones <davej@codemonkey.org.uk>
4  */
5
6 #include <linux/init.h>
7 #include <linux/types.h>
8 #include <linux/kernel.h>
9 #include <linux/module.h>
10 #include <linux/smp.h>
11 #include <linux/thread_info.h>
12
13 #include <asm/processor.h> 
14 #include <asm/system.h>
15
16 #include "mce.h"
17
18 int mce_disabled = 0;
19 int nr_mce_banks;
20
21 EXPORT_SYMBOL_GPL(nr_mce_banks);        /* non-fatal.o */
22
23 /* Handle unconfigured int18 (should never happen) */
24 static fastcall void unexpected_machine_check(struct pt_regs * regs, long error_code)
25 {       
26         printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n", smp_processor_id());
27 }
28
29 /* Call the installed machine check handler for this CPU setup. */
30 void fastcall (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check;
31
32 /* This has to be run for each processor */
33 void mcheck_init(struct cpuinfo_x86 *c)
34 {
35         if (mce_disabled==1)
36                 return;
37
38         switch (c->x86_vendor) {
39                 case X86_VENDOR_AMD:
40                         if (c->x86==6 || c->x86==15)
41                                 amd_mcheck_init(c);
42                         break;
43
44                 case X86_VENDOR_INTEL:
45                         if (c->x86==5)
46                                 intel_p5_mcheck_init(c);
47                         if (c->x86==6)
48                                 intel_p6_mcheck_init(c);
49                         if (c->x86==15)
50                                 intel_p4_mcheck_init(c);
51                         break;
52
53                 case X86_VENDOR_CENTAUR:
54                         if (c->x86==5)
55                                 winchip_mcheck_init(c);
56                         break;
57
58                 default:
59                         break;
60         }
61 }
62
63 static int __init mcheck_disable(char *str)
64 {
65         mce_disabled = 1;
66         return 1;
67 }
68
69 static int __init mcheck_enable(char *str)
70 {
71         mce_disabled = -1;
72         return 1;
73 }
74
75 __setup("nomce", mcheck_disable);
76 __setup("mce", mcheck_enable);