diff options
author | Corey Minyard <minyard@acm.org> | 2006-12-06 23:41:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:47 -0500 |
commit | b9675136e2ad95156fb93be6155f17590bb26fd7 (patch) | |
tree | 009bff8e0074774317b7f3921ed85122cf15bba9 /include | |
parent | b2c03941b50944a268ee4d5823872f220809a3ba (diff) |
[PATCH] 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.
Add 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 <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ipmi.h | 45 | ||||
-rw-r--r-- | include/linux/ipmi_msgdefs.h | 5 | ||||
-rw-r--r-- | include/linux/ipmi_smi.h | 7 |
3 files changed, 57 insertions, 0 deletions
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 796ca009fd46..7a9db390c56a 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -208,6 +208,15 @@ struct kernel_ipmi_msg | |||
208 | code as the first byte of the incoming data, unlike a response. */ | 208 | code as the first byte of the incoming data, unlike a response. */ |
209 | 209 | ||
210 | 210 | ||
211 | /* | ||
212 | * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO | ||
213 | * setting is the default and means it will be set on certain | ||
214 | * commands. Hard setting it on and off will override automatic | ||
215 | * operation. | ||
216 | */ | ||
217 | #define IPMI_MAINTENANCE_MODE_AUTO 0 | ||
218 | #define IPMI_MAINTENANCE_MODE_OFF 1 | ||
219 | #define IPMI_MAINTENANCE_MODE_ON 2 | ||
211 | 220 | ||
212 | #ifdef __KERNEL__ | 221 | #ifdef __KERNEL__ |
213 | 222 | ||
@@ -374,6 +383,35 @@ int ipmi_unregister_for_cmd(ipmi_user_t user, | |||
374 | unsigned int chans); | 383 | unsigned int chans); |
375 | 384 | ||
376 | /* | 385 | /* |
386 | * Go into a mode where the driver will not autonomously attempt to do | ||
387 | * things with the interface. It will still respond to attentions and | ||
388 | * interrupts, and it will expect that commands will complete. It | ||
389 | * will not automatcially check for flags, events, or things of that | ||
390 | * nature. | ||
391 | * | ||
392 | * This is primarily used for firmware upgrades. The idea is that | ||
393 | * when you go into firmware upgrade mode, you do this operation | ||
394 | * and the driver will not attempt to do anything but what you tell | ||
395 | * it or what the BMC asks for. | ||
396 | * | ||
397 | * Note that if you send a command that resets the BMC, the driver | ||
398 | * will still expect a response from that command. So the BMC should | ||
399 | * reset itself *after* the response is sent. Resetting before the | ||
400 | * response is just silly. | ||
401 | * | ||
402 | * If in auto maintenance mode, the driver will automatically go into | ||
403 | * maintenance mode for 30 seconds if it sees a cold reset, a warm | ||
404 | * reset, or a firmware NetFN. This means that code that uses only | ||
405 | * firmware NetFN commands to do upgrades will work automatically | ||
406 | * without change, assuming it sends a message every 30 seconds or | ||
407 | * less. | ||
408 | * | ||
409 | * See the IPMI_MAINTENANCE_MODE_xxx defines for what the mode means. | ||
410 | */ | ||
411 | int ipmi_get_maintenance_mode(ipmi_user_t user); | ||
412 | int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); | ||
413 | |||
414 | /* | ||
377 | * Allow run-to-completion mode to be set for the interface of | 415 | * Allow run-to-completion mode to be set for the interface of |
378 | * a specific user. | 416 | * a specific user. |
379 | */ | 417 | */ |
@@ -656,4 +694,11 @@ struct ipmi_timing_parms | |||
656 | #define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ | 694 | #define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ |
657 | struct ipmi_timing_parms) | 695 | struct ipmi_timing_parms) |
658 | 696 | ||
697 | /* | ||
698 | * Set the maintenance mode. See ipmi_set_maintenance_mode() above | ||
699 | * for a description of what this does. | ||
700 | */ | ||
701 | #define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int) | ||
702 | #define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int) | ||
703 | |||
659 | #endif /* __LINUX_IPMI_H */ | 704 | #endif /* __LINUX_IPMI_H */ |
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h index 4d04d8b58a0a..8d6759cc1a71 100644 --- a/include/linux/ipmi_msgdefs.h +++ b/include/linux/ipmi_msgdefs.h | |||
@@ -46,6 +46,8 @@ | |||
46 | #define IPMI_NETFN_APP_REQUEST 0x06 | 46 | #define IPMI_NETFN_APP_REQUEST 0x06 |
47 | #define IPMI_NETFN_APP_RESPONSE 0x07 | 47 | #define IPMI_NETFN_APP_RESPONSE 0x07 |
48 | #define IPMI_GET_DEVICE_ID_CMD 0x01 | 48 | #define IPMI_GET_DEVICE_ID_CMD 0x01 |
49 | #define IPMI_COLD_RESET_CMD 0x02 | ||
50 | #define IPMI_WARM_RESET_CMD 0x03 | ||
49 | #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 | 51 | #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 |
50 | #define IPMI_GET_DEVICE_GUID_CMD 0x08 | 52 | #define IPMI_GET_DEVICE_GUID_CMD 0x08 |
51 | #define IPMI_GET_MSG_FLAGS_CMD 0x31 | 53 | #define IPMI_GET_MSG_FLAGS_CMD 0x31 |
@@ -60,6 +62,9 @@ | |||
60 | #define IPMI_NETFN_STORAGE_RESPONSE 0x0b | 62 | #define IPMI_NETFN_STORAGE_RESPONSE 0x0b |
61 | #define IPMI_ADD_SEL_ENTRY_CMD 0x44 | 63 | #define IPMI_ADD_SEL_ENTRY_CMD 0x44 |
62 | 64 | ||
65 | #define IPMI_NETFN_FIRMWARE_REQUEST 0x08 | ||
66 | #define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 | ||
67 | |||
63 | /* The default slave address */ | 68 | /* The default slave address */ |
64 | #define IPMI_BMC_SLAVE_ADDR 0x20 | 69 | #define IPMI_BMC_SLAVE_ADDR 0x20 |
65 | 70 | ||
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 2cc960da4176..c0633108d05d 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -115,6 +115,13 @@ struct ipmi_smi_handlers | |||
115 | poll for operations during things like crash dumps. */ | 115 | poll for operations during things like crash dumps. */ |
116 | void (*poll)(void *send_info); | 116 | void (*poll)(void *send_info); |
117 | 117 | ||
118 | /* Enable/disable firmware maintenance mode. Note that this | ||
119 | is *not* the modes defined, this is simply an on/off | ||
120 | setting. The message handler does the mode handling. Note | ||
121 | that this is called from interupt context, so it cannot | ||
122 | block. */ | ||
123 | void (*set_maintenance_mode)(void *send_info, int enable); | ||
124 | |||
118 | /* Tell the handler that we are using it/not using it. The | 125 | /* Tell the handler that we are using it/not using it. The |
119 | message handler get the modules that this handler belongs | 126 | message handler get the modules that this handler belongs |
120 | to; this function lets the SMI claim any modules that it | 127 | to; this function lets the SMI claim any modules that it |