Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Eric Moore and committed by
James Bottomley
2ecce492 df9e062a

+30 -22
+30 -22
drivers/message/fusion/mptsas.c
··· 169 169 }; 170 170 171 171 struct mptsas_phyinfo { 172 + u16 handle; /* unique id to address this */ 172 173 u8 phy_id; /* phy index */ 173 174 u8 port_id; /* firmware port identifier */ 174 175 u8 negotiated_link_rate; /* nego'd link rate for this phy */ ··· 185 184 186 185 struct mptsas_portinfo { 187 186 struct list_head list; 188 - u16 handle; /* unique id to address this */ 189 187 u16 num_phys; /* number of phys */ 190 188 struct mptsas_phyinfo *phy_info; 191 189 }; ··· 1387 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 1390 for (i = 0; i < port_info->num_phys; i++) { 1394 1391 mptsas_print_phy_data(&buffer->PhyData[i]); 1395 1392 port_info->phy_info[i].phy_id = i; ··· 1395 1398 port_info->phy_info[i].negotiated_link_rate = 1396 1399 buffer->PhyData[i].NegotiatedLinkRate; 1397 1400 port_info->phy_info[i].portinfo = port_info; 1401 + port_info->phy_info[i].handle = 1402 + le16_to_cpu(buffer->PhyData[i].ControllerDevHandle); 1398 1403 } 1399 1404 1400 1405 out_free_consistent: ··· 1598 1599 1599 1600 /* save config data */ 1600 1601 port_info->num_phys = buffer->NumPhys; 1601 - port_info->handle = le16_to_cpu(buffer->DevHandle); 1602 1602 port_info->phy_info = kcalloc(port_info->num_phys, 1603 1603 sizeof(*port_info->phy_info),GFP_KERNEL); 1604 1604 if (!port_info->phy_info) { ··· 1605 1607 goto out_free_consistent; 1606 1608 } 1607 1609 1608 - for (i = 0; i < port_info->num_phys; i++) 1610 + for (i = 0; i < port_info->num_phys; i++) { 1609 1611 port_info->phy_info[i].portinfo = port_info; 1612 + port_info->phy_info[i].handle = 1613 + le16_to_cpu(buffer->DevHandle); 1614 + } 1610 1615 1611 1616 out_free_consistent: 1612 1617 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, ··· 1977 1976 mptsas_probe_hba_phys(MPT_ADAPTER *ioc) 1978 1977 { 1979 1978 struct mptsas_portinfo *port_info, *hba; 1980 - u32 handle = 0xFFFF; 1981 1979 int error = -ENOMEM, i; 1982 1980 1983 1981 hba = kzalloc(sizeof(*port_info), GFP_KERNEL); ··· 1988 1988 goto out_free_port_info; 1989 1989 1990 1990 mutex_lock(&ioc->sas_topology_mutex); 1991 - ioc->handle = hba->handle; 1992 - port_info = mptsas_find_portinfo_by_handle(ioc, hba->handle); 1991 + ioc->handle = hba->phy_info[0].handle; 1992 + port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); 1993 1993 if (!port_info) { 1994 1994 port_info = hba; 1995 1995 list_add_tail(&port_info->list, &ioc->sas_topology); 1996 1996 } else { 1997 - port_info->handle = hba->handle; 1998 - for (i = 0; i < hba->num_phys; i++) 1997 + for (i = 0; i < hba->num_phys; i++) { 1999 1998 port_info->phy_info[i].negotiated_link_rate = 2000 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 2005 kfree(hba->phy_info); 2002 2006 kfree(hba); 2003 2007 hba = NULL; 2004 2008 } 2005 2009 mutex_unlock(&ioc->sas_topology_mutex); 2006 - 2007 2010 for (i = 0; i < port_info->num_phys; i++) { 2008 2011 mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i], 2009 2012 (MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER << 2010 2013 MPI_SAS_PHY_PGAD_FORM_SHIFT), i); 2011 2014 2012 2015 mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, 2013 - (MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE << 2014 - MPI_SAS_DEVICE_PGAD_FORM_SHIFT), handle); 2016 + (MPI_SAS_DEVICE_PGAD_FORM_HANDLE << 2017 + MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 2018 + port_info->phy_info[i].handle); 2015 2019 port_info->phy_info[i].identify.phy_id = 2016 - port_info->phy_info[i].phy_id; 2017 - handle = port_info->phy_info[i].identify.handle; 2018 - 2020 + port_info->phy_info[i].phy_id = i; 2019 2021 if (port_info->phy_info[i].attached.handle) 2020 2022 mptsas_sas_device_pg0(ioc, 2021 2023 &port_info->phy_info[i].attached, ··· 2053 2051 goto out; 2054 2052 2055 2053 error = mptsas_sas_expander_pg0(ioc, ex, 2056 - (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << 2057 - MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle); 2054 + (MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE << 2055 + MPI_SAS_EXPAND_PGAD_FORM_SHIFT), *handle); 2058 2056 if (error) 2059 2057 goto out_free_port_info; 2060 2058 2061 - *handle = ex->handle; 2059 + *handle = ex->phy_info[0].handle; 2062 2060 2063 2061 mutex_lock(&ioc->sas_topology_mutex); 2064 2062 port_info = mptsas_find_portinfo_by_handle(ioc, *handle); ··· 2066 2064 port_info = ex; 2067 2065 list_add_tail(&port_info->list, &ioc->sas_topology); 2068 2066 } else { 2069 - port_info->handle = ex->handle; 2067 + for (i = 0; i < ex->num_phys; i++) { 2068 + port_info->phy_info[i].handle = 2069 + ex->phy_info[i].handle; 2070 + port_info->phy_info[i].port_id = 2071 + ex->phy_info[i].port_id; 2072 + } 2070 2073 kfree(ex->phy_info); 2071 2074 kfree(ex); 2072 2075 ex = NULL; ··· 2163 2156 2164 2157 if (mptsas_sas_expander_pg0(ioc, &buffer, 2165 2158 (MPI_SAS_EXPAND_PGAD_FORM_HANDLE << 2166 - MPI_SAS_EXPAND_PGAD_FORM_SHIFT), port_info->handle)) { 2159 + MPI_SAS_EXPAND_PGAD_FORM_SHIFT), 2160 + port_info->phy_info[0].handle)) { 2167 2161 2168 2162 /* 2169 2163 * Obtain the port_info instance to the parent port