debuggers.hg

view xen/arch/x86/cpu/mcheck/mce.c @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d
line source
1 /*
2 * mce.c - x86 Machine Check Exception Reporting
3 * (c) 2002 Alan Cox <alan@redhat.com>, Dave Jones <davej@codemonkey.org.uk>
4 */
6 #include <xen/init.h>
7 #include <xen/types.h>
8 #include <xen/kernel.h>
9 #include <xen/config.h>
10 #include <xen/smp.h>
12 #include <asm/processor.h>
13 #include <asm/system.h>
15 #include "mce.h"
17 int mce_disabled = 0;
18 int nr_mce_banks;
20 EXPORT_SYMBOL_GPL(nr_mce_banks); /* non-fatal.o */
22 /* Handle unconfigured int18 (should never happen) */
23 static fastcall void unexpected_machine_check(struct cpu_user_regs * regs, long error_code)
24 {
25 printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n", smp_processor_id());
26 }
28 /* Call the installed machine check handler for this CPU setup. */
29 void fastcall (*machine_check_vector)(struct cpu_user_regs *, long error_code) = unexpected_machine_check;
31 /* This has to be run for each processor */
32 void mcheck_init(struct cpuinfo_x86 *c)
33 {
34 if (mce_disabled==1)
35 return;
37 switch (c->x86_vendor) {
38 case X86_VENDOR_AMD:
39 amd_mcheck_init(c);
40 break;
42 case X86_VENDOR_INTEL:
43 #ifndef CONFIG_X86_64
44 if (c->x86==5)
45 intel_p5_mcheck_init(c);
46 if (c->x86==6)
47 intel_p6_mcheck_init(c);
48 #endif
49 if (c->x86==15)
50 intel_p4_mcheck_init(c);
51 break;
53 #ifndef CONFIG_X86_64
54 case X86_VENDOR_CENTAUR:
55 if (c->x86==5)
56 winchip_mcheck_init(c);
57 break;
58 #endif
60 default:
61 break;
62 }
63 }
65 static unsigned long old_cr4 __initdata;
67 void __init stop_mce(void)
68 {
69 old_cr4 = read_cr4();
70 clear_in_cr4(X86_CR4_MCE);
71 }
73 void __init restart_mce(void)
74 {
75 if (old_cr4 & X86_CR4_MCE)
76 set_in_cr4(X86_CR4_MCE);
77 }
79 static void __init mcheck_disable(char *str)
80 {
81 mce_disabled = 1;
82 }
84 static void __init mcheck_enable(char *str)
85 {
86 mce_disabled = -1;
87 }
89 custom_param("nomce", mcheck_disable);
90 custom_param("mce", mcheck_enable);