aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2013-02-08 01:58:03 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-02-22 09:39:27 -0500
commitfe52f6e121a8e6b66a608b79deb1c383e08aa32f (patch)
tree626270189331cabc1a86693ee3bacbfa15dbb28e /drivers/scsi/qla2xxx
parent6c3943cdb87f68a9dbb6d586f40b84622e803574 (diff)
[SCSI] qla2xxx: Integrate generic card temperature with mezz card temperature.
Give priority to I2C thermal. 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>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c33
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h5
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c82
6 files changed, 86 insertions, 40 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 7256167d579e..1d82eef4e1eb 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1272,22 +1272,29 @@ qla2x00_thermal_temp_show(struct device *dev,
1272 struct device_attribute *attr, char *buf) 1272 struct device_attribute *attr, char *buf)
1273{ 1273{
1274 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); 1274 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1275 int rval = QLA_FUNCTION_FAILED; 1275 uint16_t temp = 0;
1276 uint16_t temp, frac;
1277 1276
1278 if (!vha->hw->flags.thermal_supported) 1277 if (!vha->hw->thermal_support) {
1279 return snprintf(buf, PAGE_SIZE, "\n"); 1278 ql_log(ql_log_warn, vha, 0x70db,
1279 "Thermal not supported by this card.\n");
1280 goto done;
1281 }
1280 1282
1281 temp = frac = 0; 1283 if (qla2x00_reset_active(vha)) {
1282 if (qla2x00_reset_active(vha)) 1284 ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n");
1283 ql_log(ql_log_warn, vha, 0x707b, 1285 goto done;
1284 "ISP reset active.\n"); 1286 }
1285 else if (!vha->hw->flags.eeh_busy) 1287
1286 rval = qla2x00_get_thermal_temp(vha, &temp, &frac); 1288 if (vha->hw->flags.eeh_busy) {
1287 if (rval != QLA_SUCCESS) 1289 ql_log(ql_log_warn, vha, 0x70dd, "PCI EEH busy.\n");
1288 return snprintf(buf, PAGE_SIZE, "\n"); 1290 goto done;
1291 }
1292
1293 if (qla2x00_get_thermal_temp(vha, &temp) == QLA_SUCCESS)
1294 return snprintf(buf, PAGE_SIZE, "%d\n", temp);
1289 1295
1290 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", temp, frac); 1296done:
1297 return snprintf(buf, PAGE_SIZE, "\n");
1291} 1298}
1292 1299
1293static ssize_t 1300static ssize_t
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 69d7a851017d..1626de52e32a 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -12,7 +12,7 @@
12 * | Level | Last Value Used | Holes | 12 * | Level | Last Value Used | Holes |
13 * ---------------------------------------------------------------------- 13 * ----------------------------------------------------------------------
14 * | Module Init and Probe | 0x0126 | 0x4b,0xba,0xfa | 14 * | Module Init and Probe | 0x0126 | 0x4b,0xba,0xfa |
15 * | Mailbox commands | 0x1158 | 0x111a-0x111b | 15 * | Mailbox commands | 0x115b | 0x111a-0x111b |
16 * | | | 0x112c-0x112e | 16 * | | | 0x112c-0x112e |
17 * | | | 0x113a | 17 * | | | 0x113a |
18 * | Device Discovery | 0x2087 | 0x2020-0x2022, | 18 * | Device Discovery | 0x2087 | 0x2020-0x2022, |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 992e24081e65..c081882c566d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -864,6 +864,7 @@ typedef struct {
864#define MBX_0 BIT_0 864#define MBX_0 BIT_0
865 865
866#define RNID_TYPE_SET_VERSION 0x9 866#define RNID_TYPE_SET_VERSION 0x9
867#define RNID_TYPE_ASIC_TEMP 0xC
867 868
868/* 869/*
869 * Firmware state codes from get firmware state mailbox command 870 * Firmware state codes from get firmware state mailbox command
@@ -2628,7 +2629,6 @@ struct qla_hw_data {
2628 uint32_t nic_core_hung:1; 2629 uint32_t nic_core_hung:1;
2629 2630
2630 uint32_t quiesce_owner:1; 2631 uint32_t quiesce_owner:1;
2631 uint32_t thermal_supported:1;
2632 uint32_t nic_core_reset_hdlr_active:1; 2632 uint32_t nic_core_reset_hdlr_active:1;
2633 uint32_t nic_core_reset_owner:1; 2633 uint32_t nic_core_reset_owner:1;
2634 uint32_t isp82xx_no_md_cap:1; 2634 uint32_t isp82xx_no_md_cap:1;
@@ -3076,6 +3076,9 @@ struct qla_hw_data {
3076 int cfg_lun_q_depth; 3076 int cfg_lun_q_depth;
3077 3077
3078 struct qlt_hw_data tgt; 3078 struct qlt_hw_data tgt;
3079 uint16_t thermal_support;
3080#define THERMAL_SUPPORT_I2C BIT_0
3081#define THERMAL_SUPPORT_ISP BIT_1
3079}; 3082};
3080 3083
3081/* 3084/*
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 02f11de0ff01..eb3ca21a7f17 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -55,7 +55,7 @@ extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
55extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); 55extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
56extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *); 56extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
57 57
58extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *, uint16_t *); 58extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *);
59 59
60extern void qla84xx_put_chip(struct scsi_qla_host *); 60extern void qla84xx_put_chip(struct scsi_qla_host *);
61 61
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a1e584842b85..edf4d14a1335 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -523,7 +523,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
523 vha->flags.reset_active = 0; 523 vha->flags.reset_active = 0;
524 ha->flags.pci_channel_io_perm_failure = 0; 524 ha->flags.pci_channel_io_perm_failure = 0;
525 ha->flags.eeh_busy = 0; 525 ha->flags.eeh_busy = 0;
526 ha->flags.thermal_supported = 1; 526 ha->thermal_support = THERMAL_SUPPORT_I2C|THERMAL_SUPPORT_ISP;
527 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 527 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
528 atomic_set(&vha->loop_state, LOOP_DOWN); 528 atomic_set(&vha->loop_state, LOOP_DOWN);
529 vha->device_flags = DFLG_NO_CABLE; 529 vha->device_flags = DFLG_NO_CABLE;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 281947e2a237..186dd59ce4fa 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3924,6 +3924,39 @@ qla2x00_set_driver_version(scsi_qla_host_t *vha, char *version)
3924 return rval; 3924 return rval;
3925} 3925}
3926 3926
3927static int
3928qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp)
3929{
3930 int rval;
3931 mbx_cmd_t mc;
3932 mbx_cmd_t *mcp = &mc;
3933
3934 if (!IS_FWI2_CAPABLE(vha->hw))
3935 return QLA_FUNCTION_FAILED;
3936
3937 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1159,
3938 "Entered %s.\n", __func__);
3939
3940 mcp->mb[0] = MBC_GET_RNID_PARAMS;
3941 mcp->mb[1] = RNID_TYPE_ASIC_TEMP << 8;
3942 mcp->out_mb = MBX_1|MBX_0;
3943 mcp->in_mb = MBX_1|MBX_0;
3944 mcp->tov = MBX_TOV_SECONDS;
3945 mcp->flags = 0;
3946 rval = qla2x00_mailbox_command(vha, mcp);
3947 *temp = mcp->mb[1];
3948
3949 if (rval != QLA_SUCCESS) {
3950 ql_dbg(ql_dbg_mbx, vha, 0x115a,
3951 "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]);
3952 } else {
3953 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x115b,
3954 "Done %s.\n", __func__);
3955 }
3956
3957 return rval;
3958}
3959
3927int 3960int
3928qla2x00_read_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp, 3961qla2x00_read_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp,
3929 uint16_t dev, uint16_t off, uint16_t len, uint16_t opt) 3962 uint16_t dev, uint16_t off, uint16_t len, uint16_t opt)
@@ -4526,42 +4559,45 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
4526} 4559}
4527 4560
4528int 4561int
4529qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac) 4562qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp)
4530{ 4563{
4531 int rval; 4564 int rval = QLA_FUNCTION_FAILED;
4532 uint8_t byte;
4533 struct qla_hw_data *ha = vha->hw; 4565 struct qla_hw_data *ha = vha->hw;
4566 uint8_t byte;
4534 4567
4535 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10ca, 4568 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10ca,
4536 "Entered %s.\n", __func__); 4569 "Entered %s.\n", __func__);
4537 4570
4538 /* Integer part */ 4571 if (ha->thermal_support & THERMAL_SUPPORT_I2C) {
4539 rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x01, 1, 4572 rval = qla2x00_read_sfp(vha, 0, &byte,
4540 BIT_13|BIT_12|BIT_0); 4573 0x98, 0x1, 1, BIT_13|BIT_12|BIT_0);
4541 if (rval != QLA_SUCCESS) { 4574 *temp = byte;
4542 ql_dbg(ql_dbg_mbx, vha, 0x10c9, "Failed=%x.\n", rval); 4575 if (rval == QLA_SUCCESS)
4543 ha->flags.thermal_supported = 0; 4576 goto done;
4544 goto fail; 4577
4578 ql_log(ql_log_warn, vha, 0x10c9,
4579 "Thermal not supported by I2C.\n");
4580 ha->thermal_support &= ~THERMAL_SUPPORT_I2C;
4545 } 4581 }
4546 *temp = byte;
4547 4582
4548 /* Fraction part */ 4583 if (ha->thermal_support & THERMAL_SUPPORT_ISP) {
4549 rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x10, 1, 4584 rval = qla2x00_read_asic_temperature(vha, temp);
4550 BIT_13|BIT_12|BIT_0); 4585 if (rval == QLA_SUCCESS)
4551 if (rval != QLA_SUCCESS) { 4586 goto done;
4552 ql_dbg(ql_dbg_mbx, vha, 0x1019, "Failed=%x.\n", rval); 4587
4553 ha->flags.thermal_supported = 0; 4588 ql_log(ql_log_warn, vha, 0x1019,
4554 goto fail; 4589 "Thermal not supported by ISP.\n");
4590 ha->thermal_support &= ~THERMAL_SUPPORT_ISP;
4555 } 4591 }
4556 *frac = (byte >> 6) * 25;
4557 4592
4558 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1018,
4559 "Done %s.\n", __func__);
4560 return rval;
4561fail:
4562 ql_log(ql_log_warn, vha, 0x1150, 4593 ql_log(ql_log_warn, vha, 0x1150,
4563 "Thermal not supported by this card " 4594 "Thermal not supported by this card "
4564 "(ignoring further requests).\n"); 4595 "(ignoring further requests).\n");
4596 return rval;
4597
4598done:
4599 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1018,
4600 "Done %s.\n", __func__);
4565 return rval; 4601 return rval;
4566} 4602}
4567 4603