]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 | 2 | /* |
1da177e4 LT |
3 | * Machine specific NMI handling for generic. |
4 | * Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp> | |
5 | */ | |
05e4d316 PA |
6 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H |
7 | #define _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H | |
1da177e4 LT |
8 | |
9 | #include <asm/mc146818rtc.h> | |
10 | ||
1c7b74d4 HY |
11 | #define NMI_REASON_PORT 0x61 |
12 | ||
13 | #define NMI_REASON_SERR 0x80 | |
14 | #define NMI_REASON_IOCHK 0x40 | |
15 | #define NMI_REASON_MASK (NMI_REASON_SERR | NMI_REASON_IOCHK) | |
16 | ||
17 | #define NMI_REASON_CLEAR_SERR 0x04 | |
18 | #define NMI_REASON_CLEAR_IOCHK 0x08 | |
19 | #define NMI_REASON_CLEAR_MASK 0x0f | |
20 | ||
064a59b6 | 21 | static inline unsigned char default_get_nmi_reason(void) |
1da177e4 | 22 | { |
1c7b74d4 | 23 | return inb(NMI_REASON_PORT); |
1da177e4 LT |
24 | } |
25 | ||
26 | static inline void reassert_nmi(void) | |
27 | { | |
28 | int old_reg = -1; | |
29 | ||
30 | if (do_i_have_lock_cmos()) | |
31 | old_reg = current_lock_cmos_reg(); | |
32 | else | |
33 | lock_cmos(0); /* register doesn't matter here */ | |
34 | outb(0x8f, 0x70); | |
35 | inb(0x71); /* dummy */ | |
36 | outb(0x0f, 0x70); | |
37 | inb(0x71); /* dummy */ | |
38 | if (old_reg >= 0) | |
39 | outb(old_reg, 0x70); | |
40 | else | |
41 | unlock_cmos(); | |
42 | } | |
43 | ||
05e4d316 | 44 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H */ |