linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saurav Kashyap <saurav.kashyap@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, saurav.kashyap@qlogic.com,
	andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org
Subject: [PATCH 10/29] qla2xxx: Reconfigure thermal temperature.
Date: Tue, 27 Aug 2013 01:37:36 -0400	[thread overview]
Message-ID: <1377581875-8574-11-git-send-email-saurav.kashyap@qlogic.com> (raw)
In-Reply-To: <1377581875-8574-1-git-send-email-saurav.kashyap@qlogic.com>

From: Joe Carnuccio <joe.carnuccio@qlogic.com>

For supported ISPS, Read asic temperature by calling the
GET PARAMS (type C) mailbox command.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_attr.c |    6 ----
 drivers/scsi/qla2xxx/qla_dbg.c  |    4 ++-
 drivers/scsi/qla2xxx/qla_def.h  |    3 --
 drivers/scsi/qla2xxx/qla_gbl.h  |    2 +
 drivers/scsi/qla2xxx/qla_init.c |    1 -
 drivers/scsi/qla2xxx/qla_mbx.c  |   61 ++++++++++++++++++++------------------
 drivers/scsi/qla2xxx/qla_mr.c   |    1 -
 drivers/scsi/qla2xxx/qla_nx.c   |    8 +++++
 drivers/scsi/qla2xxx/qla_nx2.c  |    8 +++++
 9 files changed, 53 insertions(+), 41 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 8e8b50e..93f3783 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1300,12 +1300,6 @@ qla2x00_thermal_temp_show(struct device *dev,
 	scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
 	uint16_t temp = 0;
 
-	if (!vha->hw->thermal_support) {
-		ql_log(ql_log_warn, vha, 0x70db,
-		    "Thermal not supported by this card.\n");
-		goto done;
-	}
-
 	if (qla2x00_reset_active(vha)) {
 		ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n");
 		goto done;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index ecaafe4..aa31f7a 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,6 +14,8 @@
  * | Module Init and Probe        |       0x0151       | 0x4b,0xba,0xfa |
  * | Mailbox commands             |       0x1181       | 0x111a-0x111b  |
  * |                              |                    | 0x1155-0x1158  |
+ * |                              |                    | 0x1018-0x1019  |
+ * |                              |                    | 0x10ca		|
  * | Device Discovery             |       0x2095       | 0x2020-0x2022, |
  * |                              |                    | 0x2011-0x2012, |
  * |                              |                    | 0x2016         |
@@ -37,7 +39,7 @@
  * |                              |                    | 0x70a5,0x70a6, |
  * |                              |                    | 0x70a8,0x70ab, |
  * |                              |                    | 0x70ad-0x70ae, |
- * |                              |                    | 0x70d1-0x70da, |
+ * |                              |                    | 0x70d1-0x70db, |
  * |                              |                    | 0x7047,0x703b	|
  * | Task Management              |       0x803d       | 0x8025-0x8026  |
  * |                              |                    | 0x800b,0x8039  |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index f393d24..a494e2e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3304,9 +3304,6 @@ struct qla_hw_data {
 	struct mr_data_fx00 mr;
 
 	struct qlt_hw_data tgt;
-	uint16_t	thermal_support;
-#define THERMAL_SUPPORT_I2C BIT_0
-#define THERMAL_SUPPORT_ISP BIT_1
 };
 
 /*
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index dc14ac2..d03b15d 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -685,6 +685,8 @@ extern int qla81xx_get_led_config(scsi_qla_host_t *, uint16_t *);
 extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int);
 extern char *qdev_state(uint32_t);
 extern void qla82xx_clear_pending_mbx(scsi_qla_host_t *);
+extern int qla82xx_read_temperature(scsi_qla_host_t *);
+extern int qla8044_read_temperature(scsi_qla_host_t *);
 
 /* BSG related functions */
 extern int qla24xx_bsg_request(struct fc_bsg_job *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 71cbdeb..91df7a5 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -524,7 +524,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
 	vha->flags.reset_active = 0;
 	ha->flags.pci_channel_io_perm_failure = 0;
 	ha->flags.eeh_busy = 0;
-	ha->thermal_support = THERMAL_SUPPORT_I2C|THERMAL_SUPPORT_ISP;
 	atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
 	atomic_set(&vha->loop_state, LOOP_DOWN);
 	vha->device_flags = DFLG_NO_CABLE;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index ce76110..1261884 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4608,40 +4608,43 @@ qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp)
 	struct qla_hw_data *ha = vha->hw;
 	uint8_t byte;
 
-	ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10ca,
-	    "Entered %s.\n", __func__);
-
-	if (ha->thermal_support & THERMAL_SUPPORT_I2C) {
-		rval = qla2x00_read_sfp(vha, 0, &byte,
-		    0x98, 0x1, 1, BIT_13|BIT_12|BIT_0);
-		*temp = byte;
-		if (rval == QLA_SUCCESS)
-			goto done;
-
-		ql_log(ql_log_warn, vha, 0x10c9,
-		    "Thermal not supported through I2C bus, trying alternate "
-		    "method (ISP access).\n");
-		ha->thermal_support &= ~THERMAL_SUPPORT_I2C;
+	if (!IS_FWI2_CAPABLE(ha) || IS_QLA24XX_TYPE(ha) || IS_QLA81XX(ha)) {
+		ql_dbg(ql_dbg_mbx, vha, 0x1150,
+		    "Thermal not supported by this card.\n");
+		return rval;
 	}
 
-	if (ha->thermal_support & THERMAL_SUPPORT_ISP) {
-		rval = qla2x00_read_asic_temperature(vha, temp);
-		if (rval == QLA_SUCCESS)
-			goto done;
-
-		ql_log(ql_log_warn, vha, 0x1019,
-		    "Thermal not supported through ISP.\n");
-		ha->thermal_support &= ~THERMAL_SUPPORT_ISP;
+	if (IS_QLA25XX(ha)) {
+		if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
+		    ha->pdev->subsystem_device == 0x0175) {
+			rval = qla2x00_read_sfp(vha, 0, &byte,
+			    0x98, 0x1, 1, BIT_13|BIT_0);
+			*temp = byte;
+			return rval;
+		}
+		if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
+		    ha->pdev->subsystem_device == 0x338e) {
+			rval = qla2x00_read_sfp(vha, 0, &byte,
+			    0x98, 0x1, 1, BIT_15|BIT_14|BIT_0);
+			*temp = byte;
+			return rval;
+		}
+		ql_dbg(ql_dbg_mbx, vha, 0x10c9,
+		    "Thermal not supported by this card.\n");
+		return rval;
 	}
 
-	ql_log(ql_log_warn, vha, 0x1150,
-	    "Thermal not supported by this card "
-	    "(ignoring further requests).\n");
-	return  rval;
+	if (IS_QLA82XX(ha)) {
+		*temp = qla82xx_read_temperature(vha);
+		rval = QLA_SUCCESS;
+		return rval;
+	} else if (IS_QLA8044(ha)) {
+		*temp = qla8044_read_temperature(vha);
+		rval = QLA_SUCCESS;
+		return rval;
+	}
 
-done:
-	ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1018,
-	    "Done %s.\n", __func__);
+	rval = qla2x00_read_asic_temperature(vha, temp);
 	return rval;
 }
 
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index be60a77..e087a49 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -2062,7 +2062,6 @@ qlafx00_initialize_adapter(scsi_qla_host_t *vha)
 	vha->flags.reset_active = 0;
 	ha->flags.pci_channel_io_perm_failure = 0;
 	ha->flags.eeh_busy = 0;
-	ha->thermal_support = 0;
 	atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
 	atomic_set(&vha->loop_state, LOOP_DOWN);
 	vha->device_flags = DFLG_NO_CABLE;
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index b3e48f5..11ce53d 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -3327,6 +3327,14 @@ static int qla82xx_check_temp(scsi_qla_host_t *vha)
 	return 0;
 }
 
+int qla82xx_read_temperature(scsi_qla_host_t *vha)
+{
+	uint32_t temp;
+
+	temp = qla82xx_rd_32(vha->hw, CRB_TEMP_STATE);
+	return qla82xx_get_temp_val(temp);
+}
+
 void qla82xx_clear_pending_mbx(scsi_qla_host_t *vha)
 {
 	struct qla_hw_data *ha = vha->hw;
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 005cd6b..712a9bb 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -1945,6 +1945,14 @@ qla8044_check_temp(struct scsi_qla_host *vha)
 	return 0;
 }
 
+int qla8044_read_temperature(scsi_qla_host_t *vha)
+{
+	uint32_t temp;
+
+	temp = qla8044_rd_direct(vha, QLA8044_CRB_TEMP_STATE_INDEX);
+	return qla82xx_get_temp_val(temp);
+}
+
 /**
  * qla8044_check_fw_alive  - Check firmware health
  * @ha: Pointer to host adapter structure.
-- 
1.7.7


  parent reply	other threads:[~2013-08-27  6:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27  5:37 [PATCH 00/29] Update driver to 8.06.00.08-k Saurav Kashyap
2013-08-27  5:37 ` [PATCH 01/29] qla2xxx: Print some variables to hexadecimal string via %*phN format Saurav Kashyap
2013-08-27  5:37 ` [PATCH 02/29] qla2xxx: Add support for ISP8044 Saurav Kashyap
2013-08-28  7:15   ` James Bottomley
2013-08-28 13:33     ` Saurav Kashyap
2013-08-27  5:37 ` [PATCH 03/29] qla2xxx: Fix incorrect test after list_for_each_entry() exits Saurav Kashyap
2013-08-27  5:37 ` [PATCH 04/29] qla2xxx: Correct multiqueue offset calculations Saurav Kashyap
2013-08-27  5:37 ` [PATCH 05/29] qla2xxx: Set factory reset recovery timeout to 10 min. for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 06/29] qla2xxx: Perform warm reset every 2 minutes if firmware load fails " Saurav Kashyap
2013-08-27  5:37 ` [PATCH 07/29] qla2xxx: Add ISPFX00 specific bus reset routine Saurav Kashyap
2013-08-27  5:37 ` [PATCH 08/29] qla2xxx: Remove QL_DEBUG_LEVEL_17 defines from qla_nx.c Saurav Kashyap
2013-08-27  5:37 ` [PATCH 09/29] qla2xxx: Add setting of driver version string for vendor application Saurav Kashyap
2013-08-27  5:37 ` Saurav Kashyap [this message]
2013-08-27  5:37 ` [PATCH 11/29] qla2xxx: Notify ISPFX00 firmware when driver is unloaded or system is shut down Saurav Kashyap
2013-08-27  5:37 ` [PATCH 12/29] qla2xxx: Add critical temperature handling for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 13/29] qla2xxx: Make log message that prints when a completion status requires a port down more readable Saurav Kashyap
2013-08-27  5:37 ` [PATCH 14/29] qla2xxx: Add missing FCP statistics to sysfs interface Saurav Kashyap
2013-08-27  5:37 ` [PATCH 15/29] qla2xxx: Add changes to support extended IOs for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 16/29] qla2xxx: Add changes in initialization for ISPFX00 cards with BIOS Saurav Kashyap
2013-08-27  5:37 ` [PATCH 17/29] qla2xxx: Send all AENs for ISPFx00 to above layers Saurav Kashyap
2013-08-27  5:37 ` [PATCH 18/29] qla2xxx: Remove handling of Shutdown Requested AEN from qlafx00_process_aen() Saurav Kashyap
2013-08-27  5:37 ` [PATCH 19/29] qla2xxx: Correct Interrupt Register offset for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 20/29] qla2xxx: QLAFX00 make over temperature AEN handling informational, add log for normal temperature AEN Saurav Kashyap
2013-08-27  5:37 ` [PATCH 21/29] qla2xxx: Set default critical temperature value in cases when ISPFX00 firmware doesn't provide it Saurav Kashyap
2013-08-27  5:37 ` [PATCH 22/29] qla2xxx: Add loopback IDC-TIME-EXTEND aen handling support Saurav Kashyap
2013-08-27  5:37 ` [PATCH 23/29] qla2xxx: Select link initialization option bits from current operating mode Saurav Kashyap
2013-08-27  5:37 ` [PATCH 24/29] qla2xxx: Move queue depth ramp down message to i/o debug level Saurav Kashyap
2013-08-27  5:37 ` [PATCH 25/29] qla2xxx: Add a new interface to update versions Saurav Kashyap
2013-08-27  5:37 ` [PATCH 26/29] qla2xxx: Correctly print out/in mailbox registers Saurav Kashyap
2013-08-27  5:37 ` [PATCH 27/29] qla2xxx: Correction to message ids Saurav Kashyap
2013-08-27  5:37 ` [PATCH 28/29] qla2xxx: print MAC via %pMR Saurav Kashyap
2013-08-27  5:37 ` [PATCH 29/29] qla2xxx: Update the driver version to 8.06.00.08-k Saurav Kashyap
2013-08-28  3:24 ` [PATCH 00/29] Update driver " James Bottomley
2013-08-28  4:31   ` Saurav Kashyap

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=1377581875-8574-11-git-send-email-saurav.kashyap@qlogic.com \
    --to=saurav.kashyap@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /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).