Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe52f6e1 authored by Joe Carnuccio's avatar Joe Carnuccio Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Integrate generic card temperature with mezz card temperature.



Give priority to I2C thermal.

Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 6c3943cd
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -1272,22 +1272,29 @@ qla2x00_thermal_temp_show(struct device *dev,
	struct device_attribute *attr, char *buf)
{
	scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
	int rval = QLA_FUNCTION_FAILED;
	uint16_t temp, frac;
	uint16_t temp = 0;

	if (!vha->hw->flags.thermal_supported)
		return snprintf(buf, PAGE_SIZE, "\n");
	if (!vha->hw->thermal_support) {
		ql_log(ql_log_warn, vha, 0x70db,
		    "Thermal not supported by this card.\n");
		goto done;
	}

	temp = frac = 0;
	if (qla2x00_reset_active(vha))
		ql_log(ql_log_warn, vha, 0x707b,
		    "ISP reset active.\n");
	else if (!vha->hw->flags.eeh_busy)
		rval = qla2x00_get_thermal_temp(vha, &temp, &frac);
	if (rval != QLA_SUCCESS)
		return snprintf(buf, PAGE_SIZE, "\n");
	if (qla2x00_reset_active(vha)) {
		ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n");
		goto done;
	}

	if (vha->hw->flags.eeh_busy) {
		ql_log(ql_log_warn, vha, 0x70dd, "PCI EEH busy.\n");
		goto done;
	}

	if (qla2x00_get_thermal_temp(vha, &temp) == QLA_SUCCESS)
		return snprintf(buf, PAGE_SIZE, "%d\n", temp);

	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", temp, frac);
done:
	return snprintf(buf, PAGE_SIZE, "\n");
}

static ssize_t
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
 * |             Level            |   Last Value Used  |     Holes	|
 * ----------------------------------------------------------------------
 * | Module Init and Probe        |       0x0126       | 0x4b,0xba,0xfa |
 * | Mailbox commands             |       0x1158       | 0x111a-0x111b  |
 * | Mailbox commands             |       0x115b       | 0x111a-0x111b  |
 * |                              |                    | 0x112c-0x112e  |
 * |                              |                    | 0x113a         |
 * | Device Discovery             |       0x2087       | 0x2020-0x2022, |
+4 −1
Original line number Diff line number Diff line
@@ -864,6 +864,7 @@ typedef struct {
#define	MBX_0		BIT_0

#define RNID_TYPE_SET_VERSION	0x9
#define RNID_TYPE_ASIC_TEMP	0xC

/*
 * Firmware state codes from get firmware state mailbox command
@@ -2628,7 +2629,6 @@ struct qla_hw_data {
		uint32_t	nic_core_hung:1;

		uint32_t	quiesce_owner:1;
		uint32_t	thermal_supported:1;
		uint32_t	nic_core_reset_hdlr_active:1;
		uint32_t	nic_core_reset_owner:1;
		uint32_t	isp82xx_no_md_cap:1;
@@ -3076,6 +3076,9 @@ struct qla_hw_data {
	int             cfg_lun_q_depth;

	struct qlt_hw_data tgt;
	uint16_t	thermal_support;
#define THERMAL_SUPPORT_I2C BIT_0
#define THERMAL_SUPPORT_ISP BIT_1
};

/*
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);

extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *, uint16_t *);
extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *);

extern void qla84xx_put_chip(struct scsi_qla_host *);

+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ 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->flags.thermal_supported = 1;
	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;
Loading