Lines Matching defs:phy

15 static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy *phy)
17 struct sas_ha_struct *sas_ha = phy->ha;
19 if (memcmp(port->attached_sas_addr, phy->attached_sas_addr,
21 memcmp(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE) != 0))
26 static void sas_resume_port(struct asd_sas_phy *phy)
29 struct asd_sas_port *port = phy->port;
30 struct sas_ha_struct *sas_ha = phy->ha;
34 si->dft->lldd_port_formed(phy);
60 struct ex_phy *phy = &dev->ex_dev.ex_phy[i];
62 phy->phy_change_count = -1;
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)
80 struct sas_ha_struct *sas_ha = phy->ha;
81 struct asd_sas_port *port = phy->port;
88 if (!phy_is_wideport_member(port, phy))
89 sas_deform_port(phy, 0);
90 else if (phy->suspended) {
91 phy->suspended = 0;
92 sas_resume_port(phy);
94 /* phy came back, try to cancel the timeout */
98 pr_info("%s: phy%d belongs to port%d already(%d)!\n",
99 __func__, phy->id, phy->port->id,
100 phy->port->num_phys);
105 /* see if the phy should be part of a wide port */
111 phy_is_wideport_member(port, phy) && port->num_phys > 0) {
113 pr_debug("phy%d matched wide port%d\n", phy->id,
119 /* The phy does not match any existing port, create a new one */
126 memcpy(port->sas_addr, phy->sas_addr,
140 /* add the phy to the port */
142 list_add_tail(&phy->port_phy_el, &port->phy_list);
143 sas_phy_set_target(phy, port_dev);
144 phy->port = port;
146 port->phy_mask |= (1U << phy->id);
149 port->class = phy->class;
150 memcpy(port->attached_sas_addr, phy->attached_sas_addr,
152 port->iproto = phy->iproto;
153 port->tproto = phy->tproto;
154 port->oob_mode = phy->oob_mode;
155 port->linkrate = phy->linkrate;
157 port->linkrate = max(port->linkrate, phy->linkrate);
162 port->port = sas_port_alloc(phy->phy->dev.parent, port->id);
166 sas_port_add_phy(port->port, phy->phy);
169 dev_name(&phy->phy->dev), dev_name(&port->port->dev),
178 si->dft->lldd_port_formed(phy);
180 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
192 * sas_deform_port - remove this phy from the port it belongs to
193 * @phy: the phy of interest
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)
201 struct sas_ha_struct *sas_ha = phy->ha;
202 struct asd_sas_port *port = phy->port;
209 return; /* done by a phy event */
221 sas_port_delete_phy(port->port, phy->phy);
226 si->dft->lldd_port_deformed(phy);
231 list_del_init(&phy->port_phy_el);
232 sas_phy_set_target(phy, NULL);
233 phy->port = NULL;
235 port->phy_mask &= ~(1U << phy->id);
267 struct asd_sas_phy *phy = ev->phy;
269 sas_form_port(phy);
275 struct asd_sas_phy *phy = ev->phy;
279 spin_lock_irqsave(&phy->sas_prim_lock, flags);
280 prim = phy->sas_prim;
281 spin_unlock_irqrestore(&phy->sas_prim_lock, flags);
284 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
286 if (phy->port)
287 flush_workqueue(phy->port->ha->disco_q);
293 struct asd_sas_phy *phy = ev->phy;
295 sas_deform_port(phy, 1);
301 struct asd_sas_phy *phy = ev->phy;
303 sas_deform_port(phy, 1);
309 struct asd_sas_phy *phy = ev->phy;
311 sas_deform_port(phy, 1);