aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2010-12-21 19:00:21 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-23 17:04:37 -0500
commit794a5691147652387f4a2ffa890c5c1983e38849 (patch)
tree6d64e68ef373bb5c6caa570c7edb022e2d5185e3 /drivers/scsi/qla2xxx
parent10fbb7dd36eb3014fe4b928e596d89e036ee6210 (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')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c27
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h3
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c65
5 files changed, 97 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index bc8194f74625..44578b56ad0a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1309,6 +1309,31 @@ qla2x00_fabric_param_show(struct device *dev, struct device_attribute *attr,
1309} 1309}
1310 1310
1311static ssize_t 1311static ssize_t
1312qla2x00_thermal_temp_show(struct device *dev,
1313 struct device_attribute *attr, char *buf)
1314{
1315 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1316 int rval = QLA_FUNCTION_FAILED;
1317 uint16_t temp, frac;
1318
1319 if (!vha->hw->flags.thermal_supported)
1320 return snprintf(buf, PAGE_SIZE, "\n");
1321
1322 temp = frac = 0;
1323 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
1324 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
1325 DEBUG2_3_11(printk(KERN_WARNING
1326 "%s(%ld): isp reset in progress.\n",
1327 __func__, vha->host_no));
1328 else if (!vha->hw->flags.eeh_busy)
1329 rval = qla2x00_get_thermal_temp(vha, &temp, &frac);
1330 if (rval != QLA_SUCCESS)
1331 temp = frac = 0;
1332
1333 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", temp, frac);
1334}
1335
1336static ssize_t
1312qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, 1337qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
1313 char *buf) 1338 char *buf)
1314{ 1339{
@@ -1366,6 +1391,7 @@ static DEVICE_ATTR(vn_port_mac_address, S_IRUGO,
1366 qla2x00_vn_port_mac_address_show, NULL); 1391 qla2x00_vn_port_mac_address_show, NULL);
1367static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL); 1392static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL);
1368static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL); 1393static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
1394static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
1369 1395
1370struct device_attribute *qla2x00_host_attrs[] = { 1396struct device_attribute *qla2x00_host_attrs[] = {
1371 &dev_attr_driver_version, 1397 &dev_attr_driver_version,
@@ -1394,6 +1420,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
1394 &dev_attr_fabric_param, 1420 &dev_attr_fabric_param,
1395 &dev_attr_fw_state, 1421 &dev_attr_fw_state,
1396 &dev_attr_optrom_gold_fw_version, 1422 &dev_attr_optrom_gold_fw_version,
1423 &dev_attr_thermal_temp,
1397 NULL, 1424 NULL,
1398}; 1425};
1399 1426
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6168628bd6b9..ccfc8e78be21 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2426,7 +2426,8 @@ struct qla_hw_data {
2426 uint32_t fcp_prio_enabled :1; 2426 uint32_t fcp_prio_enabled :1;
2427 uint32_t fw_hung :1; 2427 uint32_t fw_hung :1;
2428 uint32_t quiesce_owner:1; 2428 uint32_t quiesce_owner:1;
2429 /* 29 bits */ 2429 uint32_t thermal_supported:1;
2430 /* 26 bits */
2430 } flags; 2431 } flags;
2431 2432
2432 /* This spinlock is used to protect "io transactions", you must 2433 /* This spinlock is used to protect "io transactions", you must
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index c228d248cf17..39c4bdda5e3e 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -53,6 +53,8 @@ extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
53extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); 53extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
54extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *); 54extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
55 55
56extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *, uint16_t *);
57
56extern void qla84xx_put_chip(struct scsi_qla_host *); 58extern void qla84xx_put_chip(struct scsi_qla_host *);
57 59
58extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *, 60extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *,
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index c8ca25a8f2c2..d0a0dc9d6d36 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -498,6 +498,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
498 vha->flags.reset_active = 0; 498 vha->flags.reset_active = 0;
499 ha->flags.pci_channel_io_perm_failure = 0; 499 ha->flags.pci_channel_io_perm_failure = 0;
500 ha->flags.eeh_busy = 0; 500 ha->flags.eeh_busy = 0;
501 ha->flags.thermal_supported = 1;
501 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 502 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
502 atomic_set(&vha->loop_state, LOOP_DOWN); 503 atomic_set(&vha->loop_state, LOOP_DOWN);
503 vha->device_flags = DFLG_NO_CABLE; 504 vha->device_flags = DFLG_NO_CABLE;
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
4162int 4162int
4163qla2x00_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));
4223fail:
4224 return rval;
4225}
4226
4227int
4163qla82xx_mbx_intr_enable(scsi_qla_host_t *vha) 4228qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
4164{ 4229{
4165 int rval; 4230 int rval;