[SCSI] qla2xxx: Reconfigure thermal temperature.
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Tue, 27 Aug 2013 05:37:36 +0000 (01:37 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 3 Sep 2013 14:28:03 +0000 (07:28 -0700)
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>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_mr.c
drivers/scsi/qla2xxx/qla_nx.c
drivers/scsi/qla2xxx/qla_nx2.c

index 8e8b50ee9a0e1fd15a9d328076f1c909ea4c9cc9..93f378325f45465d5085a5f9fa6cba11f85eb531 100644 (file)
@@ -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;
index ecaafe4f1d12160a2bf0d5d0a4e0d67040057ac1..aa31f7ab78ced91c294c8b9dcf153aa9e1f8de12 100644 (file)
@@ -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  |
index f393d24bbbacefa883d40578ffb6fd104c45c60e..a494e2e7469346b5ad9687a6d551a40f62edd816 100644 (file)
@@ -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
 };
 
 /*
index 5d960c5935881b627639f39807756734de6f2a98..d55fefd34afea35fd0e1999ea17ed17fac9b8247 100644 (file)
@@ -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 *);
index 71cbdeb591c78daecfa23ffbad92fef3c8fdfa7c..91df7a58da3018f1ed47bffd45f00f713cd9c3aa 100644 (file)
@@ -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;
index ce761106cfa4b6b8c6cdccb686a5b23a8dfe5458..126188468f8b0db9227fb6de121833995a7c8a04 100644 (file)
@@ -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;
 }
 
index be60a77e965108b606e0016b71a4967c19449cda..e087a4999965761fa2ab034dd34e0372eb39df49 100644 (file)
@@ -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;
index b3e48f501bc04d01126111c1e33f0b9d73a8960a..11ce53dcbe7e120c96cb28c1257c4a6af57f0db0 100644 (file)
@@ -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;
index 1be440cd550e68a48b9fa0ce45cf26b7b21af1ea..cbccb3f87643040433644d515cac4265875a8730 100644 (file)
@@ -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.