Skip to contentSkip to conversation

IPMI driver updates

PATCH Corey Minyard 1 participant 1 message Aug 10, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Some people found some bugs and some missing functions in the IPMI driver, so I have patching things together for the next release. The attached patch moves to version 33 of the driver and contains:

* SMBIOS table support for specifying register spacing. This allows non-contiguous registers to be specified and some machines do this.
* ACPI table updates to support all the possible register sizes and bit offsets into the registers for the IPMI information.
* Support for command line parameters to specify register spacing, sizes, and bit offsets.
* Support for power control with IPMI. This allows a halt to power down a machine with IPMI.
* A fix for a race condition with interrupts enabled on an SMP machine. A lock was released then reclaimed, but there was code later that assumed that had not happened.
* A fix for protecting the driver against bad responses from the controller chip. In the past, the driver had assumed that the controller chip would not give it bad data. This has turned out to be a bad assumption
* ACPI interrupt handlers now return a return value, adjust accordingly.

This patch is relative to 2.5.8-rc4-mm1.

Thank you to all the people who helped me with this.

Documentation/IPMI.txt +25 -0
Index: linux-2.6.8-rc4-mm1/Documentation/IPMI.txt
===================================================================
@@ -340,6 +340,8 @@
   modprobe ipmi_si.o type=<type1>,<type2>....
        ports=<port1>,<port2>... addrs=<addr1>,<addr2>...
        irqs=<irq1>,<irq2>... trydefaults=[0|1]
+       regspacings=<sp1>,<sp2>,... regsizes=<size1>,<size2>,...
+       regshifts=<shift1>,<shift2>,...
 
 Each of these except si_trydefaults is a list, the first item for the
 first interface, second item for the second interface, etc.
@@ -361,12 +363,35 @@
 any interfaces specified by ACPE are tried.  By default, the driver
 tries it, set this value to zero to turn this off.
 
+The next three parameters have to do with register layout.  The
+registers used by the interfaces may not appear at successive
+locations and they may not be in 8-bit registers.  These parameters
+allow the layout of the data in the registers to be more precisely
+specified.
+
+The regspacings parameter give the number of bytes between successive
+register start addresses.  For instance, if the regspacing is set to 4
+and the start address is 0xca2, then the address for the second
+register would be 0xca6.  This defaults to 1.
+
+The regsizes parameter gives the size of a register, in bytes.  The
+data used by IPMI is 8-bits wide, but it may be inside a larger
+register.  This parameter allows the read and write type to specified.
+It may be 1, 2, 4, or 8.  The default is 1.
+
+Since the register size may be larger than 32 bits, the IPMI data may not
+be in the lower 8 bits.  The regshifts parameter give the amount to shift
+the data to get to the actual IPMI data.
+
 When compiled into the kernel, the addresses can be specified on the
 kernel command line as:
 
   ipmi_si.type=<type1>,<type2>...
        ipmi_si.ports=<port1>,<port2>... ipmi_si.addrs=<addr1>,<addr2>...
        ipmi_si.irqs=<irq1>,<irq2>... ipmi_si.trydefaults=[0|1]
+       ipmi_si.regspacings=<sp1>,<sp2>,...
+       ipmi_si.regsizes=<size1>,<size2>,...
+       ipmi_si.regshifts=<shift1>,<shift2>,...
 
 It works the same as the module parameters of the same names.
 
drivers/char/ipmi/ipmi_bt_sm.c +1 -1
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_bt_sm.c
===================================================================
@@ -31,7 +31,7 @@
 #include <linux/ipmi_msgdefs.h>		/* for completion codes */
 #include "ipmi_si_sm.h"
 
-#define IPMI_BT_VERSION "v32"
+#define IPMI_BT_VERSION "v33"
 
 static int bt_debug = 0x00;	/* Production value 0, see following flags */
 
