Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * IDT Winchip specific Machine Check Exception Reporting |
Alan Cox | 87c6fe2 | 2009-01-05 14:08:04 +0000 | [diff] [blame] | 3 | * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/interrupt.h> |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 6 | #include <linux/kernel.h> |
| 7 | #include <linux/types.h> |
| 8 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Paolo Ciarrocchi | 4de8162 | 2008-02-22 23:10:57 +0100 | [diff] [blame] | 10 | #include <asm/processor.h> |
Hidetoshi Seto | 9e55e44 | 2009-06-15 17:22:15 +0900 | [diff] [blame] | 11 | #include <asm/mce.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/msr.h> |
| 13 | |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 14 | /* Machine check handler for WinChip C6: */ |
Paolo Ciarrocchi | 4de8162 | 2008-02-22 23:10:57 +0100 | [diff] [blame] | 15 | static void winchip_machine_check(struct pt_regs *regs, long error_code) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | { |
| 17 | printk(KERN_EMERG "CPU0: Machine Check Exception.\n"); |
Rusty Russell | 373d4d0 | 2013-01-21 17:17:39 +1030 | [diff] [blame^] | 18 | add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | /* Set up machine check reporting on the Winchip C6 series */ |
Shaohua Li | 31ab269 | 2005-11-07 00:58:42 -0800 | [diff] [blame] | 22 | void winchip_mcheck_init(struct cpuinfo_x86 *c) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { |
| 24 | u32 lo, hi; |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | machine_check_vector = winchip_machine_check; |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 27 | /* Make sure the vector pointer is visible before we enable MCEs: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | wmb(); |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | rdmsr(MSR_IDT_FCR1, lo, hi); |
Paolo Ciarrocchi | 4de8162 | 2008-02-22 23:10:57 +0100 | [diff] [blame] | 31 | lo |= (1<<2); /* Enable EIERRINT (int 18 MCE) */ |
| 32 | lo &= ~(1<<4); /* Enable MCE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | wrmsr(MSR_IDT_FCR1, lo, hi); |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 34 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | set_in_cr4(X86_CR4_MCE); |
Ingo Molnar | 9142508 | 2009-04-08 12:31:22 +0200 | [diff] [blame] | 36 | |
| 37 | printk(KERN_INFO |
| 38 | "Winchip machine check reporting enabled on CPU#0.\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } |