Files
OrangePi_CM5/arch/x86/kernel/cpu/mcheck/p5.c
T

67 lines
1.6 KiB
C
Raw Normal View History

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