aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2006-03-26 04:37:21 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:56 -0500
commit50c812b2b9513e3df34eae8c30cb2c221b79b2cb (patch)
tree565f31d3b3234e5324ba9534b752ae426b4a8c92 /include
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')
-rw-r--r--include/linux/ipmi.h3
-rw-r--r--include/linux/ipmi_msgdefs.h1
-rw-r--r--include/linux/ipmi_smi.h47
3 files changed, 48 insertions, 3 deletions
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index d6276e60b3bf..0a84b56935c2 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -36,6 +36,7 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/compiler.h> 38#include <linux/compiler.h>
39#include <linux/device.h>
39 40
40/* 41/*
41 * This file describes an interface to an IPMI driver. You have to 42 * This file describes an interface to an IPMI driver. You have to
@@ -397,7 +398,7 @@ struct ipmi_smi_watcher
397 the watcher list. So you can add and remove users from the 398 the watcher list. So you can add and remove users from the
398 IPMI interface, send messages, etc., but you cannot add 399 IPMI interface, send messages, etc., but you cannot add
399 or remove SMI watchers or SMI interfaces. */ 400 or remove SMI watchers or SMI interfaces. */
400 void (*new_smi)(int if_num); 401 void (*new_smi)(int if_num, struct device *dev);
401 void (*smi_gone)(int if_num); 402 void (*smi_gone)(int if_num);
402}; 403};
403 404
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index 03bc64dc2ec1..22f5e2afda4f 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -47,6 +47,7 @@
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_CLEAR_MSG_FLAGS_CMD 0x30 49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30
50#define IPMI_GET_DEVICE_GUID_CMD 0x08
50#define IPMI_GET_MSG_FLAGS_CMD 0x31 51#define IPMI_GET_MSG_FLAGS_CMD 0x31
51#define IPMI_SEND_MSG_CMD 0x34 52#define IPMI_SEND_MSG_CMD 0x34
52#define IPMI_GET_MSG_CMD 0x33 53#define IPMI_GET_MSG_CMD 0x33
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 @@
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/device.h>
41#include <linux/platform_device.h>
42#include <linux/ipmi_smi.h>
40 43
41/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
42 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
@@ -113,12 +116,52 @@ struct ipmi_smi_handlers
113 void (*dec_usecount)(void *send_info); 116 void (*dec_usecount)(void *send_info);
114}; 117};
115 118
119struct ipmi_device_id {
120 unsigned char device_id;
121 unsigned char device_revision;
122 unsigned char firmware_revision_1;
123 unsigned char firmware_revision_2;
124 unsigned char ipmi_version;
125 unsigned char additional_device_support;
126 unsigned int manufacturer_id;
127 unsigned int product_id;
128 unsigned char aux_firmware_revision[4];
129 unsigned int aux_firmware_revision_set : 1;
130};
131
132#define ipmi_version_major(v) ((v)->ipmi_version & 0xf)
133#define ipmi_version_minor(v) ((v)->ipmi_version >> 4)
134
135/* Take a pointer to a raw data buffer and a length and extract device
136 id information from it. The first byte of data must point to the
137 byte from the get device id response after the completion code.
138 The caller is responsible for making sure the length is at least
139 11 and the command completed without error. */
140static inline void ipmi_demangle_device_id(unsigned char *data,
141 unsigned int data_len,
142 struct ipmi_device_id *id)
143{
144 id->device_id = data[0];
145 id->device_revision = data[1];
146 id->firmware_revision_1 = data[2];
147 id->firmware_revision_2 = data[3];
148 id->ipmi_version = data[4];
149 id->additional_device_support = data[5];
150 id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16);
151 id->product_id = data[9] | (data[10] << 8);
152 if (data_len >= 15) {
153 memcpy(id->aux_firmware_revision, data+11, 4);
154 id->aux_firmware_revision_set = 1;
155 } else
156 id->aux_firmware_revision_set = 0;
157}
158
116/* Add a low-level interface to the IPMI driver. Note that if the 159/* Add a low-level interface to the IPMI driver. Note that if the
117 interface doesn't know its slave address, it should pass in zero. */ 160 interface doesn't know its slave address, it should pass in zero. */
118int ipmi_register_smi(struct ipmi_smi_handlers *handlers, 161int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
119 void *send_info, 162 void *send_info,
120 unsigned char version_major, 163 struct ipmi_device_id *device_id,
121 unsigned char version_minor, 164 struct device *dev,
122 unsigned char slave_addr, 165 unsigned char slave_addr,
123 ipmi_smi_t *intf); 166 ipmi_smi_t *intf);
124 167