diff options
Diffstat (limited to 'include/linux/ipmi_smi.h')
-rw-r--r-- | include/linux/ipmi_smi.h | 47 |
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 @@ | |||
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 | ||
119 | struct 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. */ | ||
140 | static 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. */ |
118 | int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | 161 | int 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 | ||