nmi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 atomic_t nmi_active;
  32. extern unsigned int nmi_watchdog;
  33. #define NMI_NONE 0
  34. #define NMI_IO_APIC 1
  35. #define NMI_LOCAL_APIC 2
  36. #define NMI_INVALID 3
  37. struct ctl_table;
  38. struct file;
  39. extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
  40. void __user *, size_t *, loff_t *);
  41. extern int unknown_nmi_panic;
  42. void __trigger_all_cpu_backtrace(void);
  43. #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
  44. static inline void localise_nmi_watchdog(void)
  45. {
  46. if (nmi_watchdog == NMI_IO_APIC)
  47. nmi_watchdog = NMI_LOCAL_APIC;
  48. }
  49. /* check if nmi_watchdog is active (ie was specified at boot) */
  50. static inline int nmi_watchdog_active(void)
  51. {
  52. /*
  53. * actually it should be:
  54. * return (nmi_watchdog == NMI_LOCAL_APIC ||
  55. * nmi_watchdog == NMI_IO_APIC)
  56. * but since they are power of two we could use a
  57. * cheaper way --cvg
  58. */
  59. return nmi_watchdog & 0x3;
  60. }
  61. #endif
  62. void lapic_watchdog_stop(void);
  63. int lapic_watchdog_init(unsigned nmi_hz);
  64. int lapic_wd_event(unsigned nmi_hz);
  65. unsigned lapic_adjust_nmi_hz(unsigned hz);
  66. int lapic_watchdog_ok(void);
  67. void disable_lapic_nmi_watchdog(void);
  68. void enable_lapic_nmi_watchdog(void);
  69. void stop_nmi(void);
  70. void restart_nmi(void);
  71. #endif