2 * Machine Check Handler For PII/PIII
5 #include <linux/types.h>
6 #include <linux/kernel.h>
7 #include <linux/sched.h>
8 #include <asm/processor.h>
13 void do_machine_check(struct pt_regs
* regs
, long error_code
)
16 u32 alow
, ahigh
, high
, low
;
20 rdmsr(0x17a, mcgstl
, mcgsth
);
21 if(mcgstl
&(1<<0)) /* Recoverable ? */
24 printk(KERN_EMERG
"CPU %d: Machine Check Exception: %08x%08x\n", smp_processor_id(), mcgsth
, mcgstl
);
28 rdmsr(0x401+i
*4,low
, high
);
35 printk(KERN_EMERG
"Bank %d: %08x%08x", i
, high
, low
);
39 rdmsr(0x402+i
*4, alow
, ahigh
);
40 printk("[%08x%08x]", alow
, ahigh
);
44 rdmsr(0x402+i
*4, alow
, ahigh
);
45 printk(" at %08x%08x",
49 wrmsr(0x401+i
*4, 0UL, 0UL);
56 panic("CPU context corrupt");
58 panic("Unable to continue");
59 printk(KERN_EMERG
"Attempting to continue.\n");
61 wrmsr(0x17a,mcgstl
, mcgsth
);
66 * This has to be run for each processor
69 void mcheck_init(struct cpuinfo_x86
*c
)
75 if( c
->x86_vendor
!= X86_VENDOR_INTEL
)
78 if( !test_bit(X86_FEATURE_TSC
, &c
->x86_capability
) )
81 if( !test_bit(X86_FEATURE_MCA
, &c
->x86_capability
) )
84 /* Ok machine check is available */
87 printk(KERN_INFO
"Intel machine check architecture supported.\n");
90 wrmsr(0x17b, 0xffffffff, 0xffffffff);
94 wrmsr(0x400+4*i
, 0xffffffff, 0xffffffff);
98 wrmsr(0x401+4*i
, 0x0, 0x0);
100 __asm__
__volatile__ (
101 "movl %%cr4, %%eax\n\t"
102 "orl $0x40, %%eax\n\t"
103 "movl %%eax, %%cr4\n\t" : : : "eax");
104 printk(KERN_INFO
"Intel machine check reporting enabled on CPU#%d.\n", smp_processor_id());