#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <linux/mutex.h>
#include <linux/watchdog.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
#include <linux/completion.h>
#include <linux/kdebug.h>
#include <linux/kstrtox.h>
#include <linux/rwsem.h>
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/notifier.h>
#include <linux/nmi.h>
#include <linux/reboot.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/atomic.h>
#include <linux/sched/signal.h>
#ifdef CONFIG_X86
#include <asm/kdebug.h>
#include <asm/nmi.h>
#define HAVE_DIE_NMI
#endif
#define WDOG_DONT_LOG …
#define WDOG_DONT_STOP_ON_SET …
#define WDOG_SET_TIMER_USE(byte, use) …
#define WDOG_GET_TIMER_USE(byte) …
#define WDOG_TIMER_USE_BIOS_FRB2 …
#define WDOG_TIMER_USE_BIOS_POST …
#define WDOG_TIMER_USE_OS_LOAD …
#define WDOG_TIMER_USE_SMS_OS …
#define WDOG_TIMER_USE_OEM …
#define WDOG_SET_PRETIMEOUT_ACT(byte, use) …
#define WDOG_GET_PRETIMEOUT_ACT(byte) …
#define WDOG_PRETIMEOUT_NONE …
#define WDOG_PRETIMEOUT_SMI …
#define WDOG_PRETIMEOUT_NMI …
#define WDOG_PRETIMEOUT_MSG_INT …
#define WDOG_PREOP_NONE …
#define WDOG_PREOP_PANIC …
#define WDOG_PREOP_GIVE_DATA …
#define WDOG_SET_TIMEOUT_ACT(byte, use) …
#define WDOG_GET_TIMEOUT_ACT(byte) …
#define WDOG_TIMEOUT_NONE …
#define WDOG_TIMEOUT_RESET …
#define WDOG_TIMEOUT_POWER_DOWN …
#define WDOG_TIMEOUT_POWER_CYCLE …
#define WDOG_EXPIRE_CLEAR_BIOS_FRB2 …
#define WDOG_EXPIRE_CLEAR_BIOS_POST …
#define WDOG_EXPIRE_CLEAR_OS_LOAD …
#define WDOG_EXPIRE_CLEAR_SMS_OS …
#define WDOG_EXPIRE_CLEAR_OEM …
#define WDOG_SET_TIMEOUT(byte1, byte2, val) …
#define WDOG_GET_TIMEOUT(byte1, byte2) …
#define IPMI_WDOG_RESET_TIMER …
#define IPMI_WDOG_SET_TIMER …
#define IPMI_WDOG_GET_TIMER …
#define IPMI_WDOG_TIMER_NOT_INIT_RESP …
static DEFINE_MUTEX(ipmi_watchdog_mutex);
static bool nowayout = … WATCHDOG_NOWAYOUT;
static struct ipmi_user *watchdog_user;
static int watchdog_ifnum;
static int timeout = …;
static int pretimeout;
static int panic_wdt_timeout = …;
static unsigned char action_val = …;
static char action[16] = …;
static unsigned char preaction_val = …;
static char preaction[16] = …;
static unsigned char preop_val = …;
static char preop[16] = …;
static DEFINE_SPINLOCK(ipmi_read_lock);
static char data_to_read;
static DECLARE_WAIT_QUEUE_HEAD(read_q);
static struct fasync_struct *fasync_q;
static atomic_t pretimeout_since_last_heartbeat;
static char expect_close;
static int ifnum_to_use = …;
#define IPMI_SET_TIMEOUT_NO_HB …
#define IPMI_SET_TIMEOUT_HB_IF_NECESSARY …
#define IPMI_SET_TIMEOUT_FORCE_HB …
static int ipmi_set_timeout(int do_heartbeat);
static void ipmi_register_watchdog(int ipmi_intf);
static void ipmi_unregister_watchdog(int ipmi_intf);
static int start_now;
static int set_param_timeout(const char *val, const struct kernel_param *kp)
{ … }
static const struct kernel_param_ops param_ops_timeout = …;
#define param_check_timeout …
action_fn;
static int action_op(const char *inval, char *outval);
static int preaction_op(const char *inval, char *outval);
static int preop_op(const char *inval, char *outval);
static void check_parms(void);
static int set_param_str(const char *val, const struct kernel_param *kp)
{ … }
static int get_param_str(char *buffer, const struct kernel_param *kp)
{ … }
static int set_param_wdog_ifnum(const char *val, const struct kernel_param *kp)
{ … }
static const struct kernel_param_ops param_ops_wdog_ifnum = …;
#define param_check_wdog_ifnum …
static const struct kernel_param_ops param_ops_str = …;
module_param(ifnum_to_use, wdog_ifnum, 0644);
MODULE_PARM_DESC(…) …;
module_param(timeout, timeout, 0644);
MODULE_PARM_DESC(…) …;
module_param(pretimeout, timeout, 0644);
MODULE_PARM_DESC(…) …;
module_param(panic_wdt_timeout, timeout, 0644);
MODULE_PARM_DESC(…) …;
module_param_cb(…);
MODULE_PARM_DESC(…) …;
module_param_cb(…);
MODULE_PARM_DESC(…) …;
module_param_cb(…);
MODULE_PARM_DESC(…) …;
module_param(start_now, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(nowayout, bool, 0644);
MODULE_PARM_DESC(…) …;
static unsigned char ipmi_watchdog_state = …;
static unsigned long ipmi_wdog_open;
static int ipmi_start_timer_on_heartbeat;
static unsigned char ipmi_version_major;
static unsigned char ipmi_version_minor;
static atomic_t preop_panic_excl = …;
#ifdef HAVE_DIE_NMI
static int testing_nmi;
static int nmi_handler_registered;
#endif
static int __ipmi_heartbeat(void);
static atomic_t msg_tofree = …;
static DECLARE_COMPLETION(msg_wait);
static void msg_free_smi(struct ipmi_smi_msg *msg)
{ … }
static void msg_free_recv(struct ipmi_recv_msg *msg)
{ … }
static struct ipmi_smi_msg smi_msg = …;
static struct ipmi_recv_msg recv_msg = …;
static int __ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
struct ipmi_recv_msg *recv_msg,
int *send_heartbeat_now)
{ … }
static int _ipmi_set_timeout(int do_heartbeat)
{ … }
static int ipmi_set_timeout(int do_heartbeat)
{ … }
static atomic_t panic_done_count = …;
static void panic_smi_free(struct ipmi_smi_msg *msg)
{ … }
static void panic_recv_free(struct ipmi_recv_msg *msg)
{ … }
static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = …;
static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = …;
static void panic_halt_ipmi_heartbeat(void)
{ … }
static struct ipmi_smi_msg panic_halt_smi_msg = …;
static struct ipmi_recv_msg panic_halt_recv_msg = …;
static void panic_halt_ipmi_set_timeout(void)
{ … }
static int __ipmi_heartbeat(void)
{ … }
static int _ipmi_heartbeat(void)
{ … }
static int ipmi_heartbeat(void)
{ … }
static const struct watchdog_info ident = …;
static int ipmi_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
static long ipmi_unlocked_ioctl(struct file *file,
unsigned int cmd,
unsigned long arg)
{ … }
static ssize_t ipmi_write(struct file *file,
const char __user *buf,
size_t len,
loff_t *ppos)
{ … }
static ssize_t ipmi_read(struct file *file,
char __user *buf,
size_t count,
loff_t *ppos)
{ … }
static int ipmi_open(struct inode *ino, struct file *filep)
{ … }
static __poll_t ipmi_poll(struct file *file, poll_table *wait)
{ … }
static int ipmi_fasync(int fd, struct file *file, int on)
{ … }
static int ipmi_close(struct inode *ino, struct file *filep)
{ … }
static const struct file_operations ipmi_wdog_fops = …;
static struct miscdevice ipmi_wdog_miscdev = …;
static void ipmi_wdog_msg_handler(struct ipmi_recv_msg *msg,
void *handler_data)
{ … }
static void ipmi_wdog_pretimeout_handler(void *handler_data)
{ … }
static void ipmi_wdog_panic_handler(void *user_data)
{ … }
static const struct ipmi_user_hndl ipmi_hndlrs = …;
static void ipmi_register_watchdog(int ipmi_intf)
{ … }
static void ipmi_unregister_watchdog(int ipmi_intf)
{ … }
#ifdef HAVE_DIE_NMI
static int
ipmi_nmi(unsigned int val, struct pt_regs *regs)
{ … }
#endif
static int wdog_reboot_handler(struct notifier_block *this,
unsigned long code,
void *unused)
{ … }
static struct notifier_block wdog_reboot_notifier = …;
static void ipmi_new_smi(int if_num, struct device *device)
{ … }
static void ipmi_smi_gone(int if_num)
{ … }
static struct ipmi_smi_watcher smi_watcher = …;
static int action_op(const char *inval, char *outval)
{ … }
static int preaction_op(const char *inval, char *outval)
{ … }
static int preop_op(const char *inval, char *outval)
{ … }
static void check_parms(void)
{ … }
static int __init ipmi_wdog_init(void)
{ … }
static void __exit ipmi_wdog_exit(void)
{ … }
module_exit(ipmi_wdog_exit);
module_init(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;