Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Industrial Computer Source PCI-WDT500/501 driver |
| 3 | * |
| 4 | * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. |
| 5 | * http://www.redhat.com |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version |
| 10 | * 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide |
| 13 | * warranty for any of this software. This material is provided |
| 14 | * "AS-IS" and at no charge. |
| 15 | * |
| 16 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> |
| 17 | * |
| 18 | * Release 0.10. |
| 19 | * |
| 20 | * Fixes |
| 21 | * Dave Gregorich : Modularisation and minor bugs |
| 22 | * Alan Cox : Added the watchdog ioctl() stuff |
| 23 | * Alan Cox : Fixed the reboot problem (as noted by |
| 24 | * Matt Crocker). |
| 25 | * Alan Cox : Added wdt= boot option |
| 26 | * Alan Cox : Cleaned up copy/user stuff |
| 27 | * Tim Hockin : Added insmod parameters, comment cleanup |
| 28 | * Parameterized timeout |
| 29 | * JP Nollmann : Added support for PCI wdt501p |
| 30 | * Alan Cox : Split ISA and PCI cards into two drivers |
| 31 | * Jeff Garzik : PCI cleanups |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 32 | * Tigran Aivazian : Restructured wdtpci_init_one() to handle |
| 33 | * failures |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | * Joel Becker : Added WDIOC_GET/SETTIMEOUT |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 35 | * Zwane Mwaikambo : Magic char closing, locking changes, |
| 36 | * cleanups |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | * Matt Domsch : nowayout module option |
| 38 | */ |
| 39 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #include <linux/interrupt.h> |
| 41 | #include <linux/module.h> |
| 42 | #include <linux/moduleparam.h> |
| 43 | #include <linux/types.h> |
| 44 | #include <linux/miscdevice.h> |
| 45 | #include <linux/watchdog.h> |
| 46 | #include <linux/ioport.h> |
| 47 | #include <linux/notifier.h> |
| 48 | #include <linux/reboot.h> |
| 49 | #include <linux/init.h> |
| 50 | #include <linux/fs.h> |
| 51 | #include <linux/pci.h> |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 52 | #include <linux/io.h> |
| 53 | #include <linux/uaccess.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | #include <asm/system.h> |
| 56 | |
| 57 | #define WDT_IS_PCI |
| 58 | #include "wd501p.h" |
| 59 | |
| 60 | #define PFX "wdt_pci: " |
| 61 | |
| 62 | /* |
| 63 | * Until Access I/O gets their application for a PCI vendor ID approved, |
| 64 | * I don't think that it's appropriate to move these constants into the |
| 65 | * regular pci_ids.h file. -- JPN 2000/01/18 |
| 66 | */ |
| 67 | |
| 68 | #ifndef PCI_VENDOR_ID_ACCESSIO |
| 69 | #define PCI_VENDOR_ID_ACCESSIO 0x494f |
| 70 | #endif |
| 71 | #ifndef PCI_DEVICE_ID_WDG_CSM |
| 72 | #define PCI_DEVICE_ID_WDG_CSM 0x22c0 |
| 73 | #endif |
| 74 | |
| 75 | /* We can only use 1 card due to the /dev/watchdog restriction */ |
| 76 | static int dev_count; |
| 77 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 78 | static unsigned long open_lock; |
Alexey Dobriyan | c7dfd0c | 2007-11-01 16:27:08 -0700 | [diff] [blame] | 79 | static DEFINE_SPINLOCK(wdtpci_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | static char expect_close; |
| 81 | |
| 82 | static int io; |
| 83 | static int irq; |
| 84 | |
| 85 | /* Default timeout */ |
| 86 | #define WD_TIMO 60 /* Default heartbeat = 60 seconds */ |
| 87 | |
| 88 | static int heartbeat = WD_TIMO; |
| 89 | static int wd_heartbeat; |
| 90 | module_param(heartbeat, int, 0); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 91 | MODULE_PARM_DESC(heartbeat, |
| 92 | "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" |
| 93 | __MODULE_STRING(WD_TIMO) ")"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
Andrey Panin | 4bfdf37 | 2005-07-27 11:43:58 -0700 | [diff] [blame] | 95 | static int nowayout = WATCHDOG_NOWAYOUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | module_param(nowayout, int, 0); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 97 | MODULE_PARM_DESC(nowayout, |
| 98 | "Watchdog cannot be stopped once started (default=" |
| 99 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
| 101 | #ifdef CONFIG_WDT_501_PCI |
| 102 | /* Support for the Fan Tachometer on the PCI-WDT501 */ |
| 103 | static int tachometer; |
| 104 | |
| 105 | module_param(tachometer, int, 0); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 106 | MODULE_PARM_DESC(tachometer, |
| 107 | "PCI-WDT501 Fan Tachometer support (0=disable, default=0)"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | #endif /* CONFIG_WDT_501_PCI */ |
| 109 | |
| 110 | /* |
| 111 | * Programming support |
| 112 | */ |
| 113 | |
| 114 | static void wdtpci_ctr_mode(int ctr, int mode) |
| 115 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 116 | ctr <<= 6; |
| 117 | ctr |= 0x30; |
| 118 | ctr |= (mode << 1); |
| 119 | outb(ctr, WDT_CR); |
| 120 | udelay(8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | static void wdtpci_ctr_load(int ctr, int val) |
| 124 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 125 | outb(val & 0xFF, WDT_COUNT0 + ctr); |
| 126 | udelay(8); |
| 127 | outb(val >> 8, WDT_COUNT0 + ctr); |
| 128 | udelay(8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | /** |
| 132 | * wdtpci_start: |
| 133 | * |
| 134 | * Start the watchdog driver. |
| 135 | */ |
| 136 | |
| 137 | static int wdtpci_start(void) |
| 138 | { |
| 139 | unsigned long flags; |
| 140 | |
| 141 | spin_lock_irqsave(&wdtpci_lock, flags); |
| 142 | |
| 143 | /* |
| 144 | * "pet" the watchdog, as Access says. |
| 145 | * This resets the clock outputs. |
| 146 | */ |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 147 | inb(WDT_DC); /* Disable watchdog */ |
| 148 | udelay(8); |
| 149 | wdtpci_ctr_mode(2, 0); /* Program CTR2 for Mode 0: |
| 150 | Pulse on Terminal Count */ |
| 151 | outb(0, WDT_DC); /* Enable watchdog */ |
| 152 | udelay(8); |
| 153 | inb(WDT_DC); /* Disable watchdog */ |
| 154 | udelay(8); |
| 155 | outb(0, WDT_CLOCK); /* 2.0833MHz clock */ |
| 156 | udelay(8); |
| 157 | inb(WDT_BUZZER); /* disable */ |
| 158 | udelay(8); |
| 159 | inb(WDT_OPTONOTRST); /* disable */ |
| 160 | udelay(8); |
| 161 | inb(WDT_OPTORST); /* disable */ |
| 162 | udelay(8); |
| 163 | inb(WDT_PROGOUT); /* disable */ |
| 164 | udelay(8); |
| 165 | wdtpci_ctr_mode(0, 3); /* Program CTR0 for Mode 3: |
| 166 | Square Wave Generator */ |
| 167 | wdtpci_ctr_mode(1, 2); /* Program CTR1 for Mode 2: |
| 168 | Rate Generator */ |
| 169 | wdtpci_ctr_mode(2, 1); /* Program CTR2 for Mode 1: |
| 170 | Retriggerable One-Shot */ |
| 171 | wdtpci_ctr_load(0, 20833); /* count at 100Hz */ |
| 172 | wdtpci_ctr_load(1, wd_heartbeat);/* Heartbeat */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | /* DO NOT LOAD CTR2 on PCI card! -- JPN */ |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 174 | outb(0, WDT_DC); /* Enable watchdog */ |
| 175 | udelay(8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | |
| 177 | spin_unlock_irqrestore(&wdtpci_lock, flags); |
| 178 | return 0; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * wdtpci_stop: |
| 183 | * |
| 184 | * Stop the watchdog driver. |
| 185 | */ |
| 186 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 187 | static int wdtpci_stop(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | { |
| 189 | unsigned long flags; |
| 190 | |
| 191 | /* Turn the card off */ |
| 192 | spin_lock_irqsave(&wdtpci_lock, flags); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 193 | inb(WDT_DC); /* Disable watchdog */ |
| 194 | udelay(8); |
| 195 | wdtpci_ctr_load(2, 0); /* 0 length reset pulses now */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | spin_unlock_irqrestore(&wdtpci_lock, flags); |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * wdtpci_ping: |
| 202 | * |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 203 | * Reload counter one with the watchdog heartbeat. We don't bother |
| 204 | * reloading the cascade counter. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | */ |
| 206 | |
| 207 | static int wdtpci_ping(void) |
| 208 | { |
| 209 | unsigned long flags; |
| 210 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | spin_lock_irqsave(&wdtpci_lock, flags); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 212 | /* Write a watchdog value */ |
| 213 | inb(WDT_DC); /* Disable watchdog */ |
| 214 | udelay(8); |
| 215 | wdtpci_ctr_mode(1, 2); /* Re-Program CTR1 for Mode 2: |
| 216 | Rate Generator */ |
| 217 | wdtpci_ctr_load(1, wd_heartbeat);/* Heartbeat */ |
| 218 | outb(0, WDT_DC); /* Enable watchdog */ |
| 219 | udelay(8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | spin_unlock_irqrestore(&wdtpci_lock, flags); |
| 221 | return 0; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * wdtpci_set_heartbeat: |
| 226 | * @t: the new heartbeat value that needs to be set. |
| 227 | * |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 228 | * Set a new heartbeat value for the watchdog device. If the heartbeat |
| 229 | * value is incorrect we keep the old value and return -EINVAL. |
| 230 | * If successful we return 0. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | */ |
| 232 | static int wdtpci_set_heartbeat(int t) |
| 233 | { |
| 234 | /* Arbitrary, can't find the card's limits */ |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 235 | if (t < 1 || t > 65535) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | return -EINVAL; |
| 237 | |
| 238 | heartbeat = t; |
| 239 | wd_heartbeat = t * 100; |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * wdtpci_get_status: |
| 245 | * @status: the new status. |
| 246 | * |
| 247 | * Extract the status information from a WDT watchdog device. There are |
| 248 | * several board variants so we have to know which bits are valid. Some |
| 249 | * bits default to one and some to zero in order to be maximally painful. |
| 250 | * |
| 251 | * we then map the bits onto the status ioctl flags. |
| 252 | */ |
| 253 | |
| 254 | static int wdtpci_get_status(int *status) |
| 255 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 256 | unsigned char new_status; |
| 257 | unsigned long flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 259 | spin_lock_irqsave(&wdtpci_lock, flags); |
| 260 | new_status = inb(WDT_SR); |
| 261 | spin_unlock_irqrestore(&wdtpci_lock, flags); |
| 262 | |
| 263 | *status = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | if (new_status & WDC_SR_ISOI0) |
| 265 | *status |= WDIOF_EXTERN1; |
| 266 | if (new_status & WDC_SR_ISII1) |
| 267 | *status |= WDIOF_EXTERN2; |
| 268 | #ifdef CONFIG_WDT_501_PCI |
| 269 | if (!(new_status & WDC_SR_TGOOD)) |
| 270 | *status |= WDIOF_OVERHEAT; |
| 271 | if (!(new_status & WDC_SR_PSUOVER)) |
| 272 | *status |= WDIOF_POWEROVER; |
| 273 | if (!(new_status & WDC_SR_PSUUNDR)) |
| 274 | *status |= WDIOF_POWERUNDER; |
| 275 | if (tachometer) { |
| 276 | if (!(new_status & WDC_SR_FANGOOD)) |
| 277 | *status |= WDIOF_FANFAULT; |
| 278 | } |
| 279 | #endif /* CONFIG_WDT_501_PCI */ |
| 280 | return 0; |
| 281 | } |
| 282 | |
| 283 | #ifdef CONFIG_WDT_501_PCI |
| 284 | /** |
| 285 | * wdtpci_get_temperature: |
| 286 | * |
| 287 | * Reports the temperature in degrees Fahrenheit. The API is in |
| 288 | * farenheit. It was designed by an imperial measurement luddite. |
| 289 | */ |
| 290 | |
| 291 | static int wdtpci_get_temperature(int *temperature) |
| 292 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 293 | unsigned short c; |
| 294 | unsigned long flags; |
| 295 | spin_lock_irqsave(&wdtpci_lock, flags); |
| 296 | c = inb(WDT_RT); |
| 297 | udelay(8); |
| 298 | spin_unlock_irqrestore(&wdtpci_lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | *temperature = (c * 11 / 15) + 7; |
| 300 | return 0; |
| 301 | } |
| 302 | #endif /* CONFIG_WDT_501_PCI */ |
| 303 | |
| 304 | /** |
| 305 | * wdtpci_interrupt: |
| 306 | * @irq: Interrupt number |
| 307 | * @dev_id: Unused as we don't allow multiple devices. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | * |
| 309 | * Handle an interrupt from the board. These are raised when the status |
| 310 | * map changes in what the board considers an interesting way. That means |
| 311 | * a failure condition occurring. |
| 312 | */ |
| 313 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 314 | static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | { |
| 316 | /* |
| 317 | * Read the status register see what is up and |
| 318 | * then printk it. |
| 319 | */ |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 320 | unsigned char status; |
| 321 | |
| 322 | spin_lock(&wdtpci_lock); |
| 323 | |
| 324 | status = inb(WDT_SR); |
| 325 | udelay(8); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
| 327 | printk(KERN_CRIT PFX "status %d\n", status); |
| 328 | |
| 329 | #ifdef CONFIG_WDT_501_PCI |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 330 | if (!(status & WDC_SR_TGOOD)) { |
| 331 | u8 alarm = inb(WDT_RT); |
| 332 | printk(KERN_CRIT PFX "Overheat alarm.(%d)\n", alarm); |
| 333 | udelay(8); |
| 334 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | if (!(status & WDC_SR_PSUOVER)) |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 336 | printk(KERN_CRIT PFX "PSU over voltage.\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | if (!(status & WDC_SR_PSUUNDR)) |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 338 | printk(KERN_CRIT PFX "PSU under voltage.\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | if (tachometer) { |
| 340 | if (!(status & WDC_SR_FANGOOD)) |
| 341 | printk(KERN_CRIT PFX "Possible fan fault.\n"); |
| 342 | } |
| 343 | #endif /* CONFIG_WDT_501_PCI */ |
Ilpo Jarvinen | 59338d4 | 2007-10-23 13:40:54 -0700 | [diff] [blame] | 344 | if (!(status&WDC_SR_WCCR)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | #ifdef SOFTWARE_REBOOT |
| 346 | #ifdef ONLY_TESTING |
| 347 | printk(KERN_CRIT PFX "Would Reboot.\n"); |
| 348 | #else |
| 349 | printk(KERN_CRIT PFX "Initiating system reboot.\n"); |
Eric W. Biederman | f82567e | 2005-07-26 11:53:19 -0600 | [diff] [blame] | 350 | emergency_restart(NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | #endif |
| 352 | #else |
| 353 | printk(KERN_CRIT PFX "Reset in 5ms.\n"); |
| 354 | #endif |
Ilpo Jarvinen | 59338d4 | 2007-10-23 13:40:54 -0700 | [diff] [blame] | 355 | } |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 356 | spin_unlock(&wdtpci_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | return IRQ_HANDLED; |
| 358 | } |
| 359 | |
| 360 | |
| 361 | /** |
| 362 | * wdtpci_write: |
| 363 | * @file: file handle to the watchdog |
| 364 | * @buf: buffer to write (unused as data does not matter here |
| 365 | * @count: count of bytes |
| 366 | * @ppos: pointer to the position to write. No seeks allowed |
| 367 | * |
| 368 | * A write to a watchdog device is defined as a keepalive signal. Any |
| 369 | * write of data will do, as we we don't define content meaning. |
| 370 | */ |
| 371 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 372 | static ssize_t wdtpci_write(struct file *file, const char __user *buf, |
| 373 | size_t count, loff_t *ppos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | { |
| 375 | if (count) { |
| 376 | if (!nowayout) { |
| 377 | size_t i; |
| 378 | |
| 379 | expect_close = 0; |
| 380 | |
| 381 | for (i = 0; i != count; i++) { |
| 382 | char c; |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 383 | if (get_user(c, buf+i)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | return -EFAULT; |
| 385 | if (c == 'V') |
| 386 | expect_close = 42; |
| 387 | } |
| 388 | } |
| 389 | wdtpci_ping(); |
| 390 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | return count; |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * wdtpci_ioctl: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | * @file: file handle to the device |
| 397 | * @cmd: watchdog command |
| 398 | * @arg: argument pointer |
| 399 | * |
| 400 | * The watchdog API defines a common set of functions for all watchdogs |
| 401 | * according to their available features. We only actually usefully support |
| 402 | * querying capabilities and current status. |
| 403 | */ |
| 404 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 405 | static long wdtpci_ioctl(struct file *file, unsigned int cmd, |
| 406 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | { |
| 408 | int new_heartbeat; |
| 409 | int status; |
| 410 | void __user *argp = (void __user *)arg; |
| 411 | int __user *p = argp; |
| 412 | |
| 413 | static struct watchdog_info ident = { |
| 414 | .options = WDIOF_SETTIMEOUT| |
| 415 | WDIOF_MAGICCLOSE| |
| 416 | WDIOF_KEEPALIVEPING, |
| 417 | .firmware_version = 1, |
| 418 | .identity = "PCI-WDT500/501", |
| 419 | }; |
| 420 | |
| 421 | /* Add options according to the card we have */ |
| 422 | ident.options |= (WDIOF_EXTERN1|WDIOF_EXTERN2); |
| 423 | #ifdef CONFIG_WDT_501_PCI |
| 424 | ident.options |= (WDIOF_OVERHEAT|WDIOF_POWERUNDER|WDIOF_POWEROVER); |
| 425 | if (tachometer) |
| 426 | ident.options |= WDIOF_FANFAULT; |
| 427 | #endif /* CONFIG_WDT_501_PCI */ |
| 428 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 429 | switch (cmd) { |
| 430 | default: |
| 431 | return -ENOTTY; |
| 432 | case WDIOC_GETSUPPORT: |
| 433 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; |
| 434 | case WDIOC_GETSTATUS: |
| 435 | wdtpci_get_status(&status); |
| 436 | return put_user(status, p); |
| 437 | case WDIOC_GETBOOTSTATUS: |
| 438 | return put_user(0, p); |
| 439 | case WDIOC_KEEPALIVE: |
| 440 | wdtpci_ping(); |
| 441 | return 0; |
| 442 | case WDIOC_SETTIMEOUT: |
| 443 | if (get_user(new_heartbeat, p)) |
| 444 | return -EFAULT; |
| 445 | if (wdtpci_set_heartbeat(new_heartbeat)) |
| 446 | return -EINVAL; |
| 447 | wdtpci_ping(); |
| 448 | /* Fall */ |
| 449 | case WDIOC_GETTIMEOUT: |
| 450 | return put_user(heartbeat, p); |
| 451 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | /** |
| 455 | * wdtpci_open: |
| 456 | * @inode: inode of device |
| 457 | * @file: file handle to device |
| 458 | * |
| 459 | * The watchdog device has been opened. The watchdog device is single |
| 460 | * open and on opening we load the counters. Counter zero is a 100Hz |
| 461 | * cascade, into counter 1 which downcounts to reboot. When the counter |
| 462 | * triggers counter 2 downcounts the length of the reset pulse which |
| 463 | * set set to be as long as possible. |
| 464 | */ |
| 465 | |
| 466 | static int wdtpci_open(struct inode *inode, struct file *file) |
| 467 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 468 | if (test_and_set_bit(0, &open_lock)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | return -EBUSY; |
| 470 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 471 | if (nowayout) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | __module_get(THIS_MODULE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | /* |
| 474 | * Activate |
| 475 | */ |
| 476 | wdtpci_start(); |
| 477 | return nonseekable_open(inode, file); |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * wdtpci_release: |
| 482 | * @inode: inode to board |
| 483 | * @file: file handle to board |
| 484 | * |
| 485 | * The watchdog has a configurable API. There is a religious dispute |
| 486 | * between people who want their watchdog to be able to shut down and |
| 487 | * those who want to be sure if the watchdog manager dies the machine |
| 488 | * reboots. In the former case we disable the counters, in the latter |
| 489 | * case you have to open it again very soon. |
| 490 | */ |
| 491 | |
| 492 | static int wdtpci_release(struct inode *inode, struct file *file) |
| 493 | { |
| 494 | if (expect_close == 42) { |
| 495 | wdtpci_stop(); |
| 496 | } else { |
| 497 | printk(KERN_CRIT PFX "Unexpected close, not stopping timer!"); |
| 498 | wdtpci_ping(); |
| 499 | } |
| 500 | expect_close = 0; |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 501 | clear_bit(0, &open_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | return 0; |
| 503 | } |
| 504 | |
| 505 | #ifdef CONFIG_WDT_501_PCI |
| 506 | /** |
| 507 | * wdtpci_temp_read: |
| 508 | * @file: file handle to the watchdog board |
| 509 | * @buf: buffer to write 1 byte into |
| 510 | * @count: length of buffer |
| 511 | * @ptr: offset (no seek allowed) |
| 512 | * |
| 513 | * Read reports the temperature in degrees Fahrenheit. The API is in |
| 514 | * fahrenheit. It was designed by an imperial measurement luddite. |
| 515 | */ |
| 516 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 517 | static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, |
| 518 | size_t count, loff_t *ptr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | { |
| 520 | int temperature; |
| 521 | |
| 522 | if (wdtpci_get_temperature(&temperature)) |
| 523 | return -EFAULT; |
| 524 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 525 | if (copy_to_user(buf, &temperature, 1)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | return -EFAULT; |
| 527 | |
| 528 | return 1; |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * wdtpci_temp_open: |
| 533 | * @inode: inode of device |
| 534 | * @file: file handle to device |
| 535 | * |
| 536 | * The temperature device has been opened. |
| 537 | */ |
| 538 | |
| 539 | static int wdtpci_temp_open(struct inode *inode, struct file *file) |
| 540 | { |
| 541 | return nonseekable_open(inode, file); |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * wdtpci_temp_release: |
| 546 | * @inode: inode to board |
| 547 | * @file: file handle to board |
| 548 | * |
| 549 | * The temperature device has been closed. |
| 550 | */ |
| 551 | |
| 552 | static int wdtpci_temp_release(struct inode *inode, struct file *file) |
| 553 | { |
| 554 | return 0; |
| 555 | } |
| 556 | #endif /* CONFIG_WDT_501_PCI */ |
| 557 | |
| 558 | /** |
| 559 | * notify_sys: |
| 560 | * @this: our notifier block |
| 561 | * @code: the event being reported |
| 562 | * @unused: unused |
| 563 | * |
| 564 | * Our notifier is called on system shutdowns. We want to turn the card |
| 565 | * off at reboot otherwise the machine will reboot again during memory |
| 566 | * test or worse yet during the following fsck. This would suck, in fact |
| 567 | * trust me - if it happens it does suck. |
| 568 | */ |
| 569 | |
| 570 | static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code, |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 571 | void *unused) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 573 | if (code == SYS_DOWN || code == SYS_HALT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | wdtpci_stop(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | return NOTIFY_DONE; |
| 576 | } |
| 577 | |
| 578 | /* |
| 579 | * Kernel Interfaces |
| 580 | */ |
| 581 | |
| 582 | |
Arjan van de Ven | 62322d2 | 2006-07-03 00:24:21 -0700 | [diff] [blame] | 583 | static const struct file_operations wdtpci_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | .owner = THIS_MODULE, |
| 585 | .llseek = no_llseek, |
| 586 | .write = wdtpci_write, |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 587 | .unlocked_ioctl = wdtpci_ioctl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | .open = wdtpci_open, |
| 589 | .release = wdtpci_release, |
| 590 | }; |
| 591 | |
| 592 | static struct miscdevice wdtpci_miscdev = { |
| 593 | .minor = WATCHDOG_MINOR, |
| 594 | .name = "watchdog", |
| 595 | .fops = &wdtpci_fops, |
| 596 | }; |
| 597 | |
| 598 | #ifdef CONFIG_WDT_501_PCI |
Arjan van de Ven | 62322d2 | 2006-07-03 00:24:21 -0700 | [diff] [blame] | 599 | static const struct file_operations wdtpci_temp_fops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | .owner = THIS_MODULE, |
| 601 | .llseek = no_llseek, |
| 602 | .read = wdtpci_temp_read, |
| 603 | .open = wdtpci_temp_open, |
| 604 | .release = wdtpci_temp_release, |
| 605 | }; |
| 606 | |
| 607 | static struct miscdevice temp_miscdev = { |
| 608 | .minor = TEMP_MINOR, |
| 609 | .name = "temperature", |
| 610 | .fops = &wdtpci_temp_fops, |
| 611 | }; |
| 612 | #endif /* CONFIG_WDT_501_PCI */ |
| 613 | |
| 614 | /* |
| 615 | * The WDT card needs to learn about soft shutdowns in order to |
| 616 | * turn the timebomb registers off. |
| 617 | */ |
| 618 | |
| 619 | static struct notifier_block wdtpci_notifier = { |
| 620 | .notifier_call = wdtpci_notify_sys, |
| 621 | }; |
| 622 | |
| 623 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 624 | static int __devinit wdtpci_init_one(struct pci_dev *dev, |
| 625 | const struct pci_device_id *ent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | { |
| 627 | int ret = -EIO; |
| 628 | |
| 629 | dev_count++; |
| 630 | if (dev_count > 1) { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 631 | printk(KERN_ERR PFX "This driver only supports one device\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | return -ENODEV; |
| 633 | } |
| 634 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 635 | if (pci_enable_device(dev)) { |
| 636 | printk(KERN_ERR PFX "Not possible to enable PCI Device\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | return -ENODEV; |
| 638 | } |
| 639 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 640 | if (pci_resource_start(dev, 2) == 0x0000) { |
| 641 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | ret = -ENODEV; |
| 643 | goto out_pci; |
| 644 | } |
| 645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | irq = dev->irq; |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 647 | io = pci_resource_start(dev, 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 649 | if (request_region(io, 16, "wdt_pci") == NULL) { |
| 650 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", io); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | goto out_pci; |
| 652 | } |
| 653 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 654 | if (request_irq(irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | "wdt_pci", &wdtpci_miscdev)) { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 656 | printk(KERN_ERR PFX "IRQ %d is not free\n", irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | goto out_reg; |
| 658 | } |
| 659 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 660 | printk(KERN_INFO |
| 661 | "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%04x (Interrupt %d)\n", |
| 662 | io, irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 663 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 664 | /* Check that the heartbeat value is within its range; |
| 665 | if not reset to the default */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | if (wdtpci_set_heartbeat(heartbeat)) { |
| 667 | wdtpci_set_heartbeat(WD_TIMO); |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 668 | printk(KERN_INFO PFX |
| 669 | "heartbeat value must be 0 < heartbeat < 65536, using %d\n", |
| 670 | WD_TIMO); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | } |
| 672 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 673 | ret = register_reboot_notifier(&wdtpci_notifier); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | if (ret) { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 675 | printk(KERN_ERR PFX |
| 676 | "cannot register reboot notifier (err=%d)\n", ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | goto out_irq; |
| 678 | } |
| 679 | |
| 680 | #ifdef CONFIG_WDT_501_PCI |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 681 | ret = misc_register(&temp_miscdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | if (ret) { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 683 | printk(KERN_ERR PFX |
| 684 | "cannot register miscdev on minor=%d (err=%d)\n", |
| 685 | TEMP_MINOR, ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | goto out_rbt; |
| 687 | } |
| 688 | #endif /* CONFIG_WDT_501_PCI */ |
| 689 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 690 | ret = misc_register(&wdtpci_miscdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | if (ret) { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 692 | printk(KERN_ERR PFX |
| 693 | "cannot register miscdev on minor=%d (err=%d)\n", |
| 694 | WATCHDOG_MINOR, ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | goto out_misc; |
| 696 | } |
| 697 | |
| 698 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", |
| 699 | heartbeat, nowayout); |
| 700 | #ifdef CONFIG_WDT_501_PCI |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 701 | printk(KERN_INFO "wdt: Fan Tachometer is %s\n", |
| 702 | (tachometer ? "Enabled" : "Disabled")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | #endif /* CONFIG_WDT_501_PCI */ |
| 704 | |
| 705 | ret = 0; |
| 706 | out: |
| 707 | return ret; |
| 708 | |
| 709 | out_misc: |
| 710 | #ifdef CONFIG_WDT_501_PCI |
| 711 | misc_deregister(&temp_miscdev); |
| 712 | out_rbt: |
| 713 | #endif /* CONFIG_WDT_501_PCI */ |
| 714 | unregister_reboot_notifier(&wdtpci_notifier); |
| 715 | out_irq: |
| 716 | free_irq(irq, &wdtpci_miscdev); |
| 717 | out_reg: |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 718 | release_region(io, 16); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | out_pci: |
| 720 | pci_disable_device(dev); |
| 721 | goto out; |
| 722 | } |
| 723 | |
| 724 | |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 725 | static void __devexit wdtpci_remove_one(struct pci_dev *pdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | { |
| 727 | /* here we assume only one device will ever have |
| 728 | * been picked up and registered by probe function */ |
| 729 | misc_deregister(&wdtpci_miscdev); |
| 730 | #ifdef CONFIG_WDT_501_PCI |
| 731 | misc_deregister(&temp_miscdev); |
| 732 | #endif /* CONFIG_WDT_501_PCI */ |
| 733 | unregister_reboot_notifier(&wdtpci_notifier); |
| 734 | free_irq(irq, &wdtpci_miscdev); |
| 735 | release_region(io, 16); |
| 736 | pci_disable_device(pdev); |
| 737 | dev_count--; |
| 738 | } |
| 739 | |
| 740 | |
| 741 | static struct pci_device_id wdtpci_pci_tbl[] = { |
| 742 | { |
| 743 | .vendor = PCI_VENDOR_ID_ACCESSIO, |
| 744 | .device = PCI_DEVICE_ID_WDG_CSM, |
| 745 | .subvendor = PCI_ANY_ID, |
| 746 | .subdevice = PCI_ANY_ID, |
| 747 | }, |
| 748 | { 0, }, /* terminate list */ |
| 749 | }; |
| 750 | MODULE_DEVICE_TABLE(pci, wdtpci_pci_tbl); |
| 751 | |
| 752 | |
| 753 | static struct pci_driver wdtpci_driver = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 754 | .name = "wdt_pci", |
| 755 | .id_table = wdtpci_pci_tbl, |
| 756 | .probe = wdtpci_init_one, |
| 757 | .remove = __devexit_p(wdtpci_remove_one), |
| 758 | }; |
| 759 | |
| 760 | |
| 761 | /** |
| 762 | * wdtpci_cleanup: |
| 763 | * |
| 764 | * Unload the watchdog. You cannot do this with any file handles open. |
| 765 | * If your watchdog is set to continue ticking on close and you unload |
| 766 | * it, well it keeps ticking. We won't get the interrupt but the board |
| 767 | * will not touch PC memory so all is fine. You just have to load a new |
| 768 | * module in xx seconds or reboot. |
| 769 | */ |
| 770 | |
| 771 | static void __exit wdtpci_cleanup(void) |
| 772 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 773 | pci_unregister_driver(&wdtpci_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | |
| 777 | /** |
| 778 | * wdtpci_init: |
| 779 | * |
| 780 | * Set up the WDT watchdog board. All we have to do is grab the |
| 781 | * resources we require and bitch if anyone beat us to them. |
| 782 | * The open() function will actually kick the board off. |
| 783 | */ |
| 784 | |
| 785 | static int __init wdtpci_init(void) |
| 786 | { |
Alan Cox | 9f2d1f0 | 2008-08-04 17:55:35 +0100 | [diff] [blame^] | 787 | return pci_register_driver(&wdtpci_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 788 | } |
| 789 | |
| 790 | |
| 791 | module_init(wdtpci_init); |
| 792 | module_exit(wdtpci_cleanup); |
| 793 | |
| 794 | MODULE_AUTHOR("JP Nollmann, Alan Cox"); |
| 795 | MODULE_DESCRIPTION("Driver for the ICS PCI-WDT500/501 watchdog cards"); |
| 796 | MODULE_LICENSE("GPL"); |
| 797 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
| 798 | MODULE_ALIAS_MISCDEV(TEMP_MINOR); |