aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2014-02-18 14:57:52 -0500
committerJames Bottomley <JBottomley@Parallels.com>2014-03-15 13:19:09 -0400
commit2ba8bfc82e120dd68f11135d563bb8b86a4d935b (patch)
tree70e3f4103d864dbd54c915cd24b07a2dcf52c938 /drivers/scsi/hpsa.c
parentd1e8beac49ae9925b9b1588bc1cdd5f240318568 (diff)
[SCSI] hpsa add sysfs debug switch for raid map debugging messages
Signed-off-by: Scott Teel <scott.teel@hp.com> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e36e3102c45c..09119c299794 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -312,6 +312,31 @@ static ssize_t host_store_hp_ssd_smart_path_status(struct device *dev,
312 return count; 312 return count;
313} 313}
314 314
315static ssize_t host_store_raid_offload_debug(struct device *dev,
316 struct device_attribute *attr,
317 const char *buf, size_t count)
318{
319 int debug_level, len;
320 struct ctlr_info *h;
321 struct Scsi_Host *shost = class_to_shost(dev);
322 char tmpbuf[10];
323
324 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
325 return -EACCES;
326 len = count > sizeof(tmpbuf) - 1 ? sizeof(tmpbuf) - 1 : count;
327 strncpy(tmpbuf, buf, len);
328 tmpbuf[len] = '\0';
329 if (sscanf(tmpbuf, "%d", &debug_level) != 1)
330 return -EINVAL;
331 if (debug_level < 0)
332 debug_level = 0;
333 h = shost_to_hba(shost);
334 h->raid_offload_debug = debug_level;
335 dev_warn(&h->pdev->dev, "hpsa: Set raid_offload_debug level = %d\n",
336 h->raid_offload_debug);
337 return count;
338}
339
315static ssize_t host_store_rescan(struct device *dev, 340static ssize_t host_store_rescan(struct device *dev,
316 struct device_attribute *attr, 341 struct device_attribute *attr,
317 const char *buf, size_t count) 342 const char *buf, size_t count)
@@ -585,6 +610,8 @@ static DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO,
585static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH, 610static DEVICE_ATTR(hp_ssd_smart_path_status, S_IWUSR|S_IRUGO|S_IROTH,
586 host_show_hp_ssd_smart_path_status, 611 host_show_hp_ssd_smart_path_status,
587 host_store_hp_ssd_smart_path_status); 612 host_store_hp_ssd_smart_path_status);
613static DEVICE_ATTR(raid_offload_debug, S_IWUSR, NULL,
614 host_store_raid_offload_debug);
588static DEVICE_ATTR(firmware_revision, S_IRUGO, 615static DEVICE_ATTR(firmware_revision, S_IRUGO,
589 host_show_firmware_revision, NULL); 616 host_show_firmware_revision, NULL);
590static DEVICE_ATTR(commands_outstanding, S_IRUGO, 617static DEVICE_ATTR(commands_outstanding, S_IRUGO,
@@ -609,6 +636,7 @@ static struct device_attribute *hpsa_shost_attrs[] = {
609 &dev_attr_transport_mode, 636 &dev_attr_transport_mode,
610 &dev_attr_resettable, 637 &dev_attr_resettable,
611 &dev_attr_hp_ssd_smart_path_status, 638 &dev_attr_hp_ssd_smart_path_status,
639 &dev_attr_raid_offload_debug,
612 NULL, 640 NULL,
613}; 641};
614 642
@@ -2020,6 +2048,10 @@ static void hpsa_debug_map_buff(struct ctlr_info *h, int rc,
2020 if (rc != 0) 2048 if (rc != 0)
2021 return; 2049 return;
2022 2050
2051 /* Show details only if debugging has been activated. */
2052 if (h->raid_offload_debug < 2)
2053 return;
2054
2023 dev_info(&h->pdev->dev, "structure_size = %u\n", 2055 dev_info(&h->pdev->dev, "structure_size = %u\n",
2024 le32_to_cpu(map_buff->structure_size)); 2056 le32_to_cpu(map_buff->structure_size));
2025 dev_info(&h->pdev->dev, "volume_blk_size = %u\n", 2057 dev_info(&h->pdev->dev, "volume_blk_size = %u\n",
@@ -2505,6 +2537,17 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
2505 scsi_nexus = cpu_to_le32((u32) c2a->scsi_nexus); 2537 scsi_nexus = cpu_to_le32((u32) c2a->scsi_nexus);
2506 find = c2a->scsi_nexus; 2538 find = c2a->scsi_nexus;
2507 2539
2540 if (h->raid_offload_debug > 0)
2541 dev_info(&h->pdev->dev,
2542 "%s: scsi_nexus:0x%08x device id: 0x%02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n",
2543 __func__, scsi_nexus,
2544 d->device_id[0], d->device_id[1], d->device_id[2],
2545 d->device_id[3], d->device_id[4], d->device_id[5],
2546 d->device_id[6], d->device_id[7], d->device_id[8],
2547 d->device_id[9], d->device_id[10], d->device_id[11],
2548 d->device_id[12], d->device_id[13], d->device_id[14],
2549 d->device_id[15]);
2550
2508 /* Get the list of physical devices */ 2551 /* Get the list of physical devices */
2509 physicals = kzalloc(reportsize, GFP_KERNEL); 2552 physicals = kzalloc(reportsize, GFP_KERNEL);
2510 if (hpsa_scsi_do_report_phys_luns(h, (struct ReportLUNdata *) physicals, 2553 if (hpsa_scsi_do_report_phys_luns(h, (struct ReportLUNdata *) physicals,
@@ -2529,6 +2572,15 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
2529 found = 1; 2572 found = 1;
2530 memcpy(scsi3addr, &((struct ReportExtendedLUNdata *) 2573 memcpy(scsi3addr, &((struct ReportExtendedLUNdata *)
2531 physicals)->LUN[i][0], 8); 2574 physicals)->LUN[i][0], 8);
2575 if (h->raid_offload_debug > 0)
2576 dev_info(&h->pdev->dev,
2577 "%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
2578 __func__, find,
2579 ((struct ReportExtendedLUNdata *)
2580 physicals)->LUN[i][20],
2581 scsi3addr[0], scsi3addr[1], scsi3addr[2],
2582 scsi3addr[3], scsi3addr[4], scsi3addr[5],
2583 scsi3addr[6], scsi3addr[7]);
2532 break; /* found it */ 2584 break; /* found it */
2533 } 2585 }
2534 2586
@@ -4077,6 +4129,13 @@ static int hpsa_send_reset_as_abort_ioaccel2(struct ctlr_info *h,
4077 return -1; /* not abortable */ 4129 return -1; /* not abortable */
4078 } 4130 }
4079 4131
4132 if (h->raid_offload_debug > 0)
4133 dev_info(&h->pdev->dev,
4134 "Reset as abort: Abort requested on C%d:B%d:T%d:L%d scsi3addr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
4135 h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
4136 scsi3addr[0], scsi3addr[1], scsi3addr[2], scsi3addr[3],
4137 scsi3addr[4], scsi3addr[5], scsi3addr[6], scsi3addr[7]);
4138
4080 if (!dev->offload_enabled) { 4139 if (!dev->offload_enabled) {
4081 dev_warn(&h->pdev->dev, 4140 dev_warn(&h->pdev->dev,
4082 "Can't abort: device is not operating in HP SSD Smart Path mode.\n"); 4141 "Can't abort: device is not operating in HP SSD Smart Path mode.\n");
@@ -4090,6 +4149,11 @@ static int hpsa_send_reset_as_abort_ioaccel2(struct ctlr_info *h,
4090 } 4149 }
4091 4150
4092 /* send the reset */ 4151 /* send the reset */
4152 if (h->raid_offload_debug > 0)
4153 dev_info(&h->pdev->dev,
4154 "Reset as abort: Resetting physical device at scsi3addr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
4155 psa[0], psa[1], psa[2], psa[3],
4156 psa[4], psa[5], psa[6], psa[7]);
4093 rc = hpsa_send_reset(h, psa, HPSA_RESET_TYPE_TARGET); 4157 rc = hpsa_send_reset(h, psa, HPSA_RESET_TYPE_TARGET);
4094 if (rc != 0) { 4158 if (rc != 0) {
4095 dev_warn(&h->pdev->dev, 4159 dev_warn(&h->pdev->dev,