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 (1000)
86 static s32 sci_sas_address_compare(
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) {
115 static struct isci_port *sci_port_configuration_agent_find_port(
139 if (sci_sas_address_compare(port_sas_address, phy_sas_address) == 0 &&
140 sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0)
159 static enum sci_status sci_port_configuration_agent_validate_ports(
200 if (sci_sas_address_compare(first_address, second_address) == 0) {
213 if (sci_sas_address_compare(first_address, second_address) == 0) {
227 if (sci_sas_address_compare(first_address, second_address) == 0) {
242 sci_mpc_agent_validate_phy_configuration(
struct isci_host *ihost,
246 u32 assigned_phy_mask;
252 assigned_phy_mask = 0;
253 sas_address.
high = 0;
256 for (port_index = 0; port_index <
SCI_MAX_PORTS; port_index++) {
264 if ((phy_mask & ~assigned_phy_mask) == 0) {
269 for (phy_index = 0; phy_index <
SCI_MAX_PHYS; phy_index++) {
270 if ((phy_mask & (1 << phy_index)) == 0)
282 if (phy_index != port_index) {
294 while (phy_index < SCI_MAX_PHYS) {
295 if ((phy_mask & (1 << phy_index)) == 0)
298 &phy_assigned_address);
300 if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) {
311 &ihost->
phys[phy_index]);
313 assigned_phy_mask |= (1 << phy_index);
319 return sci_port_configuration_agent_validate_ports(ihost, port_agent);
322 static void mpc_agent_timeout(
unsigned long data)
329 u16 configure_phy_mask;
347 if (configure_phy_mask & (1 << index)) {
355 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
358 static void sci_mpc_agent_link_up(
struct isci_host *ihost,
393 static void sci_mpc_agent_link_down(
421 sci_mod_timer(&port_agent->
timer,
433 sci_apc_agent_validate_phy_configuration(
struct isci_host *ihost,
443 while (phy_index < SCI_MAX_PHYS) {
444 port_index = phy_index;
450 while (++phy_index < SCI_MAX_PHYS) {
452 &phy_assigned_address);
455 if (sci_sas_address_compare(sas_address, phy_assigned_address) == 0) {
466 return sci_port_configuration_agent_validate_ports(ihost, port_agent);
479 sci_mod_timer(&port_agent->
timer, timeout);
482 static void sci_apc_agent_configure_ports(
struct isci_host *ihost,
492 iport = sci_port_configuration_agent_find_port(ihost, iphy);
507 port_index <= port_agent->phy_valid_port_range[iphy->
phy_index].max_index;
510 iport = &ihost->
ports[port_index];
565 (start_timer ==
false)
571 switch (apc_activity) {
581 sci_apc_agent_start_timer(port_agent,
604 static void sci_apc_agent_link_up(
struct isci_host *ihost,
614 sci_apc_agent_start_timer(port_agent,
624 BUG_ON(port_state != SCI_PORT_RESETTING);
643 static void sci_apc_agent_link_down(
664 static void apc_agent_timeout(
unsigned long data)
671 u16 configure_phy_mask;
685 if (!configure_phy_mask)
689 if ((configure_phy_mask & (1 << index)) == 0)
692 sci_apc_agent_configure_ports(ihost, port_agent,
693 &ihost->
phys[index],
false);
700 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
736 return ihost->
port_agent.link_up_handler == sci_apc_agent_link_up;
749 status = sci_mpc_agent_validate_phy_configuration(
755 sci_init_timer(&port_agent->
timer, mpc_agent_timeout);
757 status = sci_apc_agent_validate_phy_configuration(
763 sci_init_timer(&port_agent->
timer, apc_agent_timeout);