diff options
author | Corey Minyard <cminyard@mvista.com> | 2007-10-18 06:07:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:32 -0400 |
commit | d8c98618f4bb8161cc0c14e110b07ba37249332b (patch) | |
tree | 0b546c06c0b9946cdb3274c98a0a9d4c5084ea5d /include | |
parent | ac0191517c3b5f2cf68ab36756d64ef035c4a770 (diff) |
IPMI: add 0.9 support
Add support for IPMI 0.9 systems to the IPMI driver. Just handle a shorter
get device ID command with less information.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Stian Jordet <liste@jordet.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ipmi_smi.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index c0633108d05d..efa292a52e7e 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -148,26 +148,46 @@ struct ipmi_device_id { | |||
148 | 148 | ||
149 | /* Take a pointer to a raw data buffer and a length and extract device | 149 | /* Take a pointer to a raw data buffer and a length and extract device |
150 | id information from it. The first byte of data must point to the | 150 | id information from it. The first byte of data must point to the |
151 | byte from the get device id response after the completion code. | 151 | netfn << 2, the data should be of the format: |
152 | The caller is responsible for making sure the length is at least | 152 | netfn << 2, cmd, completion code, data |
153 | 11 and the command completed without error. */ | 153 | as normally comes from a device interface. */ |
154 | static inline void ipmi_demangle_device_id(unsigned char *data, | 154 | static inline int ipmi_demangle_device_id(const unsigned char *data, |
155 | unsigned int data_len, | 155 | unsigned int data_len, |
156 | struct ipmi_device_id *id) | 156 | struct ipmi_device_id *id) |
157 | { | 157 | { |
158 | if (data_len < 9) | ||
159 | return -EINVAL; | ||
160 | if (data[0] != IPMI_NETFN_APP_RESPONSE << 2 || | ||
161 | data[1] != IPMI_GET_DEVICE_ID_CMD) | ||
162 | /* Strange, didn't get the response we expected. */ | ||
163 | return -EINVAL; | ||
164 | if (data[2] != 0) | ||
165 | /* That's odd, it shouldn't be able to fail. */ | ||
166 | return -EINVAL; | ||
167 | |||
168 | data += 3; | ||
169 | data_len -= 3; | ||
158 | id->device_id = data[0]; | 170 | id->device_id = data[0]; |
159 | id->device_revision = data[1]; | 171 | id->device_revision = data[1]; |
160 | id->firmware_revision_1 = data[2]; | 172 | id->firmware_revision_1 = data[2]; |
161 | id->firmware_revision_2 = data[3]; | 173 | id->firmware_revision_2 = data[3]; |
162 | id->ipmi_version = data[4]; | 174 | id->ipmi_version = data[4]; |
163 | id->additional_device_support = data[5]; | 175 | id->additional_device_support = data[5]; |
164 | id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16); | 176 | if (data_len >= 6) { |
165 | id->product_id = data[9] | (data[10] << 8); | 177 | id->manufacturer_id = (data[6] | (data[7] << 8) | |
178 | (data[8] << 16)); | ||
179 | id->product_id = data[9] | (data[10] << 8); | ||
180 | } else { | ||
181 | id->manufacturer_id = 0; | ||
182 | id->product_id = 0; | ||
183 | } | ||
166 | if (data_len >= 15) { | 184 | if (data_len >= 15) { |
167 | memcpy(id->aux_firmware_revision, data+11, 4); | 185 | memcpy(id->aux_firmware_revision, data+11, 4); |
168 | id->aux_firmware_revision_set = 1; | 186 | id->aux_firmware_revision_set = 1; |
169 | } else | 187 | } else |
170 | id->aux_firmware_revision_set = 0; | 188 | id->aux_firmware_revision_set = 0; |
189 | |||
190 | return 0; | ||
171 | } | 191 | } |
172 | 192 | ||
173 | /* Add a low-level interface to the IPMI driver. Note that if the | 193 | /* Add a low-level interface to the IPMI driver. Note that if the |