// SPDX-License-Identifier: GPL-2.0 /* * Serial Attached SCSI (SAS) Port class * * Copyright (C) 2005 Adaptec, Inc. All rights reserved. * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
*/
if (si->dft->lldd_port_formed)
si->dft->lldd_port_formed(phy);
if (port->suspended)
port->suspended = 0; else { /* we only need to handle "link returned" actions once */ return;
}
/* if the port came back: * 1/ presume every device came back * 2/ force the next revalidation to check all expander phys
*/
list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { int i, rc;
if (dev_is_expander(dev->dev_type)) {
dev->ex_dev.ex_change_count = -1; for (i = 0; i < dev->ex_dev.num_phys; i++) { struct ex_phy *phy = &dev->ex_dev.ex_phy[i];
/** * sas_form_port - add this phy to a port * @phy: the phy of interest * * This function adds this phy to an existing port, thus creating a wide * port, or it creates a port and adds the phy to the port.
*/ staticvoid sas_form_port(struct asd_sas_phy *phy)
{ int i; struct sas_ha_struct *sas_ha = phy->ha; struct asd_sas_port *port = phy->port; struct domain_device *port_dev = NULL; struct sas_internal *si =
to_sas_internal(sas_ha->shost->transportt); unsignedlong flags;
if (port) { if (!phy_is_wideport_member(port, phy))
sas_deform_port(phy, false); elseif (phy->suspended) {
phy->suspended = 0;
sas_resume_port(phy);
/* phy came back, try to cancel the timeout */
wake_up(&sas_ha->eh_wait_q); return;
} else {
pr_info("%s: phy%d belongs to port%d already(%d)!\n",
__func__, phy->id, phy->port->id,
phy->port->num_phys); return;
}
}
/* see if the phy should be part of a wide port */
spin_lock_irqsave(&sas_ha->phy_port_lock, flags); for (i = 0; i < sas_ha->num_phys; i++) {
port = sas_ha->sas_port[i];
spin_lock(&port->phy_list_lock); if (*(u64 *) port->sas_addr &&
phy_is_wideport_member(port, phy) && port->num_phys > 0) { /* wide port */
port_dev = port->port_dev;
sas_form_port_add_phy(port, phy, true);
spin_unlock(&port->phy_list_lock); break;
}
spin_unlock(&port->phy_list_lock);
} /* The phy does not match any existing port, create a new one */ if (i == sas_ha->num_phys) { for (i = 0; i < sas_ha->num_phys; i++) {
port = sas_ha->sas_port[i];
spin_lock(&port->phy_list_lock); if (*(u64 *)port->sas_addr == 0
&& port->num_phys == 0) {
port_dev = port->port_dev;
sas_form_port_add_phy(port, phy, false);
spin_unlock(&port->phy_list_lock); break;
}
spin_unlock(&port->phy_list_lock);
}
if (i >= sas_ha->num_phys) {
pr_err("%s: couldn't find a free port, bug?\n",
__func__);
spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); return;
}
}
spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
/** * sas_deform_port - remove this phy from the port it belongs to * @phy: the phy of interest * @gone: whether or not the PHY is gone * * This is called when the physical link to the other phy has been * lost (on this phy), in Event thread context. We cannot delay here.
*/ void sas_deform_port(struct asd_sas_phy *phy, bool gone)
{ struct sas_ha_struct *sas_ha = phy->ha; struct asd_sas_port *port = phy->port; struct sas_internal *si =
to_sas_internal(sas_ha->shost->transportt); struct domain_device *dev; unsignedlong flags;
/* Only insert revalidate event if the port still has members */ if (port->port && dev && dev_is_expander(dev->dev_type)) { struct expander_device *ex_dev = &dev->ex_dev;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.