[SCSI] qla2xxx: Update MPI/PHY version retrieval codes.

Reflects layout and format of latest specification.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
Andrew Vasquez 2009-03-24 09:08:03 -07:00 committed by James Bottomley
parent be67e6530b
commit 55a961581f
5 changed files with 32 additions and 12 deletions

View File

@ -818,9 +818,23 @@ qla2x00_mpi_version_show(struct device *dev, struct device_attribute *attr,
if (!IS_QLA81XX(ha)) if (!IS_QLA81XX(ha))
return snprintf(buf, PAGE_SIZE, "\n"); return snprintf(buf, PAGE_SIZE, "\n");
return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x (%x)\n", return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
ha->mpi_version[0], ha->mpi_version[1], ha->mpi_version[2], ha->mpi_version[0], ha->mpi_version[1], ha->mpi_version[2],
ha->mpi_version[3], ha->mpi_capabilities); ha->mpi_capabilities);
}
static ssize_t
qla2x00_phy_version_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
struct qla_hw_data *ha = vha->hw;
if (!IS_QLA81XX(ha))
return snprintf(buf, PAGE_SIZE, "\n");
return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d\n",
ha->phy_version[0], ha->phy_version[1], ha->phy_version[2]);
} }
static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL);
@ -848,6 +862,7 @@ static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show,
static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show, static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show,
NULL); NULL);
static DEVICE_ATTR(mpi_version, S_IRUGO, qla2x00_mpi_version_show, NULL); static DEVICE_ATTR(mpi_version, S_IRUGO, qla2x00_mpi_version_show, NULL);
static DEVICE_ATTR(phy_version, S_IRUGO, qla2x00_phy_version_show, NULL);
struct device_attribute *qla2x00_host_attrs[] = { struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_driver_version, &dev_attr_driver_version,
@ -868,6 +883,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_optrom_fw_version, &dev_attr_optrom_fw_version,
&dev_attr_total_isp_aborts, &dev_attr_total_isp_aborts,
&dev_attr_mpi_version, &dev_attr_mpi_version,
&dev_attr_phy_version,
NULL, NULL,
}; };

View File

@ -2481,8 +2481,9 @@ struct qla_hw_data {
uint8_t fw_seriallink_options[4]; uint8_t fw_seriallink_options[4];
uint16_t fw_seriallink_options24[4]; uint16_t fw_seriallink_options24[4];
uint8_t mpi_version[4]; uint8_t mpi_version[3];
uint32_t mpi_capabilities; uint32_t mpi_capabilities;
uint8_t phy_version[3];
/* Firmware dump information. */ /* Firmware dump information. */
struct qla2xxx_fw_dump *fw_dump; struct qla2xxx_fw_dump *fw_dump;

View File

@ -144,8 +144,8 @@ extern int
qla2x00_execute_fw(scsi_qla_host_t *, uint32_t); qla2x00_execute_fw(scsi_qla_host_t *, uint32_t);
extern void extern void
qla2x00_get_fw_version(scsi_qla_host_t *, uint16_t *, qla2x00_get_fw_version(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *,
uint16_t *, uint16_t *, uint16_t *, uint32_t *, uint8_t *, uint32_t *); uint16_t *, uint32_t *, uint8_t *, uint32_t *, uint8_t *);
extern int extern int
qla2x00_get_fw_options(scsi_qla_host_t *, uint16_t *); qla2x00_get_fw_options(scsi_qla_host_t *, uint16_t *);

View File

@ -994,7 +994,8 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
&ha->fw_minor_version, &ha->fw_minor_version,
&ha->fw_subminor_version, &ha->fw_subminor_version,
&ha->fw_attributes, &ha->fw_memory_size, &ha->fw_attributes, &ha->fw_memory_size,
ha->mpi_version, &ha->mpi_capabilities); ha->mpi_version, &ha->mpi_capabilities,
ha->phy_version);
ha->flags.npiv_supported = 0; ha->flags.npiv_supported = 0;
if (IS_QLA2XXX_MIDTYPE(ha) && if (IS_QLA2XXX_MIDTYPE(ha) &&
(ha->fw_attributes & BIT_2)) { (ha->fw_attributes & BIT_2)) {

View File

@ -408,7 +408,7 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
void void
qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor, qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor,
uint16_t *subminor, uint16_t *attributes, uint32_t *memory, uint8_t *mpi, uint16_t *subminor, uint16_t *attributes, uint32_t *memory, uint8_t *mpi,
uint32_t *mpi_caps) uint32_t *mpi_caps, uint8_t *phy)
{ {
int rval; int rval;
mbx_cmd_t mc; mbx_cmd_t mc;
@ -420,7 +420,7 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor,
mcp->out_mb = MBX_0; mcp->out_mb = MBX_0;
mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
if (IS_QLA81XX(vha->hw)) if (IS_QLA81XX(vha->hw))
mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10; mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8;
mcp->flags = 0; mcp->flags = 0;
mcp->tov = MBX_TOV_SECONDS; mcp->tov = MBX_TOV_SECONDS;
rval = qla2x00_mailbox_command(vha, mcp); rval = qla2x00_mailbox_command(vha, mcp);
@ -435,11 +435,13 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor,
else else
*memory = (mcp->mb[5] << 16) | mcp->mb[4]; *memory = (mcp->mb[5] << 16) | mcp->mb[4];
if (IS_QLA81XX(vha->hw)) { if (IS_QLA81XX(vha->hw)) {
mpi[0] = mcp->mb[10] >> 8; mpi[0] = mcp->mb[10] & 0xff;
mpi[1] = mcp->mb[10] & 0xff; mpi[1] = mcp->mb[11] >> 8;
mpi[2] = mcp->mb[11] >> 8; mpi[2] = mcp->mb[11] & 0xff;
mpi[3] = mcp->mb[11] & 0xff;
*mpi_caps = (mcp->mb[12] << 16) | mcp->mb[13]; *mpi_caps = (mcp->mb[12] << 16) | mcp->mb[13];
phy[0] = mcp->mb[8] & 0xff;
phy[1] = mcp->mb[9] >> 8;
phy[2] = mcp->mb[9] & 0xff;
} }
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {