linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: giridhar.malavali@qlogic.com
To: James.Bottomley@HansenPartnership.com
Cc: giridhar.malavali@qlogic.com, andrew.vasquez@qlogic.com,
	madhu.iyengar@qlogic.com, linux-scsi@vger.kernel.org,
	Madhuranath Iyengar <madhuranath.iyengar@qlogic.com>
Subject: [PATCH 05/17] qla2xxx: Check for golden firmware and show version if available
Date: Fri, 23 Jul 2010 15:28:26 +0500	[thread overview]
Message-ID: <1279880918-62876-6-git-send-email-giridhar.malavali@qlogic.com> (raw)
In-Reply-To: <1279880918-62876-1-git-send-email-giridhar.malavali@qlogic.com>

From: Madhuranath Iyengar <madhuranath.iyengar@qlogic.com>


Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_attr.c |   18 ++++++++++++++++++
 drivers/scsi/qla2xxx/qla_def.h  |    2 ++
 drivers/scsi/qla2xxx/qla_sup.c  |   22 ++++++++++++++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fd6f7b1..7ebf365 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1187,6 +1187,21 @@ qla2x00_optrom_fw_version_show(struct device *dev,
 }
 
 static ssize_t
+qla2x00_optrom_gold_fw_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 (%d)\n",
+	    ha->gold_fw_version[0], ha->gold_fw_version[1],
+	    ha->gold_fw_version[2], ha->gold_fw_version[3]);
+}
+
+static ssize_t
 qla2x00_total_isp_aborts_show(struct device *dev,
 			      struct device_attribute *attr, char *buf)
 {
@@ -1336,6 +1351,8 @@ static DEVICE_ATTR(optrom_fcode_version, S_IRUGO,
 		   qla2x00_optrom_fcode_version_show, NULL);
 static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show,
 		   NULL);
+static DEVICE_ATTR(optrom_gold_fw_version, S_IRUGO,
+    qla2x00_optrom_gold_fw_version_show, NULL);
 static DEVICE_ATTR(84xx_fw_version, S_IRUGO, qla24xx_84xx_fw_version_show,
 		   NULL);
 static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show,
@@ -1376,6 +1393,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
 	&dev_attr_vn_port_mac_address,
 	&dev_attr_fabric_param,
 	&dev_attr_fw_state,
+	&dev_attr_optrom_gold_fw_version,
 	NULL,
 };
 
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 02c7480..7e11ccf 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2714,6 +2714,8 @@ struct qla_hw_data {
 	uint8_t 	fcode_revision[16];
 	uint32_t	fw_revision[4];
 
+	uint32_t	gold_fw_version[4];
+
 	/* Offsets for flash/nvram access (set to ~0 if not used). */
 	uint32_t	flash_conf_off;
 	uint32_t	flash_data_off;
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 3c5115f..df288dc 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -2759,6 +2759,28 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
 		ha->fw_revision[3] = dcode[3];
 	}
 
+	/* Check for golden firmware and get version if available */
+	if (!IS_QLA81XX(ha)) {
+		/* Golden firmware is not present in non 81XX adapters */
+		return ret;
+	}
+
+	memset(ha->gold_fw_version, 0, sizeof(ha->gold_fw_version));
+	dcode = mbuf;
+	ha->isp_ops->read_optrom(vha, (uint8_t *)dcode,
+	    ha->flt_region_gold_fw << 2, 32);
+
+	if (dcode[4] == 0xFFFFFFFF && dcode[5] == 0xFFFFFFFF &&
+	    dcode[6] == 0xFFFFFFFF && dcode[7] == 0xFFFFFFFF) {
+		DEBUG2(qla_printk(KERN_INFO, ha,
+		    "%s(%ld): Unrecognized golden fw at 0x%x.\n",
+		    __func__, vha->host_no, ha->flt_region_gold_fw * 4));
+		return ret;
+	}
+
+	for (i = 4; i < 8; i++)
+		ha->gold_fw_version[i-4] = be32_to_cpu(dcode[i]);
+
 	return ret;
 }
 
-- 
1.6.0.2


  parent reply	other threads:[~2010-07-23  9:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 10:28 [PATCH 00/17] qla2xxx: Updates for scsi-misc-2.6 giridhar.malavali
2010-07-23 10:28 ` [PATCH 01/17] qla2xxx: Don't issue set or get port param MBC if invalid port loop id giridhar.malavali
2010-07-23 10:28 ` [PATCH 02/17] qla2xxx: Removed dependency for SRB structure for Marker processing giridhar.malavali
2010-07-23 10:28 ` [PATCH 03/17] qla2xxx: Appropriately log FCP priority data messages giridhar.malavali
2010-07-23 10:28 ` [PATCH 04/17] qla2xxx: Use GFF_ID to check FCP-SCSI FC4 type before logging into Nx_Ports giridhar.malavali
2010-07-23 10:28 ` giridhar.malavali [this message]
2010-07-23 10:28 ` [PATCH 06/17] qla2xxx: Correct extended sense-data handling giridhar.malavali
2010-07-23 10:28 ` [PATCH 07/17] qla2xxx: Propogate transport disrupted status for cable pull conditions for faster failover giridhar.malavali
2010-07-23 10:28 ` [PATCH 08/17] qla2xxx: Stop firmware before doing init firmware giridhar.malavali
2010-07-23 10:28 ` [PATCH 09/17] qla2xxx: Add qla2x00_free_fcports() function giridhar.malavali
2010-07-23 10:28 ` [PATCH 10/17] qla2xxx: Don't issue set or get port param MBC if remote port is not logged in giridhar.malavali
2010-07-23 10:28 ` [PATCH 11/17] qla2xxx: Add CT passthru support for ISP23xx adapters giridhar.malavali
2010-07-23 10:28 ` [PATCH 12/17] qla2xxx: Do not allow ELS Passthru commands " giridhar.malavali
2010-07-23 10:28 ` [PATCH 13/17] qla2xxx: Updates for ISP82xx giridhar.malavali
2010-07-23 10:28 ` [PATCH 14/17] qla2xxx: Rearranged and cleaned up the code for processing the pending commands giridhar.malavali
2010-07-23 10:28 ` [PATCH 15/17] qla2xxx: Update copyright banner giridhar.malavali
2010-07-23 10:28 ` [PATCH 16/17] qla2xxx: Cleanup some dead-code and make some functions static giridhar.malavali
2010-07-23 10:28 ` [PATCH 17/17] qla2xxx: T10 DIF Type 2 support giridhar.malavali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279880918-62876-6-git-send-email-giridhar.malavali@qlogic.com \
    --to=giridhar.malavali@qlogic.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=madhu.iyengar@qlogic.com \
    --cc=madhuranath.iyengar@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).