Lines Matching full:phy

15 static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy *phy)  in phy_is_wideport_member()  argument
17 struct sas_ha_struct *sas_ha = phy->ha; in phy_is_wideport_member()
19 if (memcmp(port->attached_sas_addr, phy->attached_sas_addr, in phy_is_wideport_member()
21 memcmp(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE) != 0)) in phy_is_wideport_member()
26 static void sas_resume_port(struct asd_sas_phy *phy) in sas_resume_port() argument
29 struct asd_sas_port *port = phy->port; in sas_resume_port()
30 struct sas_ha_struct *sas_ha = phy->ha; in sas_resume_port()
34 si->dft->lldd_port_formed(phy); in sas_resume_port()
60 struct ex_phy *phy = &dev->ex_dev.ex_phy[i]; in sas_resume_port() local
62 phy->phy_change_count = -1; in sas_resume_port()
71 * sas_form_port - add this phy to a port
72 * @phy: the phy of interest
74 * This function adds this phy to an existing port, thus creating a wide
75 * port, or it creates a port and adds the phy to the port.
77 static void sas_form_port(struct asd_sas_phy *phy) in sas_form_port() argument
80 struct sas_ha_struct *sas_ha = phy->ha; in sas_form_port()
81 struct asd_sas_port *port = phy->port; in sas_form_port()
88 if (!phy_is_wideport_member(port, phy)) in sas_form_port()
89 sas_deform_port(phy, 0); in sas_form_port()
90 else if (phy->suspended) { in sas_form_port()
91 phy->suspended = 0; in sas_form_port()
92 sas_resume_port(phy); in sas_form_port()
94 /* phy came back, try to cancel the timeout */ in sas_form_port()
98 pr_info("%s: phy%d belongs to port%d already(%d)!\n", in sas_form_port()
99 __func__, phy->id, phy->port->id, in sas_form_port()
100 phy->port->num_phys); in sas_form_port()
105 /* see if the phy should be part of a wide port */ in sas_form_port()
111 phy_is_wideport_member(port, phy) && port->num_phys > 0) { in sas_form_port()
113 pr_debug("phy%d matched wide port%d\n", phy->id, in sas_form_port()
119 /* The phy does not match any existing port, create a new one */ in sas_form_port()
126 memcpy(port->sas_addr, phy->sas_addr, in sas_form_port()
140 /* add the phy to the port */ in sas_form_port()
142 list_add_tail(&phy->port_phy_el, &port->phy_list); in sas_form_port()
143 sas_phy_set_target(phy, port_dev); in sas_form_port()
144 phy->port = port; in sas_form_port()
146 port->phy_mask |= (1U << phy->id); in sas_form_port()
149 port->class = phy->class; in sas_form_port()
150 memcpy(port->attached_sas_addr, phy->attached_sas_addr, in sas_form_port()
152 port->iproto = phy->iproto; in sas_form_port()
153 port->tproto = phy->tproto; in sas_form_port()
154 port->oob_mode = phy->oob_mode; in sas_form_port()
155 port->linkrate = phy->linkrate; in sas_form_port()
157 port->linkrate = max(port->linkrate, phy->linkrate); in sas_form_port()
162 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); in sas_form_port()
166 sas_port_add_phy(port->port, phy->phy); in sas_form_port()
169 dev_name(&phy->phy->dev), dev_name(&port->port->dev), in sas_form_port()
178 si->dft->lldd_port_formed(phy); in sas_form_port()
180 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); in sas_form_port()
192 * sas_deform_port - remove this phy from the port it belongs to
193 * @phy: the phy of interest
194 * @gone: whether or not the PHY is gone
196 * This is called when the physical link to the other phy has been
197 * lost (on this phy), in Event thread context. We cannot delay here.
199 void sas_deform_port(struct asd_sas_phy *phy, int gone) in sas_deform_port() argument
201 struct sas_ha_struct *sas_ha = phy->ha; in sas_deform_port()
202 struct asd_sas_port *port = phy->port; in sas_deform_port()
209 return; /* done by a phy event */ in sas_deform_port()
221 sas_port_delete_phy(port->port, phy->phy); in sas_deform_port()
226 si->dft->lldd_port_deformed(phy); in sas_deform_port()
231 list_del_init(&phy->port_phy_el); in sas_deform_port()
232 sas_phy_set_target(phy, NULL); in sas_deform_port()
233 phy->port = NULL; in sas_deform_port()
235 port->phy_mask &= ~(1U << phy->id); in sas_deform_port()
267 struct asd_sas_phy *phy = ev->phy; in sas_porte_bytes_dmaed() local
269 sas_form_port(phy); in sas_porte_bytes_dmaed()
275 struct asd_sas_phy *phy = ev->phy; in sas_porte_broadcast_rcvd() local
279 spin_lock_irqsave(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
280 prim = phy->sas_prim; in sas_porte_broadcast_rcvd()
281 spin_unlock_irqrestore(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
284 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); in sas_porte_broadcast_rcvd()
286 if (phy->port) in sas_porte_broadcast_rcvd()
287 flush_workqueue(phy->port->ha->disco_q); in sas_porte_broadcast_rcvd()
293 struct asd_sas_phy *phy = ev->phy; in sas_porte_link_reset_err() local
295 sas_deform_port(phy, 1); in sas_porte_link_reset_err()
301 struct asd_sas_phy *phy = ev->phy; in sas_porte_timer_event() local
303 sas_deform_port(phy, 1); in sas_porte_timer_event()
309 struct asd_sas_phy *phy = ev->phy; in sas_porte_hard_reset() local
311 sas_deform_port(phy, 1); in sas_porte_hard_reset()