nmi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 nmi_watchdog_enabled;
  17. extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
  18. extern int avail_to_resrv_perfctr_nmi(unsigned int);
  19. extern int reserve_perfctr_nmi(unsigned int);
  20. extern void release_perfctr_nmi(unsigned int);
  21. extern int reserve_evntsel_nmi(unsigned int);
  22. extern void release_evntsel_nmi(unsigned int);
  23. extern void setup_apic_nmi_watchdog(void *);
  24. extern void stop_apic_nmi_watchdog(void *);
  25. extern void disable_timer_nmi_watchdog(void);
  26. extern void enable_timer_nmi_watchdog(void);
  27. extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
  28. extern void cpu_nmi_set_wd_enabled(void);
  29. extern atomic_t nmi_active;
  30. extern unsigned int nmi_watchdog;
  31. #define NMI_NONE 0
  32. #define NMI_IO_APIC 1
  33. #define NMI_LOCAL_APIC 2
  34. #define NMI_INVALID 3
  35. struct ctl_table;
  36. struct file;
  37. extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
  38. void __user *, size_t *, loff_t *);
  39. extern int unknown_nmi_panic;
  40. void __trigger_all_cpu_backtrace(void);
  41. #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
  42. static inline void localise_nmi_watchdog(void)
  43. {
  44. if (nmi_watchdog == NMI_IO_APIC)
  45. nmi_watchdog = NMI_LOCAL_APIC;
  46. }
  47. /* check if nmi_watchdog is active (ie was specified at boot) */
  48. static inline int nmi_watchdog_active(void)
  49. {
  50. /*
  51. * actually it should be:
  52. * return (nmi_watchdog == NMI_LOCAL_APIC ||
  53. * nmi_watchdog == NMI_IO_APIC)
  54. * but since they are power of two we could use a
  55. * cheaper way --cvg
  56. */
  57. return nmi_watchdog & 0x3;
  58. }
  59. #endif
  60. void lapic_watchdog_stop(void);
  61. int lapic_watchdog_init(unsigned nmi_hz);
  62. int lapic_wd_event(unsigned nmi_hz);
  63. unsigned lapic_adjust_nmi_hz(unsigned hz);
  64. int lapic_watchdog_ok(void);
  65. void disable_lapic_nmi_watchdog(void);
  66. void enable_lapic_nmi_watchdog(void);
  67. void stop_nmi(void);
  68. void restart_nmi(void);
  69. #endif /* _ASM_X86_NMI_H */