Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
ipmi_watchdog.c File Reference
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <linux/mutex.h>
#include <linux/watchdog.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
#include <linux/completion.h>
#include <linux/kdebug.h>
#include <linux/rwsem.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <linux/notifier.h>
#include <linux/nmi.h>
#include <linux/reboot.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/atomic.h>

Go to the source code of this file.

Macros

#define PFX   "IPMI Watchdog: "
 
#define WDOG_DONT_LOG   (1 << 7)
 
#define WDOG_DONT_STOP_ON_SET   (1 << 6)
 
#define WDOG_SET_TIMER_USE(byte, use)   byte = ((byte) & 0xf8) | ((use) & 0x7)
 
#define WDOG_GET_TIMER_USE(byte)   ((byte) & 0x7)
 
#define WDOG_TIMER_USE_BIOS_FRB2   1
 
#define WDOG_TIMER_USE_BIOS_POST   2
 
#define WDOG_TIMER_USE_OS_LOAD   3
 
#define WDOG_TIMER_USE_SMS_OS   4
 
#define WDOG_TIMER_USE_OEM   5
 
#define WDOG_SET_PRETIMEOUT_ACT(byte, use)   byte = ((byte) & 0x8f) | (((use) & 0x7) << 4)
 
#define WDOG_GET_PRETIMEOUT_ACT(byte)   (((byte) >> 4) & 0x7)
 
#define WDOG_PRETIMEOUT_NONE   0
 
#define WDOG_PRETIMEOUT_SMI   1
 
#define WDOG_PRETIMEOUT_NMI   2
 
#define WDOG_PRETIMEOUT_MSG_INT   3
 
#define WDOG_PREOP_NONE   0
 
#define WDOG_PREOP_PANIC   1
 
#define WDOG_PREOP_GIVE_DATA   2
 
#define WDOG_SET_TIMEOUT_ACT(byte, use)   byte = ((byte) & 0xf8) | ((use) & 0x7)
 
#define WDOG_GET_TIMEOUT_ACT(byte)   ((byte) & 0x7)
 
#define WDOG_TIMEOUT_NONE   0
 
#define WDOG_TIMEOUT_RESET   1
 
#define WDOG_TIMEOUT_POWER_DOWN   2
 
#define WDOG_TIMEOUT_POWER_CYCLE   3
 
#define WDOG_EXPIRE_CLEAR_BIOS_FRB2   (1 << 1)
 
#define WDOG_EXPIRE_CLEAR_BIOS_POST   (1 << 2)
 
#define WDOG_EXPIRE_CLEAR_OS_LOAD   (1 << 3)
 
#define WDOG_EXPIRE_CLEAR_SMS_OS   (1 << 4)
 
#define WDOG_EXPIRE_CLEAR_OEM   (1 << 5)
 
#define WDOG_SET_TIMEOUT(byte1, byte2, val)   (byte1) = (((val) * 10) & 0xff), (byte2) = (((val) * 10) >> 8)
 
#define WDOG_GET_TIMEOUT(byte1, byte2)   (((byte1) | ((byte2) << 8)) / 10)
 
#define IPMI_WDOG_RESET_TIMER   0x22
 
#define IPMI_WDOG_SET_TIMER   0x24
 
#define IPMI_WDOG_GET_TIMER   0x25
 
#define IPMI_WDOG_TIMER_NOT_INIT_RESP   0x80
 
#define IPMI_SET_TIMEOUT_NO_HB   0
 
#define IPMI_SET_TIMEOUT_HB_IF_NECESSARY   1
 
#define IPMI_SET_TIMEOUT_FORCE_HB   2
 
#define param_check_timeout   param_check_int
 
#define param_check_wdog_ifnum   param_check_int
 

Typedefs

typedef int(* action_fn )(const char *intval, char *outval)
 

