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 struct asd_sas_phy *phy, bool wideport)
73 list_add_tail(&phy->port_phy_el, &port->phy_list);
74 sas_phy_set_target(phy, port->port_dev);
75 phy->port = port;
77 port->phy_mask |= (1U << phy->id);
80 pr_debug("phy%d matched wide port%d\n", phy->id,
83 memcpy(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE);
86 memcpy(port->attached_sas_addr, phy->attached_sas_addr,
88 port->iproto = phy->iproto;
89 port->tproto = phy->tproto;
90 port->oob_mode = phy->oob_mode;
91 port->linkrate = phy->linkrate;
93 port->linkrate = max(port->linkrate, phy->linkrate);
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)
107 struct sas_ha_struct *sas_ha = phy->ha;
108 struct asd_sas_port *port = phy->port;
115 if (!phy_is_wideport_member(port, phy))
116 sas_deform_port(phy, 0);
117 else if (phy->suspended) {
118 phy->suspended = 0;
119 sas_resume_port(phy);
121 /* phy came back, try to cancel the timeout */
125 pr_info("%s: phy%d belongs to port%d already(%d)!\n",
126 __func__, phy->id, phy->port->id,
127 phy->port->num_phys);
132 /* see if the phy should be part of a wide port */
138 phy_is_wideport_member(port, phy) && port->num_phys > 0) {
141 sas_form_port_add_phy(port, phy, true);
147 /* The phy does not match any existing port, create a new one */
155 sas_form_port_add_phy(port, phy, false);
172 port->port = sas_port_alloc(phy->phy->dev.parent, port->id);
176 sas_port_add_phy(port->port, phy->phy);
179 dev_name(&phy->phy->dev), dev_name(&port->port->dev),
188 si->dft->lldd_port_formed(phy);
190 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
202 * sas_deform_port - remove this phy from the port it belongs to
203 * @phy: the phy of interest
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)
211 struct sas_ha_struct *sas_ha = phy->ha;
212 struct asd_sas_port *port = phy->port;
219 return; /* done by a phy event */
231 sas_port_delete_phy(port->port, phy->phy);
236 si->dft->lldd_port_deformed(phy);
241 list_del_init(&phy->port_phy_el);
242 sas_phy_set_target(phy, NULL);
243 phy->port = NULL;
245 port->phy_mask &= ~(1U << phy->id);
276 struct asd_sas_phy *phy = ev->phy;
278 sas_form_port(phy);
284 struct asd_sas_phy *phy = ev->phy;
288 spin_lock_irqsave(&phy->sas_prim_lock, flags);
289 prim = phy->sas_prim;
290 spin_unlock_irqrestore(&phy->sas_prim_lock, flags);
293 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
295 if (phy->port)
296 flush_workqueue(phy->port->ha->disco_q);
302 struct asd_sas_phy *phy = ev->phy;
304 sas_deform_port(phy, 1);
310 struct asd_sas_phy *phy = ev->phy;
312 sas_deform_port(phy, 1);
318 struct asd_sas_phy *phy = ev->phy;
320 sas_deform_port(phy, 1);