diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2010-12-21 19:00:21 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-23 17:04:37 -0500 |
commit | 794a5691147652387f4a2ffa890c5c1983e38849 (patch) | |
tree | 6d64e68ef373bb5c6caa570c7edb022e2d5185e3 /drivers/scsi/qla2xxx/qla_mbx.c | |
parent | 10fbb7dd36eb3014fe4b928e596d89e036ee6210 (diff) |
[SCSI] qla2xxx: Add sysfs node for displaying board temperature.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 04d6cfc2e919..e473e9fb363c 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -4160,6 +4160,71 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority, | |||
4160 | } | 4160 | } |
4161 | 4161 | ||
4162 | int | 4162 | int |
4163 | qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac) | ||
4164 | { | ||
4165 | int rval; | ||
4166 | mbx_cmd_t mc; | ||
4167 | mbx_cmd_t *mcp = &mc; | ||
4168 | struct qla_hw_data *ha = vha->hw; | ||
4169 | |||
4170 | DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, ha->host_no)); | ||
4171 | |||
4172 | /* High bits. */ | ||
4173 | mcp->mb[0] = MBC_READ_SFP; | ||
4174 | mcp->mb[1] = 0x98; | ||
4175 | mcp->mb[2] = 0; | ||
4176 | mcp->mb[3] = 0; | ||
4177 | mcp->mb[6] = 0; | ||
4178 | mcp->mb[7] = 0; | ||
4179 | mcp->mb[8] = 1; | ||
4180 | mcp->mb[9] = 0x01; | ||
4181 | mcp->mb[10] = BIT_13|BIT_0; | ||
4182 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4183 | mcp->in_mb = MBX_1|MBX_0; | ||
4184 | mcp->tov = MBX_TOV_SECONDS; | ||
4185 | mcp->flags = 0; | ||
4186 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4187 | if (rval != QLA_SUCCESS) { | ||
4188 | DEBUG2_3_11(printk(KERN_WARNING | ||
4189 | "%s(%ld): failed=%x (%x).\n", __func__, | ||
4190 | vha->host_no, rval, mcp->mb[0])); | ||
4191 | ha->flags.thermal_supported = 0; | ||
4192 | goto fail; | ||
4193 | } | ||
4194 | *temp = mcp->mb[1] & 0xFF; | ||
4195 | |||
4196 | /* Low bits. */ | ||
4197 | mcp->mb[0] = MBC_READ_SFP; | ||
4198 | mcp->mb[1] = 0x98; | ||
4199 | mcp->mb[2] = 0; | ||
4200 | mcp->mb[3] = 0; | ||
4201 | mcp->mb[6] = 0; | ||
4202 | mcp->mb[7] = 0; | ||
4203 | mcp->mb[8] = 1; | ||
4204 | mcp->mb[9] = 0x10; | ||
4205 | mcp->mb[10] = BIT_13|BIT_0; | ||
4206 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4207 | mcp->in_mb = MBX_1|MBX_0; | ||
4208 | mcp->tov = MBX_TOV_SECONDS; | ||
4209 | mcp->flags = 0; | ||
4210 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4211 | if (rval != QLA_SUCCESS) { | ||
4212 | DEBUG2_3_11(printk(KERN_WARNING | ||
4213 | "%s(%ld): failed=%x (%x).\n", __func__, | ||
4214 | vha->host_no, rval, mcp->mb[0])); | ||
4215 | ha->flags.thermal_supported = 0; | ||
4216 | goto fail; | ||
4217 | } | ||
4218 | *frac = ((mcp->mb[1] & 0xFF) >> 6) * 25; | ||
4219 | |||
4220 | if (rval == QLA_SUCCESS) | ||
4221 | DEBUG11(printk(KERN_INFO | ||
4222 | "%s(%ld): done.\n", __func__, ha->host_no)); | ||
4223 | fail: | ||
4224 | return rval; | ||
4225 | } | ||
4226 | |||
4227 | int | ||
4163 | qla82xx_mbx_intr_enable(scsi_qla_host_t *vha) | 4228 | qla82xx_mbx_intr_enable(scsi_qla_host_t *vha) |
4164 | { | 4229 | { |
4165 | int rval; | 4230 | int rval; |