IPMI driver updates, part 1a
Subsystems (2)
PATCH 1/1 IPMI driver updates, part 1a
It looks like part 1 of the IPMI driver updates was a little too big to get through. So I've split it up. Part 1a and part1b must both be applied. Here's the original message. Also, this is for the 2.6.3 kernel.
It has been far too long since the last IPMI driver updates, but now all the planets have aligned and all the pieces I needed are in and all seem to be working. This update is coming as four parts that must be applied in order, but the later parts do not have to be applied for the former parts to work.
This first part does basic updates to the IPMI infrastructure. It adds support for messaging through an IPMI LAN interface, which is required for some system software that already exists on other IPMI drivers. It also does some renaming (in preparation for one of the later patches) and a lot of little cleanups.
FYI, IPMI is a standard for monitoring and maintaining a system. It provides interfaces for detecting sensors (voltage, temperature, etc.) in the system and monitoring those sensors. Many systems have extended capabilities that allow IPMI to control the system, doing things like lighting leds and controlling hot-swap. This driver allows access to the IPMI system.
-Corey
Documentation/IPMI.txt +55 -7
@@ -22,6 +22,49 @@ http://www.intel.com/design/servers/ipmi/index.htm. IPMI is a big subject and I can't cover it all here! +Configuration +------------- + +The LinuxIPMI driver is modular, which means you have to pick several +things to have it work right depending on your hardware. Most of +these are available in the 'Character Devices' menu. + +No matter what, you must pick 'IPMI top-level message handler' to use +IPMI. What you do beyond that depends on your needs and hardware. + +The message handler does not provide any user-level interfaces. +Kernel code (like the watchdog) can still use it. If you need access +from userland, you need to select 'Device interface for IPMI' if you +want access through a device driver. Another interface is also +available, you may select 'IPMI sockets' in the 'Networking Support' +main menu. This provides a socket interface to IPMI. You may select +both of these at the same time, they will both work together. + +There is also a KCS-only driver interface supplied, most IPMI systems +support KCS, so you need taht. + +You should generally enable ACPI on your system, as systems with IPMI +should have ACPI tables describing them. + +If you have a standard interface and the board manufacturer has done +their job correctly, the IPMI controller should be automatically +detect (via ACPI or SMBIOS tables) and should just work. Sadly, many +boards do not have this information. The driver attempts standard +defaults, but they may not work. If you fall into this situation, you +need to read the section below named 'The SI Driver' on how to +hand-configure your system. + +IPMI defines a standard watchdog timer. You can enable this with the +'IPMI Watchdog Timer' config option. If you compile the driver into +the kernel, then via a kernel command-line option you can have the +watchdog timer start as soon as it intitializes. It also have a lot +of other options, see the 'Watchdog' section below for more details. +Note that you can also have the watchdog continue to run if it is +closed (by default it is disabled on close). Go into the 'Watchdog +Cards' menu, enable 'Watchdog Timer Support', and enable the option +'Disable watchdog shutdown on close'. + + Basic Design ------------
@@ -41,18 +84,19 @@ driver, each open file for this device ties in to the message handler as an IPMI user. -ipmi_kcs_drv - A driver for the KCS SMI. Most system have a KCS +ipmi_kcs_drv - A driver for the KCS SI. Most systems have a KCS interface for IPMI. Much documentation for the interface is in the include files. The IPMI include files are: -ipmi.h - Contains the user interface and IOCTL interface for IPMI. +linux/ipmi.h - Contains the user interface and IOCTL interface for IPMI. -ipmi_smi.h - Contains the interface for SMI drivers to use. +linux/ipmi_smi.h - Contains the interface for system management interfaces +(things that interface to IPMI controllers) to use. -ipmi_msgdefs.h - General definitions for base IPMI messaging. +linux/ipmi_msgdefs.h - General definitions for base IPMI messaging. Addressing
@@ -260,8 +304,8 @@ in the order they register, although if an SMI unregisters and then another one registers, all bets are off. -The ipmi_smi.h defines the interface for SMIs, see that for more -details. +The ipmi_smi.h defines the interface for management interfaces, see +that for more details. The KCS Driver
@@ -313,6 +357,7 @@ ------------ Watchdog +-------- A watchdog timer is provided that implements the Linux-standard watchdog timer interface. It has three module parameters that can be
@@ -323,7 +368,10 @@ The timeout is the number of seconds to the action, and the pretimeout is the amount of seconds before the reset that the pre-timeout panic will -occur (if pretimeout is zero, then pretimeout will not be enabled). +occur (if pretimeout is zero, then pretimeout will not be enabled). Note +that the pretimeout is the time before the final timeout. So if the +timeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout +will occur in 40 second (10 seconds before the timeout). The action may be "reset", "power_cycle", or "power_off", and specifies what to do when the timer times out, and defaults to
drivers/char/ipmi/ipmi_devintf.c +106 -52
237 lines not on this page · raw message
drivers/char/ipmi/ipmi_watchdog.c +18 -3
@@ -50,6 +50,8 @@#include <asm/apic.h> #endif +#define IPMI_WATCHDOG_VERSION "v30" +/* * The IPMI command/response information for the watchdog timer. */
@@ -153,10 +155,18 @@static char pretimeout_since_last_heartbeat =0 ;MODULE_PARM (timeout,"i" ); +MODULE_PARM_DESC (timeout,"Timeout value in seconds." );MODULE_PARM (pretimeout,"i" ); +MODULE_PARM_DESC (pretimeout,"Pretimeout value in seconds." );MODULE_PARM (action,"s" ); +MODULE_PARM_DESC (action,"Timeout action. One of: " +"reset, none, power_cycle, power_off." );MODULE_PARM (preaction,"s" ); +MODULE_PARM_DESC (preaction,"Pretimeout action. One of: " +"pre_none, pre_smi, pre_nmi, pre_int." );MODULE_PARM (preop,"s" ); +MODULE_PARM_DESC (preop,"Pretimeout driver operation. One of: " +"preop_none, preop_panic, preop_give_data." );/* Default state of the timer. */ static unsigned char ipmi_watchdog_state =WDOG_TIMEOUT_NONE ;
@@ -260,6 +270,7 @@ (struct ipmi_addr *) &addr,0 , &msg, +NULL , smi_msg, recv_msg, 1);
@@ -435,6 +446,7 @@ (struct ipmi_addr *) &addr,0 , &msg, +NULL , &heartbeat_smi_msg, &heartbeat_recv_msg, 1);
@@ -483,6 +495,7 @@ (struct ipmi_addr *) &addr,0 , &msg, +NULL , &panic_halt_heartbeat_smi_msg, &panic_halt_heartbeat_recv_msg, 1);
@@ -903,6 +916,7 @@static struct ipmi_smi_watcher smi_watcher = { + .owner =THIS_MODULE , .new_smi = ipmi_new_smi, .smi_gone = ipmi_smi_gone };
@@ -911,6 +925,9 @@ {int rv; +printk (KERN_INFO "IPMI watchdog driver version " +IPMI_WATCHDOG_VERSION "\n" ); +if (strcmp (action,"reset" ) ==0 ) { action_val =WDOG_TIMEOUT_RESET ; }else if (strcmp (action,"none" ) ==0 ) {
@@ -999,9 +1016,6 @@register_reboot_notifier (&wdog_reboot_notifier);notifier_chain_register (&panic_notifier_list, &wdog_panic_notifier); -printk (KERN_INFO "IPMI watchdog by " -"Corey Minyard ([email protected])\n" ); -return 0 ; }
@@ -1034,6 +1048,7 @@pointers to our buffers, we want to make sure they are done before we release our memory. */ while (atomic_read (&set_timeout_tofree)) { +set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 ); }
include/linux/ipmi.h +128 -3
214 lines not on this page · raw message
include/linux/ipmi_msgdefs.h +34 -2
@@ -53,6 +53,7 @@#define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e#define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f#define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 +#define IPMI_GET_CHANNEL_INFO_CMD 0x42#define IPMI_NETFN_STORAGE_REQUEST 0x0a#define IPMI_NETFN_STORAGE_RESPONSE 0x0b
@@ -61,8 +62,39 @@/* The default slave address */ #define IPMI_BMC_SLAVE_ADDR 0x20 -#define IPMI_MAX_MSG_LENGTH 80 +/* The BT interface on high-end HP systems supports up to 255 bytes in +* one transfer. Its "virtual" BMC supports some commands that are longer +* than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus +* some overhead. It would be nice to base this on the "BT Capabilities" +* but that's too hard to propogate to the rest of the driver. */ +#define IPMI_MAX_MSG_LENGTH 272/* multiple of 16 */ -#define IPMI_CC_NO_ERROR 0 +#define IPMI_CC_NO_ERROR 0x00 +#define IPMI_NODE_BUSY_ERR 0xc0 +#define IPMI_ERR_MSG_TRUNCATED 0xc6 +#define IPMI_LOST_ARBITRATION_ERR 0x81 +#define IPMI_ERR_UNSPECIFIED 0xff + +#define IPMI_CHANNEL_PROTOCOL_IPMB 1 +#define IPMI_CHANNEL_PROTOCOL_ICMB 2 +#define IPMI_CHANNEL_PROTOCOL_SMBUS 4 +#define IPMI_CHANNEL_PROTOCOL_KCS 5 +#define IPMI_CHANNEL_PROTOCOL_SMIC 6 +#define IPMI_CHANNEL_PROTOCOL_BT10 7 +#define IPMI_CHANNEL_PROTOCOL_BT15 8 +#define IPMI_CHANNEL_PROTOCOL_TMODE 9 + +#define IPMI_CHANNEL_MEDIUM_IPMB 1 +#define IPMI_CHANNEL_MEDIUM_ICMB10 2 +#define IPMI_CHANNEL_MEDIUM_ICMB09 3 +#define IPMI_CHANNEL_MEDIUM_8023LAN 4 +#define IPMI_CHANNEL_MEDIUM_ASYNC 5 +#define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 +#define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 +#define IPMI_CHANNEL_MEDIUM_SMBUS1 8 +#define IPMI_CHANNEL_MEDIUM_SMBUS2 9 +#define IPMI_CHANNEL_MEDIUM_USB1 10 +#define IPMI_CHANNEL_MEDIUM_USB2 11 +#define IPMI_CHANNEL_MEDIUM_SYSINTF 12#endif /* __LINUX_IPMI_MSGDEFS_H */
include/linux/ipmi_smi.h +10 -4
@@ -35,6 +35,8 @@#define __LINUX_IPMI_SMI_H#include <linux/ipmi_msgdefs.h> +#include <linux/proc_fs.h> +#include <linux/module.h> /* This files describes the interface for IPMI system management interface drivers to bind into the IPMI message handler. */
@@ -48,7 +50,7 @@* been received, it will report this same data structure back up to * the upper layer. If an error occurs, it should fill in the * response with an error code in the completion code location. When -* asyncronous data is received, one of these is allocated, the +* asynchronous data is received, one of these is allocated, the * data_size is set to zero and the response holds the data from the * get message or get event command that the interface initiated. * Note that it is the interfaces responsibility to detect
@@ -62,9 +64,6 @@long msgid;void *user_data; -/* If 0, add to the end of the queue. If 1, add to the beginning. */ -int prio; -int data_size;unsigned char data[IPMI_MAX_MSG_LENGTH ];
@@ -134,4 +133,11 @@ msg->done(msg); } +/* Allow the lower layer to add things to the proc filesystem +directory for this interface. Note that the entry will +automatically be dstroyed when the interface is destroyed. */ +int ipmi_smi_add_proc_entry (ipmi_smi_t smi,char *name, +read_proc_t *read_proc,write_proc_t *write_proc, +void *data,struct module *owner); +#endif /* __LINUX_IPMI_SMI_H */