Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204146
b: refs/heads/master
c: 7fbae67
h: refs/heads/master
v: v3
  • Loading branch information
Kashyap, Desai authored and James Bottomley committed Jul 27, 2010
1 parent 09c5c60 commit 5181118
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eabb08ad2d3b0257cd2c9aed4f106fb39d14604a
refs/heads/master: 7fbae67a3faa90abcbe949f1494769c84e51e189
2 changes: 2 additions & 0 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ struct _internal_cmd {
* @id: target id
* @channel: target channel
* @slot: number number
* @phy: phy identifier provided in sas device page 0
* @hidden_raid_component: set to 1 when this is a raid member
* @responding: used in _scsih_sas_device_mark_responding
*/
Expand All @@ -293,6 +294,7 @@ struct _sas_device {
int id;
int channel;
u16 slot;
u8 phy;
u8 hidden_raid_component;
u8 responding;
};
Expand Down
42 changes: 42 additions & 0 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ enum block_state {
BLOCKING,
};

/**
* _ctl_sas_device_find_by_handle - sas device search
* @ioc: per adapter object
* @handle: sas device handle (assigned by firmware)
* Context: Calling function should acquire ioc->sas_device_lock
*
* This searches for sas_device based on sas_address, then return sas_device
* object.
*/
static struct _sas_device *
_ctl_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
{
struct _sas_device *sas_device, *r;

r = NULL;
list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
if (sas_device->handle != handle)
continue;
r = sas_device;
goto out;
}

out:
return r;
}

#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
/**
* _ctl_display_some_debug - debug routine
Expand Down Expand Up @@ -205,6 +231,22 @@ _ctl_display_some_debug(struct MPT2SAS_ADAPTER *ioc, u16 smid,
MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) {
Mpi2SCSIIOReply_t *scsi_reply =
(Mpi2SCSIIOReply_t *)mpi_reply;
struct _sas_device *sas_device = NULL;
unsigned long flags;

spin_lock_irqsave(&ioc->sas_device_lock, flags);
sas_device = _ctl_sas_device_find_by_handle(ioc,
le16_to_cpu(scsi_reply->DevHandle));
if (sas_device) {
printk(MPT2SAS_WARN_FMT "\tsas_address(0x%016llx), "
"phy(%d)\n", ioc->name, (unsigned long long)
sas_device->sas_address, sas_device->phy);
printk(MPT2SAS_WARN_FMT
"\tenclosure_logical_id(0x%016llx), slot(%d)\n",
ioc->name, sas_device->enclosure_logical_id,
sas_device->slot);
}
spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)
printk(MPT2SAS_INFO_FMT
"\tscsi_state(0x%02x), scsi_status"
Expand Down
19 changes: 18 additions & 1 deletion trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,9 +1749,10 @@ _scsih_slave_configure(struct scsi_device *sdev)
}

sdev_printk(KERN_INFO, sdev, "%s: handle(0x%04x), "
"sas_addr(0x%016llx), device_name(0x%016llx)\n",
"sas_addr(0x%016llx), phy(%d), device_name(0x%016llx)\n",
ds, sas_device->handle,
(unsigned long long)sas_device->sas_address,
sas_device->phy,
(unsigned long long)sas_device->device_name);
sdev_printk(KERN_INFO, sdev, "%s: "
"enclosure_logical_id(0x%016llx), slot(%d)\n", ds,
Expand Down Expand Up @@ -3128,6 +3129,8 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
char *desc_scsi_status = NULL;
char *desc_scsi_state = ioc->tmp_string;
u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
struct _sas_device *sas_device = NULL;
unsigned long flags;

if (log_info == 0x31170000)
return;
Expand Down Expand Up @@ -3243,6 +3246,19 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
strcat(desc_scsi_state, "autosense valid ");

scsi_print_command(scmd);

spin_lock_irqsave(&ioc->sas_device_lock, flags);
sas_device = _scsih_sas_device_find_by_handle(ioc,
le16_to_cpu(mpi_reply->DevHandle));
if (sas_device) {
printk(MPT2SAS_WARN_FMT "\tsas_address(0x%016llx), phy(%d)\n",
ioc->name, sas_device->sas_address, sas_device->phy);
printk(MPT2SAS_WARN_FMT "\tenclosure_logical_id(0x%016llx), "
"slot(%d)\n", ioc->name, sas_device->enclosure_logical_id,
sas_device->slot);
}
spin_unlock_irqrestore(&ioc->sas_device_lock, flags);

printk(MPT2SAS_WARN_FMT "\tdev handle(0x%04x), "
"ioc_status(%s)(0x%04x), smid(%d)\n", ioc->name,
le16_to_cpu(mpi_reply->DevHandle), desc_ioc_state,
Expand Down Expand Up @@ -4187,6 +4203,7 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd)
le16_to_cpu(sas_device_pg0.Slot);
sas_device->device_info = device_info;
sas_device->sas_address = sas_address;
sas_device->phy = sas_device_pg0.PhyNum;
sas_device->hidden_raid_component = is_pd;

/* get enclosure_logical_id */
Expand Down

0 comments on commit 5181118

Please sign in to comment.