15 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/module.h>
19 #include <linux/types.h>
20 #include <linux/kernel.h>
24 #include <linux/watchdog.h>
26 #include <linux/reboot.h>
31 static unsigned long indydog_alive;
34 #define WATCHDOG_TIMEOUT 30
39 "Watchdog cannot be stopped once started (default="
42 static void indydog_start(
void)
46 spin_lock(&indydog_lock);
47 mc_ctrl0 =
sgimc->cpuctrl0;
49 sgimc->cpuctrl0 = mc_ctrl0;
50 spin_unlock(&indydog_lock);
53 static void indydog_stop(
void)
57 spin_lock(&indydog_lock);
59 mc_ctrl0 =
sgimc->cpuctrl0;
61 sgimc->cpuctrl0 = mc_ctrl0;
62 spin_unlock(&indydog_lock);
64 pr_info(
"Stopped watchdog timer\n");
67 static void indydog_ping(
void)
87 pr_info(
"Started watchdog timer\n");
92 static int indydog_release(
struct inode *inode,
struct file *file)
102 static ssize_t indydog_write(
struct file *file,
const char *
data,
103 size_t len, loff_t *ppos)
111 static long indydog_ioctl(
struct file *file,
unsigned int cmd,
117 .firmware_version = 0,
118 .identity =
"Hardware Watchdog for SGI IP22",
124 &ident,
sizeof(ident)))
166 .write = indydog_write,
167 .unlocked_ioctl = indydog_ioctl,
168 .open = indydog_open,
169 .release = indydog_release,
175 .fops = &indydog_fops,
179 .notifier_call = indydog_notify_sys,
182 static int __init watchdog_init(
void)
188 pr_err(
"cannot register reboot notifier (err=%d)\n", ret);
194 pr_err(
"cannot register miscdev on minor=%d (err=%d)\n",
200 pr_info(
"Hardware Watchdog Timer for SGI IP22: 0.3\n");
205 static void __exit watchdog_exit(
void)