summaryrefslogtreecommitdiff
path: root/include/linux/ipmi_smi.h
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2006-03-26 01:37:21 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 08:56:56 -0800
commit50c812b2b9513e3df34eae8c30cb2c221b79b2cb (patch)
tree565f31d3b3234e5324ba9534b752ae426b4a8c92 /include/linux/ipmi_smi.h
parentb0defcdbd2b7da7694e2645da92716cea0a3c0ff (diff)
[PATCH] ipmi: add full sysfs support
Add full driver model support for the IPMI driver. It links in the proper bus and device support. It adds an "ipmi" driver interface that has each BMC discovered by the driver (as a device). These BMCs appear in the devices/platform directory. If there are multiple interfaces to the same BMC, the driver should discover this and will only have one BMC entry. The BMC entry will have pointers to each interface device that connects to it. The device information (statistics and config information) has not yet been ported over to the driver model from proc, that will come later. This work was based on work by Yani Ioannou. I basically rewrote it using that code as a guide, but he still deserves credit :). [bunk@stusta.de: make ipmi_find_bmc_guid() static] Signed-off-by: Corey Minyard <minyard@acm.org> Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/ipmi_smi.h')
-rw-r--r--include/linux/ipmi_smi.h47
1 files changed, 45 insertions, 2 deletions
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index e36ee157ad67..53571288a9fc 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -37,6 +37,9 @@
#include <linux/ipmi_msgdefs.h>
#include <linux/proc_fs.h>
#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/ipmi_smi.h>
/* This files describes the interface for IPMI system management interface
drivers to bind into the IPMI message handler. */
@@ -113,12 +116,52 @@ struct ipmi_smi_handlers
void (*dec_usecount)(void *send_info);
};
+struct ipmi_device_id {
+ unsigned char device_id;
+ unsigned char device_revision;
+ unsigned char firmware_revision_1;
+ unsigned char firmware_revision_2;
+ unsigned char ipmi_version;
+ unsigned char additional_device_support;
+ unsigned int manufacturer_id;
+ unsigned int product_id;
+ unsigned char aux_firmware_revision[4];
+ unsigned int aux_firmware_revision_set : 1;
+};
+
+#define ipmi_version_major(v) ((v)->ipmi_version & 0xf)
+#define ipmi_version_minor(v) ((v)->ipmi_version >> 4)
+
+/* Take a pointer to a raw data buffer and a length and extract device
+ id information from it. The first byte of data must point to the
+ byte from the get device id response after the completion code.
+ The caller is responsible for making sure the length is at least
+ 11 and the command completed without error. */
+static inline void ipmi_demangle_device_id(unsigned char *data,
+ unsigned int data_len,
+ struct ipmi_device_id *id)
+{
+ id->device_id = data[0];
+ id->device_revision = data[1];
+ id->firmware_revision_1 = data[2];
+ id->firmware_revision_2 = data[3];
+ id->ipmi_version = data[4];
+ id->additional_device_support = data[5];
+ id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16);
+ id->product_id = data[9] | (data[10] << 8);
+ if (data_len >= 15) {
+ memcpy(id->aux_firmware_revision, data+11, 4);
+ id->aux_firmware_revision_set = 1;
+ } else
+ id->aux_firmware_revision_set = 0;
+}
+
/* Add a low-level interface to the IPMI driver. Note that if the
interface doesn't know its slave address, it should pass in zero. */
int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
void *send_info,
- unsigned char version_major,
- unsigned char version_minor,
+ struct ipmi_device_id *device_id,
+ struct device *dev,
unsigned char slave_addr,
ipmi_smi_t *intf);