blob: db1bf6f546aec70988d6614644c51b750b862efc [file] [log] [blame]
Thomas Mingarelli7f4da472007-12-04 17:41:54 +00001/*
Mingarelli, Thomasca22e792015-12-14 20:22:09 +00002 * HPE WatchDog Driver
Thomas Mingarelli7f4da472007-12-04 17:41:54 +00003 * based on
4 *
5 * SoftDog 0.05: A Software Watchdog Device
6 *
Jerry Hoemann9a46fc42018-02-25 20:22:19 -07007 * (c) Copyright 2018 Hewlett Packard Enterprise Development LP
Mingarelli, Thomasca22e792015-12-14 20:22:09 +00008 * Thomas Mingarelli <thomas.mingarelli@hpe.com>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +00009 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation
13 *
14 */
15
Joe Perches27c766a2012-02-15 15:06:19 -080016#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000018#include <linux/device.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000019#include <linux/io.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000020#include <linux/kernel.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000021#include <linux/module.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000022#include <linux/moduleparam.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000023#include <linux/pci.h>
24#include <linux/pci_ids.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000025#include <linux/types.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000026#include <linux/watchdog.h>
Ingo Molnard48b0e12011-10-06 14:20:27 +020027#include <asm/nmi.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000028
Jerry Hoemann437a3f82018-12-05 17:42:23 -070029#define HPWDT_VERSION "2.0.2"
dann fraziere802e322010-06-02 16:23:39 -060030#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
dann frazier6f681c22010-06-02 16:23:40 -060031#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
32#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
dann frazier923410d2010-07-27 17:50:54 -060033#define DEFAULT_MARGIN 30
Jerry Hoemann0458f402018-02-25 20:22:25 -070034#define PRETIMEOUT_SEC 9
dann frazier923410d2010-07-27 17:50:54 -060035
Jerry Hoemanna6c24732018-02-25 20:22:23 -070036static bool ilo5;
dann frazier923410d2010-07-27 17:50:54 -060037static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
Wim Van Sebroeck86a1e182012-03-05 16:51:11 +010038static bool nowayout = WATCHDOG_NOWAYOUT;
Jerry Hoemann0458f402018-02-25 20:22:25 -070039static bool pretimeout = IS_ENABLED(CONFIG_HPWDT_NMI_DECODING);
dann frazier923410d2010-07-27 17:50:54 -060040
41static void __iomem *pci_mem_addr; /* the PCI-memory address */
Jerry Hoemann838534e2017-10-23 16:46:17 -060042static unsigned long __iomem *hpwdt_nmistat;
dann frazier923410d2010-07-27 17:50:54 -060043static unsigned long __iomem *hpwdt_timer_reg;
44static unsigned long __iomem *hpwdt_timer_con;
45
Jingoo Hanbc17f9d2013-12-03 08:30:22 +090046static const struct pci_device_id hpwdt_devices[] = {
dann frazier36e3ff42010-07-27 17:50:57 -060047 { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB203) }, /* iLO2 */
48 { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3306) }, /* iLO3 */
dann frazier923410d2010-07-27 17:50:54 -060049 {0}, /* terminate list */
50};
51MODULE_DEVICE_TABLE(pci, hpwdt_devices);
52
Jerry Hoemann94d6b802018-12-05 17:42:21 -070053static const struct pci_device_id hpwdt_blacklist[] = {
54 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3306, PCI_VENDOR_ID_HP, 0x1979) }, /* auxilary iLO */
Jerry Hoemannde2cb0c2018-12-05 17:42:22 -070055 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3306, PCI_VENDOR_ID_HP_3PAR, 0x0289) }, /* CL */
Jerry Hoemann94d6b802018-12-05 17:42:21 -070056 {0}, /* terminate list */
57};
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000058
59/*
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000060 * Watchdog operations
61 */
Jerry Hoemannd0a40272018-02-25 20:22:22 -070062static int hpwdt_start(struct watchdog_device *wdd)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000063{
Jerry Hoemann0458f402018-02-25 20:22:25 -070064 int control = 0x81 | (pretimeout ? 0x4 : 0);
65 int reload = SECS_TO_TICKS(wdd->timeout);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070066
Jerry Hoemannccfd6922018-02-25 20:22:26 -070067 dev_dbg(wdd->parent, "start watchdog 0x%08x:0x%02x\n", reload, control);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000068 iowrite16(reload, hpwdt_timer_reg);
Jerry Hoemann0458f402018-02-25 20:22:25 -070069 iowrite8(control, hpwdt_timer_con);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070070
71 return 0;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000072}
73
74static void hpwdt_stop(void)
75{
76 unsigned long data;
77
Jerry Hoemannccfd6922018-02-25 20:22:26 -070078 pr_debug("stop watchdog\n");
79
Mingarelli, Thomasd08c9a32012-04-03 05:37:01 +000080 data = ioread8(hpwdt_timer_con);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000081 data &= 0xFE;
Mingarelli, Thomasd08c9a32012-04-03 05:37:01 +000082 iowrite8(data, hpwdt_timer_con);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000083}
84
Jerry Hoemannd0a40272018-02-25 20:22:22 -070085static int hpwdt_stop_core(struct watchdog_device *wdd)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000086{
Jerry Hoemannd0a40272018-02-25 20:22:22 -070087 hpwdt_stop();
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000088
89 return 0;
90}
91
Jerry Hoemannd0a40272018-02-25 20:22:22 -070092static int hpwdt_ping(struct watchdog_device *wdd)
93{
Jerry Hoemann0458f402018-02-25 20:22:25 -070094 int reload = SECS_TO_TICKS(wdd->timeout);
95
Jerry Hoemannccfd6922018-02-25 20:22:26 -070096 dev_dbg(wdd->parent, "ping watchdog 0x%08x\n", reload);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070097 iowrite16(reload, hpwdt_timer_reg);
Jerry Hoemann0458f402018-02-25 20:22:25 -070098
Jerry Hoemannd0a40272018-02-25 20:22:22 -070099 return 0;
100}
101
102static unsigned int hpwdt_gettimeleft(struct watchdog_device *wdd)
dann frazieraae67f32010-06-02 16:23:41 -0600103{
104 return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
105}
106
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700107static int hpwdt_settimeout(struct watchdog_device *wdd, unsigned int val)
108{
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700109 dev_dbg(wdd->parent, "set_timeout = %d\n", val);
110
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700111 wdd->timeout = val;
Jerry Hoemann0458f402018-02-25 20:22:25 -0700112 if (val <= wdd->pretimeout) {
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700113 dev_dbg(wdd->parent, "pretimeout < timeout. Setting to zero\n");
Jerry Hoemann0458f402018-02-25 20:22:25 -0700114 wdd->pretimeout = 0;
115 pretimeout = 0;
116 if (watchdog_active(wdd))
117 hpwdt_start(wdd);
118 }
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700119 hpwdt_ping(wdd);
120
121 return 0;
122}
123
Arnd Bergmannaeebc6b2017-12-06 22:02:37 +0100124#ifdef CONFIG_HPWDT_NMI_DECODING
Jerry Hoemann0458f402018-02-25 20:22:25 -0700125static int hpwdt_set_pretimeout(struct watchdog_device *wdd, unsigned int req)
126{
127 unsigned int val = 0;
128
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700129 dev_dbg(wdd->parent, "set_pretimeout = %d\n", req);
Jerry Hoemann0458f402018-02-25 20:22:25 -0700130 if (req) {
131 val = PRETIMEOUT_SEC;
132 if (val >= wdd->timeout)
133 return -EINVAL;
134 }
135
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700136 if (val != req)
137 dev_dbg(wdd->parent, "Rounding pretimeout to: %d\n", val);
138
Jerry Hoemann0458f402018-02-25 20:22:25 -0700139 wdd->pretimeout = val;
140 pretimeout = !!val;
141
142 if (watchdog_active(wdd))
143 hpwdt_start(wdd);
144
145 return 0;
146}
147
Jerry Hoemann838534e2017-10-23 16:46:17 -0600148static int hpwdt_my_nmi(void)
149{
150 return ioread8(hpwdt_nmistat) & 0x6;
151}
152
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000153/*
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000154 * NMI Handler
155 */
Don Zickus9c48f1c2011-09-30 15:06:21 -0400156static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000157{
Jerry Hoemanna0422292018-02-25 20:22:21 -0700158 unsigned int mynmi = hpwdt_my_nmi();
159 static char panic_msg[] =
160 "00: An NMI occurred. Depending on your system the reason "
161 "for the NMI is logged in any one of the following resources:\n"
162 "1. Integrated Management Log (IML)\n"
163 "2. OA Syslog\n"
164 "3. OA Forward Progress Log\n"
165 "4. iLO Event Log";
166
Jerry Hoemann62290a52018-05-03 15:00:55 -0600167 if (ilo5 && ulReason == NMI_UNKNOWN && !mynmi)
Jerry Hoemann838534e2017-10-23 16:46:17 -0600168 return NMI_DONE;
169
Jerry Hoemann093d4382018-08-08 13:13:24 -0600170 if (ilo5 && !pretimeout && !mynmi)
Jerry Hoemann0458f402018-02-25 20:22:25 -0700171 return NMI_DONE;
172
Jerry Hoemann703fc3d2018-02-25 20:22:24 -0700173 hpwdt_stop();
Naga Chumbalkardbc018e2011-08-09 22:27:26 +0000174
Jerry Hoemanna0422292018-02-25 20:22:21 -0700175 hex_byte_pack(panic_msg, mynmi);
176 nmi_panic(regs, panic_msg);
Thomas Mingarelli5efc7a62011-07-26 14:05:53 +0100177
Hidehiro Kawaiabc514c2016-03-22 14:27:24 -0700178 return NMI_HANDLED;
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000179}
dann frazier86ded1f2010-07-27 17:51:02 -0600180#endif /* CONFIG_HPWDT_NMI_DECODING */
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000181
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000182
Wim Van Sebroeck42747d72009-12-26 18:55:22 +0000183static const struct watchdog_info ident = {
Jerry Hoemann0458f402018-02-25 20:22:25 -0700184 .options = WDIOF_PRETIMEOUT |
185 WDIOF_SETTIMEOUT |
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000186 WDIOF_KEEPALIVEPING |
187 WDIOF_MAGICCLOSE,
Mingarelli, Thomasca22e792015-12-14 20:22:09 +0000188 .identity = "HPE iLO2+ HW Watchdog Timer",
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000189};
190
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000191/*
192 * Kernel interfaces
193 */
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700194
195static const struct watchdog_ops hpwdt_ops = {
196 .owner = THIS_MODULE,
197 .start = hpwdt_start,
198 .stop = hpwdt_stop_core,
199 .ping = hpwdt_ping,
200 .set_timeout = hpwdt_settimeout,
201 .get_timeleft = hpwdt_gettimeleft,
Jerry Hoemann0458f402018-02-25 20:22:25 -0700202#ifdef CONFIG_HPWDT_NMI_DECODING
203 .set_pretimeout = hpwdt_set_pretimeout,
204#endif
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000205};
206
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700207static struct watchdog_device hpwdt_dev = {
208 .info = &ident,
209 .ops = &hpwdt_ops,
210 .min_timeout = 1,
211 .max_timeout = HPWDT_MAX_TIMER,
212 .timeout = DEFAULT_MARGIN,
Jerry Hoemann0458f402018-02-25 20:22:25 -0700213 .pretimeout = PRETIMEOUT_SEC,
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000214};
215
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700216
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000217/*
218 * Init & Exit
219 */
220
Bill Pemberton2d991a12012-11-19 13:21:41 -0500221static int hpwdt_init_nmi_decoding(struct pci_dev *dev)
dann frazier2ec7ed62010-07-28 12:38:43 -0600222{
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700223#ifdef CONFIG_HPWDT_NMI_DECODING
dann frazier2ec7ed62010-07-28 12:38:43 -0600224 int retval;
dann frazier2ec7ed62010-07-28 12:38:43 -0600225 /*
Don Zickus09ee1012012-03-29 16:11:15 -0400226 * Only one function can register for NMI_UNKNOWN
dann frazier2ec7ed62010-07-28 12:38:43 -0600227 */
Don Zickus09ee1012012-03-29 16:11:15 -0400228 retval = register_nmi_handler(NMI_UNKNOWN, hpwdt_pretimeout, 0, "hpwdt");
Don Zickus553222f2012-03-29 16:11:16 -0400229 if (retval)
230 goto error;
231 retval = register_nmi_handler(NMI_SERR, hpwdt_pretimeout, 0, "hpwdt");
232 if (retval)
233 goto error1;
234 retval = register_nmi_handler(NMI_IO_CHECK, hpwdt_pretimeout, 0, "hpwdt");
235 if (retval)
236 goto error2;
dann frazier2ec7ed62010-07-28 12:38:43 -0600237
238 dev_info(&dev->dev,
Jerry Hoemann703fc3d2018-02-25 20:22:24 -0700239 "HPE Watchdog Timer Driver: NMI decoding initialized\n");
240
dann frazier2ec7ed62010-07-28 12:38:43 -0600241 return 0;
Don Zickus553222f2012-03-29 16:11:16 -0400242
243error2:
244 unregister_nmi_handler(NMI_SERR, "hpwdt");
245error1:
246 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt");
247error:
248 dev_warn(&dev->dev,
249 "Unable to register a die notifier (err=%d).\n",
250 retval);
Don Zickus553222f2012-03-29 16:11:16 -0400251 return retval;
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700252#endif /* CONFIG_HPWDT_NMI_DECODING */
dann frazier86ded1f2010-07-27 17:51:02 -0600253 return 0;
254}
255
Axel Linb77b7082011-03-02 11:49:44 +0800256static void hpwdt_exit_nmi_decoding(void)
dann frazier86ded1f2010-07-27 17:51:02 -0600257{
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700258#ifdef CONFIG_HPWDT_NMI_DECODING
259 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt");
260 unregister_nmi_handler(NMI_SERR, "hpwdt");
261 unregister_nmi_handler(NMI_IO_CHECK, "hpwdt");
262#endif
dann frazier86ded1f2010-07-27 17:51:02 -0600263}
Thomas Mingarelli47bece82009-06-04 19:50:45 +0000264
Bill Pemberton2d991a12012-11-19 13:21:41 -0500265static int hpwdt_init_one(struct pci_dev *dev,
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000266 const struct pci_device_id *ent)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000267{
268 int retval;
269
270 /*
dann frazier36e3ff42010-07-27 17:50:57 -0600271 * First let's find out if we are on an iLO2+ server. We will
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000272 * not run on a legacy ASM box.
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000273 * So we only support the G5 ProLiant servers and higher.
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000274 */
Brian Boylstonfc113d52016-09-26 13:57:14 -0500275 if (dev->subsystem_vendor != PCI_VENDOR_ID_HP &&
276 dev->subsystem_vendor != PCI_VENDOR_ID_HP_3PAR) {
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000277 dev_warn(&dev->dev,
dann frazier36e3ff42010-07-27 17:50:57 -0600278 "This server does not have an iLO2+ ASIC.\n");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000279 return -ENODEV;
280 }
281
Jerry Hoemann94d6b802018-12-05 17:42:21 -0700282 if (pci_match_id(hpwdt_blacklist, dev)) {
283 dev_dbg(&dev->dev, "Not supported on this device\n");
Mingarelli, Thomas0821f202013-08-09 16:31:09 +0000284 return -ENODEV;
Jerry Hoemann94d6b802018-12-05 17:42:21 -0700285 }
Mingarelli, Thomas0821f202013-08-09 16:31:09 +0000286
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000287 if (pci_enable_device(dev)) {
288 dev_warn(&dev->dev,
289 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
290 ent->vendor, ent->device);
291 return -ENODEV;
292 }
293
294 pci_mem_addr = pci_iomap(dev, 1, 0x80);
295 if (!pci_mem_addr) {
296 dev_warn(&dev->dev,
dann frazier36e3ff42010-07-27 17:50:57 -0600297 "Unable to detect the iLO2+ server memory.\n");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000298 retval = -ENOMEM;
299 goto error_pci_iomap;
300 }
Jerry Hoemann838534e2017-10-23 16:46:17 -0600301 hpwdt_nmistat = pci_mem_addr + 0x6e;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000302 hpwdt_timer_reg = pci_mem_addr + 0x70;
303 hpwdt_timer_con = pci_mem_addr + 0x72;
304
Toshi Kani308b1352012-08-27 12:52:24 -0600305 /* Make sure that timer is disabled until /dev/watchdog is opened */
306 hpwdt_stop();
307
dann frazier2ec7ed62010-07-28 12:38:43 -0600308 /* Initialize NMI Decoding functionality */
309 retval = hpwdt_init_nmi_decoding(dev);
310 if (retval != 0)
311 goto error_init_nmi_decoding;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000312
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700313 watchdog_set_nowayout(&hpwdt_dev, nowayout);
Wolfram Sang87dfe212019-04-19 20:15:51 +0200314 watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL);
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700315
Jerry Hoemann10d790d12018-09-21 14:50:39 -0600316 if (pretimeout && hpwdt_dev.timeout <= PRETIMEOUT_SEC) {
317 dev_warn(&dev->dev, "timeout <= pretimeout. Setting pretimeout to zero\n");
318 pretimeout = 0;
319 }
Jerry Hoemann4d9186d2018-08-08 13:13:23 -0600320 hpwdt_dev.pretimeout = pretimeout ? PRETIMEOUT_SEC : 0;
321
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700322 hpwdt_dev.parent = &dev->dev;
323 retval = watchdog_register_device(&hpwdt_dev);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000324 if (retval < 0) {
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700325 dev_err(&dev->dev, "watchdog register failed: %d.\n", retval);
326 goto error_wd_register;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000327 }
328
Jerry Hoemann92301462018-08-08 13:13:25 -0600329 dev_info(&dev->dev, "HPE Watchdog Timer Driver: Version: %s\n",
330 HPWDT_VERSION);
331 dev_info(&dev->dev, "timeout: %d seconds (nowayout=%d)\n",
332 hpwdt_dev.timeout, nowayout);
333 dev_info(&dev->dev, "pretimeout: %s.\n",
334 pretimeout ? "on" : "off");
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700335
Jerry Hoemanna6c24732018-02-25 20:22:23 -0700336 if (dev->subsystem_vendor == PCI_VENDOR_ID_HP_3PAR)
337 ilo5 = true;
338
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000339 return 0;
340
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700341error_wd_register:
dann frazier2ec7ed62010-07-28 12:38:43 -0600342 hpwdt_exit_nmi_decoding();
343error_init_nmi_decoding:
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000344 pci_iounmap(dev, pci_mem_addr);
345error_pci_iomap:
346 pci_disable_device(dev);
347 return retval;
348}
349
Bill Pemberton4b12b892012-11-19 13:26:24 -0500350static void hpwdt_exit(struct pci_dev *dev)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000351{
352 if (!nowayout)
353 hpwdt_stop();
354
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700355 watchdog_unregister_device(&hpwdt_dev);
dann frazier2ec7ed62010-07-28 12:38:43 -0600356 hpwdt_exit_nmi_decoding();
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000357 pci_iounmap(dev, pci_mem_addr);
358 pci_disable_device(dev);
359}
360
361static struct pci_driver hpwdt_driver = {
362 .name = "hpwdt",
363 .id_table = hpwdt_devices,
364 .probe = hpwdt_init_one,
Bill Pemberton82268712012-11-19 13:21:12 -0500365 .remove = hpwdt_exit,
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000366};
367
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000368MODULE_AUTHOR("Tom Mingarelli");
Jerry Hoemann9a46fc42018-02-25 20:22:19 -0700369MODULE_DESCRIPTION("hpe watchdog driver");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000370MODULE_LICENSE("GPL");
Thomas Mingarellid8100c32009-03-03 00:17:16 +0000371MODULE_VERSION(HPWDT_VERSION);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000372
373module_param(soft_margin, int, 0);
374MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
375
Jerry Hoemann397a35d2018-08-08 13:13:26 -0600376module_param_named(timeout, soft_margin, int, 0);
377MODULE_PARM_DESC(timeout, "Alias of soft_margin");
378
Wim Van Sebroeck86a1e182012-03-05 16:51:11 +0100379module_param(nowayout, bool, 0);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000380MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
381 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
382
Jerry Hoemann0458f402018-02-25 20:22:25 -0700383#ifdef CONFIG_HPWDT_NMI_DECODING
384module_param(pretimeout, bool, 0);
385MODULE_PARM_DESC(pretimeout, "Watchdog pretimeout enabled");
386#endif
387
Wim Van Sebroeck5ce9c372012-05-04 14:43:25 +0200388module_pci_driver(hpwdt_driver);