Commit 2ecce492 authored by Eric Moore's avatar Eric Moore Committed by James Bottomley

[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: default avatarEric Moore <Eric.Moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent df9e062a
...@@ -169,6 +169,7 @@ struct mptsas_portinfo_details{ ...@@ -169,6 +169,7 @@ struct mptsas_portinfo_details{
}; };
struct mptsas_phyinfo { struct mptsas_phyinfo {
u16 handle; /* unique id to address this */
u8 phy_id; /* phy index */ u8 phy_id; /* phy index */
u8 port_id; /* firmware port identifier */ u8 port_id; /* firmware port identifier */
u8 negotiated_link_rate; /* nego'd link rate for this phy */ u8 negotiated_link_rate; /* nego'd link rate for this phy */
...@@ -184,7 +185,6 @@ struct mptsas_phyinfo { ...@@ -184,7 +185,6 @@ struct mptsas_phyinfo {
struct mptsas_portinfo { struct mptsas_portinfo {
struct list_head list; struct list_head list;
u16 handle; /* unique id to address this */
u16 num_phys; /* number of phys */ u16 num_phys; /* number of phys */
struct mptsas_phyinfo *phy_info; struct mptsas_phyinfo *phy_info;
}; };
...@@ -1387,9 +1387,6 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) ...@@ -1387,9 +1387,6 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
goto out_free_consistent; 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++) { for (i = 0; i < port_info->num_phys; i++) {
mptsas_print_phy_data(&buffer->PhyData[i]); mptsas_print_phy_data(&buffer->PhyData[i]);
port_info->phy_info[i].phy_id = 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) ...@@ -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 = port_info->phy_info[i].negotiated_link_rate =
buffer->PhyData[i].NegotiatedLinkRate; buffer->PhyData[i].NegotiatedLinkRate;
port_info->phy_info[i].portinfo = port_info; port_info->phy_info[i].portinfo = port_info;
port_info->phy_info[i].handle =
le16_to_cpu(buffer->PhyData[i].ControllerDevHandle);
} }
out_free_consistent: out_free_consistent:
...@@ -1599,7 +1598,6 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, ...@@ -1599,7 +1598,6 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
/* save config data */ /* save config data */
port_info->num_phys = buffer->NumPhys; port_info->num_phys = buffer->NumPhys;
port_info->handle = le16_to_cpu(buffer->DevHandle);
port_info->phy_info = kcalloc(port_info->num_phys, port_info->phy_info = kcalloc(port_info->num_phys,
sizeof(*port_info->phy_info),GFP_KERNEL); sizeof(*port_info->phy_info),GFP_KERNEL);
if (!port_info->phy_info) { if (!port_info->phy_info) {
...@@ -1607,8 +1605,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, ...@@ -1607,8 +1605,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
goto out_free_consistent; 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].portinfo = port_info;
port_info->phy_info[i].handle =
le16_to_cpu(buffer->DevHandle);
}
out_free_consistent: out_free_consistent:
pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
...@@ -1976,7 +1977,6 @@ static int ...@@ -1976,7 +1977,6 @@ static int
mptsas_probe_hba_phys(MPT_ADAPTER *ioc) mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
{ {
struct mptsas_portinfo *port_info, *hba; struct mptsas_portinfo *port_info, *hba;
u32 handle = 0xFFFF;
int error = -ENOMEM, i; int error = -ENOMEM, i;
hba = kzalloc(sizeof(*port_info), GFP_KERNEL); hba = kzalloc(sizeof(*port_info), GFP_KERNEL);
...@@ -1988,34 +1988,36 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc) ...@@ -1988,34 +1988,36 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
goto out_free_port_info; goto out_free_port_info;
mutex_lock(&ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
ioc->handle = hba->handle; ioc->handle = hba->phy_info[0].handle;
port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle); port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
if (!port_info) { if (!port_info) {
port_info = hba; port_info = hba;
list_add_tail(&port_info->list, &ioc->sas_topology); list_add_tail(&port_info->list, &ioc->sas_topology);
} else { } 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 = port_info->phy_info[i].negotiated_link_rate =
hba->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->phy_info);
kfree(hba); kfree(hba);
hba = NULL; hba = NULL;
} }
mutex_unlock(&ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
for (i = 0; i < port_info->num_phys; i++) { for (i = 0; i < port_info->num_phys; i++) {
mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i], mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
(MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER << (MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER <<
MPI_SAS_PHY_PGAD_FORM_SHIFT), i); MPI_SAS_PHY_PGAD_FORM_SHIFT), i);
mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify,
(MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE << (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 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].identify.phy_id =
port_info->phy_info[i].phy_id; port_info->phy_info[i].phy_id = i;
handle = port_info->phy_info[i].identify.handle;
if (port_info->phy_info[i].attached.handle) if (port_info->phy_info[i].attached.handle)
mptsas_sas_device_pg0(ioc, mptsas_sas_device_pg0(ioc,
&port_info->phy_info[i].attached, &port_info->phy_info[i].attached,
...@@ -2051,12 +2053,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle) ...@@ -2051,12 +2053,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
goto out; goto out;
error = mptsas_sas_expander_pg0(ioc, ex, error = mptsas_sas_expander_pg0(ioc, ex,
(MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE <<
MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle); MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle);
if (error) if (error)
goto out_free_port_info; goto out_free_port_info;
*handle = ex->handle; *handle = ex->phy_info[0].handle;
mutex_lock(&ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
port_info = mptsas_find_portinfo_by_handle(ioc, *handle); port_info = mptsas_find_portinfo_by_handle(ioc, *handle);
...@@ -2064,7 +2066,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle) ...@@ -2064,7 +2066,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
port_info = ex; port_info = ex;
list_add_tail(&port_info->list, &ioc->sas_topology); list_add_tail(&port_info->list, &ioc->sas_topology);
} else { } 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->phy_info);
kfree(ex); kfree(ex);
ex = NULL; ex = NULL;
...@@ -2156,7 +2163,8 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc) ...@@ -2156,7 +2163,8 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
if (mptsas_sas_expander_pg0(ioc, &buffer, if (mptsas_sas_expander_pg0(ioc, &buffer,
(MPI_SAS_EXPAND_PGAD_FORM_HANDLE << (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 * Obtain the port_info instance to the parent port
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment