18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * QLogic iSCSI HBA Driver
48c2ecf20Sopenharmony_ci * Copyright (c)  2003-2013 QLogic Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include "ql4_def.h"
88c2ecf20Sopenharmony_ci#include "ql4_glbl.h"
98c2ecf20Sopenharmony_ci#include "ql4_dbg.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistatic ssize_t
128c2ecf20Sopenharmony_ciqla4_8xxx_sysfs_read_fw_dump(struct file *filep, struct kobject *kobj,
138c2ecf20Sopenharmony_ci			     struct bin_attribute *ba, char *buf, loff_t off,
148c2ecf20Sopenharmony_ci			     size_t count)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
178c2ecf20Sopenharmony_ci					       struct device, kobj)));
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	if (is_qla40XX(ha))
208c2ecf20Sopenharmony_ci		return -EINVAL;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	if (!test_bit(AF_82XX_DUMP_READING, &ha->flags))
238c2ecf20Sopenharmony_ci		return 0;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	return memory_read_from_buffer(buf, count, &off, ha->fw_dump,
268c2ecf20Sopenharmony_ci				       ha->fw_dump_size);
278c2ecf20Sopenharmony_ci}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic ssize_t
308c2ecf20Sopenharmony_ciqla4_8xxx_sysfs_write_fw_dump(struct file *filep, struct kobject *kobj,
318c2ecf20Sopenharmony_ci			      struct bin_attribute *ba, char *buf, loff_t off,
328c2ecf20Sopenharmony_ci			      size_t count)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
358c2ecf20Sopenharmony_ci					       struct device, kobj)));
368c2ecf20Sopenharmony_ci	uint32_t dev_state;
378c2ecf20Sopenharmony_ci	long reading;
388c2ecf20Sopenharmony_ci	int ret = 0;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	if (is_qla40XX(ha))
418c2ecf20Sopenharmony_ci		return -EINVAL;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	if (off != 0)
448c2ecf20Sopenharmony_ci		return ret;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	buf[1] = 0;
478c2ecf20Sopenharmony_ci	ret = kstrtol(buf, 10, &reading);
488c2ecf20Sopenharmony_ci	if (ret) {
498c2ecf20Sopenharmony_ci		ql4_printk(KERN_ERR, ha, "%s: Invalid input. Return err %d\n",
508c2ecf20Sopenharmony_ci			   __func__, ret);
518c2ecf20Sopenharmony_ci		return ret;
528c2ecf20Sopenharmony_ci	}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	switch (reading) {
558c2ecf20Sopenharmony_ci	case 0:
568c2ecf20Sopenharmony_ci		/* clear dump collection flags */
578c2ecf20Sopenharmony_ci		if (test_and_clear_bit(AF_82XX_DUMP_READING, &ha->flags)) {
588c2ecf20Sopenharmony_ci			clear_bit(AF_82XX_FW_DUMPED, &ha->flags);
598c2ecf20Sopenharmony_ci			/* Reload minidump template */
608c2ecf20Sopenharmony_ci			qla4xxx_alloc_fw_dump(ha);
618c2ecf20Sopenharmony_ci			DEBUG2(ql4_printk(KERN_INFO, ha,
628c2ecf20Sopenharmony_ci					  "Firmware template reloaded\n"));
638c2ecf20Sopenharmony_ci		}
648c2ecf20Sopenharmony_ci		break;
658c2ecf20Sopenharmony_ci	case 1:
668c2ecf20Sopenharmony_ci		/* Set flag to read dump */
678c2ecf20Sopenharmony_ci		if (test_bit(AF_82XX_FW_DUMPED, &ha->flags) &&
688c2ecf20Sopenharmony_ci		    !test_bit(AF_82XX_DUMP_READING, &ha->flags)) {
698c2ecf20Sopenharmony_ci			set_bit(AF_82XX_DUMP_READING, &ha->flags);
708c2ecf20Sopenharmony_ci			DEBUG2(ql4_printk(KERN_INFO, ha,
718c2ecf20Sopenharmony_ci					  "Raw firmware dump ready for read on (%ld).\n",
728c2ecf20Sopenharmony_ci					  ha->host_no));
738c2ecf20Sopenharmony_ci		}
748c2ecf20Sopenharmony_ci		break;
758c2ecf20Sopenharmony_ci	case 2:
768c2ecf20Sopenharmony_ci		/* Reset HBA and collect FW dump */
778c2ecf20Sopenharmony_ci		ha->isp_ops->idc_lock(ha);
788c2ecf20Sopenharmony_ci		dev_state = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DEV_STATE);
798c2ecf20Sopenharmony_ci		if (dev_state == QLA8XXX_DEV_READY) {
808c2ecf20Sopenharmony_ci			ql4_printk(KERN_INFO, ha, "%s: Setting Need reset\n",
818c2ecf20Sopenharmony_ci				   __func__);
828c2ecf20Sopenharmony_ci			qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE,
838c2ecf20Sopenharmony_ci					    QLA8XXX_DEV_NEED_RESET);
848c2ecf20Sopenharmony_ci			if (is_qla8022(ha) ||
858c2ecf20Sopenharmony_ci			    ((is_qla8032(ha) || is_qla8042(ha)) &&
868c2ecf20Sopenharmony_ci			     qla4_83xx_can_perform_reset(ha))) {
878c2ecf20Sopenharmony_ci				set_bit(AF_8XXX_RST_OWNER, &ha->flags);
888c2ecf20Sopenharmony_ci				set_bit(AF_FW_RECOVERY, &ha->flags);
898c2ecf20Sopenharmony_ci				ql4_printk(KERN_INFO, ha, "%s: Reset owner is 0x%x\n",
908c2ecf20Sopenharmony_ci					   __func__, ha->func_num);
918c2ecf20Sopenharmony_ci			}
928c2ecf20Sopenharmony_ci		} else
938c2ecf20Sopenharmony_ci			ql4_printk(KERN_INFO, ha,
948c2ecf20Sopenharmony_ci				   "%s: Reset not performed as device state is 0x%x\n",
958c2ecf20Sopenharmony_ci				   __func__, dev_state);
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci		ha->isp_ops->idc_unlock(ha);
988c2ecf20Sopenharmony_ci		break;
998c2ecf20Sopenharmony_ci	default:
1008c2ecf20Sopenharmony_ci		/* do nothing */
1018c2ecf20Sopenharmony_ci		break;
1028c2ecf20Sopenharmony_ci	}
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci	return count;
1058c2ecf20Sopenharmony_ci}
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_cistatic struct bin_attribute sysfs_fw_dump_attr = {
1088c2ecf20Sopenharmony_ci	.attr = {
1098c2ecf20Sopenharmony_ci		.name = "fw_dump",
1108c2ecf20Sopenharmony_ci		.mode = S_IRUSR | S_IWUSR,
1118c2ecf20Sopenharmony_ci	},
1128c2ecf20Sopenharmony_ci	.size = 0,
1138c2ecf20Sopenharmony_ci	.read = qla4_8xxx_sysfs_read_fw_dump,
1148c2ecf20Sopenharmony_ci	.write = qla4_8xxx_sysfs_write_fw_dump,
1158c2ecf20Sopenharmony_ci};
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_cistatic struct sysfs_entry {
1188c2ecf20Sopenharmony_ci	char *name;
1198c2ecf20Sopenharmony_ci	struct bin_attribute *attr;
1208c2ecf20Sopenharmony_ci} bin_file_entries[] = {
1218c2ecf20Sopenharmony_ci	{ "fw_dump", &sysfs_fw_dump_attr },
1228c2ecf20Sopenharmony_ci	{ NULL },
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_civoid qla4_8xxx_alloc_sysfs_attr(struct scsi_qla_host *ha)
1268c2ecf20Sopenharmony_ci{
1278c2ecf20Sopenharmony_ci	struct Scsi_Host *host = ha->host;
1288c2ecf20Sopenharmony_ci	struct sysfs_entry *iter;
1298c2ecf20Sopenharmony_ci	int ret;
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci	for (iter = bin_file_entries; iter->name; iter++) {
1328c2ecf20Sopenharmony_ci		ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
1338c2ecf20Sopenharmony_ci					    iter->attr);
1348c2ecf20Sopenharmony_ci		if (ret)
1358c2ecf20Sopenharmony_ci			ql4_printk(KERN_ERR, ha,
1368c2ecf20Sopenharmony_ci				   "Unable to create sysfs %s binary attribute (%d).\n",
1378c2ecf20Sopenharmony_ci				   iter->name, ret);
1388c2ecf20Sopenharmony_ci	}
1398c2ecf20Sopenharmony_ci}
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_civoid qla4_8xxx_free_sysfs_attr(struct scsi_qla_host *ha)
1428c2ecf20Sopenharmony_ci{
1438c2ecf20Sopenharmony_ci	struct Scsi_Host *host = ha->host;
1448c2ecf20Sopenharmony_ci	struct sysfs_entry *iter;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	for (iter = bin_file_entries; iter->name; iter++)
1478c2ecf20Sopenharmony_ci		sysfs_remove_bin_file(&host->shost_gendev.kobj,
1488c2ecf20Sopenharmony_ci				      iter->attr);
1498c2ecf20Sopenharmony_ci}
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci/* Scsi_Host attributes. */
1528c2ecf20Sopenharmony_cistatic ssize_t
1538c2ecf20Sopenharmony_ciqla4xxx_fw_version_show(struct device *dev,
1548c2ecf20Sopenharmony_ci			struct device_attribute *attr, char *buf)
1558c2ecf20Sopenharmony_ci{
1568c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci	if (is_qla80XX(ha))
1598c2ecf20Sopenharmony_ci		return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
1608c2ecf20Sopenharmony_ci				ha->fw_info.fw_major, ha->fw_info.fw_minor,
1618c2ecf20Sopenharmony_ci				ha->fw_info.fw_patch, ha->fw_info.fw_build);
1628c2ecf20Sopenharmony_ci	else
1638c2ecf20Sopenharmony_ci		return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
1648c2ecf20Sopenharmony_ci				ha->fw_info.fw_major, ha->fw_info.fw_minor,
1658c2ecf20Sopenharmony_ci				ha->fw_info.fw_patch, ha->fw_info.fw_build);
1668c2ecf20Sopenharmony_ci}
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_cistatic ssize_t
1698c2ecf20Sopenharmony_ciqla4xxx_serial_num_show(struct device *dev, struct device_attribute *attr,
1708c2ecf20Sopenharmony_ci			char *buf)
1718c2ecf20Sopenharmony_ci{
1728c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1738c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s\n", ha->serial_number);
1748c2ecf20Sopenharmony_ci}
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_cistatic ssize_t
1778c2ecf20Sopenharmony_ciqla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr,
1788c2ecf20Sopenharmony_ci			   char *buf)
1798c2ecf20Sopenharmony_ci{
1808c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1818c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major,
1828c2ecf20Sopenharmony_ci			ha->fw_info.iscsi_minor);
1838c2ecf20Sopenharmony_ci}
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistatic ssize_t
1868c2ecf20Sopenharmony_ciqla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr,
1878c2ecf20Sopenharmony_ci			    char *buf)
1888c2ecf20Sopenharmony_ci{
1898c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
1908c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
1918c2ecf20Sopenharmony_ci			ha->fw_info.bootload_major, ha->fw_info.bootload_minor,
1928c2ecf20Sopenharmony_ci			ha->fw_info.bootload_patch, ha->fw_info.bootload_build);
1938c2ecf20Sopenharmony_ci}
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistatic ssize_t
1968c2ecf20Sopenharmony_ciqla4xxx_board_id_show(struct device *dev, struct device_attribute *attr,
1978c2ecf20Sopenharmony_ci		      char *buf)
1988c2ecf20Sopenharmony_ci{
1998c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2008c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id);
2018c2ecf20Sopenharmony_ci}
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_cistatic ssize_t
2048c2ecf20Sopenharmony_ciqla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr,
2058c2ecf20Sopenharmony_ci		      char *buf)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	qla4xxx_get_firmware_state(ha);
2108c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state,
2118c2ecf20Sopenharmony_ci			ha->addl_fw_state);
2128c2ecf20Sopenharmony_ci}
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_cistatic ssize_t
2158c2ecf20Sopenharmony_ciqla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr,
2168c2ecf20Sopenharmony_ci		      char *buf)
2178c2ecf20Sopenharmony_ci{
2188c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	if (is_qla40XX(ha))
2218c2ecf20Sopenharmony_ci		return -ENOSYS;
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt);
2248c2ecf20Sopenharmony_ci}
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_cistatic ssize_t
2278c2ecf20Sopenharmony_ciqla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr,
2288c2ecf20Sopenharmony_ci		      char *buf)
2298c2ecf20Sopenharmony_ci{
2308c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	if (is_qla40XX(ha))
2338c2ecf20Sopenharmony_ci		return -ENOSYS;
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num);
2368c2ecf20Sopenharmony_ci}
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_cistatic ssize_t
2398c2ecf20Sopenharmony_ciqla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr,
2408c2ecf20Sopenharmony_ci		      char *buf)
2418c2ecf20Sopenharmony_ci{
2428c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci	if (is_qla40XX(ha))
2458c2ecf20Sopenharmony_ci		return -ENOSYS;
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt);
2488c2ecf20Sopenharmony_ci}
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_cistatic ssize_t
2518c2ecf20Sopenharmony_ciqla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr,
2528c2ecf20Sopenharmony_ci		       char *buf)
2538c2ecf20Sopenharmony_ci{
2548c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name);
2578c2ecf20Sopenharmony_ci}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistatic ssize_t
2608c2ecf20Sopenharmony_ciqla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr,
2618c2ecf20Sopenharmony_ci			  char *buf)
2628c2ecf20Sopenharmony_ci{
2638c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2648c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date,
2658c2ecf20Sopenharmony_ci			ha->fw_info.fw_build_time);
2668c2ecf20Sopenharmony_ci}
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_cistatic ssize_t
2698c2ecf20Sopenharmony_ciqla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr,
2708c2ecf20Sopenharmony_ci			   char *buf)
2718c2ecf20Sopenharmony_ci{
2728c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2738c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user);
2748c2ecf20Sopenharmony_ci}
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_cistatic ssize_t
2778c2ecf20Sopenharmony_ciqla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr,
2788c2ecf20Sopenharmony_ci			      char *buf)
2798c2ecf20Sopenharmony_ci{
2808c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2818c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp);
2828c2ecf20Sopenharmony_ci}
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_cistatic ssize_t
2858c2ecf20Sopenharmony_ciqla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr,
2868c2ecf20Sopenharmony_ci			 char *buf)
2878c2ecf20Sopenharmony_ci{
2888c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
2898c2ecf20Sopenharmony_ci	char *load_src = NULL;
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci	switch (ha->fw_info.fw_load_source) {
2928c2ecf20Sopenharmony_ci	case 1:
2938c2ecf20Sopenharmony_ci		load_src = "Flash Primary";
2948c2ecf20Sopenharmony_ci		break;
2958c2ecf20Sopenharmony_ci	case 2:
2968c2ecf20Sopenharmony_ci		load_src = "Flash Secondary";
2978c2ecf20Sopenharmony_ci		break;
2988c2ecf20Sopenharmony_ci	case 3:
2998c2ecf20Sopenharmony_ci		load_src = "Host Download";
3008c2ecf20Sopenharmony_ci		break;
3018c2ecf20Sopenharmony_ci	}
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%s\n", load_src);
3048c2ecf20Sopenharmony_ci}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_cistatic ssize_t
3078c2ecf20Sopenharmony_ciqla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr,
3088c2ecf20Sopenharmony_ci		       char *buf)
3098c2ecf20Sopenharmony_ci{
3108c2ecf20Sopenharmony_ci	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
3118c2ecf20Sopenharmony_ci	qla4xxx_about_firmware(ha);
3128c2ecf20Sopenharmony_ci	return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs,
3138c2ecf20Sopenharmony_ci			ha->fw_uptime_msecs);
3148c2ecf20Sopenharmony_ci}
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL);
3178c2ecf20Sopenharmony_cistatic DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL);
3188c2ecf20Sopenharmony_cistatic DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL);
3198c2ecf20Sopenharmony_cistatic DEVICE_ATTR(optrom_version, S_IRUGO, qla4xxx_optrom_version_show, NULL);
3208c2ecf20Sopenharmony_cistatic DEVICE_ATTR(board_id, S_IRUGO, qla4xxx_board_id_show, NULL);
3218c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_state, S_IRUGO, qla4xxx_fw_state_show, NULL);
3228c2ecf20Sopenharmony_cistatic DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL);
3238c2ecf20Sopenharmony_cistatic DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL);
3248c2ecf20Sopenharmony_cistatic DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL);
3258c2ecf20Sopenharmony_cistatic DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL);
3268c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_timestamp, S_IRUGO, qla4xxx_fw_timestamp_show, NULL);
3278c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_build_user, S_IRUGO, qla4xxx_fw_build_user_show, NULL);
3288c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_ext_timestamp, S_IRUGO, qla4xxx_fw_ext_timestamp_show,
3298c2ecf20Sopenharmony_ci		   NULL);
3308c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_load_src, S_IRUGO, qla4xxx_fw_load_src_show, NULL);
3318c2ecf20Sopenharmony_cistatic DEVICE_ATTR(fw_uptime, S_IRUGO, qla4xxx_fw_uptime_show, NULL);
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cistruct device_attribute *qla4xxx_host_attrs[] = {
3348c2ecf20Sopenharmony_ci	&dev_attr_fw_version,
3358c2ecf20Sopenharmony_ci	&dev_attr_serial_num,
3368c2ecf20Sopenharmony_ci	&dev_attr_iscsi_version,
3378c2ecf20Sopenharmony_ci	&dev_attr_optrom_version,
3388c2ecf20Sopenharmony_ci	&dev_attr_board_id,
3398c2ecf20Sopenharmony_ci	&dev_attr_fw_state,
3408c2ecf20Sopenharmony_ci	&dev_attr_phy_port_cnt,
3418c2ecf20Sopenharmony_ci	&dev_attr_phy_port_num,
3428c2ecf20Sopenharmony_ci	&dev_attr_iscsi_func_cnt,
3438c2ecf20Sopenharmony_ci	&dev_attr_hba_model,
3448c2ecf20Sopenharmony_ci	&dev_attr_fw_timestamp,
3458c2ecf20Sopenharmony_ci	&dev_attr_fw_build_user,
3468c2ecf20Sopenharmony_ci	&dev_attr_fw_ext_timestamp,
3478c2ecf20Sopenharmony_ci	&dev_attr_fw_load_src,
3488c2ecf20Sopenharmony_ci	&dev_attr_fw_uptime,
3498c2ecf20Sopenharmony_ci	NULL,
3508c2ecf20Sopenharmony_ci};
351