aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_attr.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_attr.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_attr.c b/drivers/scsi/qla4xxx/ql4_attr.c
index 864d018631c..0b0a7d42137 100644
--- a/drivers/scsi/qla4xxx/ql4_attr.c
+++ b/drivers/scsi/qla4xxx/ql4_attr.c
@@ -55,15 +55,91 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr,
55 ha->bootload_patch, ha->bootload_build); 55 ha->bootload_patch, ha->bootload_build);
56} 56}
57 57
58static ssize_t
59qla4xxx_board_id_show(struct device *dev, struct device_attribute *attr,
60 char *buf)
61{
62 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
63 return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id);
64}
65
66static ssize_t
67qla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr,
68 char *buf)
69{
70 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
71
72 qla4xxx_get_firmware_state(ha);
73 return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state,
74 ha->addl_fw_state);
75}
76
77static ssize_t
78qla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr,
79 char *buf)
80{
81 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
82
83 if (!is_qla8022(ha))
84 return -ENOSYS;
85
86 return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt);
87}
88
89static ssize_t
90qla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr,
91 char *buf)
92{
93 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
94
95 if (!is_qla8022(ha))
96 return -ENOSYS;
97
98 return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num);
99}
100
101static ssize_t
102qla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr,
103 char *buf)
104{
105 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
106
107 if (!is_qla8022(ha))
108 return -ENOSYS;
109
110 return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt);
111}
112
113static ssize_t
114qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr,
115 char *buf)
116{
117 struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
118
119 return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name);
120}
121
58static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL); 122static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL);
59static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL); 123static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL);
60static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL); 124static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL);
61static DEVICE_ATTR(optrom_version, S_IRUGO, qla4xxx_optrom_version_show, NULL); 125static DEVICE_ATTR(optrom_version, S_IRUGO, qla4xxx_optrom_version_show, NULL);
126static DEVICE_ATTR(board_id, S_IRUGO, qla4xxx_board_id_show, NULL);
127static DEVICE_ATTR(fw_state, S_IRUGO, qla4xxx_fw_state_show, NULL);
128static DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL);
129static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL);
130static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL);
131static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL);
62 132
63struct device_attribute *qla4xxx_host_attrs[] = { 133struct device_attribute *qla4xxx_host_attrs[] = {
64 &dev_attr_fw_version, 134 &dev_attr_fw_version,
65 &dev_attr_serial_num, 135 &dev_attr_serial_num,
66 &dev_attr_iscsi_version, 136 &dev_attr_iscsi_version,
67 &dev_attr_optrom_version, 137 &dev_attr_optrom_version,
138 &dev_attr_board_id,
139 &dev_attr_fw_state,
140 &dev_attr_phy_port_cnt,
141 &dev_attr_phy_port_num,
142 &dev_attr_iscsi_func_cnt,
143 &dev_attr_hba_model,
68 NULL, 144 NULL,
69}; 145};