Skip to content

Commit

Permalink
[SCSI] fusion - report wide port sas address's for hba phys
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Moore authored and James Bottomley committed Feb 3, 2007
1 parent df9e062 commit 2ecce49
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions drivers/message/fusion/mptsas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -1599,16 +1598,18 @@ 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) {
error = -ENOMEM;
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,
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -2051,20 +2053,25 @@ 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);
if (!port_info) {
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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2ecce49

Please sign in to comment.