diff options
author | Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> | 2013-07-08 08:33:10 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-08-23 13:40:19 -0400 |
commit | eee06a0f42ac9399868ac99c490199ea2cb4f1ef (patch) | |
tree | f2e12025ac9c101b8741d3caefebf948be172c16 /drivers/scsi/qla4xxx | |
parent | 9993757409adbd2eb335e4fd1c8f966bc49d68d2 (diff) |
[SCSI] qla4xxx: Export more firmware info in sysfs
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_attr.c | 86 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_def.h | 9 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_fw.h | 2 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 33 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 4 |
5 files changed, 105 insertions, 29 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_attr.c b/drivers/scsi/qla4xxx/ql4_attr.c index 19ee55a6226c..687c07fc30e6 100644 --- a/drivers/scsi/qla4xxx/ql4_attr.c +++ b/drivers/scsi/qla4xxx/ql4_attr.c | |||
@@ -158,14 +158,12 @@ qla4xxx_fw_version_show(struct device *dev, | |||
158 | 158 | ||
159 | if (is_qla80XX(ha)) | 159 | if (is_qla80XX(ha)) |
160 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n", | 160 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n", |
161 | ha->firmware_version[0], | 161 | ha->fw_info.fw_major, ha->fw_info.fw_minor, |
162 | ha->firmware_version[1], | 162 | ha->fw_info.fw_patch, ha->fw_info.fw_build); |
163 | ha->patch_number, ha->build_number); | ||
164 | else | 163 | else |
165 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", | 164 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", |
166 | ha->firmware_version[0], | 165 | ha->fw_info.fw_major, ha->fw_info.fw_minor, |
167 | ha->firmware_version[1], | 166 | ha->fw_info.fw_patch, ha->fw_info.fw_build); |
168 | ha->patch_number, ha->build_number); | ||
169 | } | 167 | } |
170 | 168 | ||
171 | static ssize_t | 169 | static ssize_t |
@@ -181,8 +179,8 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr, | |||
181 | char *buf) | 179 | char *buf) |
182 | { | 180 | { |
183 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | 181 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); |
184 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->iscsi_major, | 182 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major, |
185 | ha->iscsi_minor); | 183 | ha->fw_info.iscsi_minor); |
186 | } | 184 | } |
187 | 185 | ||
188 | static ssize_t | 186 | static ssize_t |
@@ -191,8 +189,8 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr, | |||
191 | { | 189 | { |
192 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | 190 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); |
193 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", | 191 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", |
194 | ha->bootload_major, ha->bootload_minor, | 192 | ha->fw_info.bootload_major, ha->fw_info.bootload_minor, |
195 | ha->bootload_patch, ha->bootload_build); | 193 | ha->fw_info.bootload_patch, ha->fw_info.bootload_build); |
196 | } | 194 | } |
197 | 195 | ||
198 | static ssize_t | 196 | static ssize_t |
@@ -259,6 +257,63 @@ qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr, | |||
259 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name); | 257 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name); |
260 | } | 258 | } |
261 | 259 | ||
260 | static ssize_t | ||
261 | qla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr, | ||
262 | char *buf) | ||
263 | { | ||
264 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | ||
265 | return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date, | ||
266 | ha->fw_info.fw_build_time); | ||
267 | } | ||
268 | |||
269 | static ssize_t | ||
270 | qla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr, | ||
271 | char *buf) | ||
272 | { | ||
273 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | ||
274 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user); | ||
275 | } | ||
276 | |||
277 | static ssize_t | ||
278 | qla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr, | ||
279 | char *buf) | ||
280 | { | ||
281 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | ||
282 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp); | ||
283 | } | ||
284 | |||
285 | static ssize_t | ||
286 | qla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr, | ||
287 | char *buf) | ||
288 | { | ||
289 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | ||
290 | char *load_src = NULL; | ||
291 | |||
292 | switch (ha->fw_info.fw_load_source) { | ||
293 | case 1: | ||
294 | load_src = "Flash Primary"; | ||
295 | break; | ||
296 | case 2: | ||
297 | load_src = "Flash Secondary"; | ||
298 | break; | ||
299 | case 3: | ||
300 | load_src = "Host Download"; | ||
301 | break; | ||
302 | } | ||
303 | |||
304 | return snprintf(buf, PAGE_SIZE, "%s\n", load_src); | ||
305 | } | ||
306 | |||
307 | static ssize_t | ||
308 | qla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr, | ||
309 | char *buf) | ||
310 | { | ||
311 | struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); | ||
312 | qla4xxx_about_firmware(ha); | ||
313 | return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs, | ||
314 | ha->fw_uptime_msecs); | ||
315 | } | ||
316 | |||
262 | static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL); | 317 | static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL); |
263 | static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL); | 318 | static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL); |
264 | static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL); | 319 | static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL); |
@@ -269,6 +324,12 @@ static DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL); | |||
269 | static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL); | 324 | static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL); |
270 | static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL); | 325 | static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL); |
271 | static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL); | 326 | static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL); |
327 | static DEVICE_ATTR(fw_timestamp, S_IRUGO, qla4xxx_fw_timestamp_show, NULL); | ||
328 | static DEVICE_ATTR(fw_build_user, S_IRUGO, qla4xxx_fw_build_user_show, NULL); | ||
329 | static DEVICE_ATTR(fw_ext_timestamp, S_IRUGO, qla4xxx_fw_ext_timestamp_show, | ||
330 | NULL); | ||
331 | static DEVICE_ATTR(fw_load_src, S_IRUGO, qla4xxx_fw_load_src_show, NULL); | ||
332 | static DEVICE_ATTR(fw_uptime, S_IRUGO, qla4xxx_fw_uptime_show, NULL); | ||
272 | 333 | ||
273 | struct device_attribute *qla4xxx_host_attrs[] = { | 334 | struct device_attribute *qla4xxx_host_attrs[] = { |
274 | &dev_attr_fw_version, | 335 | &dev_attr_fw_version, |
@@ -281,5 +342,10 @@ struct device_attribute *qla4xxx_host_attrs[] = { | |||
281 | &dev_attr_phy_port_num, | 342 | &dev_attr_phy_port_num, |
282 | &dev_attr_iscsi_func_cnt, | 343 | &dev_attr_iscsi_func_cnt, |
283 | &dev_attr_hba_model, | 344 | &dev_attr_hba_model, |
345 | &dev_attr_fw_timestamp, | ||
346 | &dev_attr_fw_build_user, | ||
347 | &dev_attr_fw_ext_timestamp, | ||
348 | &dev_attr_fw_load_src, | ||
349 | &dev_attr_fw_uptime, | ||
284 | NULL, | 350 | NULL, |
285 | }; | 351 | }; |
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 50dc0c73d274..b0a0e93ac95e 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
@@ -735,12 +735,9 @@ struct scsi_qla_host { | |||
735 | struct iscsi_iface *iface_ipv6_1; | 735 | struct iscsi_iface *iface_ipv6_1; |
736 | 736 | ||
737 | /* --- From About Firmware --- */ | 737 | /* --- From About Firmware --- */ |
738 | uint16_t iscsi_major; | 738 | struct about_fw_info fw_info; |
739 | uint16_t iscsi_minor; | 739 | uint32_t fw_uptime_secs; /* seconds elapsed since fw bootup */ |
740 | uint16_t bootload_major; | 740 | uint32_t fw_uptime_msecs; /* milliseconds beyond elapsed seconds */ |
741 | uint16_t bootload_minor; | ||
742 | uint16_t bootload_patch; | ||
743 | uint16_t bootload_build; | ||
744 | uint16_t def_timeout; /* Default login timeout */ | 741 | uint16_t def_timeout; /* Default login timeout */ |
745 | 742 | ||
746 | uint32_t flash_state; | 743 | uint32_t flash_state; |
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index c7b8892b5a83..9a46f5971d56 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h | |||
@@ -955,7 +955,7 @@ struct about_fw_info { | |||
955 | uint16_t bootload_minor; /* 46 - 47 */ | 955 | uint16_t bootload_minor; /* 46 - 47 */ |
956 | uint16_t bootload_patch; /* 48 - 49 */ | 956 | uint16_t bootload_patch; /* 48 - 49 */ |
957 | uint16_t bootload_build; /* 4A - 4B */ | 957 | uint16_t bootload_build; /* 4A - 4B */ |
958 | uint8_t reserved2[180]; /* 4C - FF */ | 958 | uint8_t extended_timestamp[180];/* 4C - FF */ |
959 | }; | 959 | }; |
960 | 960 | ||
961 | struct crash_record { | 961 | struct crash_record { |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index a501beab3ffe..3c18b7f331f4 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * See LICENSE.qla4xxx for copyright and licensing details. | 5 | * See LICENSE.qla4xxx for copyright and licensing details. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/ctype.h> | ||
8 | #include "ql4_def.h" | 9 | #include "ql4_def.h" |
9 | #include "ql4_glbl.h" | 10 | #include "ql4_glbl.h" |
10 | #include "ql4_dbg.h" | 11 | #include "ql4_dbg.h" |
@@ -1270,16 +1271,28 @@ int qla4xxx_about_firmware(struct scsi_qla_host *ha) | |||
1270 | } | 1271 | } |
1271 | 1272 | ||
1272 | /* Save version information. */ | 1273 | /* Save version information. */ |
1273 | ha->firmware_version[0] = le16_to_cpu(about_fw->fw_major); | 1274 | ha->fw_info.fw_major = le16_to_cpu(about_fw->fw_major); |
1274 | ha->firmware_version[1] = le16_to_cpu(about_fw->fw_minor); | 1275 | ha->fw_info.fw_minor = le16_to_cpu(about_fw->fw_minor); |
1275 | ha->patch_number = le16_to_cpu(about_fw->fw_patch); | 1276 | ha->fw_info.fw_patch = le16_to_cpu(about_fw->fw_patch); |
1276 | ha->build_number = le16_to_cpu(about_fw->fw_build); | 1277 | ha->fw_info.fw_build = le16_to_cpu(about_fw->fw_build); |
1277 | ha->iscsi_major = le16_to_cpu(about_fw->iscsi_major); | 1278 | memcpy(ha->fw_info.fw_build_date, about_fw->fw_build_date, |
1278 | ha->iscsi_minor = le16_to_cpu(about_fw->iscsi_minor); | 1279 | sizeof(about_fw->fw_build_date)); |
1279 | ha->bootload_major = le16_to_cpu(about_fw->bootload_major); | 1280 | memcpy(ha->fw_info.fw_build_time, about_fw->fw_build_time, |
1280 | ha->bootload_minor = le16_to_cpu(about_fw->bootload_minor); | 1281 | sizeof(about_fw->fw_build_time)); |
1281 | ha->bootload_patch = le16_to_cpu(about_fw->bootload_patch); | 1282 | strcpy((char *)ha->fw_info.fw_build_user, |
1282 | ha->bootload_build = le16_to_cpu(about_fw->bootload_build); | 1283 | skip_spaces((char *)about_fw->fw_build_user)); |
1284 | ha->fw_info.fw_load_source = le16_to_cpu(about_fw->fw_load_source); | ||
1285 | ha->fw_info.iscsi_major = le16_to_cpu(about_fw->iscsi_major); | ||
1286 | ha->fw_info.iscsi_minor = le16_to_cpu(about_fw->iscsi_minor); | ||
1287 | ha->fw_info.bootload_major = le16_to_cpu(about_fw->bootload_major); | ||
1288 | ha->fw_info.bootload_minor = le16_to_cpu(about_fw->bootload_minor); | ||
1289 | ha->fw_info.bootload_patch = le16_to_cpu(about_fw->bootload_patch); | ||
1290 | ha->fw_info.bootload_build = le16_to_cpu(about_fw->bootload_build); | ||
1291 | strcpy((char *)ha->fw_info.extended_timestamp, | ||
1292 | skip_spaces((char *)about_fw->extended_timestamp)); | ||
1293 | |||
1294 | ha->fw_uptime_secs = le32_to_cpu(mbox_sts[5]); | ||
1295 | ha->fw_uptime_msecs = le32_to_cpu(mbox_sts[6]); | ||
1283 | status = QLA_SUCCESS; | 1296 | status = QLA_SUCCESS; |
1284 | 1297 | ||
1285 | exit_about_fw: | 1298 | exit_about_fw: |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 66489b2b03e8..6226df61a354 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -7220,8 +7220,8 @@ skip_retry_init: | |||
7220 | " QLogic iSCSI HBA Driver version: %s\n" | 7220 | " QLogic iSCSI HBA Driver version: %s\n" |
7221 | " QLogic ISP%04x @ %s, host#=%ld, fw=%02d.%02d.%02d.%02d\n", | 7221 | " QLogic ISP%04x @ %s, host#=%ld, fw=%02d.%02d.%02d.%02d\n", |
7222 | qla4xxx_version_str, ha->pdev->device, pci_name(ha->pdev), | 7222 | qla4xxx_version_str, ha->pdev->device, pci_name(ha->pdev), |
7223 | ha->host_no, ha->firmware_version[0], ha->firmware_version[1], | 7223 | ha->host_no, ha->fw_info.fw_major, ha->fw_info.fw_minor, |
7224 | ha->patch_number, ha->build_number); | 7224 | ha->fw_info.fw_patch, ha->fw_info.fw_build); |
7225 | 7225 | ||
7226 | /* Set the driver version */ | 7226 | /* Set the driver version */ |
7227 | if (is_qla80XX(ha)) | 7227 | if (is_qla80XX(ha)) |