blob: e9a701aecaa14a3959e8c2176e14a9be308d8bcd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IDT Winchip specific Machine Check Exception Reporting
Alan Cox87c6fe22009-01-05 14:08:04 +00003 * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/interrupt.h>
Ingo Molnar91425082009-04-08 12:31:22 +02006#include <linux/kernel.h>
7#include <linux/types.h>
8#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Paolo Ciarrocchi4de81622008-02-22 23:10:57 +010010#include <asm/processor.h>
Hidetoshi Seto9e55e442009-06-15 17:22:15 +090011#include <asm/mce.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/msr.h>
13
Ingo Molnar91425082009-04-08 12:31:22 +020014/* Machine check handler for WinChip C6: */
Paolo Ciarrocchi4de81622008-02-22 23:10:57 +010015static void winchip_machine_check(struct pt_regs *regs, long error_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -070016{
17 printk(KERN_EMERG "CPU0: Machine Check Exception.\n");
Rusty Russell373d4d02013-01-21 17:17:39 +103018 add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
Linus Torvalds1da177e2005-04-16 15:20:36 -070019}
20
21/* Set up machine check reporting on the Winchip C6 series */
Shaohua Li31ab2692005-11-07 00:58:42 -080022void winchip_mcheck_init(struct cpuinfo_x86 *c)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023{
24 u32 lo, hi;
Ingo Molnar91425082009-04-08 12:31:22 +020025
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 machine_check_vector = winchip_machine_check;
Ingo Molnar91425082009-04-08 12:31:22 +020027 /* Make sure the vector pointer is visible before we enable MCEs: */
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 wmb();
Ingo Molnar91425082009-04-08 12:31:22 +020029
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 rdmsr(MSR_IDT_FCR1, lo, hi);
Paolo Ciarrocchi4de81622008-02-22 23:10:57 +010031 lo |= (1<<2); /* Enable EIERRINT (int 18 MCE) */
32 lo &= ~(1<<4); /* Enable MCE */
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 wrmsr(MSR_IDT_FCR1, lo, hi);
Ingo Molnar91425082009-04-08 12:31:22 +020034
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 set_in_cr4(X86_CR4_MCE);
Ingo Molnar91425082009-04-08 12:31:22 +020036
37 printk(KERN_INFO
38 "Winchip machine check reporting enabled on CPU#0.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070039}