[SCSI] qla4xxx: Added vendor specific sysfs attributes
Added board_id, fw_state, phy_port_cnt, phy_port_num, iscsi_func_cnt, hba_model Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Родитель
7c07d139cf
Коммит
91ec7cec4a
|
@ -55,15 +55,91 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr,
|
|||
ha->bootload_patch, ha->bootload_build);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_board_id_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
|
||||
qla4xxx_get_firmware_state(ha);
|
||||
return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state,
|
||||
ha->addl_fw_state);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
|
||||
if (!is_qla8022(ha))
|
||||
return -ENOSYS;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
|
||||
if (!is_qla8022(ha))
|
||||
return -ENOSYS;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
|
||||
if (!is_qla8022(ha))
|
||||
return -ENOSYS;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL);
|
||||
static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL);
|
||||
static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL);
|
||||
static DEVICE_ATTR(optrom_version, S_IRUGO, qla4xxx_optrom_version_show, NULL);
|
||||
static DEVICE_ATTR(board_id, S_IRUGO, qla4xxx_board_id_show, NULL);
|
||||
static DEVICE_ATTR(fw_state, S_IRUGO, qla4xxx_fw_state_show, NULL);
|
||||
static DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL);
|
||||
static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL);
|
||||
static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL);
|
||||
static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL);
|
||||
|
||||
struct device_attribute *qla4xxx_host_attrs[] = {
|
||||
&dev_attr_fw_version,
|
||||
&dev_attr_serial_num,
|
||||
&dev_attr_iscsi_version,
|
||||
&dev_attr_optrom_version,
|
||||
&dev_attr_board_id,
|
||||
&dev_attr_fw_state,
|
||||
&dev_attr_phy_port_cnt,
|
||||
&dev_attr_phy_port_num,
|
||||
&dev_attr_iscsi_func_cnt,
|
||||
&dev_attr_hba_model,
|
||||
NULL,
|
||||
};
|
||||
|
|
|
@ -610,6 +610,10 @@ struct scsi_qla_host {
|
|||
#define SYSFS_FLAG_FW_SEL_BOOT 2
|
||||
struct iscsi_boot_kset *boot_kset;
|
||||
struct ql4_boot_tgt_info boot_tgt;
|
||||
uint16_t phy_port_num;
|
||||
uint16_t phy_port_cnt;
|
||||
uint16_t iscsi_pci_func_cnt;
|
||||
uint8_t model_name[16];
|
||||
};
|
||||
|
||||
struct ql4_task_data {
|
||||
|
|
|
@ -446,6 +446,21 @@ static int qla4xxx_init_firmware(struct scsi_qla_host *ha)
|
|||
return qla4xxx_get_firmware_status(ha);
|
||||
}
|
||||
|
||||
static void qla4xxx_set_model_info(struct scsi_qla_host *ha)
|
||||
{
|
||||
uint16_t board_id_string[8];
|
||||
int i;
|
||||
int size = sizeof(ha->nvram->isp4022.boardIdStr);
|
||||
int offset = offsetof(struct eeprom_data, isp4022.boardIdStr) / 2;
|
||||
|
||||
for (i = 0; i < (size / 2) ; i++) {
|
||||
board_id_string[i] = rd_nvram_word(ha, offset);
|
||||
offset += 1;
|
||||
}
|
||||
|
||||
memcpy(ha->model_name, board_id_string, size);
|
||||
}
|
||||
|
||||
static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
@ -481,6 +496,12 @@ static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
|
|||
else
|
||||
return QLA_ERROR;
|
||||
}
|
||||
|
||||
if (is_qla4022(ha) || is_qla4032(ha))
|
||||
qla4xxx_set_model_info(ha);
|
||||
else
|
||||
strcpy(ha->model_name, "QLA4010");
|
||||
|
||||
DEBUG(printk("scsi%ld: %s: Setting extHwConfig to 0xFFFF%04x\n",
|
||||
ha->host_no, __func__, extHwConfig.Asuint32_t));
|
||||
|
||||
|
|
|
@ -2266,6 +2266,11 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)
|
|||
min(sizeof(ha->my_mac), sizeof(sys_info->mac_addr)));
|
||||
memcpy(ha->serial_number, &sys_info->serial_number,
|
||||
min(sizeof(ha->serial_number), sizeof(sys_info->serial_number)));
|
||||
memcpy(ha->model_name, &sys_info->board_id_str,
|
||||
min(sizeof(ha->model_name), sizeof(sys_info->board_id_str)));
|
||||
ha->phy_port_cnt = sys_info->phys_port_cnt;
|
||||
ha->phy_port_num = sys_info->port_num;
|
||||
ha->iscsi_pci_func_cnt = sys_info->iscsi_pci_func_cnt;
|
||||
|
||||
DEBUG2(printk("scsi%ld: %s: "
|
||||
"mac %02x:%02x:%02x:%02x:%02x:%02x "
|
||||
|
|
Загрузка…
Ссылка в новой задаче