nmi.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _ASM_X86_NMI_H
  2. #define _ASM_X86_NMI_H
  3. #include <linux/pm.h>
  4. #include <asm/irq.h>
  5. #include <asm/io.h>
  6. #ifdef ARCH_HAS_NMI_WATCHDOG
  7. /**
  8. * do_nmi_callback
  9. *
  10. * Check to see if a callback exists and execute it. Return 1
  11. * if the handler exists and was handled successfully.
  12. */
  13. int do_nmi_callback(struct pt_regs *regs, int cpu);
  14. extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
  15. extern int check_nmi_watchdog(void);
  16. extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
  17. extern int reserve_perfctr_nmi(unsigned int);
  18. extern void release_perfctr_nmi(unsigned int);
  19. extern int reserve_evntsel_nmi(unsigned int);
  20. extern void release_evntsel_nmi(unsigned int);
  21. extern void setup_apic_nmi_watchdog(void *);
  22. extern void stop_apic_nmi_watchdog(void *);
  23. extern void disable_timer_nmi_watchdog(void);
  24. extern void enable_timer_nmi_watchdog(void);
  25. extern void cpu_nmi_set_wd_enabled(void);
  26. extern atomic_t nmi_active;
  27. extern unsigned int nmi_watchdog;
  28. #define NMI_NONE 0
  29. #define NMI_IO_APIC 1
  30. #define NMI_LOCAL_APIC 2
  31. #define NMI_INVALID 3
  32. struct ctl_table;
  33. extern int proc_nmi_enabled(struct ctl_table *, int ,
  34. void __user *, size_t *, loff_t *);
  35. extern int unknown_nmi_panic;
  36. void arch_trigger_all_cpu_backtrace(void);
  37. #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
  38. static inline void localise_nmi_watchdog(void)
  39. {
  40. if (nmi_watchdog == NMI_IO_APIC)
  41. nmi_watchdog = NMI_LOCAL_APIC;
  42. }
  43. /* check if nmi_watchdog is active (ie was specified at boot) */
  44. static inline int nmi_watchdog_active(void)
  45. {
  46. /*
  47. * actually it should be:
  48. * return (nmi_watchdog == NMI_LOCAL_APIC ||
  49. * nmi_watchdog == NMI_IO_APIC)
  50. * but since they are power of two we could use a
  51. * cheaper way --cvg
  52. */
  53. return nmi_watchdog & (NMI_LOCAL_APIC | NMI_IO_APIC);
  54. }
  55. #endif
  56. void lapic_watchdog_stop(void);
  57. int lapic_watchdog_init(unsigned nmi_hz);
  58. int lapic_wd_event(unsigned nmi_hz);
  59. unsigned lapic_adjust_nmi_hz(unsigned hz);
  60. void disable_lapic_nmi_watchdog(void);
  61. void enable_lapic_nmi_watchdog(void);
  62. void stop_nmi(void);
  63. void restart_nmi(void);
  64. #endif /* _ASM_X86_NMI_H */