aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMoore, Eric <Eric.Moore@lsil.com>2006-01-13 18:25:20 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:55:06 -0500
commit816aa907b909177bdf6e6e6b0d00c5e5a6e2be8c (patch)
tree5953e5fc46a49bcdb28b17c6812469af4cc59c93 /drivers
parente02f3f59225d8c3b2a0ad0dc941a09865e27da61 (diff)
[SCSI] fusion - adding raid support in mptsas
The SAS RAID volumes are reported beyond the expected number of phys. Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/message/fusion/mptbase.h1
-rw-r--r--drivers/message/fusion/mptsas.c27
2 files changed, 27 insertions, 1 deletions
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 25f44064b96c..47053ac65068 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -630,6 +630,7 @@ typedef struct _MPT_ADAPTER
630 struct list_head sas_topology; 630 struct list_head sas_topology;
631 struct mutex sas_topology_mutex; 631 struct mutex sas_topology_mutex;
632 MPT_SAS_MGMT sas_mgmt; 632 MPT_SAS_MGMT sas_mgmt;
633 int num_ports;
633 634
634 struct list_head fc_rports; 635 struct list_head fc_rports;
635 spinlock_t fc_rport_lock; /* list and ri flags */ 636 spinlock_t fc_rport_lock; /* list and ri flags */
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 668a101b89f0..5a06d8d8694e 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -274,6 +274,16 @@ mptsas_slave_alloc(struct scsi_device *sdev)
274 hd->Targets[sdev->id] = vtarget; 274 hd->Targets[sdev->id] = vtarget;
275 } 275 }
276 276
277 /*
278 RAID volumes placed beyond the last expected port.
279 */
280 if (sdev->channel == hd->ioc->num_ports) {
281 vdev->target_id = sdev->id;
282 vdev->bus_id = 0;
283 vdev->lun = 0;
284 goto out;
285 }
286
277 rphy = dev_to_rphy(sdev->sdev_target->dev.parent); 287 rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
278 mutex_lock(&hd->ioc->sas_topology_mutex); 288 mutex_lock(&hd->ioc->sas_topology_mutex);
279 list_for_each_entry(p, &hd->ioc->sas_topology, list) { 289 list_for_each_entry(p, &hd->ioc->sas_topology, list) {
@@ -284,6 +294,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
284 p->phy_info[i].attached.id; 294 p->phy_info[i].attached.id;
285 vdev->bus_id = p->phy_info[i].attached.channel; 295 vdev->bus_id = p->phy_info[i].attached.channel;
286 vdev->lun = sdev->lun; 296 vdev->lun = sdev->lun;
297 mutex_unlock(&hd->ioc->sas_topology_mutex);
287 goto out; 298 goto out;
288 } 299 }
289 } 300 }
@@ -295,7 +306,6 @@ mptsas_slave_alloc(struct scsi_device *sdev)
295 return -ENODEV; 306 return -ENODEV;
296 307
297 out: 308 out:
298 mutex_unlock(&hd->ioc->sas_topology_mutex);
299 vtarget->ioc_id = vdev->ioc_id; 309 vtarget->ioc_id = vdev->ioc_id;
300 vtarget->target_id = vdev->target_id; 310 vtarget->target_id = vdev->target_id;
301 vtarget->bus_id = vdev->bus_id; 311 vtarget->bus_id = vdev->bus_id;
@@ -1051,6 +1061,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index)
1051 if (error) 1061 if (error)
1052 goto out_free_port_info; 1062 goto out_free_port_info;
1053 1063
1064 ioc->num_ports = port_info->num_phys;
1054 mutex_lock(&ioc->sas_topology_mutex); 1065 mutex_lock(&ioc->sas_topology_mutex);
1055 list_add_tail(&port_info->list, &ioc->sas_topology); 1066 list_add_tail(&port_info->list, &ioc->sas_topology);
1056 mutex_unlock(&ioc->sas_topology_mutex); 1067 mutex_unlock(&ioc->sas_topology_mutex);
@@ -1585,6 +1596,20 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1585 1596
1586 mptsas_scan_sas_topology(ioc); 1597 mptsas_scan_sas_topology(ioc);
1587 1598
1599 /*
1600 Reporting RAID volumes.
1601 */
1602 if (!ioc->raid_data.pIocPg2)
1603 return 0;
1604 if (!ioc->raid_data.pIocPg2->NumActiveVolumes)
1605 return 0;
1606 for (ii=0;ii<ioc->raid_data.pIocPg2->NumActiveVolumes;ii++) {
1607 scsi_add_device(sh,
1608 ioc->num_ports,
1609 ioc->raid_data.pIocPg2->RaidVolume[ii].VolumeID,
1610 0);
1611 }
1612
1588 return 0; 1613 return 0;
1589 1614
1590out_mptsas_probe: 1615out_mptsas_probe: