pcwd_pci.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. /*
  2. * Berkshire PCI-PC Watchdog Card Driver
  3. *
  4. * (c) Copyright 2003 Wim Van Sebroeck <wim@iguana.be>.
  5. *
  6. * Based on source code of the following authors:
  7. * Ken Hollis <kenji@bitgate.com>,
  8. * Lindsay Harris <lindsay@bluegum.com>,
  9. * Alan Cox <alan@redhat.com>,
  10. * Matt Domsch <Matt_Domsch@dell.com>,
  11. * Rob Radez <rob@osinvestor.com>
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version
  16. * 2 of the License, or (at your option) any later version.
  17. *
  18. * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor
  19. * provide warranty for any of this software. This material is
  20. * provided "AS-IS" and at no charge.
  21. */
  22. /*
  23. * A bells and whistles driver is available from http://www.pcwd.de/
  24. * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/
  25. */
  26. /*
  27. * Includes, defines, variables, module parameters, ...
  28. */
  29. #include <linux/config.h> /* For CONFIG_WATCHDOG_NOWAYOUT/... */
  30. #include <linux/module.h> /* For module specific items */
  31. #include <linux/moduleparam.h> /* For new moduleparam's */
  32. #include <linux/types.h> /* For standard types (like size_t) */
  33. #include <linux/errno.h> /* For the -ENODEV/... values */
  34. #include <linux/kernel.h> /* For printk/panic/... */
  35. #include <linux/delay.h> /* For mdelay function */
  36. #include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
  37. #include <linux/watchdog.h> /* For the watchdog specific items */
  38. #include <linux/notifier.h> /* For notifier support */
  39. #include <linux/reboot.h> /* For reboot_notifier stuff */
  40. #include <linux/init.h> /* For __init/__exit/... */
  41. #include <linux/fs.h> /* For file operations */
  42. #include <linux/pci.h> /* For pci functions */
  43. #include <linux/ioport.h> /* For io-port access */
  44. #include <linux/spinlock.h> /* For spin_lock/spin_unlock/... */
  45. #include <asm/uaccess.h> /* For copy_to_user/put_user/... */
  46. #include <asm/io.h> /* For inb/outb/... */
  47. /* Module and version information */
  48. #define WATCHDOG_VERSION "1.01"
  49. #define WATCHDOG_DATE "02 Sep 2005"
  50. #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog"
  51. #define WATCHDOG_NAME "pcwd_pci"
  52. #define PFX WATCHDOG_NAME ": "
  53. #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION " (" WATCHDOG_DATE ")\n"
  54. /* Stuff for the PCI ID's */
  55. #ifndef PCI_VENDOR_ID_QUICKLOGIC
  56. #define PCI_VENDOR_ID_QUICKLOGIC 0x11e3
  57. #endif
  58. #ifndef PCI_DEVICE_ID_WATCHDOG_PCIPCWD
  59. #define PCI_DEVICE_ID_WATCHDOG_PCIPCWD 0x5030
  60. #endif
  61. /*
  62. * These are the defines that describe the control status bits for the
  63. * PCI-PC Watchdog card.
  64. */
  65. #define WD_PCI_WTRP 0x01 /* Watchdog Trip status */
  66. #define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */
  67. #define WD_PCI_TTRP 0x04 /* Temperature Trip status */
  68. /* according to documentation max. time to process a command for the pci
  69. * watchdog card is 100 ms, so we give it 150 ms to do it's job */
  70. #define PCI_COMMAND_TIMEOUT 150
  71. /* Watchdog's internal commands */
  72. #define CMD_GET_STATUS 0x04
  73. #define CMD_GET_FIRMWARE_VERSION 0x08
  74. #define CMD_READ_WATCHDOG_TIMEOUT 0x18
  75. #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19
  76. /* We can only use 1 card due to the /dev/watchdog restriction */
  77. static int cards_found;
  78. /* internal variables */
  79. static int temp_panic;
  80. static unsigned long is_active;
  81. static char expect_release;
  82. static struct {
  83. int supports_temp; /* Wether or not the card has a temperature device */
  84. int boot_status; /* The card's boot status */
  85. unsigned long io_addr; /* The cards I/O address */
  86. spinlock_t io_lock;
  87. struct pci_dev *pdev;
  88. } pcipcwd_private;
  89. /* module parameters */
  90. #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */
  91. static int heartbeat = WATCHDOG_HEARTBEAT;
  92. module_param(heartbeat, int, 0);
  93. MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
  94. static int nowayout = WATCHDOG_NOWAYOUT;
  95. module_param(nowayout, int, 0);
  96. MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
  97. /*
  98. * Internal functions
  99. */
  100. static int send_command(int cmd, int *msb, int *lsb)
  101. {
  102. int got_response, count;
  103. spin_lock(&pcipcwd_private.io_lock);
  104. /* If a command requires data it should be written first.
  105. * Data for commands with 8 bits of data should be written to port 4.
  106. * Commands with 16 bits of data, should be written as LSB to port 4
  107. * and MSB to port 5.
  108. * After the required data has been written then write the command to
  109. * port 6. */
  110. outb_p(*lsb, pcipcwd_private.io_addr + 4);
  111. outb_p(*msb, pcipcwd_private.io_addr + 5);
  112. outb_p(cmd, pcipcwd_private.io_addr + 6);
  113. /* wait till the pci card processed the command, signaled by
  114. * the WRSP bit in port 2 and give it a max. timeout of
  115. * PCI_COMMAND_TIMEOUT to process */
  116. got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40;
  117. for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) {
  118. mdelay(1);
  119. got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40;
  120. }
  121. if (got_response) {
  122. /* read back response */
  123. *lsb = inb_p(pcipcwd_private.io_addr + 4);
  124. *msb = inb_p(pcipcwd_private.io_addr + 5);
  125. /* clear WRSP bit */
  126. inb_p(pcipcwd_private.io_addr + 6);
  127. }
  128. spin_unlock(&pcipcwd_private.io_lock);
  129. return got_response;
  130. }
  131. static int pcipcwd_start(void)
  132. {
  133. int stat_reg;
  134. spin_lock(&pcipcwd_private.io_lock);
  135. outb_p(0x00, pcipcwd_private.io_addr + 3);
  136. udelay(1000);
  137. stat_reg = inb_p(pcipcwd_private.io_addr + 2);
  138. spin_unlock(&pcipcwd_private.io_lock);
  139. if (stat_reg & 0x10) {
  140. printk(KERN_ERR PFX "Card timer not enabled\n");
  141. return -1;
  142. }
  143. return 0;
  144. }
  145. static int pcipcwd_stop(void)
  146. {
  147. int stat_reg;
  148. spin_lock(&pcipcwd_private.io_lock);
  149. outb_p(0xA5, pcipcwd_private.io_addr + 3);
  150. udelay(1000);
  151. outb_p(0xA5, pcipcwd_private.io_addr + 3);
  152. udelay(1000);
  153. stat_reg = inb_p(pcipcwd_private.io_addr + 2);
  154. spin_unlock(&pcipcwd_private.io_lock);
  155. if (!(stat_reg & 0x10)) {
  156. printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n");
  157. return -1;
  158. }
  159. return 0;
  160. }
  161. static int pcipcwd_keepalive(void)
  162. {
  163. /* Re-trigger watchdog by writing to port 0 */
  164. outb_p(0x42, pcipcwd_private.io_addr);
  165. return 0;
  166. }
  167. static int pcipcwd_set_heartbeat(int t)
  168. {
  169. int t_msb = t / 256;
  170. int t_lsb = t % 256;
  171. if ((t < 0x0001) || (t > 0xFFFF))
  172. return -EINVAL;
  173. /* Write new heartbeat to watchdog */
  174. send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb);
  175. heartbeat = t;
  176. return 0;
  177. }
  178. static int pcipcwd_get_status(int *status)
  179. {
  180. int new_status;
  181. *status=0;
  182. new_status = inb_p(pcipcwd_private.io_addr + 1);
  183. if (new_status & WD_PCI_WTRP)
  184. *status |= WDIOF_CARDRESET;
  185. if (new_status & WD_PCI_TTRP) {
  186. *status |= WDIOF_OVERHEAT;
  187. if (temp_panic)
  188. panic(PFX "Temperature overheat trip!\n");
  189. }
  190. return 0;
  191. }
  192. static int pcipcwd_clear_status(void)
  193. {
  194. outb_p(0x01, pcipcwd_private.io_addr + 1);
  195. return 0;
  196. }
  197. static int pcipcwd_get_temperature(int *temperature)
  198. {
  199. *temperature = 0;
  200. if (!pcipcwd_private.supports_temp)
  201. return -ENODEV;
  202. /*
  203. * Convert celsius to fahrenheit, since this was
  204. * the decided 'standard' for this return value.
  205. */
  206. *temperature = ((inb_p(pcipcwd_private.io_addr)) * 9 / 5) + 32;
  207. return 0;
  208. }
  209. /*
  210. * /dev/watchdog handling
  211. */
  212. static ssize_t pcipcwd_write(struct file *file, const char __user *data,
  213. size_t len, loff_t *ppos)
  214. {
  215. /* See if we got the magic character 'V' and reload the timer */
  216. if (len) {
  217. if (!nowayout) {
  218. size_t i;
  219. /* note: just in case someone wrote the magic character
  220. * five months ago... */
  221. expect_release = 0;
  222. /* scan to see whether or not we got the magic character */
  223. for (i = 0; i != len; i++) {
  224. char c;
  225. if(get_user(c, data+i))
  226. return -EFAULT;
  227. if (c == 'V')
  228. expect_release = 42;
  229. }
  230. }
  231. /* someone wrote to us, we should reload the timer */
  232. pcipcwd_keepalive();
  233. }
  234. return len;
  235. }
  236. static int pcipcwd_ioctl(struct inode *inode, struct file *file,
  237. unsigned int cmd, unsigned long arg)
  238. {
  239. void __user *argp = (void __user *)arg;
  240. int __user *p = argp;
  241. static struct watchdog_info ident = {
  242. .options = WDIOF_OVERHEAT |
  243. WDIOF_CARDRESET |
  244. WDIOF_KEEPALIVEPING |
  245. WDIOF_SETTIMEOUT |
  246. WDIOF_MAGICCLOSE,
  247. .firmware_version = 1,
  248. .identity = WATCHDOG_DRIVER_NAME,
  249. };
  250. switch (cmd) {
  251. case WDIOC_GETSUPPORT:
  252. return copy_to_user(argp, &ident,
  253. sizeof (ident)) ? -EFAULT : 0;
  254. case WDIOC_GETSTATUS:
  255. {
  256. int status;
  257. pcipcwd_get_status(&status);
  258. return put_user(status, p);
  259. }
  260. case WDIOC_GETBOOTSTATUS:
  261. return put_user(pcipcwd_private.boot_status, p);
  262. case WDIOC_GETTEMP:
  263. {
  264. int temperature;
  265. if (pcipcwd_get_temperature(&temperature))
  266. return -EFAULT;
  267. return put_user(temperature, p);
  268. }
  269. case WDIOC_KEEPALIVE:
  270. pcipcwd_keepalive();
  271. return 0;
  272. case WDIOC_SETOPTIONS:
  273. {
  274. int new_options, retval = -EINVAL;
  275. if (get_user (new_options, p))
  276. return -EFAULT;
  277. if (new_options & WDIOS_DISABLECARD) {
  278. if (pcipcwd_stop())
  279. return -EIO;
  280. retval = 0;
  281. }
  282. if (new_options & WDIOS_ENABLECARD) {
  283. if (pcipcwd_start())
  284. return -EIO;
  285. retval = 0;
  286. }
  287. if (new_options & WDIOS_TEMPPANIC) {
  288. temp_panic = 1;
  289. retval = 0;
  290. }
  291. return retval;
  292. }
  293. case WDIOC_SETTIMEOUT:
  294. {
  295. int new_heartbeat;
  296. if (get_user(new_heartbeat, p))
  297. return -EFAULT;
  298. if (pcipcwd_set_heartbeat(new_heartbeat))
  299. return -EINVAL;
  300. pcipcwd_keepalive();
  301. /* Fall */
  302. }
  303. case WDIOC_GETTIMEOUT:
  304. return put_user(heartbeat, p);
  305. default:
  306. return -ENOIOCTLCMD;
  307. }
  308. }
  309. static int pcipcwd_open(struct inode *inode, struct file *file)
  310. {
  311. /* /dev/watchdog can only be opened once */
  312. if (test_and_set_bit(0, &is_active))
  313. return -EBUSY;
  314. /* Activate */
  315. pcipcwd_start();
  316. pcipcwd_keepalive();
  317. return nonseekable_open(inode, file);
  318. }
  319. static int pcipcwd_release(struct inode *inode, struct file *file)
  320. {
  321. /*
  322. * Shut off the timer.
  323. */
  324. if (expect_release == 42) {
  325. pcipcwd_stop();
  326. } else {
  327. printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
  328. pcipcwd_keepalive();
  329. }
  330. expect_release = 0;
  331. clear_bit(0, &is_active);
  332. return 0;
  333. }
  334. /*
  335. * /dev/temperature handling
  336. */
  337. static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
  338. size_t len, loff_t *ppos)
  339. {
  340. int temperature;
  341. if (pcipcwd_get_temperature(&temperature))
  342. return -EFAULT;
  343. if (copy_to_user (data, &temperature, 1))
  344. return -EFAULT;
  345. return 1;
  346. }
  347. static int pcipcwd_temp_open(struct inode *inode, struct file *file)
  348. {
  349. if (!pcipcwd_private.supports_temp)
  350. return -ENODEV;
  351. return nonseekable_open(inode, file);
  352. }
  353. static int pcipcwd_temp_release(struct inode *inode, struct file *file)
  354. {
  355. return 0;
  356. }
  357. /*
  358. * Notify system
  359. */
  360. static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
  361. {
  362. if (code==SYS_DOWN || code==SYS_HALT) {
  363. /* Turn the WDT off */
  364. pcipcwd_stop();
  365. }
  366. return NOTIFY_DONE;
  367. }
  368. /*
  369. * Kernel Interfaces
  370. */
  371. static struct file_operations pcipcwd_fops = {
  372. .owner = THIS_MODULE,
  373. .llseek = no_llseek,
  374. .write = pcipcwd_write,
  375. .ioctl = pcipcwd_ioctl,
  376. .open = pcipcwd_open,
  377. .release = pcipcwd_release,
  378. };
  379. static struct miscdevice pcipcwd_miscdev = {
  380. .minor = WATCHDOG_MINOR,
  381. .name = "watchdog",
  382. .fops = &pcipcwd_fops,
  383. };
  384. static struct file_operations pcipcwd_temp_fops = {
  385. .owner = THIS_MODULE,
  386. .llseek = no_llseek,
  387. .read = pcipcwd_temp_read,
  388. .open = pcipcwd_temp_open,
  389. .release = pcipcwd_temp_release,
  390. };
  391. static struct miscdevice pcipcwd_temp_miscdev = {
  392. .minor = TEMP_MINOR,
  393. .name = "temperature",
  394. .fops = &pcipcwd_temp_fops,
  395. };
  396. static struct notifier_block pcipcwd_notifier = {
  397. .notifier_call = pcipcwd_notify_sys,
  398. };
  399. /*
  400. * Init & exit routines
  401. */
  402. static inline void check_temperature_support(void)
  403. {
  404. if (inb_p(pcipcwd_private.io_addr) != 0xF0)
  405. pcipcwd_private.supports_temp = 1;
  406. }
  407. static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
  408. const struct pci_device_id *ent)
  409. {
  410. int ret = -EIO;
  411. int got_fw_rev, fw_rev_major, fw_rev_minor;
  412. char fw_ver_str[20];
  413. char option_switches;
  414. cards_found++;
  415. if (cards_found == 1)
  416. printk(KERN_INFO PFX DRIVER_VERSION);
  417. if (cards_found > 1) {
  418. printk(KERN_ERR PFX "This driver only supports 1 device\n");
  419. return -ENODEV;
  420. }
  421. if (pci_enable_device(pdev)) {
  422. printk(KERN_ERR PFX "Not possible to enable PCI Device\n");
  423. return -ENODEV;
  424. }
  425. if (pci_resource_start(pdev, 0) == 0x0000) {
  426. printk(KERN_ERR PFX "No I/O-Address for card detected\n");
  427. ret = -ENODEV;
  428. goto err_out_disable_device;
  429. }
  430. pcipcwd_private.pdev = pdev;
  431. pcipcwd_private.io_addr = pci_resource_start(pdev, 0);
  432. if (pci_request_regions(pdev, WATCHDOG_NAME)) {
  433. printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
  434. (int) pcipcwd_private.io_addr);
  435. ret = -EIO;
  436. goto err_out_disable_device;
  437. }
  438. /* get the boot_status */
  439. pcipcwd_get_status(&pcipcwd_private.boot_status);
  440. /* clear the "card caused reboot" flag */
  441. pcipcwd_clear_status();
  442. /* disable card */
  443. pcipcwd_stop();
  444. /* Check whether or not the card supports the temperature device */
  445. check_temperature_support();
  446. /* Get the Firmware Version */
  447. got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
  448. if (got_fw_rev) {
  449. sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
  450. } else {
  451. sprintf(fw_ver_str, "<card no answer>");
  452. }
  453. /* Get switch settings */
  454. option_switches = inb_p(pcipcwd_private.io_addr + 3);
  455. printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n",
  456. (int) pcipcwd_private.io_addr, fw_ver_str,
  457. (pcipcwd_private.supports_temp ? "with" : "without"));
  458. printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
  459. option_switches,
  460. ((option_switches & 0x10) ? "ON" : "OFF"),
  461. ((option_switches & 0x08) ? "ON" : "OFF"));
  462. if (pcipcwd_private.boot_status & WDIOF_CARDRESET)
  463. printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n");
  464. if (pcipcwd_private.boot_status & WDIOF_OVERHEAT)
  465. printk(KERN_INFO PFX "Card sensed a CPU Overheat\n");
  466. if (pcipcwd_private.boot_status == 0)
  467. printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
  468. /* Check that the heartbeat value is within it's range ; if not reset to the default */
  469. if (pcipcwd_set_heartbeat(heartbeat)) {
  470. pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
  471. printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
  472. WATCHDOG_HEARTBEAT);
  473. }
  474. ret = register_reboot_notifier(&pcipcwd_notifier);
  475. if (ret != 0) {
  476. printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
  477. ret);
  478. goto err_out_release_region;
  479. }
  480. if (pcipcwd_private.supports_temp) {
  481. ret = misc_register(&pcipcwd_temp_miscdev);
  482. if (ret != 0) {
  483. printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
  484. TEMP_MINOR, ret);
  485. goto err_out_unregister_reboot;
  486. }
  487. }
  488. ret = misc_register(&pcipcwd_miscdev);
  489. if (ret != 0) {
  490. printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
  491. WATCHDOG_MINOR, ret);
  492. goto err_out_misc_deregister;
  493. }
  494. printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
  495. heartbeat, nowayout);
  496. return 0;
  497. err_out_misc_deregister:
  498. if (pcipcwd_private.supports_temp)
  499. misc_deregister(&pcipcwd_temp_miscdev);
  500. err_out_unregister_reboot:
  501. unregister_reboot_notifier(&pcipcwd_notifier);
  502. err_out_release_region:
  503. pci_release_regions(pdev);
  504. err_out_disable_device:
  505. pci_disable_device(pdev);
  506. return ret;
  507. }
  508. static void __devexit pcipcwd_card_exit(struct pci_dev *pdev)
  509. {
  510. /* Stop the timer before we leave */
  511. if (!nowayout)
  512. pcipcwd_stop();
  513. /* Deregister */
  514. misc_deregister(&pcipcwd_miscdev);
  515. if (pcipcwd_private.supports_temp)
  516. misc_deregister(&pcipcwd_temp_miscdev);
  517. unregister_reboot_notifier(&pcipcwd_notifier);
  518. pci_release_regions(pdev);
  519. pci_disable_device(pdev);
  520. cards_found--;
  521. }
  522. static struct pci_device_id pcipcwd_pci_tbl[] = {
  523. { PCI_VENDOR_ID_QUICKLOGIC, PCI_DEVICE_ID_WATCHDOG_PCIPCWD,
  524. PCI_ANY_ID, PCI_ANY_ID, },
  525. { 0 }, /* End of list */
  526. };
  527. MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl);
  528. static struct pci_driver pcipcwd_driver = {
  529. .name = WATCHDOG_NAME,
  530. .id_table = pcipcwd_pci_tbl,
  531. .probe = pcipcwd_card_init,
  532. .remove = __devexit_p(pcipcwd_card_exit),
  533. };
  534. static int __init pcipcwd_init_module(void)
  535. {
  536. spin_lock_init (&pcipcwd_private.io_lock);
  537. return pci_register_driver(&pcipcwd_driver);
  538. }
  539. static void __exit pcipcwd_cleanup_module(void)
  540. {
  541. pci_unregister_driver(&pcipcwd_driver);
  542. }
  543. module_init(pcipcwd_init_module);
  544. module_exit(pcipcwd_cleanup_module);
  545. MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>");
  546. MODULE_DESCRIPTION("Berkshire PCI-PC Watchdog driver");
  547. MODULE_LICENSE("GPL");
  548. MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
  549. MODULE_ALIAS_MISCDEV(TEMP_MINOR);