diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 7b18a6c7b7eb..8081b637d97e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -140,6 +140,8 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
140 | ha->isp_ops.write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count); | 140 | ha->isp_ops.write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count); |
141 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 141 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
142 | 142 | ||
143 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | ||
144 | |||
143 | return (count); | 145 | return (count); |
144 | } | 146 | } |
145 | 147 | ||
@@ -653,6 +655,43 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf, | |||
653 | return count; | 655 | return count; |
654 | } | 656 | } |
655 | 657 | ||
658 | static ssize_t | ||
659 | qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) | ||
660 | { | ||
661 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
662 | |||
663 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], | ||
664 | ha->bios_revision[0]); | ||
665 | } | ||
666 | |||
667 | static ssize_t | ||
668 | qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) | ||
669 | { | ||
670 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
671 | |||
672 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], | ||
673 | ha->efi_revision[0]); | ||
674 | } | ||
675 | |||
676 | static ssize_t | ||
677 | qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) | ||
678 | { | ||
679 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
680 | |||
681 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], | ||
682 | ha->fcode_revision[0]); | ||
683 | } | ||
684 | |||
685 | static ssize_t | ||
686 | qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) | ||
687 | { | ||
688 | scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev)); | ||
689 | |||
690 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", | ||
691 | ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], | ||
692 | ha->fw_revision[3]); | ||
693 | } | ||
694 | |||
656 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 695 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, |
657 | NULL); | 696 | NULL); |
658 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 697 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
@@ -669,6 +708,14 @@ static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | |||
669 | qla2x00_zio_timer_store); | 708 | qla2x00_zio_timer_store); |
670 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, | 709 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, |
671 | qla2x00_beacon_store); | 710 | qla2x00_beacon_store); |
711 | static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, | ||
712 | qla2x00_optrom_bios_version_show, NULL); | ||
713 | static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, | ||
714 | qla2x00_optrom_efi_version_show, NULL); | ||
715 | static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, | ||
716 | qla2x00_optrom_fcode_version_show, NULL); | ||
717 | static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, | ||
718 | qla2x00_optrom_fw_version_show, NULL); | ||
672 | 719 | ||
673 | struct class_device_attribute *qla2x00_host_attrs[] = { | 720 | struct class_device_attribute *qla2x00_host_attrs[] = { |
674 | &class_device_attr_driver_version, | 721 | &class_device_attr_driver_version, |
@@ -683,6 +730,10 @@ struct class_device_attribute *qla2x00_host_attrs[] = { | |||
683 | &class_device_attr_zio, | 730 | &class_device_attr_zio, |
684 | &class_device_attr_zio_timer, | 731 | &class_device_attr_zio_timer, |
685 | &class_device_attr_beacon, | 732 | &class_device_attr_beacon, |
733 | &class_device_attr_optrom_bios_version, | ||
734 | &class_device_attr_optrom_efi_version, | ||
735 | &class_device_attr_optrom_fcode_version, | ||
736 | &class_device_attr_optrom_fw_version, | ||
686 | NULL, | 737 | NULL, |
687 | }; | 738 | }; |
688 | 739 | ||
@@ -836,21 +887,24 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
836 | link_stat_t stat_buf; | 887 | link_stat_t stat_buf; |
837 | struct fc_host_statistics *pfc_host_stat; | 888 | struct fc_host_statistics *pfc_host_stat; |
838 | 889 | ||
890 | rval = QLA_FUNCTION_FAILED; | ||
839 | pfc_host_stat = &ha->fc_host_stat; | 891 | pfc_host_stat = &ha->fc_host_stat; |
840 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | 892 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); |
841 | 893 | ||
842 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { | 894 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { |
843 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, | 895 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, |
844 | sizeof(stat_buf) / 4, mb_stat); | 896 | sizeof(stat_buf) / 4, mb_stat); |
845 | } else { | 897 | } else if (atomic_read(&ha->loop_state) == LOOP_READY && |
898 | !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) && | ||
899 | !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) && | ||
900 | !ha->dpc_active) { | ||
901 | /* Must be in a 'READY' state for statistics retrieval. */ | ||
846 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, | 902 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, |
847 | mb_stat); | 903 | mb_stat); |
848 | } | 904 | } |
849 | if (rval != 0) { | 905 | |
850 | qla_printk(KERN_WARNING, ha, | 906 | if (rval != QLA_SUCCESS) |
851 | "Unable to retrieve host statistics (%d).\n", mb_stat[0]); | 907 | goto done; |
852 | return pfc_host_stat; | ||
853 | } | ||
854 | 908 | ||
855 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; | 909 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; |
856 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; | 910 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; |
@@ -858,7 +912,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
858 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; | 912 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; |
859 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; | 913 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; |
860 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; | 914 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; |
861 | 915 | done: | |
862 | return pfc_host_stat; | 916 | return pfc_host_stat; |
863 | } | 917 | } |
864 | 918 | ||