Functions

 module_param (ifnum_to_use, wdog_ifnum, 0644)
 
 MODULE_PARM_DESC (ifnum_to_use,"The interface number to use for the watchdog ""timer. Setting to -1 defaults to the first registered ""interface")
 
 module_param (timeout, timeout, 0644)
 
 MODULE_PARM_DESC (timeout,"Timeout value in seconds.")
 
 module_param (pretimeout, timeout, 0644)
 
 MODULE_PARM_DESC (pretimeout,"Pretimeout value in seconds.")
 
 module_param_cb (action,&param_ops_str, action_op, 0644)
 
 MODULE_PARM_DESC (action,"Timeout action. One of: ""reset, none, power_cycle, power_off.")
 
 module_param_cb (preaction,&param_ops_str, preaction_op, 0644)
 
 MODULE_PARM_DESC (preaction,"Pretimeout action. One of: ""pre_none, pre_smi, pre_nmi, pre_int.")
 
 module_param_cb (preop,&param_ops_str, preop_op, 0644)
 
 MODULE_PARM_DESC (preop,"Pretimeout driver operation. One of: ""preop_none, preop_panic, preop_give_data.")
 
 module_param (start_now, int, 0444)
 
 MODULE_PARM_DESC (start_now,"Set to 1 to start the watchdog as""soon as the driver is loaded.")
 
 module_param (nowayout, bool, 0644)
 
 MODULE_PARM_DESC (nowayout,"Watchdog cannot be stopped once started ""(default=CONFIG_WATCHDOG_NOWAYOUT)")
 
 module_exit (ipmi_wdog_exit)
 
 module_init (ipmi_wdog_init)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Corey Minyard <[email protected]>")
 
 MODULE_DESCRIPTION ("watchdog timer based upon the IPMI interface.")
 

Macro Definition Documentation

#define IPMI_SET_TIMEOUT_FORCE_HB   2

Definition at line 180 of file ipmi_watchdog.c.

#define IPMI_SET_TIMEOUT_HB_IF_NECESSARY   1

Definition at line 179 of file ipmi_watchdog.c.

#define IPMI_SET_TIMEOUT_NO_HB   0

Definition at line 178 of file ipmi_watchdog.c.

#define IPMI_WDOG_GET_TIMER   0x25

Definition at line 140 of file ipmi_watchdog.c.

#define IPMI_WDOG_RESET_TIMER   0x22

Definition at line 138 of file ipmi_watchdog.c.

#define IPMI_WDOG_SET_TIMER   0x24

Definition at line 139 of file ipmi_watchdog.c.

#define IPMI_WDOG_TIMER_NOT_INIT_RESP   0x80

Definition at line 142 of file ipmi_watchdog.c.

#define param_check_timeout   param_check_int

Definition at line 215 of file ipmi_watchdog.c.

#define param_check_wdog_ifnum   param_check_int

Definition at line 278 of file ipmi_watchdog.c.

#define PFX   "IPMI Watchdog: "

Definition at line 72 of file ipmi_watchdog.c.

#define WDOG_DONT_LOG   (1 << 7)

Definition at line 79 of file ipmi_watchdog.c.

#define WDOG_DONT_STOP_ON_SET   (1 << 6)

Definition at line 80 of file ipmi_watchdog.c.

#define WDOG_EXPIRE_CLEAR_BIOS_FRB2   (1 << 1)

Definition at line 120 of file ipmi_watchdog.c.

#define WDOG_EXPIRE_CLEAR_BIOS_POST   (1 << 2)

Definition at line 121 of file ipmi_watchdog.c.

#define WDOG_EXPIRE_CLEAR_OEM   (1 << 5)

Definition at line 124 of file ipmi_watchdog.c.

#define WDOG_EXPIRE_CLEAR_OS_LOAD   (1 << 3)

Definition at line 122 of file ipmi_watchdog.c.

#define WDOG_EXPIRE_CLEAR_SMS_OS   (1 << 4)

Definition at line 123 of file ipmi_watchdog.c.

#define WDOG_GET_PRETIMEOUT_ACT (   byte)    (((byte) >> 4) & 0x7)

Definition at line 93 of file ipmi_watchdog.c.

#define WDOG_GET_TIMEOUT (   byte1,
  byte2 
)    (((byte1) | ((byte2) << 8)) / 10)

Definition at line 135 of file ipmi_watchdog.c.

#define WDOG_GET_TIMEOUT_ACT (   byte)    ((byte) & 0x7)

Definition at line 108 of file ipmi_watchdog.c.

#define WDOG_GET_TIMER_USE (   byte)    ((byte) & 0x7)

Definition at line 83 of file ipmi_watchdog.c.

#define WDOG_PREOP_GIVE_DATA   2

Definition at line 103 of file ipmi_watchdog.c.

#define WDOG_PREOP_NONE   0

Definition at line 100 of file ipmi_watchdog.c.

#define WDOG_PREOP_PANIC   1

Definition at line 101 of file ipmi_watchdog.c.

#define WDOG_PRETIMEOUT_MSG_INT   3

Definition at line 97 of file ipmi_watchdog.c.

