ipmi_watchdog.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. /*
  2. * ipmi_watchdog.c
  3. *
  4. * A watchdog timer based upon the IPMI interface.
  5. *
  6. * Author: MontaVista Software, Inc.
  7. * Corey Minyard <minyard@mvista.com>
  8. * source@mvista.com
  9. *
  10. * Copyright 2002 MontaVista Software Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. *
  17. *
  18. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  19. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  20. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  26. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  27. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * You should have received a copy of the GNU General Public License along
  30. * with this program; if not, write to the Free Software Foundation, Inc.,
  31. * 675 Mass Ave, Cambridge, MA 02139, USA.
  32. */
  33. #include <linux/module.h>
  34. #include <linux/moduleparam.h>
  35. #include <linux/ipmi.h>
  36. #include <linux/ipmi_smi.h>
  37. #include <linux/watchdog.h>
  38. #include <linux/miscdevice.h>
  39. #include <linux/init.h>
  40. #include <linux/completion.h>
  41. #include <linux/kdebug.h>
  42. #include <linux/rwsem.h>
  43. #include <linux/errno.h>
  44. #include <asm/uaccess.h>
  45. #include <linux/notifier.h>
  46. #include <linux/nmi.h>
  47. #include <linux/reboot.h>
  48. #include <linux/wait.h>
  49. #include <linux/poll.h>
  50. #include <linux/string.h>
  51. #include <linux/ctype.h>
  52. #include <asm/atomic.h>
  53. #ifdef CONFIG_X86_LOCAL_APIC
  54. #include <asm/apic.h>
  55. #endif
  56. #define PFX "IPMI Watchdog: "
  57. /*
  58. * The IPMI command/response information for the watchdog timer.
  59. */
  60. /* values for byte 1 of the set command, byte 2 of the get response. */
  61. #define WDOG_DONT_LOG (1 << 7)
  62. #define WDOG_DONT_STOP_ON_SET (1 << 6)
  63. #define WDOG_SET_TIMER_USE(byte, use) \
  64. byte = ((byte) & 0xf8) | ((use) & 0x7)
  65. #define WDOG_GET_TIMER_USE(byte) ((byte) & 0x7)
  66. #define WDOG_TIMER_USE_BIOS_FRB2 1
  67. #define WDOG_TIMER_USE_BIOS_POST 2
  68. #define WDOG_TIMER_USE_OS_LOAD 3
  69. #define WDOG_TIMER_USE_SMS_OS 4
  70. #define WDOG_TIMER_USE_OEM 5
  71. /* values for byte 2 of the set command, byte 3 of the get response. */
  72. #define WDOG_SET_PRETIMEOUT_ACT(byte, use) \
  73. byte = ((byte) & 0x8f) | (((use) & 0x7) << 4)
  74. #define WDOG_GET_PRETIMEOUT_ACT(byte) (((byte) >> 4) & 0x7)
  75. #define WDOG_PRETIMEOUT_NONE 0
  76. #define WDOG_PRETIMEOUT_SMI 1
  77. #define WDOG_PRETIMEOUT_NMI 2
  78. #define WDOG_PRETIMEOUT_MSG_INT 3
  79. /* Operations that can be performed on a pretimout. */
  80. #define WDOG_PREOP_NONE 0
  81. #define WDOG_PREOP_PANIC 1
  82. #define WDOG_PREOP_GIVE_DATA 2 /* Cause data to be available to
  83. read. Doesn't work in NMI
  84. mode. */
  85. /* Actions to perform on a full timeout. */
  86. #define WDOG_SET_TIMEOUT_ACT(byte, use) \
  87. byte = ((byte) & 0xf8) | ((use) & 0x7)
  88. #define WDOG_GET_TIMEOUT_ACT(byte) ((byte) & 0x7)
  89. #define WDOG_TIMEOUT_NONE 0
  90. #define WDOG_TIMEOUT_RESET 1
  91. #define WDOG_TIMEOUT_POWER_DOWN 2
  92. #define WDOG_TIMEOUT_POWER_CYCLE 3
  93. /* Byte 3 of the get command, byte 4 of the get response is the
  94. pre-timeout in seconds. */
  95. /* Bits for setting byte 4 of the set command, byte 5 of the get response. */
  96. #define WDOG_EXPIRE_CLEAR_BIOS_FRB2 (1 << 1)
  97. #define WDOG_EXPIRE_CLEAR_BIOS_POST (1 << 2)
  98. #define WDOG_EXPIRE_CLEAR_OS_LOAD (1 << 3)
  99. #define WDOG_EXPIRE_CLEAR_SMS_OS (1 << 4)
  100. #define WDOG_EXPIRE_CLEAR_OEM (1 << 5)
  101. /* Setting/getting the watchdog timer value. This is for bytes 5 and
  102. 6 (the timeout time) of the set command, and bytes 6 and 7 (the
  103. timeout time) and 8 and 9 (the current countdown value) of the
  104. response. The timeout value is given in seconds (in the command it
  105. is 100ms intervals). */
  106. #define WDOG_SET_TIMEOUT(byte1, byte2, val) \
  107. (byte1) = (((val) * 10) & 0xff), (byte2) = (((val) * 10) >> 8)
  108. #define WDOG_GET_TIMEOUT(byte1, byte2) \
  109. (((byte1) | ((byte2) << 8)) / 10)
  110. #define IPMI_WDOG_RESET_TIMER 0x22
  111. #define IPMI_WDOG_SET_TIMER 0x24
  112. #define IPMI_WDOG_GET_TIMER 0x25
  113. /* These are here until the real ones get into the watchdog.h interface. */
  114. #ifndef WDIOC_GETTIMEOUT
  115. #define WDIOC_GETTIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 20, int)
  116. #endif
  117. #ifndef WDIOC_SET_PRETIMEOUT
  118. #define WDIOC_SET_PRETIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 21, int)
  119. #endif
  120. #ifndef WDIOC_GET_PRETIMEOUT
  121. #define WDIOC_GET_PRETIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 22, int)
  122. #endif
  123. static int nowayout = WATCHDOG_NOWAYOUT;
  124. static ipmi_user_t watchdog_user;
  125. static int watchdog_ifnum;
  126. /* Default the timeout to 10 seconds. */
  127. static int timeout = 10;
  128. /* The pre-timeout is disabled by default. */
  129. static int pretimeout;
  130. /* Default action is to reset the board on a timeout. */
  131. static unsigned char action_val = WDOG_TIMEOUT_RESET;
  132. static char action[16] = "reset";
  133. static unsigned char preaction_val = WDOG_PRETIMEOUT_NONE;
  134. static char preaction[16] = "pre_none";
  135. static unsigned char preop_val = WDOG_PREOP_NONE;
  136. static char preop[16] = "preop_none";
  137. static DEFINE_SPINLOCK(ipmi_read_lock);
  138. static char data_to_read;
  139. static DECLARE_WAIT_QUEUE_HEAD(read_q);
  140. static struct fasync_struct *fasync_q;
  141. static char pretimeout_since_last_heartbeat;
  142. static char expect_close;
  143. static int ifnum_to_use = -1;
  144. static DECLARE_RWSEM(register_sem);
  145. /* Parameters to ipmi_set_timeout */
  146. #define IPMI_SET_TIMEOUT_NO_HB 0
  147. #define IPMI_SET_TIMEOUT_HB_IF_NECESSARY 1
  148. #define IPMI_SET_TIMEOUT_FORCE_HB 2
  149. static int ipmi_set_timeout(int do_heartbeat);
  150. static void ipmi_register_watchdog(int ipmi_intf);
  151. static void ipmi_unregister_watchdog(int ipmi_intf);
  152. /* If true, the driver will start running as soon as it is configured
  153. and ready. */
  154. static int start_now;
  155. static int set_param_int(const char *val, struct kernel_param *kp)
  156. {
  157. char *endp;
  158. int l;
  159. int rv = 0;
  160. if (!val)
  161. return -EINVAL;
  162. l = simple_strtoul(val, &endp, 0);
  163. if (endp == val)
  164. return -EINVAL;
  165. down_read(&register_sem);
  166. *((int *)kp->arg) = l;
  167. if (watchdog_user)
  168. rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
  169. up_read(&register_sem);
  170. return rv;
  171. }
  172. static int get_param_int(char *buffer, struct kernel_param *kp)
  173. {
  174. return sprintf(buffer, "%i", *((int *)kp->arg));
  175. }
  176. typedef int (*action_fn)(const char *intval, char *outval);
  177. static int action_op(const char *inval, char *outval);
  178. static int preaction_op(const char *inval, char *outval);
  179. static int preop_op(const char *inval, char *outval);
  180. static void check_parms(void);
  181. static int set_param_str(const char *val, struct kernel_param *kp)
  182. {
  183. action_fn fn = (action_fn) kp->arg;
  184. int rv = 0;
  185. char valcp[16];
  186. char *s;
  187. strncpy(valcp, val, 16);
  188. valcp[15] = '\0';
  189. s = strstrip(valcp);
  190. down_read(&register_sem);
  191. rv = fn(s, NULL);
  192. if (rv)
  193. goto out_unlock;
  194. check_parms();
  195. if (watchdog_user)
  196. rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
  197. out_unlock:
  198. up_read(&register_sem);
  199. return rv;
  200. }
  201. static int get_param_str(char *buffer, struct kernel_param *kp)
  202. {
  203. action_fn fn = (action_fn) kp->arg;
  204. int rv;
  205. rv = fn(NULL, buffer);
  206. if (rv)
  207. return rv;
  208. return strlen(buffer);
  209. }
  210. static int set_param_wdog_ifnum(const char *val, struct kernel_param *kp)
  211. {
  212. int rv = param_set_int(val, kp);
  213. if (rv)
  214. return rv;
  215. if ((ifnum_to_use < 0) || (ifnum_to_use == watchdog_ifnum))
  216. return 0;
  217. ipmi_unregister_watchdog(watchdog_ifnum);
  218. ipmi_register_watchdog(ifnum_to_use);
  219. return 0;
  220. }
  221. module_param_call(ifnum_to_use, set_param_wdog_ifnum, get_param_int,
  222. &ifnum_to_use, 0644);
  223. MODULE_PARM_DESC(ifnum_to_use, "The interface number to use for the watchdog "
  224. "timer. Setting to -1 defaults to the first registered "
  225. "interface");
  226. module_param_call(timeout, set_param_int, get_param_int, &timeout, 0644);
  227. MODULE_PARM_DESC(timeout, "Timeout value in seconds.");
  228. module_param_call(pretimeout, set_param_int, get_param_int, &pretimeout, 0644);
  229. MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
  230. module_param_call(action, set_param_str, get_param_str, action_op, 0644);
  231. MODULE_PARM_DESC(action, "Timeout action. One of: "
  232. "reset, none, power_cycle, power_off.");
  233. module_param_call(preaction, set_param_str, get_param_str, preaction_op, 0644);
  234. MODULE_PARM_DESC(preaction, "Pretimeout action. One of: "
  235. "pre_none, pre_smi, pre_nmi, pre_int.");
  236. module_param_call(preop, set_param_str, get_param_str, preop_op, 0644);
  237. MODULE_PARM_DESC(preop, "Pretimeout driver operation. One of: "
  238. "preop_none, preop_panic, preop_give_data.");
  239. module_param(start_now, int, 0444);
  240. MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as"
  241. "soon as the driver is loaded.");
  242. module_param(nowayout, int, 0644);
  243. MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
  244. "(default=CONFIG_WATCHDOG_NOWAYOUT)");
  245. /* Default state of the timer. */
  246. static unsigned char ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
  247. /* If shutting down via IPMI, we ignore the heartbeat. */
  248. static int ipmi_ignore_heartbeat;
  249. /* Is someone using the watchdog? Only one user is allowed. */
  250. static unsigned long ipmi_wdog_open;
  251. /* If set to 1, the heartbeat command will set the state to reset and
  252. start the timer. The timer doesn't normally run when the driver is
  253. first opened until the heartbeat is set the first time, this
  254. variable is used to accomplish this. */
  255. static int ipmi_start_timer_on_heartbeat;
  256. /* IPMI version of the BMC. */
  257. static unsigned char ipmi_version_major;
  258. static unsigned char ipmi_version_minor;
  259. /* If a pretimeout occurs, this is used to allow only one panic to happen. */
  260. static atomic_t preop_panic_excl = ATOMIC_INIT(-1);
  261. static int ipmi_heartbeat(void);
  262. static void panic_halt_ipmi_heartbeat(void);
  263. /* We use a mutex to make sure that only one thing can send a set
  264. timeout at one time, because we only have one copy of the data.
  265. The mutex is claimed when the set_timeout is sent and freed
  266. when both messages are free. */
  267. static atomic_t set_timeout_tofree = ATOMIC_INIT(0);
  268. static DEFINE_MUTEX(set_timeout_lock);
  269. static DECLARE_COMPLETION(set_timeout_wait);
  270. static void set_timeout_free_smi(struct ipmi_smi_msg *msg)
  271. {
  272. if (atomic_dec_and_test(&set_timeout_tofree))
  273. complete(&set_timeout_wait);
  274. }
  275. static void set_timeout_free_recv(struct ipmi_recv_msg *msg)
  276. {
  277. if (atomic_dec_and_test(&set_timeout_tofree))
  278. complete(&set_timeout_wait);
  279. }
  280. static struct ipmi_smi_msg set_timeout_smi_msg =
  281. {
  282. .done = set_timeout_free_smi
  283. };
  284. static struct ipmi_recv_msg set_timeout_recv_msg =
  285. {
  286. .done = set_timeout_free_recv
  287. };
  288. static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
  289. struct ipmi_recv_msg *recv_msg,
  290. int *send_heartbeat_now)
  291. {
  292. struct kernel_ipmi_msg msg;
  293. unsigned char data[6];
  294. int rv;
  295. struct ipmi_system_interface_addr addr;
  296. int hbnow = 0;
  297. data[0] = 0;
  298. WDOG_SET_TIMER_USE(data[0], WDOG_TIMER_USE_SMS_OS);
  299. if ((ipmi_version_major > 1)
  300. || ((ipmi_version_major == 1) && (ipmi_version_minor >= 5)))
  301. {
  302. /* This is an IPMI 1.5-only feature. */
  303. data[0] |= WDOG_DONT_STOP_ON_SET;
  304. } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
  305. /* In ipmi 1.0, setting the timer stops the watchdog, we
  306. need to start it back up again. */
  307. hbnow = 1;
  308. }
  309. data[1] = 0;
  310. WDOG_SET_TIMEOUT_ACT(data[1], ipmi_watchdog_state);
  311. if ((pretimeout > 0) && (ipmi_watchdog_state != WDOG_TIMEOUT_NONE)) {
  312. WDOG_SET_PRETIMEOUT_ACT(data[1], preaction_val);
  313. data[2] = pretimeout;
  314. } else {
  315. WDOG_SET_PRETIMEOUT_ACT(data[1], WDOG_PRETIMEOUT_NONE);
  316. data[2] = 0; /* No pretimeout. */
  317. }
  318. data[3] = 0;
  319. WDOG_SET_TIMEOUT(data[4], data[5], timeout);
  320. addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
  321. addr.channel = IPMI_BMC_CHANNEL;
  322. addr.lun = 0;
  323. msg.netfn = 0x06;
  324. msg.cmd = IPMI_WDOG_SET_TIMER;
  325. msg.data = data;
  326. msg.data_len = sizeof(data);
  327. rv = ipmi_request_supply_msgs(watchdog_user,
  328. (struct ipmi_addr *) &addr,
  329. 0,
  330. &msg,
  331. NULL,
  332. smi_msg,
  333. recv_msg,
  334. 1);
  335. if (rv) {
  336. printk(KERN_WARNING PFX "set timeout error: %d\n",
  337. rv);
  338. }
  339. if (send_heartbeat_now)
  340. *send_heartbeat_now = hbnow;
  341. return rv;
  342. }
  343. static int ipmi_set_timeout(int do_heartbeat)
  344. {
  345. int send_heartbeat_now;
  346. int rv;
  347. /* We can only send one of these at a time. */
  348. mutex_lock(&set_timeout_lock);
  349. atomic_set(&set_timeout_tofree, 2);
  350. rv = i_ipmi_set_timeout(&set_timeout_smi_msg,
  351. &set_timeout_recv_msg,
  352. &send_heartbeat_now);
  353. if (rv) {
  354. mutex_unlock(&set_timeout_lock);
  355. goto out;
  356. }
  357. wait_for_completion(&set_timeout_wait);
  358. if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB)
  359. || ((send_heartbeat_now)
  360. && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY)))
  361. {
  362. rv = ipmi_heartbeat();
  363. }
  364. mutex_unlock(&set_timeout_lock);
  365. out:
  366. return rv;
  367. }
  368. static void dummy_smi_free(struct ipmi_smi_msg *msg)
  369. {
  370. }
  371. static void dummy_recv_free(struct ipmi_recv_msg *msg)
  372. {
  373. }
  374. static struct ipmi_smi_msg panic_halt_smi_msg =
  375. {
  376. .done = dummy_smi_free
  377. };
  378. static struct ipmi_recv_msg panic_halt_recv_msg =
  379. {
  380. .done = dummy_recv_free
  381. };
  382. /* Special call, doesn't claim any locks. This is only to be called
  383. at panic or halt time, in run-to-completion mode, when the caller
  384. is the only CPU and the only thing that will be going is these IPMI
  385. calls. */
  386. static void panic_halt_ipmi_set_timeout(void)
  387. {
  388. int send_heartbeat_now;
  389. int rv;
  390. rv = i_ipmi_set_timeout(&panic_halt_smi_msg,
  391. &panic_halt_recv_msg,
  392. &send_heartbeat_now);
  393. if (!rv) {
  394. if (send_heartbeat_now)
  395. panic_halt_ipmi_heartbeat();
  396. }
  397. }
  398. /* We use a semaphore to make sure that only one thing can send a
  399. heartbeat at one time, because we only have one copy of the data.
  400. The semaphore is claimed when the set_timeout is sent and freed
  401. when both messages are free. */
  402. static atomic_t heartbeat_tofree = ATOMIC_INIT(0);
  403. static DEFINE_MUTEX(heartbeat_lock);
  404. static DECLARE_COMPLETION(heartbeat_wait);
  405. static void heartbeat_free_smi(struct ipmi_smi_msg *msg)
  406. {
  407. if (atomic_dec_and_test(&heartbeat_tofree))
  408. complete(&heartbeat_wait);
  409. }
  410. static void heartbeat_free_recv(struct ipmi_recv_msg *msg)
  411. {
  412. if (atomic_dec_and_test(&heartbeat_tofree))
  413. complete(&heartbeat_wait);
  414. }
  415. static struct ipmi_smi_msg heartbeat_smi_msg =
  416. {
  417. .done = heartbeat_free_smi
  418. };
  419. static struct ipmi_recv_msg heartbeat_recv_msg =
  420. {
  421. .done = heartbeat_free_recv
  422. };
  423. static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
  424. {
  425. .done = dummy_smi_free
  426. };
  427. static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
  428. {
  429. .done = dummy_recv_free
  430. };
  431. static int ipmi_heartbeat(void)
  432. {
  433. struct kernel_ipmi_msg msg;
  434. int rv;
  435. struct ipmi_system_interface_addr addr;
  436. if (ipmi_ignore_heartbeat) {
  437. return 0;
  438. }
  439. if (ipmi_start_timer_on_heartbeat) {
  440. ipmi_start_timer_on_heartbeat = 0;
  441. ipmi_watchdog_state = action_val;
  442. return ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB);
  443. } else if (pretimeout_since_last_heartbeat) {
  444. /* A pretimeout occurred, make sure we set the timeout.
  445. We don't want to set the action, though, we want to
  446. leave that alone (thus it can't be combined with the
  447. above operation. */
  448. pretimeout_since_last_heartbeat = 0;
  449. return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
  450. }
  451. mutex_lock(&heartbeat_lock);
  452. atomic_set(&heartbeat_tofree, 2);
  453. /* Don't reset the timer if we have the timer turned off, that
  454. re-enables the watchdog. */
  455. if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) {
  456. mutex_unlock(&heartbeat_lock);
  457. return 0;
  458. }
  459. addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
  460. addr.channel = IPMI_BMC_CHANNEL;
  461. addr.lun = 0;
  462. msg.netfn = 0x06;
  463. msg.cmd = IPMI_WDOG_RESET_TIMER;
  464. msg.data = NULL;
  465. msg.data_len = 0;
  466. rv = ipmi_request_supply_msgs(watchdog_user,
  467. (struct ipmi_addr *) &addr,
  468. 0,
  469. &msg,
  470. NULL,
  471. &heartbeat_smi_msg,
  472. &heartbeat_recv_msg,
  473. 1);
  474. if (rv) {
  475. mutex_unlock(&heartbeat_lock);
  476. printk(KERN_WARNING PFX "heartbeat failure: %d\n",
  477. rv);
  478. return rv;
  479. }
  480. /* Wait for the heartbeat to be sent. */
  481. wait_for_completion(&heartbeat_wait);
  482. if (heartbeat_recv_msg.msg.data[0] != 0) {
  483. /* Got an error in the heartbeat response. It was already
  484. reported in ipmi_wdog_msg_handler, but we should return
  485. an error here. */
  486. rv = -EINVAL;
  487. }
  488. mutex_unlock(&heartbeat_lock);
  489. return rv;
  490. }
  491. static void panic_halt_ipmi_heartbeat(void)
  492. {
  493. struct kernel_ipmi_msg msg;
  494. struct ipmi_system_interface_addr addr;
  495. /* Don't reset the timer if we have the timer turned off, that
  496. re-enables the watchdog. */
  497. if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
  498. return;
  499. addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
  500. addr.channel = IPMI_BMC_CHANNEL;
  501. addr.lun = 0;
  502. msg.netfn = 0x06;
  503. msg.cmd = IPMI_WDOG_RESET_TIMER;
  504. msg.data = NULL;
  505. msg.data_len = 0;
  506. ipmi_request_supply_msgs(watchdog_user,
  507. (struct ipmi_addr *) &addr,
  508. 0,
  509. &msg,
  510. NULL,
  511. &panic_halt_heartbeat_smi_msg,
  512. &panic_halt_heartbeat_recv_msg,
  513. 1);
  514. }
  515. static struct watchdog_info ident =
  516. {
  517. .options = 0, /* WDIOF_SETTIMEOUT, */
  518. .firmware_version = 1,
  519. .identity = "IPMI"
  520. };
  521. static int ipmi_ioctl(struct inode *inode, struct file *file,
  522. unsigned int cmd, unsigned long arg)
  523. {
  524. void __user *argp = (void __user *)arg;
  525. int i;
  526. int val;
  527. switch(cmd) {
  528. case WDIOC_GETSUPPORT:
  529. i = copy_to_user(argp, &ident, sizeof(ident));
  530. return i ? -EFAULT : 0;
  531. case WDIOC_SETTIMEOUT:
  532. i = copy_from_user(&val, argp, sizeof(int));
  533. if (i)
  534. return -EFAULT;
  535. timeout = val;
  536. return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
  537. case WDIOC_GETTIMEOUT:
  538. i = copy_to_user(argp, &timeout, sizeof(timeout));
  539. if (i)
  540. return -EFAULT;
  541. return 0;
  542. case WDIOC_SET_PRETIMEOUT:
  543. i = copy_from_user(&val, argp, sizeof(int));
  544. if (i)
  545. return -EFAULT;
  546. pretimeout = val;
  547. return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
  548. case WDIOC_GET_PRETIMEOUT:
  549. i = copy_to_user(argp, &pretimeout, sizeof(pretimeout));
  550. if (i)
  551. return -EFAULT;
  552. return 0;
  553. case WDIOC_KEEPALIVE:
  554. return ipmi_heartbeat();
  555. case WDIOC_SETOPTIONS:
  556. i = copy_from_user(&val, argp, sizeof(int));
  557. if (i)
  558. return -EFAULT;
  559. if (val & WDIOS_DISABLECARD)
  560. {
  561. ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
  562. ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
  563. ipmi_start_timer_on_heartbeat = 0;
  564. }
  565. if (val & WDIOS_ENABLECARD)
  566. {
  567. ipmi_watchdog_state = action_val;
  568. ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB);
  569. }
  570. return 0;
  571. case WDIOC_GETSTATUS:
  572. val = 0;
  573. i = copy_to_user(argp, &val, sizeof(val));
  574. if (i)
  575. return -EFAULT;
  576. return 0;
  577. default:
  578. return -ENOIOCTLCMD;
  579. }
  580. }
  581. static ssize_t ipmi_write(struct file *file,
  582. const char __user *buf,
  583. size_t len,
  584. loff_t *ppos)
  585. {
  586. int rv;
  587. if (len) {
  588. if (!nowayout) {
  589. size_t i;
  590. /* In case it was set long ago */
  591. expect_close = 0;
  592. for (i = 0; i != len; i++) {
  593. char c;
  594. if (get_user(c, buf + i))
  595. return -EFAULT;
  596. if (c == 'V')
  597. expect_close = 42;
  598. }
  599. }
  600. rv = ipmi_heartbeat();
  601. if (rv)
  602. return rv;
  603. return 1;
  604. }
  605. return 0;
  606. }
  607. static ssize_t ipmi_read(struct file *file,
  608. char __user *buf,
  609. size_t count,
  610. loff_t *ppos)
  611. {
  612. int rv = 0;
  613. wait_queue_t wait;
  614. if (count <= 0)
  615. return 0;
  616. /* Reading returns if the pretimeout has gone off, and it only does
  617. it once per pretimeout. */
  618. spin_lock(&ipmi_read_lock);
  619. if (!data_to_read) {
  620. if (file->f_flags & O_NONBLOCK) {
  621. rv = -EAGAIN;
  622. goto out;
  623. }
  624. init_waitqueue_entry(&wait, current);
  625. add_wait_queue(&read_q, &wait);
  626. while (!data_to_read) {
  627. set_current_state(TASK_INTERRUPTIBLE);
  628. spin_unlock(&ipmi_read_lock);
  629. schedule();
  630. spin_lock(&ipmi_read_lock);
  631. }
  632. remove_wait_queue(&read_q, &wait);
  633. if (signal_pending(current)) {
  634. rv = -ERESTARTSYS;
  635. goto out;
  636. }
  637. }
  638. data_to_read = 0;
  639. out:
  640. spin_unlock(&ipmi_read_lock);
  641. if (rv == 0) {
  642. if (copy_to_user(buf, &data_to_read, 1))
  643. rv = -EFAULT;
  644. else
  645. rv = 1;
  646. }
  647. return rv;
  648. }
  649. static int ipmi_open(struct inode *ino, struct file *filep)
  650. {
  651. switch (iminor(ino)) {
  652. case WATCHDOG_MINOR:
  653. if (test_and_set_bit(0, &ipmi_wdog_open))
  654. return -EBUSY;
  655. /* Don't start the timer now, let it start on the
  656. first heartbeat. */
  657. ipmi_start_timer_on_heartbeat = 1;
  658. return nonseekable_open(ino, filep);
  659. default:
  660. return (-ENODEV);
  661. }
  662. }
  663. static unsigned int ipmi_poll(struct file *file, poll_table *wait)
  664. {
  665. unsigned int mask = 0;
  666. poll_wait(file, &read_q, wait);
  667. spin_lock(&ipmi_read_lock);
  668. if (data_to_read)
  669. mask |= (POLLIN | POLLRDNORM);
  670. spin_unlock(&ipmi_read_lock);
  671. return mask;
  672. }
  673. static int ipmi_fasync(int fd, struct file *file, int on)
  674. {
  675. int result;
  676. result = fasync_helper(fd, file, on, &fasync_q);
  677. return (result);
  678. }
  679. static int ipmi_close(struct inode *ino, struct file *filep)
  680. {
  681. if (iminor(ino) == WATCHDOG_MINOR) {
  682. if (expect_close == 42) {
  683. ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
  684. ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
  685. } else {
  686. printk(KERN_CRIT PFX
  687. "Unexpected close, not stopping watchdog!\n");
  688. ipmi_heartbeat();
  689. }
  690. clear_bit(0, &ipmi_wdog_open);
  691. }
  692. ipmi_fasync (-1, filep, 0);
  693. expect_close = 0;
  694. return 0;
  695. }
  696. static const struct file_operations ipmi_wdog_fops = {
  697. .owner = THIS_MODULE,
  698. .read = ipmi_read,
  699. .poll = ipmi_poll,
  700. .write = ipmi_write,
  701. .ioctl = ipmi_ioctl,
  702. .open = ipmi_open,
  703. .release = ipmi_close,
  704. .fasync = ipmi_fasync,
  705. };
  706. static struct miscdevice ipmi_wdog_miscdev = {
  707. .minor = WATCHDOG_MINOR,
  708. .name = "watchdog",
  709. .fops = &ipmi_wdog_fops
  710. };
  711. static void ipmi_wdog_msg_handler(struct ipmi_recv_msg *msg,
  712. void *handler_data)
  713. {
  714. if (msg->msg.data[0] != 0) {
  715. printk(KERN_ERR PFX "response: Error %x on cmd %x\n",
  716. msg->msg.data[0],
  717. msg->msg.cmd);
  718. }
  719. ipmi_free_recv_msg(msg);
  720. }
  721. static void ipmi_wdog_pretimeout_handler(void *handler_data)
  722. {
  723. if (preaction_val != WDOG_PRETIMEOUT_NONE) {
  724. if (preop_val == WDOG_PREOP_PANIC) {
  725. if (atomic_inc_and_test(&preop_panic_excl))
  726. panic("Watchdog pre-timeout");
  727. } else if (preop_val == WDOG_PREOP_GIVE_DATA) {
  728. spin_lock(&ipmi_read_lock);
  729. data_to_read = 1;
  730. wake_up_interruptible(&read_q);
  731. kill_fasync(&fasync_q, SIGIO, POLL_IN);
  732. spin_unlock(&ipmi_read_lock);
  733. }
  734. }
  735. /* On some machines, the heartbeat will give
  736. an error and not work unless we re-enable
  737. the timer. So do so. */
  738. pretimeout_since_last_heartbeat = 1;
  739. }
  740. static struct ipmi_user_hndl ipmi_hndlrs =
  741. {
  742. .ipmi_recv_hndl = ipmi_wdog_msg_handler,
  743. .ipmi_watchdog_pretimeout = ipmi_wdog_pretimeout_handler
  744. };
  745. static void ipmi_register_watchdog(int ipmi_intf)
  746. {
  747. int rv = -EBUSY;
  748. down_write(&register_sem);
  749. if (watchdog_user)
  750. goto out;
  751. if ((ifnum_to_use >= 0) && (ifnum_to_use != ipmi_intf))
  752. goto out;
  753. watchdog_ifnum = ipmi_intf;
  754. rv = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &watchdog_user);
  755. if (rv < 0) {
  756. printk(KERN_CRIT PFX "Unable to register with ipmi\n");
  757. goto out;
  758. }
  759. ipmi_get_version(watchdog_user,
  760. &ipmi_version_major,
  761. &ipmi_version_minor);
  762. rv = misc_register(&ipmi_wdog_miscdev);
  763. if (rv < 0) {
  764. ipmi_destroy_user(watchdog_user);
  765. watchdog_user = NULL;
  766. printk(KERN_CRIT PFX "Unable to register misc device\n");
  767. }
  768. out:
  769. up_write(&register_sem);
  770. if ((start_now) && (rv == 0)) {
  771. /* Run from startup, so start the timer now. */
  772. start_now = 0; /* Disable this function after first startup. */
  773. ipmi_watchdog_state = action_val;
  774. ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB);
  775. printk(KERN_INFO PFX "Starting now!\n");
  776. }
  777. }
  778. static void ipmi_unregister_watchdog(int ipmi_intf)
  779. {
  780. int rv;
  781. down_write(&register_sem);
  782. if (!watchdog_user)
  783. goto out;
  784. if (watchdog_ifnum != ipmi_intf)
  785. goto out;
  786. /* Make sure no one can call us any more. */
  787. misc_deregister(&ipmi_wdog_miscdev);
  788. /* Wait to make sure the message makes it out. The lower layer has
  789. pointers to our buffers, we want to make sure they are done before
  790. we release our memory. */
  791. while (atomic_read(&set_timeout_tofree))
  792. schedule_timeout_uninterruptible(1);
  793. /* Disconnect from IPMI. */
  794. rv = ipmi_destroy_user(watchdog_user);
  795. if (rv) {
  796. printk(KERN_WARNING PFX "error unlinking from IPMI: %d\n",
  797. rv);
  798. }
  799. watchdog_user = NULL;
  800. out:
  801. up_write(&register_sem);
  802. }
  803. #ifdef HAVE_NMI_HANDLER
  804. static int
  805. ipmi_nmi(void *dev_id, int cpu, int handled)
  806. {
  807. /* If we are not expecting a timeout, ignore it. */
  808. if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
  809. return NOTIFY_DONE;
  810. /* If no one else handled the NMI, we assume it was the IPMI
  811. watchdog. */
  812. if ((!handled) && (preop_val == WDOG_PREOP_PANIC)) {
  813. /* On some machines, the heartbeat will give
  814. an error and not work unless we re-enable
  815. the timer. So do so. */
  816. pretimeout_since_last_heartbeat = 1;
  817. if (atomic_inc_and_test(&preop_panic_excl))
  818. panic(PFX "pre-timeout");
  819. }
  820. return NOTIFY_DONE;
  821. }
  822. static struct nmi_handler ipmi_nmi_handler =
  823. {
  824. .link = LIST_HEAD_INIT(ipmi_nmi_handler.link),
  825. .dev_name = "ipmi_watchdog",
  826. .dev_id = NULL,
  827. .handler = ipmi_nmi,
  828. .priority = 0, /* Call us last. */
  829. };
  830. int nmi_handler_registered;
  831. #endif
  832. static int wdog_reboot_handler(struct notifier_block *this,
  833. unsigned long code,
  834. void *unused)
  835. {
  836. static int reboot_event_handled = 0;
  837. if ((watchdog_user) && (!reboot_event_handled)) {
  838. /* Make sure we only do this once. */
  839. reboot_event_handled = 1;
  840. if (code == SYS_DOWN || code == SYS_HALT) {
  841. /* Disable the WDT if we are shutting down. */
  842. ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
  843. panic_halt_ipmi_set_timeout();
  844. } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
  845. /* Set a long timer to let the reboot happens, but
  846. reboot if it hangs, but only if the watchdog
  847. timer was already running. */
  848. timeout = 120;
  849. pretimeout = 0;
  850. ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
  851. panic_halt_ipmi_set_timeout();
  852. }
  853. }
  854. return NOTIFY_OK;
  855. }
  856. static struct notifier_block wdog_reboot_notifier = {
  857. .notifier_call = wdog_reboot_handler,
  858. .next = NULL,
  859. .priority = 0
  860. };
  861. static int wdog_panic_handler(struct notifier_block *this,
  862. unsigned long event,
  863. void *unused)
  864. {
  865. static int panic_event_handled = 0;
  866. /* On a panic, if we have a panic timeout, make sure to extend
  867. the watchdog timer to a reasonable value to complete the
  868. panic, if the watchdog timer is running. Plus the
  869. pretimeout is meaningless at panic time. */
  870. if (watchdog_user && !panic_event_handled &&
  871. ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
  872. /* Make sure we do this only once. */
  873. panic_event_handled = 1;
  874. timeout = 255;
  875. pretimeout = 0;
  876. panic_halt_ipmi_set_timeout();
  877. }
  878. return NOTIFY_OK;
  879. }
  880. static struct notifier_block wdog_panic_notifier = {
  881. .notifier_call = wdog_panic_handler,
  882. .next = NULL,
  883. .priority = 150 /* priority: INT_MAX >= x >= 0 */
  884. };
  885. static void ipmi_new_smi(int if_num, struct device *device)
  886. {
  887. ipmi_register_watchdog(if_num);
  888. }
  889. static void ipmi_smi_gone(int if_num)
  890. {
  891. ipmi_unregister_watchdog(if_num);
  892. }
  893. static struct ipmi_smi_watcher smi_watcher =
  894. {
  895. .owner = THIS_MODULE,
  896. .new_smi = ipmi_new_smi,
  897. .smi_gone = ipmi_smi_gone
  898. };
  899. static int action_op(const char *inval, char *outval)
  900. {
  901. if (outval)
  902. strcpy(outval, action);
  903. if (!inval)
  904. return 0;
  905. if (strcmp(inval, "reset") == 0)
  906. action_val = WDOG_TIMEOUT_RESET;
  907. else if (strcmp(inval, "none") == 0)
  908. action_val = WDOG_TIMEOUT_NONE;
  909. else if (strcmp(inval, "power_cycle") == 0)
  910. action_val = WDOG_TIMEOUT_POWER_CYCLE;
  911. else if (strcmp(inval, "power_off") == 0)
  912. action_val = WDOG_TIMEOUT_POWER_DOWN;
  913. else
  914. return -EINVAL;
  915. strcpy(action, inval);
  916. return 0;
  917. }
  918. static int preaction_op(const char *inval, char *outval)
  919. {
  920. if (outval)
  921. strcpy(outval, preaction);
  922. if (!inval)
  923. return 0;
  924. if (strcmp(inval, "pre_none") == 0)
  925. preaction_val = WDOG_PRETIMEOUT_NONE;
  926. else if (strcmp(inval, "pre_smi") == 0)
  927. preaction_val = WDOG_PRETIMEOUT_SMI;
  928. #ifdef HAVE_NMI_HANDLER
  929. else if (strcmp(inval, "pre_nmi") == 0)
  930. preaction_val = WDOG_PRETIMEOUT_NMI;
  931. #endif
  932. else if (strcmp(inval, "pre_int") == 0)
  933. preaction_val = WDOG_PRETIMEOUT_MSG_INT;
  934. else
  935. return -EINVAL;
  936. strcpy(preaction, inval);
  937. return 0;
  938. }
  939. static int preop_op(const char *inval, char *outval)
  940. {
  941. if (outval)
  942. strcpy(outval, preop);
  943. if (!inval)
  944. return 0;
  945. if (strcmp(inval, "preop_none") == 0)
  946. preop_val = WDOG_PREOP_NONE;
  947. else if (strcmp(inval, "preop_panic") == 0)
  948. preop_val = WDOG_PREOP_PANIC;
  949. else if (strcmp(inval, "preop_give_data") == 0)
  950. preop_val = WDOG_PREOP_GIVE_DATA;
  951. else
  952. return -EINVAL;
  953. strcpy(preop, inval);
  954. return 0;
  955. }
  956. static void check_parms(void)
  957. {
  958. #ifdef HAVE_NMI_HANDLER
  959. int do_nmi = 0;
  960. int rv;
  961. if (preaction_val == WDOG_PRETIMEOUT_NMI) {
  962. do_nmi = 1;
  963. if (preop_val == WDOG_PREOP_GIVE_DATA) {
  964. printk(KERN_WARNING PFX "Pretimeout op is to give data"
  965. " but NMI pretimeout is enabled, setting"
  966. " pretimeout op to none\n");
  967. preop_op("preop_none", NULL);
  968. do_nmi = 0;
  969. }
  970. #ifdef CONFIG_X86_LOCAL_APIC
  971. if (nmi_watchdog == NMI_IO_APIC) {
  972. printk(KERN_WARNING PFX "nmi_watchdog is set to IO APIC"
  973. " mode (value is %d), that is incompatible"
  974. " with using NMI in the IPMI watchdog."
  975. " Disabling IPMI nmi pretimeout.\n",
  976. nmi_watchdog);
  977. preaction_val = WDOG_PRETIMEOUT_NONE;
  978. do_nmi = 0;
  979. }
  980. #endif
  981. }
  982. if (do_nmi && !nmi_handler_registered) {
  983. rv = request_nmi(&ipmi_nmi_handler);
  984. if (rv) {
  985. printk(KERN_WARNING PFX
  986. "Can't register nmi handler\n");
  987. return;
  988. } else
  989. nmi_handler_registered = 1;
  990. } else if (!do_nmi && nmi_handler_registered) {
  991. release_nmi(&ipmi_nmi_handler);
  992. nmi_handler_registered = 0;
  993. }
  994. #endif
  995. }
  996. static int __init ipmi_wdog_init(void)
  997. {
  998. int rv;
  999. if (action_op(action, NULL)) {
  1000. action_op("reset", NULL);
  1001. printk(KERN_INFO PFX "Unknown action '%s', defaulting to"
  1002. " reset\n", action);
  1003. }
  1004. if (preaction_op(preaction, NULL)) {
  1005. preaction_op("pre_none", NULL);
  1006. printk(KERN_INFO PFX "Unknown preaction '%s', defaulting to"
  1007. " none\n", preaction);
  1008. }
  1009. if (preop_op(preop, NULL)) {
  1010. preop_op("preop_none", NULL);
  1011. printk(KERN_INFO PFX "Unknown preop '%s', defaulting to"
  1012. " none\n", preop);
  1013. }
  1014. check_parms();
  1015. register_reboot_notifier(&wdog_reboot_notifier);
  1016. atomic_notifier_chain_register(&panic_notifier_list,
  1017. &wdog_panic_notifier);
  1018. rv = ipmi_smi_watcher_register(&smi_watcher);
  1019. if (rv) {
  1020. #ifdef HAVE_NMI_HANDLER
  1021. if (preaction_val == WDOG_PRETIMEOUT_NMI)
  1022. release_nmi(&ipmi_nmi_handler);
  1023. #endif
  1024. atomic_notifier_chain_unregister(&panic_notifier_list,
  1025. &wdog_panic_notifier);
  1026. unregister_reboot_notifier(&wdog_reboot_notifier);
  1027. printk(KERN_WARNING PFX "can't register smi watcher\n");
  1028. return rv;
  1029. }
  1030. printk(KERN_INFO PFX "driver initialized\n");
  1031. return 0;
  1032. }
  1033. static void __exit ipmi_wdog_exit(void)
  1034. {
  1035. ipmi_smi_watcher_unregister(&smi_watcher);
  1036. ipmi_unregister_watchdog(watchdog_ifnum);
  1037. #ifdef HAVE_NMI_HANDLER
  1038. if (nmi_handler_registered)
  1039. release_nmi(&ipmi_nmi_handler);
  1040. #endif
  1041. atomic_notifier_chain_unregister(&panic_notifier_list,
  1042. &wdog_panic_notifier);
  1043. unregister_reboot_notifier(&wdog_reboot_notifier);
  1044. }
  1045. module_exit(ipmi_wdog_exit);
  1046. module_init(ipmi_wdog_init);
  1047. MODULE_LICENSE("GPL");
  1048. MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
  1049. MODULE_DESCRIPTION("watchdog timer based upon the IPMI interface.");