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 memcpy(port->attached_sas_addr, phy->attached_sas_addr, in sas_form_port_add_phy()
88 port->iproto = phy->iproto; in sas_form_port_add_phy()
89 port->tproto = phy->tproto; in sas_form_port_add_phy()
90 port->oob_mode = phy->oob_mode; in sas_form_port_add_phy()
91 port->linkrate = phy->linkrate; in sas_form_port_add_phy()
93 port->linkrate = max(port->linkrate, phy->linkrate); in sas_form_port_add_phy()
98 * sas_form_port - add this phy to a port
99 * @phy: the phy of interest
101 * This function adds this phy to an existing port, thus creating a wide
102 * port, or it creates a port and adds the phy to the port.
104 static void sas_form_port(struct asd_sas_phy *phy) in sas_form_port() argument
107 struct sas_ha_struct *sas_ha = phy->ha; in sas_form_port()
108 struct asd_sas_port *port = phy->port; in sas_form_port()
115 if (!phy_is_wideport_member(port, phy)) in sas_form_port()
116 sas_deform_port(phy, 0); in sas_form_port()
117 else if (phy->suspended) { in sas_form_port()
118 phy->suspended = 0; in sas_form_port()
119 sas_resume_port(phy); in sas_form_port()
121 /* phy came back, try to cancel the timeout */ in sas_form_port()
125 pr_info("%s: phy%d belongs to port%d already(%d)!\n", in sas_form_port()
126 __func__, phy->id, phy->port->id, in sas_form_port()
127 phy->port->num_phys); in sas_form_port()
132 /* see if the phy should be part of a wide port */ in sas_form_port()
138 phy_is_wideport_member(port, phy) && port->num_phys > 0) { in sas_form_port()
141 sas_form_port_add_phy(port, phy, true); in sas_form_port()
147 /* The phy does not match any existing port, create a new one */ in sas_form_port()
155 sas_form_port_add_phy(port, phy, false); in sas_form_port()
172 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); in sas_form_port()
176 sas_port_add_phy(port->port, phy->phy); in sas_form_port()
179 dev_name(&phy->phy->dev), dev_name(&port->port->dev), in sas_form_port()
188 si->dft->lldd_port_formed(phy); in sas_form_port()
190 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); in sas_form_port()
202 * sas_deform_port - remove this phy from the port it belongs to
203 * @phy: the phy of interest
204 * @gone: whether or not the PHY is gone
206 * This is called when the physical link to the other phy has been
207 * lost (on this phy), in Event thread context. We cannot delay here.
209 void sas_deform_port(struct asd_sas_phy *phy, int gone) in sas_deform_port() argument
211 struct sas_ha_struct *sas_ha = phy->ha; in sas_deform_port()
212 struct asd_sas_port *port = phy->port; in sas_deform_port()
219 return; /* done by a phy event */ in sas_deform_port()
231 sas_port_delete_phy(port->port, phy->phy); in sas_deform_port()
236 si->dft->lldd_port_deformed(phy); in sas_deform_port()
241 list_del_init(&phy->port_phy_el); in sas_deform_port()
242 sas_phy_set_target(phy, NULL); in sas_deform_port()
243 phy->port = NULL; in sas_deform_port()
245 port->phy_mask &= ~(1U << phy->id); in sas_deform_port()
276 struct asd_sas_phy *phy = ev->phy; in sas_porte_bytes_dmaed() local
278 sas_form_port(phy); in sas_porte_bytes_dmaed()
284 struct asd_sas_phy *phy = ev->phy; in sas_porte_broadcast_rcvd() local
288 spin_lock_irqsave(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
289 prim = phy->sas_prim; in sas_porte_broadcast_rcvd()
290 spin_unlock_irqrestore(&phy->sas_prim_lock, flags); in sas_porte_broadcast_rcvd()
293 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); in sas_porte_broadcast_rcvd()
295 if (phy->port) in sas_porte_broadcast_rcvd()
296 flush_workqueue(phy->port->ha->disco_q); in sas_porte_broadcast_rcvd()
302 struct asd_sas_phy *phy = ev->phy; in sas_porte_link_reset_err() local
304 sas_deform_port(phy, 1); in sas_porte_link_reset_err()
310 struct asd_sas_phy *phy = ev->phy; in sas_porte_timer_event() local
312 sas_deform_port(phy, 1); in sas_porte_timer_event()
318 struct asd_sas_phy *phy = ev->phy; in sas_porte_hard_reset() local
320 sas_deform_port(phy, 1); in sas_porte_hard_reset()