2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* P5 specific Machine Check Exception Reporting
|
2009-01-05 22:08:04 +08:00
|
|
|
* (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
2008-02-20 06:20:45 +08:00
|
|
|
#include <asm/processor.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/msr.h>
|
|
|
|
|
|
|
|
#include "mce.h"
|
|
|
|
|
|
|
|
/* Machine check handler for Pentium class Intel */
|
2008-02-20 06:20:45 +08:00
|
|
|
static void pentium_machine_check(struct pt_regs *regs, long error_code)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
u32 loaddr, hi, lotype;
|
|
|
|
rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
|
|
|
|
rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
|
|
|
|
printk(KERN_EMERG "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n", smp_processor_id(), loaddr, lotype);
|
2008-02-20 06:20:45 +08:00
|
|
|
if (lotype&(1<<5))
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(KERN_EMERG "CPU#%d: Possible thermal failure (CPU on fire ?).\n", smp_processor_id());
|
|
|
|
add_taint(TAINT_MACHINE_CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set up machine check reporting for processors with Intel style MCE */
|
2005-11-07 16:58:42 +08:00
|
|
|
void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
u32 l, h;
|
2008-02-20 06:20:45 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*Check for MCE support */
|
2008-02-20 06:20:45 +08:00
|
|
|
if (!cpu_has(c, X86_FEATURE_MCE))
|
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Default P5 to off as its often misconnected */
|
2008-02-20 06:20:45 +08:00
|
|
|
if (mce_disabled != -1)
|
2005-04-17 06:20:36 +08:00
|
|
|
return;
|
|
|
|
machine_check_vector = pentium_machine_check;
|
|
|
|
wmb();
|
|
|
|
|
|
|
|
/* Read registers before enabling */
|
|
|
|
rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
|
|
|
|
rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
|
|
|
|
printk(KERN_INFO "Intel old style machine check architecture supported.\n");
|
|
|
|
|
2008-02-20 06:20:45 +08:00
|
|
|
/* Enable MCE */
|
2005-04-17 06:20:36 +08:00
|
|
|
set_in_cr4(X86_CR4_MCE);
|
|
|
|
printk(KERN_INFO "Intel old style machine check reporting enabled on CPU#%d.\n", smp_processor_id());
|
|
|
|
}
|