Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Machine specific NMI handling for generic. |
| 3 | * Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp> |
| 4 | */ |
H. Peter Anvin | 05e4d31 | 2008-10-23 00:01:39 -0700 | [diff] [blame] | 5 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H |
| 6 | #define _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
| 8 | #include <asm/mc146818rtc.h> |
| 9 | |
Huang Ying | 1c7b74d | 2011-01-06 16:18:47 -0500 | [diff] [blame] | 10 | #define NMI_REASON_PORT 0x61 |
| 11 | |
| 12 | #define NMI_REASON_SERR 0x80 |
| 13 | #define NMI_REASON_IOCHK 0x40 |
| 14 | #define NMI_REASON_MASK (NMI_REASON_SERR | NMI_REASON_IOCHK) |
| 15 | |
| 16 | #define NMI_REASON_CLEAR_SERR 0x04 |
| 17 | #define NMI_REASON_CLEAR_IOCHK 0x08 |
| 18 | #define NMI_REASON_CLEAR_MASK 0x0f |
| 19 | |
Jacob Pan | 064a59b | 2011-11-10 13:43:05 +0000 | [diff] [blame] | 20 | static inline unsigned char default_get_nmi_reason(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | { |
Huang Ying | 1c7b74d | 2011-01-06 16:18:47 -0500 | [diff] [blame] | 22 | return inb(NMI_REASON_PORT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | static inline void reassert_nmi(void) |
| 26 | { |
| 27 | int old_reg = -1; |
| 28 | |
| 29 | if (do_i_have_lock_cmos()) |
| 30 | old_reg = current_lock_cmos_reg(); |
| 31 | else |
| 32 | lock_cmos(0); /* register doesn't matter here */ |
| 33 | outb(0x8f, 0x70); |
| 34 | inb(0x71); /* dummy */ |
| 35 | outb(0x0f, 0x70); |
| 36 | inb(0x71); /* dummy */ |
| 37 | if (old_reg >= 0) |
| 38 | outb(old_reg, 0x70); |
| 39 | else |
| 40 | unlock_cmos(); |
| 41 | } |
| 42 | |
H. Peter Anvin | 05e4d31 | 2008-10-23 00:01:39 -0700 | [diff] [blame] | 43 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H */ |