#define WDOG_PRETIMEOUT_NMI   2

Definition at line 96 of file ipmi_watchdog.c.

#define WDOG_PRETIMEOUT_NONE   0

Definition at line 94 of file ipmi_watchdog.c.

#define WDOG_PRETIMEOUT_SMI   1

Definition at line 95 of file ipmi_watchdog.c.

#define WDOG_SET_PRETIMEOUT_ACT (   byte,
  use 
)    byte = ((byte) & 0x8f) | (((use) & 0x7) << 4)

Definition at line 91 of file ipmi_watchdog.c.

#define WDOG_SET_TIMEOUT (   byte1,
  byte2,
  val 
)    (byte1) = (((val) * 10) & 0xff), (byte2) = (((val) * 10) >> 8)

Definition at line 133 of file ipmi_watchdog.c.

#define WDOG_SET_TIMEOUT_ACT (   byte,
  use 
)    byte = ((byte) & 0xf8) | ((use) & 0x7)

Definition at line 106 of file ipmi_watchdog.c.

#define WDOG_SET_TIMER_USE (   byte,
  use 
)    byte = ((byte) & 0xf8) | ((use) & 0x7)

Definition at line 81 of file ipmi_watchdog.c.

#define WDOG_TIMEOUT_NONE   0

Definition at line 109 of file ipmi_watchdog.c.

#define WDOG_TIMEOUT_POWER_CYCLE   3

Definition at line 112 of file ipmi_watchdog.c.

#define WDOG_TIMEOUT_POWER_DOWN   2

Definition at line 111 of file ipmi_watchdog.c.

#define WDOG_TIMEOUT_RESET   1

Definition at line 110 of file ipmi_watchdog.c.

#define WDOG_TIMER_USE_BIOS_FRB2   1

Definition at line 84 of file ipmi_watchdog.c.

#define WDOG_TIMER_USE_BIOS_POST   2

Definition at line 85 of file ipmi_watchdog.c.

#define WDOG_TIMER_USE_OEM   5

Definition at line 88 of file ipmi_watchdog.c.

#define WDOG_TIMER_USE_OS_LOAD   3

Definition at line 86 of file ipmi_watchdog.c.

#define WDOG_TIMER_USE_SMS_OS   4

Definition at line 87 of file ipmi_watchdog.c.

Typedef Documentation

typedef int(* action_fn)(const char *intval, char *outval)

Definition at line 217 of file ipmi_watchdog.c.

Function Documentation

MODULE_AUTHOR ( "Corey Minyard <[email protected]>"  )
MODULE_DESCRIPTION ( "watchdog timer based upon the IPMI interface."  )
module_exit ( ipmi_wdog_exit  )
module_init ( ipmi_wdog_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( ifnum_to_use  ,
wdog_ifnum  ,
0644   
)
module_param ( timeout  ,
timeout  ,
0644   
)
module_param ( pretimeout  ,
timeout  ,
0644   
)
module_param ( start_now  ,
int  ,
0444   
)
module_param ( nowayout  ,
bool  ,
0644   
)
module_param_cb ( action  ,
param_ops_str,
action_op  ,
0644   
)
module_param_cb ( preaction  ,
param_ops_str,
preaction_op  ,
0644   
)
module_param_cb ( preop  ,
param_ops_str,
preop_op  ,
0644   
)
MODULE_PARM_DESC ( ifnum_to_use  ,
"The interface number to use for the watchdog ""timer. Setting to -1 defaults to the first registered ""interface  
)
MODULE_PARM_DESC ( timeout  ,
"Timeout value in seconds."   
)
MODULE_PARM_DESC ( pretimeout  ,
"Pretimeout value in seconds."   
)
MODULE_PARM_DESC ( action  ,
"Timeout action. One of: ""  reset,
none  ,
power_cycle  ,
power_off."   
)
MODULE_PARM_DESC ( preaction  ,
"Pretimeout action. One of: ""  pre_none,
pre_smi  ,
pre_nmi  ,
pre_int."   
)
MODULE_PARM_DESC ( preop  ,
"Pretimeout driver operation. One of: ""  preop_none,
preop_panic  ,
preop_give_data."   
)
MODULE_PARM_DESC ( start_now  ,
"Set to 1 to start the watchdog as""soon as the driver is loaded."   
)
MODULE_PARM_DESC ( nowayout  ,
"Watchdog cannot be stopped once started ""(default=CONFIG_WATCHDOG_NOWAYOUT)"   
)