blob: f7b5242b9c85664f0886ecf0af26d96467778783 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Thomas Mingarelli7f4da472007-12-04 17:41:54 +00002/*
Mingarelli, Thomasca22e792015-12-14 20:22:09 +00003 * HPE WatchDog Driver
Thomas Mingarelli7f4da472007-12-04 17:41:54 +00004 * based on
5 *
6 * SoftDog 0.05: A Software Watchdog Device
7 *
Jerry Hoemann9a46fc42018-02-25 20:22:19 -07008 * (c) Copyright 2018 Hewlett Packard Enterprise Development LP
Mingarelli, Thomasca22e792015-12-14 20:22:09 +00009 * Thomas Mingarelli <thomas.mingarelli@hpe.com>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000010 */
11
Joe Perches27c766a2012-02-15 15:06:19 -080012#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000014#include <linux/device.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000015#include <linux/io.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000016#include <linux/kernel.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000017#include <linux/module.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000018#include <linux/moduleparam.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000019#include <linux/pci.h>
20#include <linux/pci_ids.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000021#include <linux/types.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000022#include <linux/watchdog.h>
Ingo Molnard48b0e12011-10-06 14:20:27 +020023#include <asm/nmi.h>
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000024
Jerry Hoemann437a3f82018-12-05 17:42:23 -070025#define HPWDT_VERSION "2.0.2"
dann fraziere802e322010-06-02 16:23:39 -060026#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
dann frazier6f681c22010-06-02 16:23:40 -060027#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
28#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
dann frazier923410d2010-07-27 17:50:54 -060029#define DEFAULT_MARGIN 30
Jerry Hoemann0458f402018-02-25 20:22:25 -070030#define PRETIMEOUT_SEC 9
dann frazier923410d2010-07-27 17:50:54 -060031
Jerry Hoemanna6c24732018-02-25 20:22:23 -070032static bool ilo5;
dann frazier923410d2010-07-27 17:50:54 -060033static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
Wim Van Sebroeck86a1e182012-03-05 16:51:11 +010034static bool nowayout = WATCHDOG_NOWAYOUT;
Jerry Hoemann0458f402018-02-25 20:22:25 -070035static bool pretimeout = IS_ENABLED(CONFIG_HPWDT_NMI_DECODING);
dann frazier923410d2010-07-27 17:50:54 -060036
37static void __iomem *pci_mem_addr; /* the PCI-memory address */
Jerry Hoemann838534e2017-10-23 16:46:17 -060038static unsigned long __iomem *hpwdt_nmistat;
dann frazier923410d2010-07-27 17:50:54 -060039static unsigned long __iomem *hpwdt_timer_reg;
40static unsigned long __iomem *hpwdt_timer_con;
41
Jingoo Hanbc17f9d2013-12-03 08:30:22 +090042static const struct pci_device_id hpwdt_devices[] = {
dann frazier36e3ff42010-07-27 17:50:57 -060043 { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB203) }, /* iLO2 */
44 { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3306) }, /* iLO3 */
dann frazier923410d2010-07-27 17:50:54 -060045 {0}, /* terminate list */
46};
47MODULE_DEVICE_TABLE(pci, hpwdt_devices);
48
Jerry Hoemann94d6b802018-12-05 17:42:21 -070049static const struct pci_device_id hpwdt_blacklist[] = {
50 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3306, PCI_VENDOR_ID_HP, 0x1979) }, /* auxilary iLO */
Jerry Hoemannde2cb0c2018-12-05 17:42:22 -070051 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3306, PCI_VENDOR_ID_HP_3PAR, 0x0289) }, /* CL */
Jerry Hoemann94d6b802018-12-05 17:42:21 -070052 {0}, /* terminate list */
53};
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000054
55/*
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000056 * Watchdog operations
57 */
Jerry Hoemannd0a40272018-02-25 20:22:22 -070058static int hpwdt_start(struct watchdog_device *wdd)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000059{
Jerry Hoemann0458f402018-02-25 20:22:25 -070060 int control = 0x81 | (pretimeout ? 0x4 : 0);
61 int reload = SECS_TO_TICKS(wdd->timeout);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070062
Jerry Hoemannccfd6922018-02-25 20:22:26 -070063 dev_dbg(wdd->parent, "start watchdog 0x%08x:0x%02x\n", reload, control);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000064 iowrite16(reload, hpwdt_timer_reg);
Jerry Hoemann0458f402018-02-25 20:22:25 -070065 iowrite8(control, hpwdt_timer_con);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070066
67 return 0;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000068}
69
70static void hpwdt_stop(void)
71{
72 unsigned long data;
73
Jerry Hoemannccfd6922018-02-25 20:22:26 -070074 pr_debug("stop watchdog\n");
75
Mingarelli, Thomasd08c9a32012-04-03 05:37:01 +000076 data = ioread8(hpwdt_timer_con);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000077 data &= 0xFE;
Mingarelli, Thomasd08c9a32012-04-03 05:37:01 +000078 iowrite8(data, hpwdt_timer_con);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000079}
80
Jerry Hoemannd0a40272018-02-25 20:22:22 -070081static int hpwdt_stop_core(struct watchdog_device *wdd)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000082{
Jerry Hoemannd0a40272018-02-25 20:22:22 -070083 hpwdt_stop();
Thomas Mingarelli7f4da472007-12-04 17:41:54 +000084
85 return 0;
86}
87
Jerry Hoemannd0a40272018-02-25 20:22:22 -070088static int hpwdt_ping(struct watchdog_device *wdd)
89{
Jerry Hoemann0458f402018-02-25 20:22:25 -070090 int reload = SECS_TO_TICKS(wdd->timeout);
91
Jerry Hoemannccfd6922018-02-25 20:22:26 -070092 dev_dbg(wdd->parent, "ping watchdog 0x%08x\n", reload);
Jerry Hoemannd0a40272018-02-25 20:22:22 -070093 iowrite16(reload, hpwdt_timer_reg);
Jerry Hoemann0458f402018-02-25 20:22:25 -070094
Jerry Hoemannd0a40272018-02-25 20:22:22 -070095 return 0;
96}
97
98static unsigned int hpwdt_gettimeleft(struct watchdog_device *wdd)
dann frazieraae67f32010-06-02 16:23:41 -060099{
100 return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
101}
102
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700103static int hpwdt_settimeout(struct watchdog_device *wdd, unsigned int val)
104{
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700105 dev_dbg(wdd->parent, "set_timeout = %d\n", val);
106
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700107 wdd->timeout = val;
Jerry Hoemann0458f402018-02-25 20:22:25 -0700108 if (val <= wdd->pretimeout) {
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700109 dev_dbg(wdd->parent, "pretimeout < timeout. Setting to zero\n");
Jerry Hoemann0458f402018-02-25 20:22:25 -0700110 wdd->pretimeout = 0;
111 pretimeout = 0;
112 if (watchdog_active(wdd))
113 hpwdt_start(wdd);
114 }
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700115 hpwdt_ping(wdd);
116
117 return 0;
118}
119
Arnd Bergmannaeebc6b2017-12-06 22:02:37 +0100120#ifdef CONFIG_HPWDT_NMI_DECODING
Jerry Hoemann0458f402018-02-25 20:22:25 -0700121static int hpwdt_set_pretimeout(struct watchdog_device *wdd, unsigned int req)
122{
123 unsigned int val = 0;
124
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700125 dev_dbg(wdd->parent, "set_pretimeout = %d\n", req);
Jerry Hoemann0458f402018-02-25 20:22:25 -0700126 if (req) {
127 val = PRETIMEOUT_SEC;
128 if (val >= wdd->timeout)
129 return -EINVAL;
130 }
131
Jerry Hoemannccfd6922018-02-25 20:22:26 -0700132 if (val != req)
133 dev_dbg(wdd->parent, "Rounding pretimeout to: %d\n", val);
134
Jerry Hoemann0458f402018-02-25 20:22:25 -0700135 wdd->pretimeout = val;
136 pretimeout = !!val;
137
138 if (watchdog_active(wdd))
139 hpwdt_start(wdd);
140
141 return 0;
142}
143
Jerry Hoemann838534e2017-10-23 16:46:17 -0600144static int hpwdt_my_nmi(void)
145{
146 return ioread8(hpwdt_nmistat) & 0x6;
147}
148
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000149/*
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000150 * NMI Handler
151 */
Don Zickus9c48f1c2011-09-30 15:06:21 -0400152static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000153{
Jerry Hoemanna0422292018-02-25 20:22:21 -0700154 unsigned int mynmi = hpwdt_my_nmi();
155 static char panic_msg[] =
156 "00: An NMI occurred. Depending on your system the reason "
157 "for the NMI is logged in any one of the following resources:\n"
158 "1. Integrated Management Log (IML)\n"
159 "2. OA Syslog\n"
160 "3. OA Forward Progress Log\n"
161 "4. iLO Event Log";
162
Jerry Hoemann62290a52018-05-03 15:00:55 -0600163 if (ilo5 && ulReason == NMI_UNKNOWN && !mynmi)
Jerry Hoemann838534e2017-10-23 16:46:17 -0600164 return NMI_DONE;
165
Jerry Hoemann093d4382018-08-08 13:13:24 -0600166 if (ilo5 && !pretimeout && !mynmi)
Jerry Hoemann0458f402018-02-25 20:22:25 -0700167 return NMI_DONE;
168
Jerry Hoemann703fc3d2018-02-25 20:22:24 -0700169 hpwdt_stop();
Naga Chumbalkardbc018e2011-08-09 22:27:26 +0000170
Jerry Hoemanna0422292018-02-25 20:22:21 -0700171 hex_byte_pack(panic_msg, mynmi);
172 nmi_panic(regs, panic_msg);
Thomas Mingarelli5efc7a62011-07-26 14:05:53 +0100173
Hidehiro Kawaiabc514c2016-03-22 14:27:24 -0700174 return NMI_HANDLED;
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000175}
dann frazier86ded1f2010-07-27 17:51:02 -0600176#endif /* CONFIG_HPWDT_NMI_DECODING */
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000177
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000178
Wim Van Sebroeck42747d72009-12-26 18:55:22 +0000179static const struct watchdog_info ident = {
Jerry Hoemann0458f402018-02-25 20:22:25 -0700180 .options = WDIOF_PRETIMEOUT |
181 WDIOF_SETTIMEOUT |
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000182 WDIOF_KEEPALIVEPING |
183 WDIOF_MAGICCLOSE,
Mingarelli, Thomasca22e792015-12-14 20:22:09 +0000184 .identity = "HPE iLO2+ HW Watchdog Timer",
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000185};
186
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000187/*
188 * Kernel interfaces
189 */
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700190
191static const struct watchdog_ops hpwdt_ops = {
192 .owner = THIS_MODULE,
193 .start = hpwdt_start,
194 .stop = hpwdt_stop_core,
195 .ping = hpwdt_ping,
196 .set_timeout = hpwdt_settimeout,
197 .get_timeleft = hpwdt_gettimeleft,
Jerry Hoemann0458f402018-02-25 20:22:25 -0700198#ifdef CONFIG_HPWDT_NMI_DECODING
199 .set_pretimeout = hpwdt_set_pretimeout,
200#endif
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000201};
202
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700203static struct watchdog_device hpwdt_dev = {
204 .info = &ident,
205 .ops = &hpwdt_ops,
206 .min_timeout = 1,
207 .max_timeout = HPWDT_MAX_TIMER,
208 .timeout = DEFAULT_MARGIN,
Jerry Hoemann0458f402018-02-25 20:22:25 -0700209 .pretimeout = PRETIMEOUT_SEC,
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000210};
211
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700212
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000213/*
214 * Init & Exit
215 */
216
Bill Pemberton2d991a12012-11-19 13:21:41 -0500217static int hpwdt_init_nmi_decoding(struct pci_dev *dev)
dann frazier2ec7ed62010-07-28 12:38:43 -0600218{
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700219#ifdef CONFIG_HPWDT_NMI_DECODING
dann frazier2ec7ed62010-07-28 12:38:43 -0600220 int retval;
dann frazier2ec7ed62010-07-28 12:38:43 -0600221 /*
Don Zickus09ee1012012-03-29 16:11:15 -0400222 * Only one function can register for NMI_UNKNOWN
dann frazier2ec7ed62010-07-28 12:38:43 -0600223 */
Don Zickus09ee1012012-03-29 16:11:15 -0400224 retval = register_nmi_handler(NMI_UNKNOWN, hpwdt_pretimeout, 0, "hpwdt");
Don Zickus553222f2012-03-29 16:11:16 -0400225 if (retval)
226 goto error;
227 retval = register_nmi_handler(NMI_SERR, hpwdt_pretimeout, 0, "hpwdt");
228 if (retval)
229 goto error1;
230 retval = register_nmi_handler(NMI_IO_CHECK, hpwdt_pretimeout, 0, "hpwdt");
231 if (retval)
232 goto error2;
dann frazier2ec7ed62010-07-28 12:38:43 -0600233
234 dev_info(&dev->dev,
Jerry Hoemann703fc3d2018-02-25 20:22:24 -0700235 "HPE Watchdog Timer Driver: NMI decoding initialized\n");
236
dann frazier2ec7ed62010-07-28 12:38:43 -0600237 return 0;
Don Zickus553222f2012-03-29 16:11:16 -0400238
239error2:
240 unregister_nmi_handler(NMI_SERR, "hpwdt");
241error1:
242 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt");
243error:
244 dev_warn(&dev->dev,
245 "Unable to register a die notifier (err=%d).\n",
246 retval);
Don Zickus553222f2012-03-29 16:11:16 -0400247 return retval;
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700248#endif /* CONFIG_HPWDT_NMI_DECODING */
dann frazier86ded1f2010-07-27 17:51:02 -0600249 return 0;
250}
251
Axel Linb77b7082011-03-02 11:49:44 +0800252static void hpwdt_exit_nmi_decoding(void)
dann frazier86ded1f2010-07-27 17:51:02 -0600253{
Jerry Hoemann2b3d89b2018-02-25 20:22:20 -0700254#ifdef CONFIG_HPWDT_NMI_DECODING
255 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt");
256 unregister_nmi_handler(NMI_SERR, "hpwdt");
257 unregister_nmi_handler(NMI_IO_CHECK, "hpwdt");
258#endif
dann frazier86ded1f2010-07-27 17:51:02 -0600259}
Thomas Mingarelli47bece82009-06-04 19:50:45 +0000260
Bill Pemberton2d991a12012-11-19 13:21:41 -0500261static int hpwdt_init_one(struct pci_dev *dev,
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000262 const struct pci_device_id *ent)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000263{
264 int retval;
265
266 /*
dann frazier36e3ff42010-07-27 17:50:57 -0600267 * First let's find out if we are on an iLO2+ server. We will
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000268 * not run on a legacy ASM box.
Thomas Mingarelliab4ba3c2008-07-15 19:40:41 +0000269 * So we only support the G5 ProLiant servers and higher.
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000270 */
Brian Boylstonfc113d52016-09-26 13:57:14 -0500271 if (dev->subsystem_vendor != PCI_VENDOR_ID_HP &&
272 dev->subsystem_vendor != PCI_VENDOR_ID_HP_3PAR) {
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000273 dev_warn(&dev->dev,
dann frazier36e3ff42010-07-27 17:50:57 -0600274 "This server does not have an iLO2+ ASIC.\n");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000275 return -ENODEV;
276 }
277
Jerry Hoemann94d6b802018-12-05 17:42:21 -0700278 if (pci_match_id(hpwdt_blacklist, dev)) {
279 dev_dbg(&dev->dev, "Not supported on this device\n");
Mingarelli, Thomas0821f202013-08-09 16:31:09 +0000280 return -ENODEV;
Jerry Hoemann94d6b802018-12-05 17:42:21 -0700281 }
Mingarelli, Thomas0821f202013-08-09 16:31:09 +0000282
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000283 if (pci_enable_device(dev)) {
284 dev_warn(&dev->dev,
285 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
286 ent->vendor, ent->device);
287 return -ENODEV;
288 }
289
290 pci_mem_addr = pci_iomap(dev, 1, 0x80);
291 if (!pci_mem_addr) {
292 dev_warn(&dev->dev,
dann frazier36e3ff42010-07-27 17:50:57 -0600293 "Unable to detect the iLO2+ server memory.\n");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000294 retval = -ENOMEM;
295 goto error_pci_iomap;
296 }
Jerry Hoemann838534e2017-10-23 16:46:17 -0600297 hpwdt_nmistat = pci_mem_addr + 0x6e;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000298 hpwdt_timer_reg = pci_mem_addr + 0x70;
299 hpwdt_timer_con = pci_mem_addr + 0x72;
300
Toshi Kani308b1352012-08-27 12:52:24 -0600301 /* Make sure that timer is disabled until /dev/watchdog is opened */
302 hpwdt_stop();
303
dann frazier2ec7ed62010-07-28 12:38:43 -0600304 /* Initialize NMI Decoding functionality */
305 retval = hpwdt_init_nmi_decoding(dev);
306 if (retval != 0)
307 goto error_init_nmi_decoding;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000308
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700309 watchdog_set_nowayout(&hpwdt_dev, nowayout);
Wolfram Sang87dfe212019-04-19 20:15:51 +0200310 watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL);
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700311
Jerry Hoemann10d790d12018-09-21 14:50:39 -0600312 if (pretimeout && hpwdt_dev.timeout <= PRETIMEOUT_SEC) {
313 dev_warn(&dev->dev, "timeout <= pretimeout. Setting pretimeout to zero\n");
314 pretimeout = 0;
315 }
Jerry Hoemann4d9186d2018-08-08 13:13:23 -0600316 hpwdt_dev.pretimeout = pretimeout ? PRETIMEOUT_SEC : 0;
317
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700318 hpwdt_dev.parent = &dev->dev;
319 retval = watchdog_register_device(&hpwdt_dev);
Wolfram Sangf51540b2019-05-18 23:27:28 +0200320 if (retval < 0)
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700321 goto error_wd_register;
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000322
Jerry Hoemann92301462018-08-08 13:13:25 -0600323 dev_info(&dev->dev, "HPE Watchdog Timer Driver: Version: %s\n",
324 HPWDT_VERSION);
325 dev_info(&dev->dev, "timeout: %d seconds (nowayout=%d)\n",
326 hpwdt_dev.timeout, nowayout);
327 dev_info(&dev->dev, "pretimeout: %s.\n",
328 pretimeout ? "on" : "off");
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700329
Jerry Hoemanna6c24732018-02-25 20:22:23 -0700330 if (dev->subsystem_vendor == PCI_VENDOR_ID_HP_3PAR)
331 ilo5 = true;
332
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000333 return 0;
334
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700335error_wd_register:
dann frazier2ec7ed62010-07-28 12:38:43 -0600336 hpwdt_exit_nmi_decoding();
337error_init_nmi_decoding:
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000338 pci_iounmap(dev, pci_mem_addr);
339error_pci_iomap:
340 pci_disable_device(dev);
341 return retval;
342}
343
Bill Pemberton4b12b892012-11-19 13:26:24 -0500344static void hpwdt_exit(struct pci_dev *dev)
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000345{
346 if (!nowayout)
347 hpwdt_stop();
348
Jerry Hoemannd0a40272018-02-25 20:22:22 -0700349 watchdog_unregister_device(&hpwdt_dev);
dann frazier2ec7ed62010-07-28 12:38:43 -0600350 hpwdt_exit_nmi_decoding();
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000351 pci_iounmap(dev, pci_mem_addr);
352 pci_disable_device(dev);
353}
354
355static struct pci_driver hpwdt_driver = {
356 .name = "hpwdt",
357 .id_table = hpwdt_devices,
358 .probe = hpwdt_init_one,
Bill Pemberton82268712012-11-19 13:21:12 -0500359 .remove = hpwdt_exit,
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000360};
361
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000362MODULE_AUTHOR("Tom Mingarelli");
Jerry Hoemann9a46fc42018-02-25 20:22:19 -0700363MODULE_DESCRIPTION("hpe watchdog driver");
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000364MODULE_LICENSE("GPL");
Thomas Mingarellid8100c32009-03-03 00:17:16 +0000365MODULE_VERSION(HPWDT_VERSION);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000366
367module_param(soft_margin, int, 0);
368MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
369
Jerry Hoemann397a35d2018-08-08 13:13:26 -0600370module_param_named(timeout, soft_margin, int, 0);
371MODULE_PARM_DESC(timeout, "Alias of soft_margin");
372
Wim Van Sebroeck86a1e182012-03-05 16:51:11 +0100373module_param(nowayout, bool, 0);
Thomas Mingarelli7f4da472007-12-04 17:41:54 +0000374MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
375 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
376
Jerry Hoemann0458f402018-02-25 20:22:25 -0700377#ifdef CONFIG_HPWDT_NMI_DECODING
378module_param(pretimeout, bool, 0);
379MODULE_PARM_DESC(pretimeout, "Watchdog pretimeout enabled");
380#endif
381
Wim Van Sebroeck5ce9c372012-05-04 14:43:25 +0200382module_pci_driver(hpwdt_driver);