aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-01-29 09:47:08 -0700
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-02-02 21:05:46 -0600
commit2ecce492290bf0d5eedc76cf0f4bf45f8c3f42bc (patch)
tree0564bac0764283559d8e43dc3b8b450f51e1cb29
parentdf9e062ad994c4db683377b108c0dbed4690e4b0 (diff)
[SCSI] fusion - report wide port sas address's for hba phys
Return proper sas address to sas transport layer for parent phys that form a wide port. Current implementation returns a different address for each phy, incremented by one from the base address. Signed-off-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/message/fusion/mptsas.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 3dbb5659f61..9d0f87f4c5e 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -169,6 +169,7 @@ struct mptsas_portinfo_details{
};
struct mptsas_phyinfo {
+ u16 handle; /* unique id to address this */
u8 phy_id; /* phy index */
u8 port_id; /* firmware port identifier */
u8 negotiated_link_rate; /* nego'd link rate for this phy */
@@ -184,7 +185,6 @@ struct mptsas_phyinfo {
struct mptsas_portinfo {
struct list_head list;
- u16 handle; /* unique id to address this */
u16 num_phys; /* number of phys */
struct mptsas_phyinfo *phy_info;
};
@@ -1387,9 +1387,6 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
goto out_free_consistent;
}
- if (port_info->num_phys)
- port_info->handle =
- le16_to_cpu(buffer->PhyData[0].ControllerDevHandle);
for (i = 0; i < port_info->num_phys; i++) {
mptsas_print_phy_data(&buffer->PhyData[i]);
port_info->phy_info[i].phy_id = i;
@@ -1398,6 +1395,8 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
port_info->phy_info[i].negotiated_link_rate =
buffer->PhyData[i].NegotiatedLinkRate;
port_info->phy_info[i].portinfo = port_info;
+ port_info->phy_info[i].handle =
+ le16_to_cpu(buffer->PhyData[i].ControllerDevHandle);
}
out_free_consistent:
@@ -1599,7 +1598,6 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
/* save config data */
port_info->num_phys = buffer->NumPhys;
- port_info->handle = le16_to_cpu(buffer->DevHandle);
port_info->phy_info = kcalloc(port_info->num_phys,
sizeof(*port_info->phy_info),GFP_KERNEL);
if (!port_info->phy_info) {
@@ -1607,8 +1605,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
goto out_free_consistent;
}
- for (i = 0; i < port_info->num_phys; i++)
+ for (i = 0; i < port_info->num_phys; i++) {
port_info->phy_info[i].portinfo = port_info;
+ port_info->phy_info[i].handle =
+ le16_to_cpu(buffer->DevHandle);
+ }
out_free_consistent:
pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
@@ -1976,7 +1977,6 @@ static int
mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
{
struct mptsas_portinfo *port_info, *hba;
- u32 handle = 0xFFFF;
int error = -ENOMEM, i;
hba = kzalloc(sizeof(*port_info), GFP_KERNEL);
@@ -1988,34 +1988,36 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
goto out_free_port_info;
mutex_lock(&ioc->sas_topology_mutex);
- ioc->handle = hba->handle;
- port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle);
+ ioc->handle = hba->phy_info[0].handle;
+ port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
if (!port_info) {
port_info = hba;
list_add_tail(&port_info->list, &ioc->sas_topology);
} else {
- port_info->handle = hba->handle;
- for (i = 0; i < hba->num_phys; i++)
+ for (i = 0; i < hba->num_phys; i++) {
port_info->phy_info[i].negotiated_link_rate =
hba->phy_info[i].negotiated_link_rate;
+ port_info->phy_info[i].handle =
+ hba->phy_info[i].handle;
+ port_info->phy_info[i].port_id =
+ hba->phy_info[i].port_id;
+ }
kfree(hba->phy_info);
kfree(hba);
hba = NULL;
}
mutex_unlock(&ioc->sas_topology_mutex);
-
for (i = 0; i < port_info->num_phys; i++) {
mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
(MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER <<
MPI_SAS_PHY_PGAD_FORM_SHIFT), i);
mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify,
- (MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE <<
- MPI_SAS_DEVICE_PGAD_FORM_SHIFT), handle);
+ (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
+ MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
+ port_info->phy_info[i].handle);
port_info->phy_info[i].identify.phy_id =
- port_info->phy_info[i].phy_id;
- handle = port_info->phy_info[i].identify.handle;
-
+ port_info->phy_info[i].phy_id = i;
if (port_info->phy_info[i].attached.handle)
mptsas_sas_device_pg0(ioc,
&port_info->phy_info[i].attached,
@@ -2051,12 +2053,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
goto out;
error = mptsas_sas_expander_pg0(ioc, ex,
- (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE <<
- MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle);
+ (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE <<
+ MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle);
if (error)
goto out_free_port_info;
- *handle = ex->handle;
+ *handle = ex->phy_info[0].handle;
mutex_lock(&ioc->sas_topology_mutex);
port_info = mptsas_find_portinfo_by_handle(ioc, *handle);
@@ -2064,7 +2066,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
port_info = ex;
list_add_tail(&port_info->list, &ioc->sas_topology);
} else {
- port_info->handle = ex->handle;
+ for (i = 0; i < ex->num_phys; i++) {
+ port_info->phy_info[i].handle =
+ ex->phy_info[i].handle;
+ port_info->phy_info[i].port_id =
+ ex->phy_info[i].port_id;
+ }
kfree(ex->phy_info);
kfree(ex);
ex = NULL;
@@ -2156,7 +2163,8 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
if (mptsas_sas_expander_pg0(ioc, &buffer,
(MPI_SAS_EXPAND_PGAD_FORM_HANDLE <<
- MPI_SAS_EXPAND_PGAD_FORM_SHIFT), port_info->handle)) {
+ MPI_SAS_EXPAND_PGAD_FORM_SHIFT),
+ port_info->phy_info[0].handle)) {
/*
* Obtain the port_info instance to the parent port