1e3976af5SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
27ad633c0SHarish Zunjarrao /*
37ad633c0SHarish Zunjarrao * QLogic iSCSI HBA Driver
44a4f51e9SVikas Chaudhary * Copyright (c) 2003-2013 QLogic Corporation
57ad633c0SHarish Zunjarrao */
67ad633c0SHarish Zunjarrao
77ad633c0SHarish Zunjarrao #include "ql4_def.h"
87ad633c0SHarish Zunjarrao #include "ql4_glbl.h"
97ad633c0SHarish Zunjarrao #include "ql4_dbg.h"
107ad633c0SHarish Zunjarrao
11068237c8STej Parkash static ssize_t
qla4_8xxx_sysfs_read_fw_dump(struct file * filep,struct kobject * kobj,struct bin_attribute * ba,char * buf,loff_t off,size_t count)12068237c8STej Parkash qla4_8xxx_sysfs_read_fw_dump(struct file *filep, struct kobject *kobj,
13068237c8STej Parkash struct bin_attribute *ba, char *buf, loff_t off,
14068237c8STej Parkash size_t count)
15068237c8STej Parkash {
16068237c8STej Parkash struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
17068237c8STej Parkash struct device, kobj)));
18068237c8STej Parkash
19ee996a69SVikas Chaudhary if (is_qla40XX(ha))
20068237c8STej Parkash return -EINVAL;
21068237c8STej Parkash
22068237c8STej Parkash if (!test_bit(AF_82XX_DUMP_READING, &ha->flags))
23068237c8STej Parkash return 0;
24068237c8STej Parkash
25068237c8STej Parkash return memory_read_from_buffer(buf, count, &off, ha->fw_dump,
26068237c8STej Parkash ha->fw_dump_size);
27068237c8STej Parkash }
28068237c8STej Parkash
29068237c8STej Parkash static ssize_t
qla4_8xxx_sysfs_write_fw_dump(struct file * filep,struct kobject * kobj,struct bin_attribute * ba,char * buf,loff_t off,size_t count)30068237c8STej Parkash qla4_8xxx_sysfs_write_fw_dump(struct file *filep, struct kobject *kobj,
31068237c8STej Parkash struct bin_attribute *ba, char *buf, loff_t off,
32068237c8STej Parkash size_t count)
33068237c8STej Parkash {
34068237c8STej Parkash struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
35068237c8STej Parkash struct device, kobj)));
36068237c8STej Parkash uint32_t dev_state;
37068237c8STej Parkash long reading;
38068237c8STej Parkash int ret = 0;
39068237c8STej Parkash
40ee996a69SVikas Chaudhary if (is_qla40XX(ha))
41068237c8STej Parkash return -EINVAL;
42068237c8STej Parkash
43068237c8STej Parkash if (off != 0)
44068237c8STej Parkash return ret;
45068237c8STej Parkash
46068237c8STej Parkash buf[1] = 0;
47068237c8STej Parkash ret = kstrtol(buf, 10, &reading);
48068237c8STej Parkash if (ret) {
49068237c8STej Parkash ql4_printk(KERN_ERR, ha, "%s: Invalid input. Return err %d\n",
50068237c8STej Parkash __func__, ret);
51068237c8STej Parkash return ret;
52068237c8STej Parkash }
53068237c8STej Parkash
54068237c8STej Parkash switch (reading) {
55068237c8STej Parkash case 0:
56068237c8STej Parkash /* clear dump collection flags */
57068237c8STej Parkash if (test_and_clear_bit(AF_82XX_DUMP_READING, &ha->flags)) {
58068237c8STej Parkash clear_bit(AF_82XX_FW_DUMPED, &ha->flags);
59068237c8STej Parkash /* Reload minidump template */
60068237c8STej Parkash qla4xxx_alloc_fw_dump(ha);
61068237c8STej Parkash DEBUG2(ql4_printk(KERN_INFO, ha,
62068237c8STej Parkash "Firmware template reloaded\n"));
63068237c8STej Parkash }
64068237c8STej Parkash break;
65068237c8STej Parkash case 1:
66068237c8STej Parkash /* Set flag to read dump */
67068237c8STej Parkash if (test_bit(AF_82XX_FW_DUMPED, &ha->flags) &&
68068237c8STej Parkash !test_bit(AF_82XX_DUMP_READING, &ha->flags)) {
69068237c8STej Parkash set_bit(AF_82XX_DUMP_READING, &ha->flags);
70068237c8STej Parkash DEBUG2(ql4_printk(KERN_INFO, ha,
71068237c8STej Parkash "Raw firmware dump ready for read on (%ld).\n",
72068237c8STej Parkash ha->host_no));
73068237c8STej Parkash }
74068237c8STej Parkash break;
75068237c8STej Parkash case 2:
769661975fSVikas Chaudhary /* Reset HBA and collect FW dump */
7733693c7aSVikas Chaudhary ha->isp_ops->idc_lock(ha);
7833693c7aSVikas Chaudhary dev_state = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DEV_STATE);
79de8c72daSVikas Chaudhary if (dev_state == QLA8XXX_DEV_READY) {
809661975fSVikas Chaudhary ql4_printk(KERN_INFO, ha, "%s: Setting Need reset\n",
819661975fSVikas Chaudhary __func__);
8233693c7aSVikas Chaudhary qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE,
83de8c72daSVikas Chaudhary QLA8XXX_DEV_NEED_RESET);
849661975fSVikas Chaudhary if (is_qla8022(ha) ||
85b37ca418SVikas Chaudhary ((is_qla8032(ha) || is_qla8042(ha)) &&
869661975fSVikas Chaudhary qla4_83xx_can_perform_reset(ha))) {
87de8c72daSVikas Chaudhary set_bit(AF_8XXX_RST_OWNER, &ha->flags);
889661975fSVikas Chaudhary set_bit(AF_FW_RECOVERY, &ha->flags);
899661975fSVikas Chaudhary ql4_printk(KERN_INFO, ha, "%s: Reset owner is 0x%x\n",
909661975fSVikas Chaudhary __func__, ha->func_num);
919661975fSVikas Chaudhary }
92068237c8STej Parkash } else
93068237c8STej Parkash ql4_printk(KERN_INFO, ha,
94068237c8STej Parkash "%s: Reset not performed as device state is 0x%x\n",
95068237c8STej Parkash __func__, dev_state);
96068237c8STej Parkash
9733693c7aSVikas Chaudhary ha->isp_ops->idc_unlock(ha);
98068237c8STej Parkash break;
99068237c8STej Parkash default:
100068237c8STej Parkash /* do nothing */
101068237c8STej Parkash break;
102068237c8STej Parkash }
103068237c8STej Parkash
104068237c8STej Parkash return count;
105068237c8STej Parkash }
106068237c8STej Parkash
107068237c8STej Parkash static struct bin_attribute sysfs_fw_dump_attr = {
108068237c8STej Parkash .attr = {
109068237c8STej Parkash .name = "fw_dump",
110068237c8STej Parkash .mode = S_IRUSR | S_IWUSR,
111068237c8STej Parkash },
112068237c8STej Parkash .size = 0,
113068237c8STej Parkash .read = qla4_8xxx_sysfs_read_fw_dump,
114068237c8STej Parkash .write = qla4_8xxx_sysfs_write_fw_dump,
115068237c8STej Parkash };
116068237c8STej Parkash
117068237c8STej Parkash static struct sysfs_entry {
118068237c8STej Parkash char *name;
119068237c8STej Parkash struct bin_attribute *attr;
120068237c8STej Parkash } bin_file_entries[] = {
121068237c8STej Parkash { "fw_dump", &sysfs_fw_dump_attr },
122068237c8STej Parkash { NULL },
123068237c8STej Parkash };
124068237c8STej Parkash
qla4_8xxx_alloc_sysfs_attr(struct scsi_qla_host * ha)125068237c8STej Parkash void qla4_8xxx_alloc_sysfs_attr(struct scsi_qla_host *ha)
126068237c8STej Parkash {
127068237c8STej Parkash struct Scsi_Host *host = ha->host;
128068237c8STej Parkash struct sysfs_entry *iter;
129068237c8STej Parkash int ret;
130068237c8STej Parkash
131068237c8STej Parkash for (iter = bin_file_entries; iter->name; iter++) {
132068237c8STej Parkash ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
133068237c8STej Parkash iter->attr);
134068237c8STej Parkash if (ret)
135068237c8STej Parkash ql4_printk(KERN_ERR, ha,
136068237c8STej Parkash "Unable to create sysfs %s binary attribute (%d).\n",
137068237c8STej Parkash iter->name, ret);
138068237c8STej Parkash }
139068237c8STej Parkash }
140068237c8STej Parkash
qla4_8xxx_free_sysfs_attr(struct scsi_qla_host * ha)141068237c8STej Parkash void qla4_8xxx_free_sysfs_attr(struct scsi_qla_host *ha)
142068237c8STej Parkash {
143068237c8STej Parkash struct Scsi_Host *host = ha->host;
144068237c8STej Parkash struct sysfs_entry *iter;
145068237c8STej Parkash
146068237c8STej Parkash for (iter = bin_file_entries; iter->name; iter++)
147068237c8STej Parkash sysfs_remove_bin_file(&host->shost_gendev.kobj,
148068237c8STej Parkash iter->attr);
149068237c8STej Parkash }
150068237c8STej Parkash
1517ad633c0SHarish Zunjarrao /* Scsi_Host attributes. */
1527ad633c0SHarish Zunjarrao static ssize_t
qla4xxx_fw_version_show(struct device * dev,struct device_attribute * attr,char * buf)1537ad633c0SHarish Zunjarrao qla4xxx_fw_version_show(struct device *dev,
1547ad633c0SHarish Zunjarrao struct device_attribute *attr, char *buf)
1557ad633c0SHarish Zunjarrao {
1567ad633c0SHarish Zunjarrao struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1577ad633c0SHarish Zunjarrao
1586e7b4292SVikas Chaudhary if (is_qla80XX(ha))
1597ad633c0SHarish Zunjarrao return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
160eee06a0fSAdheer Chandravanshi ha->fw_info.fw_major, ha->fw_info.fw_minor,
161eee06a0fSAdheer Chandravanshi ha->fw_info.fw_patch, ha->fw_info.fw_build);
1627ad633c0SHarish Zunjarrao else
1637ad633c0SHarish Zunjarrao return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
164eee06a0fSAdheer Chandravanshi ha->fw_info.fw_major, ha->fw_info.fw_minor,
165eee06a0fSAdheer Chandravanshi ha->fw_info.fw_patch, ha->fw_info.fw_build);
1667ad633c0SHarish Zunjarrao }
1677ad633c0SHarish Zunjarrao
1687ad633c0SHarish Zunjarrao static ssize_t
qla4xxx_serial_num_show(struct device * dev,struct device_attribute * attr,char * buf)1697ad633c0SHarish Zunjarrao qla4xxx_serial_num_show(struct device *dev, struct device_attribute *attr,
1707ad633c0SHarish Zunjarrao char *buf)
1717ad633c0SHarish Zunjarrao {
1727ad633c0SHarish Zunjarrao struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1737ad633c0SHarish Zunjarrao return snprintf(buf, PAGE_SIZE, "%s\n", ha->serial_number);
1747ad633c0SHarish Zunjarrao }
1757ad633c0SHarish Zunjarrao
1767ad633c0SHarish Zunjarrao static ssize_t
qla4xxx_iscsi_version_show(struct device * dev,struct device_attribute * attr,char * buf)1777ad633c0SHarish Zunjarrao qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr,
1787ad633c0SHarish Zunjarrao char *buf)
1797ad633c0SHarish Zunjarrao {
1807ad633c0SHarish Zunjarrao struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
181eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major,
182eee06a0fSAdheer Chandravanshi ha->fw_info.iscsi_minor);
1837ad633c0SHarish Zunjarrao }
1847ad633c0SHarish Zunjarrao
1857ad633c0SHarish Zunjarrao static ssize_t
qla4xxx_optrom_version_show(struct device * dev,struct device_attribute * attr,char * buf)1867ad633c0SHarish Zunjarrao qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr,
1877ad633c0SHarish Zunjarrao char *buf)
1887ad633c0SHarish Zunjarrao {
1897ad633c0SHarish Zunjarrao struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1907ad633c0SHarish Zunjarrao return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
191eee06a0fSAdheer Chandravanshi ha->fw_info.bootload_major, ha->fw_info.bootload_minor,
192eee06a0fSAdheer Chandravanshi ha->fw_info.bootload_patch, ha->fw_info.bootload_build);
1937ad633c0SHarish Zunjarrao }
1947ad633c0SHarish Zunjarrao
19591ec7cecSVikas Chaudhary static ssize_t
qla4xxx_board_id_show(struct device * dev,struct device_attribute * attr,char * buf)19691ec7cecSVikas Chaudhary qla4xxx_board_id_show(struct device *dev, struct device_attribute *attr,
19791ec7cecSVikas Chaudhary char *buf)
19891ec7cecSVikas Chaudhary {
19991ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
20091ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id);
20191ec7cecSVikas Chaudhary }
20291ec7cecSVikas Chaudhary
20391ec7cecSVikas Chaudhary static ssize_t
qla4xxx_fw_state_show(struct device * dev,struct device_attribute * attr,char * buf)20491ec7cecSVikas Chaudhary qla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr,
20591ec7cecSVikas Chaudhary char *buf)
20691ec7cecSVikas Chaudhary {
20791ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
20891ec7cecSVikas Chaudhary
20991ec7cecSVikas Chaudhary qla4xxx_get_firmware_state(ha);
21091ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state,
21191ec7cecSVikas Chaudhary ha->addl_fw_state);
21291ec7cecSVikas Chaudhary }
21391ec7cecSVikas Chaudhary
21491ec7cecSVikas Chaudhary static ssize_t
qla4xxx_phy_port_cnt_show(struct device * dev,struct device_attribute * attr,char * buf)21591ec7cecSVikas Chaudhary qla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr,
21691ec7cecSVikas Chaudhary char *buf)
21791ec7cecSVikas Chaudhary {
21891ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
21991ec7cecSVikas Chaudhary
220ee996a69SVikas Chaudhary if (is_qla40XX(ha))
22191ec7cecSVikas Chaudhary return -ENOSYS;
22291ec7cecSVikas Chaudhary
22391ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt);
22491ec7cecSVikas Chaudhary }
22591ec7cecSVikas Chaudhary
22691ec7cecSVikas Chaudhary static ssize_t
qla4xxx_phy_port_num_show(struct device * dev,struct device_attribute * attr,char * buf)22791ec7cecSVikas Chaudhary qla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr,
22891ec7cecSVikas Chaudhary char *buf)
22991ec7cecSVikas Chaudhary {
23091ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
23191ec7cecSVikas Chaudhary
232ee996a69SVikas Chaudhary if (is_qla40XX(ha))
23391ec7cecSVikas Chaudhary return -ENOSYS;
23491ec7cecSVikas Chaudhary
23591ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num);
23691ec7cecSVikas Chaudhary }
23791ec7cecSVikas Chaudhary
23891ec7cecSVikas Chaudhary static ssize_t
qla4xxx_iscsi_func_cnt_show(struct device * dev,struct device_attribute * attr,char * buf)23991ec7cecSVikas Chaudhary qla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr,
24091ec7cecSVikas Chaudhary char *buf)
24191ec7cecSVikas Chaudhary {
24291ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
24391ec7cecSVikas Chaudhary
244ee996a69SVikas Chaudhary if (is_qla40XX(ha))
24591ec7cecSVikas Chaudhary return -ENOSYS;
24691ec7cecSVikas Chaudhary
24791ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt);
24891ec7cecSVikas Chaudhary }
24991ec7cecSVikas Chaudhary
25091ec7cecSVikas Chaudhary static ssize_t
qla4xxx_hba_model_show(struct device * dev,struct device_attribute * attr,char * buf)25191ec7cecSVikas Chaudhary qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr,
25291ec7cecSVikas Chaudhary char *buf)
25391ec7cecSVikas Chaudhary {
25491ec7cecSVikas Chaudhary struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
25591ec7cecSVikas Chaudhary
25691ec7cecSVikas Chaudhary return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name);
25791ec7cecSVikas Chaudhary }
25891ec7cecSVikas Chaudhary
259eee06a0fSAdheer Chandravanshi static ssize_t
qla4xxx_fw_timestamp_show(struct device * dev,struct device_attribute * attr,char * buf)260eee06a0fSAdheer Chandravanshi qla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr,
261eee06a0fSAdheer Chandravanshi char *buf)
262eee06a0fSAdheer Chandravanshi {
263eee06a0fSAdheer Chandravanshi struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
264eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date,
265eee06a0fSAdheer Chandravanshi ha->fw_info.fw_build_time);
266eee06a0fSAdheer Chandravanshi }
267eee06a0fSAdheer Chandravanshi
268eee06a0fSAdheer Chandravanshi static ssize_t
qla4xxx_fw_build_user_show(struct device * dev,struct device_attribute * attr,char * buf)269eee06a0fSAdheer Chandravanshi qla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr,
270eee06a0fSAdheer Chandravanshi char *buf)
271eee06a0fSAdheer Chandravanshi {
272eee06a0fSAdheer Chandravanshi struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
273eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user);
274eee06a0fSAdheer Chandravanshi }
275eee06a0fSAdheer Chandravanshi
276eee06a0fSAdheer Chandravanshi static ssize_t
qla4xxx_fw_ext_timestamp_show(struct device * dev,struct device_attribute * attr,char * buf)277eee06a0fSAdheer Chandravanshi qla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr,
278eee06a0fSAdheer Chandravanshi char *buf)
279eee06a0fSAdheer Chandravanshi {
280eee06a0fSAdheer Chandravanshi struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
281eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp);
282eee06a0fSAdheer Chandravanshi }
283eee06a0fSAdheer Chandravanshi
284eee06a0fSAdheer Chandravanshi static ssize_t
qla4xxx_fw_load_src_show(struct device * dev,struct device_attribute * attr,char * buf)285eee06a0fSAdheer Chandravanshi qla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr,
286eee06a0fSAdheer Chandravanshi char *buf)
287eee06a0fSAdheer Chandravanshi {
288eee06a0fSAdheer Chandravanshi struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
289eee06a0fSAdheer Chandravanshi char *load_src = NULL;
290eee06a0fSAdheer Chandravanshi
291eee06a0fSAdheer Chandravanshi switch (ha->fw_info.fw_load_source) {
292eee06a0fSAdheer Chandravanshi case 1:
293eee06a0fSAdheer Chandravanshi load_src = "Flash Primary";
294eee06a0fSAdheer Chandravanshi break;
295eee06a0fSAdheer Chandravanshi case 2:
296eee06a0fSAdheer Chandravanshi load_src = "Flash Secondary";
297eee06a0fSAdheer Chandravanshi break;
298eee06a0fSAdheer Chandravanshi case 3:
299eee06a0fSAdheer Chandravanshi load_src = "Host Download";
300eee06a0fSAdheer Chandravanshi break;
301eee06a0fSAdheer Chandravanshi }
302eee06a0fSAdheer Chandravanshi
303eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%s\n", load_src);
304eee06a0fSAdheer Chandravanshi }
305eee06a0fSAdheer Chandravanshi
306eee06a0fSAdheer Chandravanshi static ssize_t
qla4xxx_fw_uptime_show(struct device * dev,struct device_attribute * attr,char * buf)307eee06a0fSAdheer Chandravanshi qla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr,
308eee06a0fSAdheer Chandravanshi char *buf)
309eee06a0fSAdheer Chandravanshi {
310eee06a0fSAdheer Chandravanshi struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
311eee06a0fSAdheer Chandravanshi qla4xxx_about_firmware(ha);
312eee06a0fSAdheer Chandravanshi return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs,
313eee06a0fSAdheer Chandravanshi ha->fw_uptime_msecs);
314eee06a0fSAdheer Chandravanshi }
315eee06a0fSAdheer Chandravanshi
3167ad633c0SHarish Zunjarrao static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL);
3177ad633c0SHarish Zunjarrao static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL);
3187ad633c0SHarish Zunjarrao static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL);
3197ad633c0SHarish Zunjarrao static DEVICE_ATTR(optrom_version, S_IRUGO, qla4xxx_optrom_version_show, NULL);
32091ec7cecSVikas Chaudhary static DEVICE_ATTR(board_id, S_IRUGO, qla4xxx_board_id_show, NULL);
32191ec7cecSVikas Chaudhary static DEVICE_ATTR(fw_state, S_IRUGO, qla4xxx_fw_state_show, NULL);
32291ec7cecSVikas Chaudhary static DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL);
32391ec7cecSVikas Chaudhary static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL);
32491ec7cecSVikas Chaudhary static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL);
32591ec7cecSVikas Chaudhary static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL);
326eee06a0fSAdheer Chandravanshi static DEVICE_ATTR(fw_timestamp, S_IRUGO, qla4xxx_fw_timestamp_show, NULL);
327eee06a0fSAdheer Chandravanshi static DEVICE_ATTR(fw_build_user, S_IRUGO, qla4xxx_fw_build_user_show, NULL);
328eee06a0fSAdheer Chandravanshi static DEVICE_ATTR(fw_ext_timestamp, S_IRUGO, qla4xxx_fw_ext_timestamp_show,
329eee06a0fSAdheer Chandravanshi NULL);
330eee06a0fSAdheer Chandravanshi static DEVICE_ATTR(fw_load_src, S_IRUGO, qla4xxx_fw_load_src_show, NULL);
331eee06a0fSAdheer Chandravanshi static DEVICE_ATTR(fw_uptime, S_IRUGO, qla4xxx_fw_uptime_show, NULL);
3327ad633c0SHarish Zunjarrao
333*a8b476fcSBart Van Assche static struct attribute *qla4xxx_host_attrs[] = {
334*a8b476fcSBart Van Assche &dev_attr_fw_version.attr,
335*a8b476fcSBart Van Assche &dev_attr_serial_num.attr,
336*a8b476fcSBart Van Assche &dev_attr_iscsi_version.attr,
337*a8b476fcSBart Van Assche &dev_attr_optrom_version.attr,
338*a8b476fcSBart Van Assche &dev_attr_board_id.attr,
339*a8b476fcSBart Van Assche &dev_attr_fw_state.attr,
340*a8b476fcSBart Van Assche &dev_attr_phy_port_cnt.attr,
341*a8b476fcSBart Van Assche &dev_attr_phy_port_num.attr,
342*a8b476fcSBart Van Assche &dev_attr_iscsi_func_cnt.attr,
343*a8b476fcSBart Van Assche &dev_attr_hba_model.attr,
344*a8b476fcSBart Van Assche &dev_attr_fw_timestamp.attr,
345*a8b476fcSBart Van Assche &dev_attr_fw_build_user.attr,
346*a8b476fcSBart Van Assche &dev_attr_fw_ext_timestamp.attr,
347*a8b476fcSBart Van Assche &dev_attr_fw_load_src.attr,
348*a8b476fcSBart Van Assche &dev_attr_fw_uptime.attr,
3497ad633c0SHarish Zunjarrao NULL,
3507ad633c0SHarish Zunjarrao };
351*a8b476fcSBart Van Assche
352*a8b476fcSBart Van Assche static const struct attribute_group qla4xxx_host_attr_group = {
353*a8b476fcSBart Van Assche .attrs = qla4xxx_host_attrs
354*a8b476fcSBart Van Assche };
355*a8b476fcSBart Van Assche
356*a8b476fcSBart Van Assche const struct attribute_group *qla4xxx_host_groups[] = {
357*a8b476fcSBart Van Assche &qla4xxx_host_attr_group,
358*a8b476fcSBart Van Assche NULL
359*a8b476fcSBart Van Assche };
360