mach_traps.h 974 B

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