diff options
author | Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com> | 2013-09-18 03:24:41 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-10-25 04:58:14 -0400 |
commit | 966fdcff8eb78cce81da8f5adc5b7fe601b53d18 (patch) | |
tree | 31edbb4ff5b10f2aea4a580d4262c9ebdf60e12f | |
parent | cb993e5d50dd82e3d675225e2eff3c77951682b0 (diff) |
[SCSI] pm80xx: Display controller BIOS version.
Signed-off-by: Anandkumar.Santhanam@pmcs.com
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 34 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.h | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index d99f41c2ca13..5a19e1930b4b 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -309,6 +309,39 @@ static ssize_t pm8001_ctl_aap_log_show(struct device *cdev, | |||
309 | } | 309 | } |
310 | static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL); | 310 | static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL); |
311 | /** | 311 | /** |
312 | * pm8001_ctl_bios_version_show - Bios version Display | ||
313 | * @cdev:pointer to embedded class device | ||
314 | * @buf:the buffer returned | ||
315 | * A sysfs 'read-only' shost attribute. | ||
316 | */ | ||
317 | static ssize_t pm8001_ctl_bios_version_show(struct device *cdev, | ||
318 | struct device_attribute *attr, char *buf) | ||
319 | { | ||
320 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
321 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | ||
322 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | ||
323 | char *str = buf; | ||
324 | void *virt_addr; | ||
325 | int bios_index; | ||
326 | DECLARE_COMPLETION_ONSTACK(completion); | ||
327 | struct pm8001_ioctl_payload payload; | ||
328 | |||
329 | pm8001_ha->nvmd_completion = &completion; | ||
330 | payload.minor_function = 7; | ||
331 | payload.offset = 0; | ||
332 | payload.length = 4096; | ||
333 | payload.func_specific = kzalloc(4096, GFP_KERNEL); | ||
334 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); | ||
335 | wait_for_completion(&completion); | ||
336 | virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; | ||
337 | for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT; | ||
338 | bios_index++) | ||
339 | str += sprintf(str, "%c", | ||
340 | *((u8 *)((u8 *)virt_addr+bios_index))); | ||
341 | return str - buf; | ||
342 | } | ||
343 | static DEVICE_ATTR(bios_version, S_IRUGO, pm8001_ctl_bios_version_show, NULL); | ||
344 | /** | ||
312 | * pm8001_ctl_aap_log_show - IOP event log | 345 | * pm8001_ctl_aap_log_show - IOP event log |
313 | * @cdev: pointer to embedded class device | 346 | * @cdev: pointer to embedded class device |
314 | * @buf: the buffer returned | 347 | * @buf: the buffer returned |
@@ -609,6 +642,7 @@ struct device_attribute *pm8001_host_attrs[] = { | |||
609 | &dev_attr_sas_spec_support, | 642 | &dev_attr_sas_spec_support, |
610 | &dev_attr_logging_level, | 643 | &dev_attr_logging_level, |
611 | &dev_attr_host_sas_address, | 644 | &dev_attr_host_sas_address, |
645 | &dev_attr_bios_version, | ||
612 | NULL, | 646 | NULL, |
613 | }; | 647 | }; |
614 | 648 | ||
diff --git a/drivers/scsi/pm8001/pm8001_ctl.h b/drivers/scsi/pm8001/pm8001_ctl.h index 63ad4aa0c422..c6d8fdd3b9b9 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.h +++ b/drivers/scsi/pm8001/pm8001_ctl.h | |||
@@ -45,6 +45,8 @@ | |||
45 | #define HEADER_LEN 28 | 45 | #define HEADER_LEN 28 |
46 | #define SIZE_OFFSET 16 | 46 | #define SIZE_OFFSET 16 |
47 | 47 | ||
48 | #define BIOSOFFSET 56 | ||
49 | #define BIOS_OFFSET_LIMIT 61 | ||
48 | 50 | ||
49 | #define FLASH_OK 0x000000 | 51 | #define FLASH_OK 0x000000 |
50 | #define FAIL_OPEN_BIOS_FILE 0x000100 | 52 | #define FAIL_OPEN_BIOS_FILE 0x000100 |