aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-06-17 04:15:17 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:02:17 -0400
commit7fbae67a3faa90abcbe949f1494769c84e51e189 (patch)
treea840770a07918c2af5d7020d7b2614c1a65f70be /drivers/scsi/mpt2sas
parenteabb08ad2d3b0257cd2c9aed4f106fb39d14604a (diff)
[SCSI] mpt2sas: Tie a log info message to a specific PHY.
Add support to display additional debug info for SCSI_IO and RAID_SCSI_IO_PASSTHROUGH sent from the normal entry queued entry point, as well as internal generated commands, and IOCTLS. The additional debug info included the phy number, as well as the sas address, enclosure logical id, and slot number. This debug info has to be enabled thru the logging_level command line option, by default this will not be displayed. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h2
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c42
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c19
3 files changed, 62 insertions, 1 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 08404b331f73..e2c5cee6450e 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -275,6 +275,7 @@ struct _internal_cmd {
275 * @id: target id 275 * @id: target id
276 * @channel: target channel 276 * @channel: target channel
277 * @slot: number number 277 * @slot: number number
278 * @phy: phy identifier provided in sas device page 0
278 * @hidden_raid_component: set to 1 when this is a raid member 279 * @hidden_raid_component: set to 1 when this is a raid member
279 * @responding: used in _scsih_sas_device_mark_responding 280 * @responding: used in _scsih_sas_device_mark_responding
280 */ 281 */
@@ -293,6 +294,7 @@ struct _sas_device {
293 int id; 294 int id;
294 int channel; 295 int channel;
295 u16 slot; 296 u16 slot;
297 u8 phy;
296 u8 hidden_raid_component; 298 u8 hidden_raid_component;
297 u8 responding; 299 u8 responding;
298}; 300};
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index 55fbd5b69b83..ce63a4a66706 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -80,6 +80,32 @@ enum block_state {
80 BLOCKING, 80 BLOCKING,
81}; 81};
82 82
83/**
84 * _ctl_sas_device_find_by_handle - sas device search
85 * @ioc: per adapter object
86 * @handle: sas device handle (assigned by firmware)
87 * Context: Calling function should acquire ioc->sas_device_lock
88 *
89 * This searches for sas_device based on sas_address, then return sas_device
90 * object.
91 */
92static struct _sas_device *
93_ctl_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
94{
95 struct _sas_device *sas_device, *r;
96
97 r = NULL;
98 list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
99 if (sas_device->handle != handle)
100 continue;
101 r = sas_device;
102 goto out;
103 }
104
105 out:
106 return r;
107}
108
83#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 109#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
84/** 110/**
85 * _ctl_display_some_debug - debug routine 111 * _ctl_display_some_debug - debug routine
@@ -205,6 +231,22 @@ _ctl_display_some_debug(struct MPT2SAS_ADAPTER *ioc, u16 smid,
205 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) { 231 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) {
206 Mpi2SCSIIOReply_t *scsi_reply = 232 Mpi2SCSIIOReply_t *scsi_reply =
207 (Mpi2SCSIIOReply_t *)mpi_reply; 233 (Mpi2SCSIIOReply_t *)mpi_reply;
234 struct _sas_device *sas_device = NULL;
235 unsigned long flags;
236
237 spin_lock_irqsave(&ioc->sas_device_lock, flags);
238 sas_device = _ctl_sas_device_find_by_handle(ioc,
239 le16_to_cpu(scsi_reply->DevHandle));
240 if (sas_device) {
241 printk(MPT2SAS_WARN_FMT "\tsas_address(0x%016llx), "
242 "phy(%d)\n", ioc->name, (unsigned long long)
243 sas_device->sas_address, sas_device->phy);
244 printk(MPT2SAS_WARN_FMT
245 "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
246 ioc->name, sas_device->enclosure_logical_id,
247 sas_device->slot);
248 }
249 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
208 if (scsi_reply->SCSIState || scsi_reply->SCSIStatus) 250 if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)
209 printk(MPT2SAS_INFO_FMT 251 printk(MPT2SAS_INFO_FMT
210 "\tscsi_state(0x%02x), scsi_status" 252 "\tscsi_state(0x%02x), scsi_status"
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 82c2d4c5ece6..db12e184d1d9 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1749,9 +1749,10 @@ _scsih_slave_configure(struct scsi_device *sdev)
1749 } 1749 }
1750 1750
1751 sdev_printk(KERN_INFO, sdev, "%s: handle(0x%04x), " 1751 sdev_printk(KERN_INFO, sdev, "%s: handle(0x%04x), "
1752 "sas_addr(0x%016llx), device_name(0x%016llx)\n", 1752 "sas_addr(0x%016llx), phy(%d), device_name(0x%016llx)\n",
1753 ds, sas_device->handle, 1753 ds, sas_device->handle,
1754 (unsigned long long)sas_device->sas_address, 1754 (unsigned long long)sas_device->sas_address,
1755 sas_device->phy,
1755 (unsigned long long)sas_device->device_name); 1756 (unsigned long long)sas_device->device_name);
1756 sdev_printk(KERN_INFO, sdev, "%s: " 1757 sdev_printk(KERN_INFO, sdev, "%s: "
1757 "enclosure_logical_id(0x%016llx), slot(%d)\n", ds, 1758 "enclosure_logical_id(0x%016llx), slot(%d)\n", ds,
@@ -3128,6 +3129,8 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3128 char *desc_scsi_status = NULL; 3129 char *desc_scsi_status = NULL;
3129 char *desc_scsi_state = ioc->tmp_string; 3130 char *desc_scsi_state = ioc->tmp_string;
3130 u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo); 3131 u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
3132 struct _sas_device *sas_device = NULL;
3133 unsigned long flags;
3131 3134
3132 if (log_info == 0x31170000) 3135 if (log_info == 0x31170000)
3133 return; 3136 return;
@@ -3243,6 +3246,19 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3243 strcat(desc_scsi_state, "autosense valid "); 3246 strcat(desc_scsi_state, "autosense valid ");
3244 3247
3245 scsi_print_command(scmd); 3248 scsi_print_command(scmd);
3249
3250 spin_lock_irqsave(&ioc->sas_device_lock, flags);
3251 sas_device = _scsih_sas_device_find_by_handle(ioc,
3252 le16_to_cpu(mpi_reply->DevHandle));
3253 if (sas_device) {
3254 printk(MPT2SAS_WARN_FMT "\tsas_address(0x%016llx), phy(%d)\n",
3255 ioc->name, sas_device->sas_address, sas_device->phy);
3256 printk(MPT2SAS_WARN_FMT "\tenclosure_logical_id(0x%016llx), "
3257 "slot(%d)\n", ioc->name, sas_device->enclosure_logical_id,
3258 sas_device->slot);
3259 }
3260 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
3261
3246 printk(MPT2SAS_WARN_FMT "\tdev handle(0x%04x), " 3262 printk(MPT2SAS_WARN_FMT "\tdev handle(0x%04x), "
3247 "ioc_status(%s)(0x%04x), smid(%d)\n", ioc->name, 3263 "ioc_status(%s)(0x%04x), smid(%d)\n", ioc->name,
3248 le16_to_cpu(mpi_reply->DevHandle), desc_ioc_state, 3264 le16_to_cpu(mpi_reply->DevHandle), desc_ioc_state,
@@ -4187,6 +4203,7 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd)
4187 le16_to_cpu(sas_device_pg0.Slot); 4203 le16_to_cpu(sas_device_pg0.Slot);
4188 sas_device->device_info = device_info; 4204 sas_device->device_info = device_info;
4189 sas_device->sas_address = sas_address; 4205 sas_device->sas_address = sas_address;
4206 sas_device->phy = sas_device_pg0.PhyNum;
4190 sas_device->hidden_raid_component = is_pd; 4207 sas_device->hidden_raid_component = is_pd;
4191 4208
4192 /* get enclosure_logical_id */ 4209 /* get enclosure_logical_id */