mach_traps.h 1013 B

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