Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  Machine specific NMI handling for generic.
0004  *  Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp>
0005  */
0006 #ifndef _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H
0007 #define _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H
0008 
0009 #include <asm/mc146818rtc.h>
0010 
0011 #define NMI_REASON_PORT     0x61
0012 
0013 #define NMI_REASON_SERR     0x80
0014 #define NMI_REASON_IOCHK    0x40
0015 #define NMI_REASON_MASK     (NMI_REASON_SERR | NMI_REASON_IOCHK)
0016 
0017 #define NMI_REASON_CLEAR_SERR   0x04
0018 #define NMI_REASON_CLEAR_IOCHK  0x08
0019 #define NMI_REASON_CLEAR_MASK   0x0f
0020 
0021 static inline unsigned char default_get_nmi_reason(void)
0022 {
0023     return inb(NMI_REASON_PORT);
0024 }
0025 
0026 static inline void reassert_nmi(void)
0027 {
0028     int old_reg = -1;
0029 
0030     if (do_i_have_lock_cmos())
0031         old_reg = current_lock_cmos_reg();
0032     else
0033         lock_cmos(0); /* register doesn't matter here */
0034     outb(0x8f, 0x70);
0035     inb(0x71);      /* dummy */
0036     outb(0x0f, 0x70);
0037     inb(0x71);      /* dummy */
0038     if (old_reg >= 0)
0039         outb(old_reg, 0x70);
0040     else
0041         unlock_cmos();
0042 }
0043 
0044 #endif /* _ASM_X86_MACH_DEFAULT_MACH_TRAPS_H */