• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/scsi/libsas/

Lines Matching defs:port

32  * sas_form_port -- add this phy to a port
35 * This function adds this phy to an existing port, thus creating a wide
36 * port, or it creates a port and adds the phy to the port.
42 struct asd_sas_port *port = phy->port;
47 if (port) {
48 if (memcmp(port->attached_sas_addr, phy->attached_sas_addr,
52 SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n",
53 __func__, phy->id, phy->port->id,
54 phy->port->num_phys);
59 /* see if the phy should be part of a wide port */
62 port = sas_ha->sas_port[i];
63 spin_lock(&port->phy_list_lock);
64 if (*(u64 *) port->sas_addr &&
65 memcmp(port->attached_sas_addr,
67 port->num_phys > 0) {
68 /* wide port */
69 SAS_DPRINTK("phy%d matched wide port%d\n", phy->id,
70 port->id);
73 spin_unlock(&port->phy_list_lock);
75 /* The phy does not match any existing port, create a new one */
78 port = sas_ha->sas_port[i];
79 spin_lock(&port->phy_list_lock);
80 if (*(u64 *)port->sas_addr == 0
81 && port->num_phys == 0) {
82 memcpy(port->sas_addr, phy->sas_addr,
86 spin_unlock(&port->phy_list_lock);
91 printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
97 /* add the phy to the port */
98 list_add_tail(&phy->port_phy_el, &port->phy_list);
99 phy->port = port;
100 port->num_phys++;
101 port->phy_mask |= (1U << phy->id);
103 if (!port->phy)
104 port->phy = phy->phy;
106 if (*(u64 *)port->attached_sas_addr == 0) {
107 port->class = phy->class;
108 memcpy(port->attached_sas_addr, phy->attached_sas_addr,
110 port->iproto = phy->iproto;
111 port->tproto = phy->tproto;
112 port->oob_mode = phy->oob_mode;
113 port->linkrate = phy->linkrate;
115 port->linkrate = max(port->linkrate, phy->linkrate);
116 spin_unlock(&port->phy_list_lock);
119 if (!port->port) {
120 port->port = sas_port_alloc(phy->phy->dev.parent, port->id);
121 BUG_ON(!port->port);
122 sas_port_add(port->port);
124 sas_port_add_phy(port->port, phy->phy);
127 dev_name(&phy->phy->dev), dev_name(&port->port->dev),
128 port->phy_mask,
129 SAS_ADDR(port->attached_sas_addr));
131 if (port->port_dev)
132 port->port_dev->pathways = port->num_phys;
134 /* Tell the LLDD about this port formation. */
138 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
142 * sas_deform_port -- remove this phy from the port it belongs to
151 struct asd_sas_port *port = phy->port;
156 if (!port)
159 if (port->port_dev)
160 port->port_dev->pathways--;
162 if (port->num_phys == 1) {
163 sas_unregister_domain_devices(port);
164 sas_port_delete(port->port);
165 port->port = NULL;
167 sas_port_delete_phy(port->port, phy->phy);
174 spin_lock(&port->phy_list_lock);
177 phy->port = NULL;
178 port->num_phys--;
179 port->phy_mask &= ~(1U << phy->id);
181 if (port->num_phys == 0) {
182 INIT_LIST_HEAD(&port->phy_list);
183 memset(port->sas_addr, 0, SAS_ADDR_SIZE);
184 memset(port->attached_sas_addr, 0, SAS_ADDR_SIZE);
185 port->class = 0;
186 port->iproto = 0;
187 port->tproto = 0;
188 port->oob_mode = 0;
189 port->phy_mask = 0;
191 spin_unlock(&port->phy_list_lock);
197 /* ---------- SAS port events ---------- */
227 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
266 /* ---------- SAS port registration ---------- */
268 static void sas_init_port(struct asd_sas_port *port,
271 memset(port, 0, sizeof(*port));
272 port->id = i;
273 INIT_LIST_HEAD(&port->dev_list);
274 spin_lock_init(&port->phy_list_lock);
275 INIT_LIST_HEAD(&port->phy_list);
276 port->ha = sas_ha;
278 spin_lock_init(&port->dev_list_lock);
287 struct asd_sas_port *port = sas_ha->sas_port[i];
289 sas_init_port(port, sas_ha, i);
290 sas_init_disc(&port->disc, port);
300 if (sas_ha->sas_phy[i]->port)