Lines Matching refs:port
31 static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy *phy) in phy_is_wideport_member() argument
35 if (memcmp(port->attached_sas_addr, phy->attached_sas_addr, in phy_is_wideport_member()
37 memcmp(port->sas_addr, phy->sas_addr, SAS_ADDR_SIZE) != 0)) in phy_is_wideport_member()
45 struct asd_sas_port *port = phy->port; in sas_resume_port() local
52 if (port->suspended) in sas_resume_port()
53 port->suspended = 0; in sas_resume_port()
63 list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { in sas_resume_port()
68 sas_unregister_dev(port, dev); in sas_resume_port()
82 sas_discover_event(port, DISCE_RESUME); in sas_resume_port()
96 struct asd_sas_port *port = phy->port; in sas_form_port() local
101 if (port) { in sas_form_port()
102 if (!phy_is_wideport_member(port, phy)) in sas_form_port()
113 __func__, phy->id, phy->port->id, in sas_form_port()
114 phy->port->num_phys); in sas_form_port()
122 port = sas_ha->sas_port[i]; in sas_form_port()
123 spin_lock(&port->phy_list_lock); in sas_form_port()
124 if (*(u64 *) port->sas_addr && in sas_form_port()
125 phy_is_wideport_member(port, phy) && port->num_phys > 0) { in sas_form_port()
128 port->id); in sas_form_port()
131 spin_unlock(&port->phy_list_lock); in sas_form_port()
136 port = sas_ha->sas_port[i]; in sas_form_port()
137 spin_lock(&port->phy_list_lock); in sas_form_port()
138 if (*(u64 *)port->sas_addr == 0 in sas_form_port()
139 && port->num_phys == 0) { in sas_form_port()
140 memcpy(port->sas_addr, phy->sas_addr, in sas_form_port()
144 spin_unlock(&port->phy_list_lock); in sas_form_port()
156 list_add_tail(&phy->port_phy_el, &port->phy_list); in sas_form_port()
157 sas_phy_set_target(phy, port->port_dev); in sas_form_port()
158 phy->port = port; in sas_form_port()
159 port->num_phys++; in sas_form_port()
160 port->phy_mask |= (1U << phy->id); in sas_form_port()
162 if (*(u64 *)port->attached_sas_addr == 0) { in sas_form_port()
163 port->class = phy->class; in sas_form_port()
164 memcpy(port->attached_sas_addr, phy->attached_sas_addr, in sas_form_port()
166 port->iproto = phy->iproto; in sas_form_port()
167 port->tproto = phy->tproto; in sas_form_port()
168 port->oob_mode = phy->oob_mode; in sas_form_port()
169 port->linkrate = phy->linkrate; in sas_form_port()
171 port->linkrate = max(port->linkrate, phy->linkrate); in sas_form_port()
172 spin_unlock(&port->phy_list_lock); in sas_form_port()
175 if (!port->port) { in sas_form_port()
176 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); in sas_form_port()
177 BUG_ON(!port->port); in sas_form_port()
178 sas_port_add(port->port); in sas_form_port()
180 sas_port_add_phy(port->port, phy->phy); in sas_form_port()
183 dev_name(&phy->phy->dev), dev_name(&port->port->dev), in sas_form_port()
184 port->phy_mask, in sas_form_port()
185 SAS_ADDR(port->attached_sas_addr)); in sas_form_port()
187 if (port->port_dev) in sas_form_port()
188 port->port_dev->pathways = port->num_phys; in sas_form_port()
194 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); in sas_form_port()
207 struct asd_sas_port *port = phy->port; in sas_deform_port() local
213 if (!port) in sas_deform_port()
216 dev = port->port_dev; in sas_deform_port()
220 if (port->num_phys == 1) { in sas_deform_port()
221 sas_unregister_domain_devices(port, gone); in sas_deform_port()
222 sas_port_delete(port->port); in sas_deform_port()
223 port->port = NULL; in sas_deform_port()
225 sas_port_delete_phy(port->port, phy->phy); in sas_deform_port()
226 sas_device_set_phy(dev, port->port); in sas_deform_port()
233 spin_lock(&port->phy_list_lock); in sas_deform_port()
237 phy->port = NULL; in sas_deform_port()
238 port->num_phys--; in sas_deform_port()
239 port->phy_mask &= ~(1U << phy->id); in sas_deform_port()
241 if (port->num_phys == 0) { in sas_deform_port()
242 INIT_LIST_HEAD(&port->phy_list); in sas_deform_port()
243 memset(port->sas_addr, 0, SAS_ADDR_SIZE); in sas_deform_port()
244 memset(port->attached_sas_addr, 0, SAS_ADDR_SIZE); in sas_deform_port()
245 port->class = 0; in sas_deform_port()
246 port->iproto = 0; in sas_deform_port()
247 port->tproto = 0; in sas_deform_port()
248 port->oob_mode = 0; in sas_deform_port()
249 port->phy_mask = 0; in sas_deform_port()
251 spin_unlock(&port->phy_list_lock); in sas_deform_port()
283 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); in sas_porte_broadcast_rcvd()
318 static void sas_init_port(struct asd_sas_port *port, in sas_init_port() argument
321 memset(port, 0, sizeof(*port)); in sas_init_port()
322 port->id = i; in sas_init_port()
323 INIT_LIST_HEAD(&port->dev_list); in sas_init_port()
324 INIT_LIST_HEAD(&port->disco_list); in sas_init_port()
325 INIT_LIST_HEAD(&port->destroy_list); in sas_init_port()
326 spin_lock_init(&port->phy_list_lock); in sas_init_port()
327 INIT_LIST_HEAD(&port->phy_list); in sas_init_port()
328 port->ha = sas_ha; in sas_init_port()
330 spin_lock_init(&port->dev_list_lock); in sas_init_port()
339 struct asd_sas_port *port = sas_ha->sas_port[i]; in sas_register_ports() local
341 sas_init_port(port, sas_ha, i); in sas_register_ports()
342 sas_init_disc(&port->disc, port); in sas_register_ports()
352 if (sas_ha->sas_phy[i]->port) in sas_unregister_ports()