drivers/char/ipmi/ipmi_devintf.c +1 -1
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_devintf.c
===================================================================
@@ -45,7 +45,7 @@
 #include <asm/semaphore.h>
 #include <linux/init.h>
 
-#define IPMI_DEVINTF_VERSION "v32"
+#define IPMI_DEVINTF_VERSION "v33"
 
 struct ipmi_file_private
 {
drivers/char/ipmi/ipmi_kcs_sm.c +1 -1
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_kcs_sm.c
===================================================================
@@ -42,7 +42,7 @@
 #include <linux/ipmi_msgdefs.h>		/* for completion codes */
 #include "ipmi_si_sm.h"
 
-#define IPMI_KCS_VERSION "v32"
+#define IPMI_KCS_VERSION "v33"
 
 /* Set this if you want a printout of why the state machine was hosed
    when it gets hosed. */
drivers/char/ipmi/ipmi_msghandler.c +46 -12

112 lines not on this page · raw message

drivers/char/ipmi/ipmi_poweroff.c +543 -0

543 lines not on this page · raw message

drivers/char/ipmi/ipmi_si_intf.c +297 -63

594 lines not on this page · raw message

drivers/char/ipmi/ipmi_si_sm.h +3 -0
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_si_sm.h
===================================================================
@@ -52,6 +52,9 @@
            state machine shouldn't touch these. */
 	void *info;
 	void *addr;
+	int  regspacing;
+	int  regsize;
+	int  regshift;
 };
 
 /* Results of SMI events. */
drivers/char/ipmi/ipmi_smic_sm.c +1 -1
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_smic_sm.c
===================================================================
@@ -46,7 +46,7 @@
 #include <linux/ipmi_msgdefs.h>		/* for completion codes */
 #include "ipmi_si_sm.h"
 
-#define IPMI_SMIC_VERSION "v32"
+#define IPMI_SMIC_VERSION "v33"
 
 /* smic_debug is a bit-field
  *	SMIC_DEBUG_ENABLE -	turned on for now
drivers/char/ipmi/ipmi_watchdog.c +1 -1
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/ipmi_watchdog.c
===================================================================
@@ -53,7 +53,7 @@
 
 #define	PFX "IPMI Watchdog: "
 
-#define IPMI_WATCHDOG_VERSION "v32"
+#define IPMI_WATCHDOG_VERSION "v33"
 
 /*
  * The IPMI command/response information for the watchdog timer.
drivers/char/ipmi/Kconfig +7 -0
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/Kconfig
===================================================================
@@ -57,4 +57,11 @@
        help
          This enables the IPMI watchdog timer.
 
+config IPMI_POWEROFF
+       tristate 'IPMI Poweroff'
+       depends on IPMI_HANDLER
+       help
+         This enables a function to power off the system with IPMI if
+	 the IPMI management controller is capable of this.
+
 endmenu
drivers/char/ipmi/Makefile +1 -0
Index: linux-2.6.8-rc4-mm1/drivers/char/ipmi/Makefile
===================================================================
@@ -8,6 +8,7 @@
 obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
 obj-$(CONFIG_IPMI_SI) += ipmi_si.o
 obj-$(CONFIG_IPMI_WATCHDOG) += ipmi_watchdog.o
+obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
 
 ipmi_si.o:	$(ipmi_si-objs)
 	$(LD) -r -o $@ $(ipmi_si-objs)
include/linux/ipmi.h +6 -0
Index: linux-2.6.8-rc4-mm1/include/linux/ipmi.h
===================================================================
@@ -406,6 +406,12 @@
 			    unsigned char cmd);
 
 /*
+ * Allow run-to-completion mode to be set for the interface of
+ * a specific user.
+ */
+void ipmi_user_set_run_to_completion(ipmi_user_t user, int val);
+
+/*
  * When the user is created, it will not receive IPMI events by
  * default.  The user must set this to TRUE to get incoming events.
  * The first user that sets this to TRUE will receive all events that