• Home
  • Raw
  • Download

Lines Matching full:port

2  * Serial Attached SCSI (SAS) Port class
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()
59 /* if the port came back: in sas_resume_port()
63 list_for_each_entry(dev, &port->dev_list, dev_list_node) { in sas_resume_port()
68 sas_unregister_dev(port, dev); in sas_resume_port()
69 sas_destruct_devices(port); in sas_resume_port()
83 sas_discover_event(port, DISCE_RESUME); in sas_resume_port()
87 * sas_form_port - add this phy to a port
90 * This function adds this phy to an existing port, thus creating a wide
91 * port, or it creates a port and adds the phy to the port.
97 struct asd_sas_port *port = phy->port; in sas_form_port() local
102 if (port) { in sas_form_port()
103 if (!phy_is_wideport_member(port, phy)) in sas_form_port()
113 SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n", in sas_form_port()
114 __func__, phy->id, phy->port->id, in sas_form_port()
115 phy->port->num_phys); in sas_form_port()
120 /* see if the phy should be part of a wide port */ in sas_form_port()
123 port = sas_ha->sas_port[i]; in sas_form_port()
124 spin_lock(&port->phy_list_lock); in sas_form_port()
125 if (*(u64 *) port->sas_addr && in sas_form_port()
126 phy_is_wideport_member(port, phy) && port->num_phys > 0) { in sas_form_port()
127 /* wide port */ in sas_form_port()
128 SAS_DPRINTK("phy%d matched wide port%d\n", phy->id, in sas_form_port()
129 port->id); in sas_form_port()
132 spin_unlock(&port->phy_list_lock); in sas_form_port()
134 /* The phy does not match any existing port, create a new one */ in sas_form_port()
137 port = sas_ha->sas_port[i]; in sas_form_port()
138 spin_lock(&port->phy_list_lock); in sas_form_port()
139 if (*(u64 *)port->sas_addr == 0 in sas_form_port()
140 && port->num_phys == 0) { in sas_form_port()
141 memcpy(port->sas_addr, phy->sas_addr, in sas_form_port()
145 spin_unlock(&port->phy_list_lock); in sas_form_port()
150 printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n", in sas_form_port()
156 /* add the phy to the port */ in sas_form_port()
157 list_add_tail(&phy->port_phy_el, &port->phy_list); in sas_form_port()
158 sas_phy_set_target(phy, port->port_dev); in sas_form_port()
159 phy->port = port; in sas_form_port()
160 port->num_phys++; in sas_form_port()
161 port->phy_mask |= (1U << phy->id); in sas_form_port()
163 if (*(u64 *)port->attached_sas_addr == 0) { in sas_form_port()
164 port->class = phy->class; in sas_form_port()
165 memcpy(port->attached_sas_addr, phy->attached_sas_addr, in sas_form_port()
167 port->iproto = phy->iproto; in sas_form_port()
168 port->tproto = phy->tproto; in sas_form_port()
169 port->oob_mode = phy->oob_mode; in sas_form_port()
170 port->linkrate = phy->linkrate; in sas_form_port()
172 port->linkrate = max(port->linkrate, phy->linkrate); in sas_form_port()
173 spin_unlock(&port->phy_list_lock); in sas_form_port()
176 if (!port->port) { in sas_form_port()
177 port->port = sas_port_alloc(phy->phy->dev.parent, port->id); in sas_form_port()
178 BUG_ON(!port->port); in sas_form_port()
179 sas_port_add(port->port); in sas_form_port()
181 sas_port_add_phy(port->port, phy->phy); in sas_form_port()
184 dev_name(&phy->phy->dev), dev_name(&port->port->dev), in sas_form_port()
185 port->phy_mask, in sas_form_port()
186 SAS_ADDR(port->attached_sas_addr)); in sas_form_port()
188 if (port->port_dev) in sas_form_port()
189 port->port_dev->pathways = port->num_phys; in sas_form_port()
191 /* Tell the LLDD about this port formation. */ in sas_form_port()
195 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); in sas_form_port()
200 * sas_deform_port - remove this phy from the port it belongs to
210 struct asd_sas_port *port = phy->port; in sas_deform_port() local
216 if (!port) in sas_deform_port()
219 dev = port->port_dev; in sas_deform_port()
223 if (port->num_phys == 1) { in sas_deform_port()
224 sas_unregister_domain_devices(port, gone); in sas_deform_port()
225 sas_destruct_devices(port); in sas_deform_port()
226 sas_port_delete(port->port); in sas_deform_port()
227 port->port = NULL; in sas_deform_port()
229 sas_port_delete_phy(port->port, phy->phy); in sas_deform_port()
230 sas_device_set_phy(dev, port->port); in sas_deform_port()
237 spin_lock(&port->phy_list_lock); in sas_deform_port()
241 phy->port = NULL; in sas_deform_port()
242 port->num_phys--; in sas_deform_port()
243 port->phy_mask &= ~(1U << phy->id); in sas_deform_port()
245 if (port->num_phys == 0) { in sas_deform_port()
246 INIT_LIST_HEAD(&port->phy_list); in sas_deform_port()
247 memset(port->sas_addr, 0, SAS_ADDR_SIZE); in sas_deform_port()
248 memset(port->attached_sas_addr, 0, SAS_ADDR_SIZE); in sas_deform_port()
249 port->class = 0; in sas_deform_port()
250 port->iproto = 0; in sas_deform_port()
251 port->tproto = 0; in sas_deform_port()
252 port->oob_mode = 0; in sas_deform_port()
253 port->phy_mask = 0; in sas_deform_port()
255 spin_unlock(&port->phy_list_lock); in sas_deform_port()
261 /* ---------- SAS port events ---------- */
283 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); in sas_porte_broadcast_rcvd()
285 if (phy->port) in sas_porte_broadcast_rcvd()
286 flush_workqueue(phy->port->ha->disco_q); in sas_porte_broadcast_rcvd()
313 /* ---------- SAS port registration ---------- */
315 static void sas_init_port(struct asd_sas_port *port, in sas_init_port() argument
318 memset(port, 0, sizeof(*port)); in sas_init_port()
319 port->id = i; in sas_init_port()
320 INIT_LIST_HEAD(&port->dev_list); in sas_init_port()
321 INIT_LIST_HEAD(&port->disco_list); in sas_init_port()
322 INIT_LIST_HEAD(&port->destroy_list); in sas_init_port()
323 INIT_LIST_HEAD(&port->sas_port_del_list); in sas_init_port()
324 spin_lock_init(&port->phy_list_lock); in sas_init_port()
325 INIT_LIST_HEAD(&port->phy_list); in sas_init_port()
326 port->ha = sas_ha; in sas_init_port()
328 spin_lock_init(&port->dev_list_lock); in sas_init_port()
337 struct asd_sas_port *port = sas_ha->sas_port[i]; in sas_register_ports() local
339 sas_init_port(port, sas_ha, i); in sas_register_ports()
340 sas_init_disc(&port->disc, port); in sas_register_ports()
350 if (sas_ha->sas_phy[i]->port) in sas_unregister_ports()