2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 #define SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT (10)
59 #define SCIC_SDS_APC_RECONFIGURATION_TIMEOUT (10)
60 #define SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION (100)
62 enum SCIC_SDS_APC_ACTIVITY {
63 SCIC_SDS_APC_SKIP_PHY,
65 SCIC_SDS_APC_START_TIMER,
67 SCIC_SDS_APC_ACTIVITY_MAX
71 * ******************************************************************************
72 * General port configuration agent routines
73 * ****************************************************************************** */
77 * @address_one: A SAS Address to be compared.
78 * @address_two: A SAS Address to be compared.
80 * Compare the two SAS Address and if SAS Address One is greater than SAS
81 * Address Two then return > 0 else if SAS Address One is less than SAS Address
82 * Two return < 0 Otherwise they are the same return 0 A signed value of x > 0
83 * > y where x is returned for Address One > Address Two y is returned for
84 * Address One < Address Two 0 is returned ofr Address One = Address Two
86 static s32 sci_sas_address_compare(
87 struct sci_sas_address address_one,
88 struct sci_sas_address address_two)
90 if (address_one.high > address_two.high) {
92 } else if (address_one.high < address_two.high) {
94 } else if (address_one.low > address_two.low) {
96 } else if (address_one.low < address_two.low) {
100 /* The two SAS Address must be identical */
106 * @controller: The controller object used for the port search.
107 * @phy: The phy object to match.
109 * This routine will find a matching port for the phy. This means that the
110 * port and phy both have the same broadcast sas address and same received sas
111 * address. The port address or the NULL if there is no matching
112 * port. port address if the port can be found to match the phy.
113 * NULL if there is no matching port for the phy.
115 static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
116 struct scic_sds_controller *scic,
117 struct isci_phy *iphy)
120 struct sci_sas_address port_sas_address;
121 struct sci_sas_address port_attached_device_address;
122 struct sci_sas_address phy_sas_address;
123 struct sci_sas_address phy_attached_device_address;
126 * Since this phy can be a member of a wide port check to see if one or
127 * more phys match the sent and received SAS address as this phy in which
128 * case it should participate in the same port.
130 scic_sds_phy_get_sas_address(iphy, &phy_sas_address);
131 scic_sds_phy_get_attached_sas_address(iphy, &phy_attached_device_address);
133 for (i = 0; i < scic->logical_port_entries; i++) {
134 struct isci_host *ihost = scic_to_ihost(scic);
135 struct scic_sds_port *sci_port = &ihost->ports[i].sci;
137 scic_sds_port_get_sas_address(sci_port, &port_sas_address);
138 scic_sds_port_get_attached_sas_address(sci_port, &port_attached_device_address);
140 if (sci_sas_address_compare(port_sas_address, phy_sas_address) == 0 &&
141 sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0)
150 * @controller: This is the controller object that contains the port agent
151 * @port_agent: This is the port configruation agent for the controller.
153 * This routine will validate the port configuration is correct for the SCU
154 * hardware. The SCU hardware allows for port configurations as follows. LP0
155 * -> (PE0), (PE0, PE1), (PE0, PE1, PE2, PE3) LP1 -> (PE1) LP2 -> (PE2), (PE2,
156 * PE3) LP3 -> (PE3) enum sci_status SCI_SUCCESS the port configuration is valid for
157 * this port configuration agent. SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION
158 * the port configuration is not valid for this port configuration agent.
160 static enum sci_status scic_sds_port_configuration_agent_validate_ports(
161 struct scic_sds_controller *controller,
162 struct scic_sds_port_configuration_agent *port_agent)
164 struct isci_host *ihost = scic_to_ihost(controller);
165 struct sci_sas_address first_address;
166 struct sci_sas_address second_address;
169 * Sanity check the max ranges for all the phys the max index
170 * is always equal to the port range index */
171 if (port_agent->phy_valid_port_range[0].max_index != 0 ||
172 port_agent->phy_valid_port_range[1].max_index != 1 ||
173 port_agent->phy_valid_port_range[2].max_index != 2 ||
174 port_agent->phy_valid_port_range[3].max_index != 3)
175 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
178 * This is a request to configure a single x4 port or at least attempt
179 * to make all the phys into a single port */
180 if (port_agent->phy_valid_port_range[0].min_index == 0 &&
181 port_agent->phy_valid_port_range[1].min_index == 0 &&
182 port_agent->phy_valid_port_range[2].min_index == 0 &&
183 port_agent->phy_valid_port_range[3].min_index == 0)
187 * This is a degenerate case where phy 1 and phy 2 are assigned
188 * to the same port this is explicitly disallowed by the hardware
189 * unless they are part of the same x4 port and this condition was
190 * already checked above. */
191 if (port_agent->phy_valid_port_range[2].min_index == 1) {
192 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
196 * PE0 and PE3 can never have the same SAS Address unless they
197 * are part of the same x4 wide port and we have already checked
198 * for this condition. */
199 scic_sds_phy_get_sas_address(&ihost->phys[0], &first_address);
200 scic_sds_phy_get_sas_address(&ihost->phys[3], &second_address);
202 if (sci_sas_address_compare(first_address, second_address) == 0) {
203 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
207 * PE0 and PE1 are configured into a 2x1 ports make sure that the
208 * SAS Address for PE0 and PE2 are different since they can not be
209 * part of the same port. */
210 if (port_agent->phy_valid_port_range[0].min_index == 0 &&
211 port_agent->phy_valid_port_range[1].min_index == 1) {
212 scic_sds_phy_get_sas_address(&ihost->phys[0], &first_address);
213 scic_sds_phy_get_sas_address(&ihost->phys[2], &second_address);
215 if (sci_sas_address_compare(first_address, second_address) == 0) {
216 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
221 * PE2 and PE3 are configured into a 2x1 ports make sure that the
222 * SAS Address for PE1 and PE3 are different since they can not be
223 * part of the same port. */
224 if (port_agent->phy_valid_port_range[2].min_index == 2 &&
225 port_agent->phy_valid_port_range[3].min_index == 3) {
226 scic_sds_phy_get_sas_address(&ihost->phys[1], &first_address);
227 scic_sds_phy_get_sas_address(&ihost->phys[3], &second_address);
229 if (sci_sas_address_compare(first_address, second_address) == 0) {
230 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
238 * ******************************************************************************
239 * Manual port configuration agent routines
240 * ****************************************************************************** */
245 * This routine will verify that all of the phys in the same port are using the
248 static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
249 struct scic_sds_controller *controller,
250 struct scic_sds_port_configuration_agent *port_agent)
252 struct isci_host *ihost = scic_to_ihost(controller);
254 u32 assigned_phy_mask;
255 struct sci_sas_address sas_address;
256 struct sci_sas_address phy_assigned_address;
260 assigned_phy_mask = 0;
261 sas_address.high = 0;
264 for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) {
265 phy_mask = controller->oem_parameters.sds1.ports[port_index].phy_mask;
270 * Make sure that one or more of the phys were not already assinged to
271 * a different port. */
272 if ((phy_mask & ~assigned_phy_mask) == 0) {
273 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
276 /* Find the starting phy index for this round through the loop */
277 for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) {
278 if ((phy_mask & (1 << phy_index)) == 0)
280 scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
284 * The phy_index can be used as the starting point for the
285 * port range since the hardware starts all logical ports
286 * the same as the PE index. */
287 port_agent->phy_valid_port_range[phy_index].min_index = port_index;
288 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
290 if (phy_index != port_index) {
291 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
298 * See how many additional phys are being added to this logical port.
299 * Note: We have not moved the current phy_index so we will actually
300 * compare the startting phy with itself.
301 * This is expected and required to add the phy to the port. */
302 while (phy_index < SCI_MAX_PHYS) {
303 if ((phy_mask & (1 << phy_index)) == 0)
305 scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
306 &phy_assigned_address);
308 if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) {
310 * The phy mask specified that this phy is part of the same port
311 * as the starting phy and it is not so fail this configuration */
312 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
315 port_agent->phy_valid_port_range[phy_index].min_index = port_index;
316 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
318 scic_sds_port_add_phy(&ihost->ports[port_index].sci,
319 &ihost->phys[phy_index]);
321 assigned_phy_mask |= (1 << phy_index);
327 return scic_sds_port_configuration_agent_validate_ports(controller, port_agent);
330 static void mpc_agent_timeout(unsigned long data)
333 struct sci_timer *tmr = (struct sci_timer *)data;
334 struct scic_sds_port_configuration_agent *port_agent;
335 struct scic_sds_controller *scic;
336 struct isci_host *ihost;
338 u16 configure_phy_mask;
340 port_agent = container_of(tmr, typeof(*port_agent), timer);
341 scic = container_of(port_agent, typeof(*scic), port_agent);
342 ihost = scic_to_ihost(scic);
344 spin_lock_irqsave(&ihost->scic_lock, flags);
349 port_agent->timer_pending = false;
351 /* Find the mask of phys that are reported read but as yet unconfigured into a port */
352 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask;
354 for (index = 0; index < SCI_MAX_PHYS; index++) {
355 struct isci_phy *iphy = &ihost->phys[index];
357 if (configure_phy_mask & (1 << index)) {
358 port_agent->link_up_handler(scic, port_agent,
359 phy_get_non_dummy_port(iphy),
365 spin_unlock_irqrestore(&ihost->scic_lock, flags);
368 static void scic_sds_mpc_agent_link_up(struct scic_sds_controller *controller,
369 struct scic_sds_port_configuration_agent *port_agent,
370 struct scic_sds_port *port,
371 struct isci_phy *iphy)
373 /* If the port has an invalid handle then the phy was not assigned to
374 * a port. This is because the phy was not given the same SAS Address
375 * as the other PHYs in the port.
378 port_agent->phy_ready_mask |= (1 << scic_sds_phy_get_index(iphy));
380 scic_sds_port_link_up(port, iphy);
382 if ((port->active_phy_mask & (1 << scic_sds_phy_get_index(iphy))) != 0) {
383 port_agent->phy_configured_mask |= (1 << scic_sds_phy_get_index(iphy));
390 * @controller: This is the controller object that receives the link down
392 * @port: This is the port object associated with the phy. If the is no
393 * associated port this is an NULL. The port is an invalid
394 * handle only if the phy was never port of this port. This happens when
395 * the phy is not broadcasting the same SAS address as the other phys in the
397 * @phy: This is the phy object which has gone link down.
399 * This function handles the manual port configuration link down notifications.
400 * Since all ports and phys are associated at initialization time we just turn
401 * around and notifiy the port object of the link down event. If this PHY is
402 * not associated with a port there is no action taken. Is it possible to get a
403 * link down notification from a phy that has no assocoated port?
405 static void scic_sds_mpc_agent_link_down(
406 struct scic_sds_controller *scic,
407 struct scic_sds_port_configuration_agent *port_agent,
408 struct scic_sds_port *sci_port,
409 struct isci_phy *iphy)
411 if (sci_port != NULL) {
413 * If we can form a new port from the remainder of the phys
414 * then we want to start the timer to allow the SCI User to
415 * cleanup old devices and rediscover the port before
416 * rebuilding the port with the phys that remain in the ready
419 port_agent->phy_ready_mask &=
420 ~(1 << scic_sds_phy_get_index(iphy));
421 port_agent->phy_configured_mask &=
422 ~(1 << scic_sds_phy_get_index(iphy));
425 * Check to see if there are more phys waiting to be
426 * configured into a port. If there are allow the SCI User
427 * to tear down this port, if necessary, and then reconstruct
428 * the port after the timeout.
430 if ((port_agent->phy_configured_mask == 0x0000) &&
431 (port_agent->phy_ready_mask != 0x0000) &&
432 !port_agent->timer_pending) {
433 port_agent->timer_pending = true;
435 sci_mod_timer(&port_agent->timer,
436 SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT);
439 scic_sds_port_link_down(sci_port, iphy);
444 * ******************************************************************************
445 * Automatic port configuration agent routines
446 * ****************************************************************************** */
451 * This routine will verify that the phys are assigned a valid SAS address for
452 * automatic port configuration mode.
454 static enum sci_status scic_sds_apc_agent_validate_phy_configuration(
455 struct scic_sds_controller *controller,
456 struct scic_sds_port_configuration_agent *port_agent)
460 struct sci_sas_address sas_address;
461 struct sci_sas_address phy_assigned_address;
462 struct isci_host *ihost = scic_to_ihost(controller);
466 while (phy_index < SCI_MAX_PHYS) {
467 port_index = phy_index;
469 /* Get the assigned SAS Address for the first PHY on the controller. */
470 scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
473 while (++phy_index < SCI_MAX_PHYS) {
474 scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
475 &phy_assigned_address);
477 /* Verify each of the SAS address are all the same for every PHY */
478 if (sci_sas_address_compare(sas_address, phy_assigned_address) == 0) {
479 port_agent->phy_valid_port_range[phy_index].min_index = port_index;
480 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
482 port_agent->phy_valid_port_range[phy_index].min_index = phy_index;
483 port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
489 return scic_sds_port_configuration_agent_validate_ports(controller, port_agent);
492 static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *controller,
493 struct scic_sds_port_configuration_agent *port_agent,
494 struct isci_phy *iphy,
498 enum sci_status status;
499 struct scic_sds_port *port;
500 enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY;
501 struct isci_host *ihost = scic_to_ihost(controller);
503 port = scic_sds_port_configuration_agent_find_port(controller, iphy);
506 if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index))
507 apc_activity = SCIC_SDS_APC_ADD_PHY;
509 apc_activity = SCIC_SDS_APC_SKIP_PHY;
512 * There is no matching Port for this PHY so lets search through the
513 * Ports and see if we can add the PHY to its own port or maybe start
514 * the timer and wait to see if a wider port can be made.
516 * Note the break when we reach the condition of the port id == phy id */
518 port_index = port_agent->phy_valid_port_range[iphy->phy_index].min_index;
519 port_index <= port_agent->phy_valid_port_range[iphy->phy_index].max_index;
523 port = &ihost->ports[port_index].sci;
525 /* First we must make sure that this PHY can be added to this Port. */
526 if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index)) {
528 * Port contains a PHY with a greater PHY ID than the current
529 * PHY that has gone link up. This phy can not be part of any
530 * port so skip it and move on. */
531 if (port->active_phy_mask > (1 << iphy->phy_index)) {
532 apc_activity = SCIC_SDS_APC_SKIP_PHY;
537 * We have reached the end of our Port list and have not found
538 * any reason why we should not either add the PHY to the port
539 * or wait for more phys to become active. */
540 if (port->physical_port_index == iphy->phy_index) {
542 * The Port either has no active PHYs.
543 * Consider that if the port had any active PHYs we would have
544 * or active PHYs with
545 * a lower PHY Id than this PHY. */
546 if (apc_activity != SCIC_SDS_APC_START_TIMER) {
547 apc_activity = SCIC_SDS_APC_ADD_PHY;
554 * The current Port has no active PHYs and this PHY could be part
555 * of this Port. Since we dont know as yet setup to start the
556 * timer and see if there is a better configuration. */
557 if (port->active_phy_mask == 0) {
558 apc_activity = SCIC_SDS_APC_START_TIMER;
560 } else if (port->active_phy_mask != 0) {
562 * The Port has an active phy and the current Phy can not
563 * participate in this port so skip the PHY and see if
564 * there is a better configuration. */
565 apc_activity = SCIC_SDS_APC_SKIP_PHY;
571 * Check to see if the start timer operations should instead map to an
572 * add phy operation. This is caused because we have been waiting to
573 * add a phy to a port but could not becuase the automatic port
574 * configuration engine had a choice of possible ports for the phy.
575 * Since we have gone through a timeout we are going to restrict the
576 * choice to the smallest possible port. */
578 (start_timer == false)
579 && (apc_activity == SCIC_SDS_APC_START_TIMER)
581 apc_activity = SCIC_SDS_APC_ADD_PHY;
584 switch (apc_activity) {
585 case SCIC_SDS_APC_ADD_PHY:
586 status = scic_sds_port_add_phy(port, iphy);
588 if (status == SCI_SUCCESS) {
589 port_agent->phy_configured_mask |= (1 << iphy->phy_index);
593 case SCIC_SDS_APC_START_TIMER:
595 * This can occur for either a link down event, or a link
596 * up event where we cannot yet tell the port to which a
599 if (port_agent->timer_pending)
600 sci_del_timer(&port_agent->timer);
602 port_agent->timer_pending = true;
603 sci_mod_timer(&port_agent->timer,
604 SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION);
607 case SCIC_SDS_APC_SKIP_PHY:
609 /* do nothing the PHY can not be made part of a port at this time. */
615 * scic_sds_apc_agent_link_up - handle apc link up events
616 * @scic: This is the controller object that receives the link up
618 * @sci_port: This is the port object associated with the phy. If the is no
619 * associated port this is an NULL.
620 * @sci_phy: This is the phy object which has gone link up.
622 * This method handles the automatic port configuration for link up
623 * notifications. Is it possible to get a link down notification from a phy
624 * that has no assocoated port?
626 static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
627 struct scic_sds_port_configuration_agent *port_agent,
628 struct scic_sds_port *sci_port,
629 struct isci_phy *iphy)
631 u8 phy_index = iphy->phy_index;
634 /* the phy is not the part of this port */
635 port_agent->phy_ready_mask |= 1 << phy_index;
636 scic_sds_apc_agent_configure_ports(scic, port_agent, iphy, true);
638 /* the phy is already the part of the port */
639 u32 port_state = sci_port->sm.current_state_id;
641 /* if the PORT'S state is resetting then the link up is from
642 * port hard reset in this case, we need to tell the port
643 * that link up is recieved
645 BUG_ON(port_state != SCI_PORT_RESETTING);
646 port_agent->phy_ready_mask |= 1 << phy_index;
647 scic_sds_port_link_up(sci_port, iphy);
653 * @controller: This is the controller object that receives the link down
655 * @port: This is the port object associated with the phy. If the is no
656 * associated port this is an NULL.
657 * @phy: This is the phy object which has gone link down.
659 * This method handles the automatic port configuration link down
660 * notifications. not associated with a port there is no action taken. Is it
661 * possible to get a link down notification from a phy that has no assocoated
664 static void scic_sds_apc_agent_link_down(
665 struct scic_sds_controller *controller,
666 struct scic_sds_port_configuration_agent *port_agent,
667 struct scic_sds_port *port,
668 struct isci_phy *iphy)
670 port_agent->phy_ready_mask &= ~(1 << scic_sds_phy_get_index(iphy));
673 if (port_agent->phy_configured_mask & (1 << iphy->phy_index)) {
674 enum sci_status status;
676 status = scic_sds_port_remove_phy(port, iphy);
678 if (status == SCI_SUCCESS) {
679 port_agent->phy_configured_mask &= ~(1 << iphy->phy_index);
685 /* configure the phys into ports when the timer fires */
686 static void apc_agent_timeout(unsigned long data)
689 struct sci_timer *tmr = (struct sci_timer *)data;
690 struct scic_sds_port_configuration_agent *port_agent;
691 struct scic_sds_controller *scic;
692 struct isci_host *ihost;
694 u16 configure_phy_mask;
696 port_agent = container_of(tmr, typeof(*port_agent), timer);
697 scic = container_of(port_agent, typeof(*scic), port_agent);
698 ihost = scic_to_ihost(scic);
700 spin_lock_irqsave(&ihost->scic_lock, flags);
705 port_agent->timer_pending = false;
707 configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask;
709 if (!configure_phy_mask)
712 for (index = 0; index < SCI_MAX_PHYS; index++) {
713 if ((configure_phy_mask & (1 << index)) == 0)
716 scic_sds_apc_agent_configure_ports(scic, port_agent,
717 &ihost->phys[index], false);
721 spin_unlock_irqrestore(&ihost->scic_lock, flags);
725 * ******************************************************************************
726 * Public port configuration agent routines
727 * ****************************************************************************** */
732 * This method will construct the port configuration agent for operation. This
733 * call is universal for both manual port configuration and automatic port
734 * configuration modes.
736 void scic_sds_port_configuration_agent_construct(
737 struct scic_sds_port_configuration_agent *port_agent)
741 port_agent->phy_configured_mask = 0x00;
742 port_agent->phy_ready_mask = 0x00;
744 port_agent->link_up_handler = NULL;
745 port_agent->link_down_handler = NULL;
747 port_agent->timer_pending = false;
749 for (index = 0; index < SCI_MAX_PORTS; index++) {
750 port_agent->phy_valid_port_range[index].min_index = 0;
751 port_agent->phy_valid_port_range[index].max_index = 0;
755 enum sci_status scic_sds_port_configuration_agent_initialize(
756 struct scic_sds_controller *scic,
757 struct scic_sds_port_configuration_agent *port_agent)
759 enum sci_status status;
760 enum scic_port_configuration_mode mode;
762 mode = scic->oem_parameters.sds1.controller.mode_type;
764 if (mode == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
765 status = scic_sds_mpc_agent_validate_phy_configuration(
768 port_agent->link_up_handler = scic_sds_mpc_agent_link_up;
769 port_agent->link_down_handler = scic_sds_mpc_agent_link_down;
771 sci_init_timer(&port_agent->timer, mpc_agent_timeout);
773 status = scic_sds_apc_agent_validate_phy_configuration(
776 port_agent->link_up_handler = scic_sds_apc_agent_link_up;
777 port_agent->link_down_handler = scic_sds_apc_agent_link_down;
779 sci_init_timer(&port_agent->timer, apc_agent_timeout);