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 struct asd_sas_phy *phy, bool wideport) in sas_form_port_add_phy() argument
73 list_add_tail(&phy->port_phy_el, &port->phy_list); in sas_form_port_add_phy()
74 sas_phy_set_target(phy, port->port_dev); in sas_form_port_add_phy()
75 phy->port = port; in sas_form_port_add_phy()
77 port->phy_mask |= (1U << phy->id); in sas_form_port_add_phy()
80 pr_debug("phy%d matched wide port%d\n", phy->id, in sas_form_port_add_phy()
83 memcpy(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE); in sas_form_port_add_phy()
86 port->class = phy->class; in sas_form_port_add_phy()
87 memcpy(port->attached_sas_addr, phy->attached_sas_addr, in sas_form_port_add_phy()
89 port->iproto = phy->iproto; in sas_form_port_add_phy()
90 port->tproto = phy->tproto; in sas_form_port_add_phy()
91 port->oob_mode = phy->oob_mode; in sas_form_port_add_phy()
92 port->linkrate = phy->linkrate; in sas_form_port_add_phy()
94 port->linkrate = max(port->linkrate, phy->linkrate); in sas_form_port_add_phy()
99 * sas_form_port - add this phy to a port
100 * @phy: the phy of interest
102 * This function adds this phy to an existing port, thus creating a wide
103 * port, or it creates a port and adds the phy to the port.
105 static void sas_form_port(struct asd_sas_phy *phy) in sas_form_port() argument
108 struct sas_ha_struct *sas_ha = phy->ha; in sas_form_port()
109 struct asd_sas_port *port = phy->port; in sas_form_port()
116 if (!phy_is_wideport_member(port, phy)) in sas_form_port()
117 sas_deform_port(phy, 0); in sas_form_port()
118 else if (phy->suspended) { in sas_form_port()
119 phy->suspended = 0; in sas_form_port()
120 sas_resume_port(phy); in sas_form_port()
122 /* phy came back, try to cancel the timeout */ in sas_form_port()
126 pr_info("%s: phy%d belongs to port%d already(%d)!\n", in sas_form_port()
127 __func__, phy->id, phy->port->id, in sas_form_port()
128 phy->port->num_phys); in sas_form_port()
133 /* see if the phy should be part of a wide port */ in sas_form_port()
139 phy_is_wideport_member(port, phy) && port->num_phys > 0) { in sas_form_port()
142 sas_form_port_add_phy(port, phy, true); in sas_form_port()
148 /* The phy does not match any existing port, create a new one */ in sas_form_port()
156 sas_form_port_add_phy(port, phy, false); in sas_form_port()
173 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); in sas_form_port()
177 sas_port_add_phy(port->port, phy->phy); in sas_form_port()
180 dev_name(&phy->phy->dev), dev_name(&port->port->dev), in sas_form_port()
189 si->dft->lldd_port_formed(phy); in sas_form_port()
191 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); in sas_form_port()
203 * sas_deform_port - remove this phy from the port it belongs to
204 * @phy: the phy of interest
205 * @gone: whether or not the PHY is gone
207 * This is called when the physical link to the other phy has been
208 * lost (on this phy), in Event thread context. We cannot delay here.
210 void sas_deform_port(struct asd_sas_phy *phy, int gone) in sas_deform_port() argument
212 struct sas_ha_struct *sas_ha = phy->ha; in sas_deform_port()
213 struct asd_sas_port *port = phy->port; in sas_deform_port()
220 return; /* done by a phy event */ in sas_deform_port()
232 sas_port_delete_phy(port->port, phy->phy); in sas_deform_port()
237 si->dft->lldd_port_deformed(phy); in sas_deform_port()
242 list_del_init(&phy->port_phy_el); in sas_deform_port()
243 sas_phy_set_target(phy, NULL); in sas_deform_port()
244 phy->port = NULL; in sas_deform_port()
246 port->phy_mask &= ~(1U << phy->id); in sas_deform_port()
278 struct asd_sas_phy *phy = ev->phy; in sas_porte_bytes_dmaed() local
280 sas_form_port(phy); in sas_porte_bytes_dmaed()
286 struct asd_sas_phy *phy = ev->phy; in sas_porte_broadcast_rcvd() local
290 spin_lock_irqsave(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
291 prim = phy->sas_prim; in sas_porte_broadcast_rcvd()
292 spin_unlock_irqrestore(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
295 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); in sas_porte_broadcast_rcvd()
297 if (phy->port) in sas_porte_broadcast_rcvd()
298 flush_workqueue(phy->port->ha->disco_q); in sas_porte_broadcast_rcvd()
304 struct asd_sas_phy *phy = ev->phy; in sas_porte_link_reset_err() local
306 sas_deform_port(phy, 1); in sas_porte_link_reset_err()
312 struct asd_sas_phy *phy = ev->phy; in sas_porte_timer_event() local
314 sas_deform_port(phy, 1); in sas_porte_timer_event()
320 struct asd_sas_phy *phy = ev->phy; in sas_porte_hard_reset() local
322 sas_deform_port(phy, 1); in sas_porte_hard_reset()