nmi.h 2.3 KB

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