aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptsas.c
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-01-29 11:47:08 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-02-02 22:05:46 -0500
commit2ecce492290bf0d5eedc76cf0f4bf45f8c3f42bc (patch)
tree0564bac0764283559d8e43dc3b8b450f51e1cb29 /drivers/message/fusion/mptsas.c
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>
Diffstat (limited to 'drivers/message/fusion/mptsas.c')
-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 3dbb5659f615..9d0f87f4c5e5 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -169,6 +169,7 @@ struct mptsas_portinfo_details{
169}; 169};
170 170
171struct mptsas_phyinfo { 171struct mptsas_phyinfo {
172 u16 handle; /* unique id to address this */
172 u8 phy_id; /* phy index */ 173 u8 phy_id; /* phy index */
173 u8 port_id; /* firmware port identifier */ 174 u8 port_id; /* firmware port identifier */
174 u8 negotiated_link_rate; /* nego'd link rate for this phy */ 175 u8 negotiated_link_rate; /* nego'd link rate for this phy */
@@ -184,7 +185,6 @@ struct mptsas_phyinfo {
184 185
185struct mptsas_portinfo { 186struct mptsas_portinfo {
186 struct list_head list; 187 struct list_head list;
187 u16 handle; /* unique id to address this */
188 u16 num_phys; /* number of phys */ 188 u16 num_phys; /* number of phys */
189 struct mptsas_phyinfo *phy_info; 189 struct mptsas_phyinfo *phy_info;
190}; 190};
@@ -1387,9 +1387,6 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1387 goto out_free_consistent; 1387 goto out_free_consistent;
1388 } 1388 }
1389 1389
1390 if (port_info->num_phys)
1391 port_info->handle =
1392 le16_to_cpu(buffer->PhyData[0].ControllerDevHandle);
1393 for (i = 0; i < port_info->num_phys; i++) { 1390 for (i = 0; i < port_info->num_phys; i++) {
1394 mptsas_print_phy_data(&buffer->PhyData[i]); 1391 mptsas_print_phy_data(&buffer->PhyData[i]);
1395 port_info->phy_info[i].phy_id = i; 1392 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 port_info->phy_info[i].negotiated_link_rate = 1395 port_info->phy_info[i].negotiated_link_rate =
1399 buffer->PhyData[i].NegotiatedLinkRate; 1396 buffer->PhyData[i].NegotiatedLinkRate;
1400 port_info->phy_info[i].portinfo = port_info; 1397 port_info->phy_info[i].portinfo = port_info;
1398 port_info->phy_info[i].handle =
1399 le16_to_cpu(buffer->PhyData[i].ControllerDevHandle);
1401 } 1400 }
1402 1401
1403 out_free_consistent: 1402 out_free_consistent:
@@ -1599,7 +1598,6 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
1599 1598
1600 /* save config data */ 1599 /* save config data */
1601 port_info->num_phys = buffer->NumPhys; 1600 port_info->num_phys = buffer->NumPhys;
1602 port_info->handle = le16_to_cpu(buffer->DevHandle);
1603 port_info->phy_info = kcalloc(port_info->num_phys, 1601 port_info->phy_info = kcalloc(port_info->num_phys,
1604 sizeof(*port_info->phy_info),GFP_KERNEL); 1602 sizeof(*port_info->phy_info),GFP_KERNEL);
1605 if (!port_info->phy_info) { 1603 if (!port_info->phy_info) {
@@ -1607,8 +1605,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
1607 goto out_free_consistent; 1605 goto out_free_consistent;
1608 } 1606 }
1609 1607
1610 for (i = 0; i < port_info->num_phys; i++) 1608 for (i = 0; i < port_info->num_phys; i++) {
1611 port_info->phy_info[i].portinfo = port_info; 1609 port_info->phy_info[i].portinfo = port_info;
1610 port_info->phy_info[i].handle =
1611 le16_to_cpu(buffer->DevHandle);
1612 }
1612 1613
1613 out_free_consistent: 1614 out_free_consistent:
1614 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 1615 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
@@ -1976,7 +1977,6 @@ static int
1976mptsas_probe_hba_phys(MPT_ADAPTER *ioc) 1977mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1977{ 1978{
1978 struct mptsas_portinfo *port_info, *hba; 1979 struct mptsas_portinfo *port_info, *hba;
1979 u32 handle = 0xFFFF;
1980 int error = -ENOMEM, i; 1980 int error = -ENOMEM, i;
1981 1981
1982 hba = kzalloc(sizeof(*port_info), GFP_KERNEL); 1982 hba = kzalloc(sizeof(*port_info), GFP_KERNEL);
@@ -1988,34 +1988,36 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1988 goto out_free_port_info; 1988 goto out_free_port_info;
1989 1989
1990 mutex_lock(&ioc->sas_topology_mutex); 1990 mutex_lock(&ioc->sas_topology_mutex);
1991 ioc->handle = hba->handle; 1991 ioc->handle = hba->phy_info[0].handle;
1992 port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle); 1992 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
1993 if (!port_info) { 1993 if (!port_info) {
1994 port_info = hba; 1994 port_info = hba;
1995 list_add_tail(&port_info->list, &ioc->sas_topology); 1995 list_add_tail(&port_info->list, &ioc->sas_topology);
1996 } else { 1996 } else {
1997 port_info->handle = hba->handle; 1997 for (i = 0; i < hba->num_phys; i++) {
1998 for (i = 0; i < hba->num_phys; i++)
1999 port_info->phy_info[i].negotiated_link_rate = 1998 port_info->phy_info[i].negotiated_link_rate =
2000 hba->phy_info[i].negotiated_link_rate; 1999 hba->phy_info[i].negotiated_link_rate;
2000 port_info->phy_info[i].handle =
2001 hba->phy_info[i].handle;
2002 port_info->phy_info[i].port_id =
2003 hba->phy_info[i].port_id;
2004 }
2001 kfree(hba->phy_info); 2005 kfree(hba->phy_info);
2002 kfree(hba); 2006 kfree(hba);
2003 hba = NULL; 2007 hba = NULL;
2004 } 2008 }
2005 mutex_unlock(&ioc->sas_topology_mutex); 2009 mutex_unlock(&ioc->sas_topology_mutex);
2006
2007 for (i = 0; i < port_info->num_phys; i++) { 2010 for (i = 0; i < port_info->num_phys; i++) {
2008 mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i], 2011 mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
2009 (MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER << 2012 (MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER <<
2010 MPI_SAS_PHY_PGAD_FORM_SHIFT), i); 2013 MPI_SAS_PHY_PGAD_FORM_SHIFT), i);
2011 2014
2012 mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, 2015 mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify,
2013 (MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE << 2016 (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<
2014 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), handle); 2017 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
2018 port_info->phy_info[i].handle);
2015 port_info->phy_info[i].identify.phy_id = 2019 port_info->phy_info[i].identify.phy_id =
2016 port_info->phy_info[i].phy_id; 2020 port_info->phy_info[i].phy_id = i;
2017 handle = port_info->phy_info[i].identify.handle;
2018
2019 if (port_info->phy_info[i].attached.handle) 2021 if (port_info->phy_info[i].attached.handle)
2020 mptsas_sas_device_pg0(ioc, 2022 mptsas_sas_device_pg0(ioc,
2021 &port_info->phy_info[i].attached, 2023 &port_info->phy_info[i].attached,
@@ -2051,12 +2053,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
2051 goto out; 2053 goto out;
2052 2054
2053 error = mptsas_sas_expander_pg0(ioc, ex, 2055 error = mptsas_sas_expander_pg0(ioc, ex,
2054 (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << 2056 (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE <<
2055 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle); 2057 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle);
2056 if (error) 2058 if (error)
2057 goto out_free_port_info; 2059 goto out_free_port_info;
2058 2060
2059 *handle = ex->handle; 2061 *handle = ex->phy_info[0].handle;
2060 2062
2061 mutex_lock(&ioc->sas_topology_mutex); 2063 mutex_lock(&ioc->sas_topology_mutex);
2062 port_info = mptsas_find_portinfo_by_handle(ioc, *handle); 2064 port_info = mptsas_find_portinfo_by_handle(ioc, *handle);
@@ -2064,7 +2066,12 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle)
2064 port_info = ex; 2066 port_info = ex;
2065 list_add_tail(&port_info->list, &ioc->sas_topology); 2067 list_add_tail(&port_info->list, &ioc->sas_topology);
2066 } else { 2068 } else {
2067 port_info->handle = ex->handle; 2069 for (i = 0; i < ex->num_phys; i++) {
2070 port_info->phy_info[i].handle =
2071 ex->phy_info[i].handle;
2072 port_info->phy_info[i].port_id =
2073 ex->phy_info[i].port_id;
2074 }
2068 kfree(ex->phy_info); 2075 kfree(ex->phy_info);
2069 kfree(ex); 2076 kfree(ex);
2070 ex = NULL; 2077 ex = NULL;
@@ -2156,7 +2163,8 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
2156 2163
2157 if (mptsas_sas_expander_pg0(ioc, &buffer, 2164 if (mptsas_sas_expander_pg0(ioc, &buffer,
2158 (MPI_SAS_EXPAND_PGAD_FORM_HANDLE << 2165 (MPI_SAS_EXPAND_PGAD_FORM_HANDLE <<
2159 MPI_SAS_EXPAND_PGAD_FORM_SHIFT), port_info->handle)) { 2166 MPI_SAS_EXPAND_PGAD_FORM_SHIFT),
2167 port_info->phy_info[0].handle)) {
2160 2168
2161 /* 2169 /*
2162 * Obtain the port_info instance to the parent port 2170 * Obtain the port_info instance to the parent port