IPMI: Add maintenance mode
PATCH 5/12 IPMI: Add maintenance mode
Some commands and operations on a BMC can cause the BMC to "go away" for a while. This can cause the automatic flag processing and other things of that nature to timeout and generate annoying logs, or possibly cause other bad things to happen when in firmware update mode.
This patch adds detection of those commands (cold reset, warm reset, and any firmware command) and turns off automatic processing for 30 seconds. It also add a manual override either way.
Signed-off-by Corey Minyard <[email protected]>
drivers/char/ipmi/ipmi_devintf.c +25 -0
@@ -596,6 +596,31 @@ static int ipmi_ioctl(struct inode *ino rv =0 ;break ; } + +case IPMICTL_GET_MAINTENANCE_MODE_CMD : + { +int mode; + + mode =ipmi_get_maintenance_mode (priv->user); +if (copy_to_user (arg, &mode,sizeof (mode))) { + rv = -EFAULT ; +break ; + } + rv =0 ; +break ; + } + +case IPMICTL_SET_MAINTENANCE_MODE_CMD : + { +int mode; + +if (copy_from_user (&mode, arg,sizeof (mode))) { + rv = -EFAULT ; +break ; + } + rv =ipmi_set_maintenance_mode (priv->user, mode); +break ; + } }return rv;
drivers/char/ipmi/ipmi_msghandler.c +116 -1
165 lines not on this page · raw message
drivers/char/ipmi/ipmi_si_intf.c +9 -0
@@ -949,12 +949,21 @@ static int smi_start_processing(voidreturn 0 ; } +static void set_maintenance_mode (void *send_info,int enable) +{ +struct smi_info *smi_info = send_info; + +if (!enable) +atomic_set (&smi_info->req_events,0 ); +} +static struct ipmi_smi_handlers handlers = { .owner =THIS_MODULE , .start_processing = smi_start_processing, .sender = sender, .request_events = request_events, + .set_maintenance_mode = set_maintenance_mode, .set_run_to_completion = set_run_to_completion, .poll = poll, };
include/linux/ipmi.h +45 -0
61 lines not on this page · raw message
include/linux/ipmi_msgdefs.h +5 -0
@@ -46,6 +46,8 @@#define IPMI_NETFN_APP_REQUEST 0x06#define IPMI_NETFN_APP_RESPONSE 0x07#define IPMI_GET_DEVICE_ID_CMD 0x01 +#define IPMI_COLD_RESET_CMD 0x02 +#define IPMI_WARM_RESET_CMD 0x03#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30#define IPMI_GET_DEVICE_GUID_CMD 0x08#define IPMI_GET_MSG_FLAGS_CMD 0x31
@@ -60,6 +62,9 @@#define IPMI_NETFN_STORAGE_RESPONSE 0x0b#define IPMI_ADD_SEL_ENTRY_CMD 0x44 +#define IPMI_NETFN_FIRMWARE_REQUEST 0x08 +#define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 +/* The default slave address */ #define IPMI_BMC_SLAVE_ADDR 0x20
include/linux/ipmi_smi.h +7 -0
@@ -115,6 +115,13 @@ struct ipmi_smi_handlerspoll for operations during things like crash dumps. */ void (*poll)(void *send_info); +/* Enable/disable firmware maintenance mode. Note that this +is *not* the modes defined, this is simply an on/off +setting. The message handler does the mode handling. Note +that this is called from interupt context, so it cannot +block. */ +void (*set_maintenance_mode)(void *send_info,int enable); +/* Tell the handler that we are using it/not using it. The message handler get the modules that this handler belongs to; this function lets the SMI claim any modules that it