1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21164dd00SIngo Molnar /* 31164dd00SIngo Molnar * Machine specific NMI handling for generic. 41164dd00SIngo Molnar * Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp> 51164dd00SIngo Molnar */ 61164dd00SIngo Molnar #ifndef _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H 71164dd00SIngo Molnar #define _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H 81164dd00SIngo Molnar 91164dd00SIngo Molnar #include <asm/mc146818rtc.h> 101164dd00SIngo Molnar 111c7b74d4SHuang Ying #define NMI_REASON_PORT 0x61 121c7b74d4SHuang Ying 131c7b74d4SHuang Ying #define NMI_REASON_SERR 0x80 141c7b74d4SHuang Ying #define NMI_REASON_IOCHK 0x40 151c7b74d4SHuang Ying #define NMI_REASON_MASK (NMI_REASON_SERR | NMI_REASON_IOCHK) 161c7b74d4SHuang Ying 171c7b74d4SHuang Ying #define NMI_REASON_CLEAR_SERR 0x04 181c7b74d4SHuang Ying #define NMI_REASON_CLEAR_IOCHK 0x08 191c7b74d4SHuang Ying #define NMI_REASON_CLEAR_MASK 0x0f 201c7b74d4SHuang Ying default_get_nmi_reason(void)21064a59b6SJacob Panstatic inline unsigned char default_get_nmi_reason(void) 221164dd00SIngo Molnar { 231c7b74d4SHuang Ying return inb(NMI_REASON_PORT); 241164dd00SIngo Molnar } 251164dd00SIngo Molnar reassert_nmi(void)261164dd00SIngo Molnarstatic inline void reassert_nmi(void) 271164dd00SIngo Molnar { 281164dd00SIngo Molnar int old_reg = -1; 291164dd00SIngo Molnar 301164dd00SIngo Molnar if (do_i_have_lock_cmos()) 311164dd00SIngo Molnar old_reg = current_lock_cmos_reg(); 321164dd00SIngo Molnar else 331164dd00SIngo Molnar lock_cmos(0); /* register doesn't matter here */ 341164dd00SIngo Molnar outb(0x8f, 0x70); 351164dd00SIngo Molnar inb(0x71); /* dummy */ 361164dd00SIngo Molnar outb(0x0f, 0x70); 371164dd00SIngo Molnar inb(0x71); /* dummy */ 381164dd00SIngo Molnar if (old_reg >= 0) 391164dd00SIngo Molnar outb(old_reg, 0x70); 401164dd00SIngo Molnar else 411164dd00SIngo Molnar unlock_cmos(); 421164dd00SIngo Molnar } 431164dd00SIngo Molnar 441164dd00SIngo Molnar #endif /* _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H */ 45