Lines Matching +full:port +full:- +full:phys
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
57 #include "port.h"
75 int i = iport->physical_port_index; in sciport_to_dev()
82 table = iport - i; in sciport_to_dev()
85 return &ihost->pdev->dev; in sciport_to_dev()
92 proto->all = 0; in sci_port_get_protocols()
94 struct isci_phy *iphy = iport->phy_table[index]; in sci_port_get_protocols()
109 if (iport->phy_table[index]) in sci_port_get_phys()
116 * sci_port_get_properties() - This method simply returns the properties
117 * regarding the port, such as: physical index, protocols, sas address, etc.
118 * @port: this parameter specifies the port for which to retrieve the physical
123 * Indicate if the user specified a valid port. SCI_SUCCESS This value is
124 * returned if the specified port was valid. SCI_FAILURE_INVALID_PORT This
125 * value is returned if the specified port is not valid. When this value is
131 if (!iport || iport->logical_port_index == SCIC_SDS_DUMMY_PORT) in sci_port_get_properties()
134 prop->index = iport->logical_port_index; in sci_port_get_properties()
135 prop->phy_mask = sci_port_get_phys(iport); in sci_port_get_properties()
136 sci_port_get_sas_address(iport, &prop->local.sas_address); in sci_port_get_properties()
137 sci_port_get_protocols(iport, &prop->local.protocols); in sci_port_get_properties()
138 sci_port_get_attached_sas_address(iport, &prop->remote.sas_address); in sci_port_get_properties()
149 for (i = 0; i < ARRAY_SIZE(iport->phy_table); i++) { in sci_port_bcn_enable()
150 iphy = iport->phy_table[i]; in sci_port_bcn_enable()
153 val = readl(&iphy->link_layer_registers->link_layer_control); in sci_port_bcn_enable()
155 writel(val, &iphy->link_layer_registers->link_layer_control); in sci_port_bcn_enable()
163 dev_dbg(&ihost->pdev->dev, in isci_port_bc_change_received()
165 __func__, iphy, &iphy->sas_phy); in isci_port_bc_change_received()
167 sas_notify_port_event_gfp(&iphy->sas_phy, in isci_port_bc_change_received()
180 dev_dbg(&isci_host->pdev->dev, in isci_port_link_up()
184 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); in isci_port_link_up()
188 if (iphy->protocol == SAS_PROTOCOL_SATA) { in isci_port_link_up()
191 iphy->sas_phy.oob_mode = SATA_OOB_MODE; in isci_port_link_up()
192 iphy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis); in isci_port_link_up()
195 * For direct-attached SATA devices, the SCI core will in isci_port_link_up()
197 * for the purpose of creating a port. This SAS address in isci_port_link_up()
206 memcpy(&iphy->sas_phy.attached_sas_addr, in isci_port_link_up()
208 } else if (iphy->protocol == SAS_PROTOCOL_SSP) { in isci_port_link_up()
209 iphy->sas_phy.oob_mode = SAS_OOB_MODE; in isci_port_link_up()
210 iphy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame); in isci_port_link_up()
213 memcpy(iphy->sas_phy.attached_sas_addr, in isci_port_link_up()
214 iphy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE); in isci_port_link_up()
216 dev_err(&isci_host->pdev->dev, "%s: unknown target\n", __func__); in isci_port_link_up()
220 iphy->sas_phy.phy->negotiated_linkrate = sci_phy_linkrate(iphy); in isci_port_link_up()
222 spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); in isci_port_link_up()
227 sas_notify_port_event_gfp(&iphy->sas_phy, in isci_port_link_up()
233 * isci_port_link_down() - This function is called by the sci core when a link
237 * @port: This parameter specifies the isci port with the active link.
246 dev_dbg(&isci_host->pdev->dev, in isci_port_link_down()
251 /* check to see if this is the last phy on this port. */ in isci_port_link_down()
252 if (isci_phy->sas_phy.port && in isci_port_link_down()
253 isci_phy->sas_phy.port->num_phys == 1) { in isci_port_link_down()
254 /* change the state for all devices on this port. The in isci_port_link_down()
260 &isci_port->remote_dev_list, in isci_port_link_down()
262 dev_dbg(&isci_host->pdev->dev, in isci_port_link_down()
265 set_bit(IDEV_GONE, &isci_device->flags); in isci_port_link_down()
273 sas_phy_disconnected(&isci_phy->sas_phy); in isci_port_link_down()
274 sas_notify_phy_event_gfp(&isci_phy->sas_phy, in isci_port_link_down()
277 dev_dbg(&isci_host->pdev->dev, in isci_port_link_down()
278 "%s: isci_port = %p - Done\n", __func__, isci_port); in isci_port_link_down()
298 struct sci_base_state_machine *sm = &iport->sm; in port_state_machine_change()
299 enum sci_port_states old_state = sm->current_state_id; in port_state_machine_change()
302 iport->ready_exit = true; in port_state_machine_change()
305 iport->ready_exit = false; in port_state_machine_change()
309 * isci_port_hard_reset_complete() - This function is called by the sci core
311 * @port: This parameter specifies the sci port with the active link.
319 struct isci_host *ihost = isci_port->owning_controller; in isci_port_hard_reset_complete()
321 dev_dbg(&ihost->pdev->dev, in isci_port_hard_reset_complete()
325 /* Save the status of the hard reset from the port. */ in isci_port_hard_reset_complete()
326 isci_port->hard_reset_status = completion_status; in isci_port_hard_reset_complete()
330 /* The reset failed. The port state is now SCI_PORT_FAILED. */ in isci_port_hard_reset_complete()
331 if (isci_port->active_phy_mask == 0) { in isci_port_hard_reset_complete()
332 int phy_idx = isci_port->last_active_phy; in isci_port_hard_reset_complete()
333 struct isci_phy *iphy = &ihost->phys[phy_idx]; in isci_port_hard_reset_complete()
341 /* Advance the port state so that link state changes will be in isci_port_hard_reset_complete()
347 clear_bit(IPORT_RESET_PENDING, &isci_port->state); in isci_port_hard_reset_complete()
348 wake_up(&ihost->eventq); in isci_port_hard_reset_complete()
353 * this port The following is a list of phys for each port that are allowed: -
354 * Port 0 - 3 2 1 0 - Port 1 - 1 - Port 2 - 3 2 - Port 3 - 3 This method
356 * of the allowable set of phy identifiers for that port. For example, one
357 * could assign phy 3 to port 0 and no other phys. Please refer to
359 * phy_mask for a port can be supported. bool true if this is a valid phy
360 * assignment for the port false if this is not a valid phy assignment for the
361 * port
365 struct isci_host *ihost = iport->owning_controller; in sci_port_is_valid_phy_assignment()
366 struct sci_user_parameters *user = &ihost->user_parameters; in sci_port_is_valid_phy_assignment()
372 if ((iport->physical_port_index == 1) && (phy_index != 1)) in sci_port_is_valid_phy_assignment()
375 if (iport->physical_port_index == 3 && phy_index != 3) in sci_port_is_valid_phy_assignment()
378 if (iport->physical_port_index == 2 && in sci_port_is_valid_phy_assignment()
383 if (iport->phy_table[index] && index != phy_index) in sci_port_is_valid_phy_assignment()
386 /* Ensure that all of the phys in the port are capable of in sci_port_is_valid_phy_assignment()
390 user->phys[phy_index].max_speed_generation != in sci_port_is_valid_phy_assignment()
391 user->phys[existing_phy_index].max_speed_generation) in sci_port_is_valid_phy_assignment()
399 * @sci_port: This is the port object for which to determine if the phy mask
402 * This method will return a true value if the port's phy mask can be supported
404 * each port: - Port 0 - [[3 2] 1] 0 - Port 1 - [1] - Port 2 - [[3] 2]
405 * - Port 3 - [3] This method returns a boolean indication specifying if the
407 * port false if this is not a valid phy assignment for the port
413 if (iport->physical_port_index == 0) { in sci_port_is_phy_mask_valid()
419 } else if (iport->physical_port_index == 1) { in sci_port_is_phy_mask_valid()
423 } else if (iport->physical_port_index == 2) { in sci_port_is_phy_mask_valid()
428 } else if (iport->physical_port_index == 3) { in sci_port_is_phy_mask_valid()
439 * the port. Currently, the lowest order phy that is connected is returned.
442 * point) phys contained in the port. All other values specify a struct sci_phy
443 * object that is active in the port.
451 /* Ensure that the phy is both part of the port and currently in sci_port_get_a_connected_phy()
452 * connected to the remote end-point. in sci_port_get_a_connected_phy()
454 iphy = iport->phy_table[index]; in sci_port_get_a_connected_phy()
464 /* Check to see if we can add this phy to a port in sci_port_set_phy()
465 * that means that the phy is not part of a port and that the port does in sci_port_set_phy()
468 if (!iport->phy_table[iphy->phy_index] && in sci_port_set_phy()
470 sci_port_is_valid_phy_assignment(iport, iphy->phy_index)) { in sci_port_set_phy()
472 * make logical port index = physical port index in sci_port_set_phy()
474 iport->logical_port_index = iport->physical_port_index; in sci_port_set_phy()
475 iport->phy_table[iphy->phy_index] = iphy; in sci_port_set_phy()
486 /* Make sure that this phy is part of this port */ in sci_port_clear_phy()
487 if (iport->phy_table[iphy->phy_index] == iphy && in sci_port_clear_phy()
489 struct isci_host *ihost = iport->owning_controller; in sci_port_clear_phy()
491 /* Yep it is assigned to this port so remove it */ in sci_port_clear_phy()
492 sci_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); in sci_port_clear_phy()
493 iport->phy_table[iphy->phy_index] = NULL; in sci_port_clear_phy()
504 sas->high = 0; in sci_port_get_sas_address()
505 sas->low = 0; in sci_port_get_sas_address()
507 if (iport->phy_table[index]) in sci_port_get_sas_address()
508 sci_phy_get_sas_address(iport->phy_table[index], sas); in sci_port_get_sas_address()
516 * Ensure that the phy is both part of the port and currently in sci_port_get_attached_sas_address()
517 * connected to the remote end-point. in sci_port_get_attached_sas_address()
521 if (iphy->protocol != SAS_PROTOCOL_SATA) { in sci_port_get_attached_sas_address()
525 sas->low += iphy->phy_index; in sci_port_get_attached_sas_address()
528 sas->high = 0; in sci_port_get_attached_sas_address()
529 sas->low = 0; in sci_port_get_attached_sas_address()
534 * sci_port_construct_dummy_rnc() - create dummy rnc for si workaround
536 * @sci_port: logical port on which we need to create the remote node context
547 rnc = &iport->owning_controller->remote_node_context_table[rni]; in sci_port_construct_dummy_rnc()
551 rnc->ssp.remote_sas_address_hi = 0; in sci_port_construct_dummy_rnc()
552 rnc->ssp.remote_sas_address_lo = 0; in sci_port_construct_dummy_rnc()
554 rnc->ssp.remote_node_index = rni; in sci_port_construct_dummy_rnc()
555 rnc->ssp.remote_node_port_width = 1; in sci_port_construct_dummy_rnc()
556 rnc->ssp.logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_rnc()
558 rnc->ssp.nexus_loss_timer_enable = false; in sci_port_construct_dummy_rnc()
559 rnc->ssp.check_bit = false; in sci_port_construct_dummy_rnc()
560 rnc->ssp.is_valid = true; in sci_port_construct_dummy_rnc()
561 rnc->ssp.is_remote_node_context = true; in sci_port_construct_dummy_rnc()
562 rnc->ssp.function_number = 0; in sci_port_construct_dummy_rnc()
563 rnc->ssp.arbitration_wait_time = 0; in sci_port_construct_dummy_rnc()
573 struct isci_host *ihost = iport->owning_controller; in sci_port_construct_dummy_task()
576 task_context = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_construct_dummy_task()
579 task_context->initiator_request = 1; in sci_port_construct_dummy_task()
580 task_context->connection_rate = 1; in sci_port_construct_dummy_task()
581 task_context->logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_task()
582 task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; in sci_port_construct_dummy_task()
583 task_context->task_index = ISCI_TAG_TCI(tag); in sci_port_construct_dummy_task()
584 task_context->valid = SCU_TASK_CONTEXT_VALID; in sci_port_construct_dummy_task()
585 task_context->context_type = SCU_TASK_CONTEXT_TYPE; in sci_port_construct_dummy_task()
586 task_context->remote_node_index = iport->reserved_rni; in sci_port_construct_dummy_task()
587 task_context->do_not_dma_ssp_good_response = 1; in sci_port_construct_dummy_task()
588 task_context->task_phase = 0x01; in sci_port_construct_dummy_task()
593 struct isci_host *ihost = iport->owning_controller; in sci_port_destroy_dummy_resources()
595 if (iport->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) in sci_port_destroy_dummy_resources()
596 isci_free_tag(ihost, iport->reserved_tag); in sci_port_destroy_dummy_resources()
598 if (iport->reserved_rni != SCU_DUMMY_INDEX) in sci_port_destroy_dummy_resources()
599 sci_remote_node_table_release_remote_node_index(&ihost->available_remote_nodes, in sci_port_destroy_dummy_resources()
600 1, iport->reserved_rni); in sci_port_destroy_dummy_resources()
602 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_destroy_dummy_resources()
603 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_destroy_dummy_resources()
611 if (iport->active_phy_mask & (1 << index)) in sci_port_setup_transports()
612 sci_phy_setup_transport(iport->phy_table[index], device_id); in sci_port_setup_transports()
619 iport->enabled_phy_mask |= 1 << iphy->phy_index; in sci_port_resume_phy()
626 struct isci_host *ihost = iport->owning_controller; in sci_port_activate_phy()
628 if (iphy->protocol != SAS_PROTOCOL_SATA && (flags & PF_RESUME)) in sci_port_activate_phy()
631 iport->active_phy_mask |= 1 << iphy->phy_index; in sci_port_activate_phy()
642 struct isci_host *ihost = iport->owning_controller; in sci_port_deactivate_phy()
644 iport->active_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
645 iport->enabled_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
646 if (!iport->active_phy_mask) in sci_port_deactivate_phy()
647 iport->last_active_phy = iphy->phy_index; in sci_port_deactivate_phy()
649 iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; in sci_port_deactivate_phy()
651 /* Re-assign the phy back to the LP as if it were a narrow port for APC in sci_port_deactivate_phy()
652 * mode. For MPC mode, the phy will remain in the port. in sci_port_deactivate_phy()
654 if (iport->owning_controller->oem_parameters.controller.mode_type == in sci_port_deactivate_phy()
656 writel(iphy->phy_index, in sci_port_deactivate_phy()
657 &iport->port_pe_configuration_register[iphy->phy_index]); in sci_port_deactivate_phy()
665 struct isci_host *ihost = iport->owning_controller; in sci_port_invalid_link_up()
672 if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { in sci_port_invalid_link_up()
673 ihost->invalid_phy_mask |= 1 << iphy->phy_index; in sci_port_invalid_link_up()
674 dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); in sci_port_invalid_link_up()
679 * sci_port_general_link_up_handler - phy can be assigned to port?
684 * Determine if this phy can be assigned to this port . If the phy is
685 * not a valid PHY for this port then the function will notify the user.
686 * A PHY can only be part of a port if it's attached SAS ADDRESS is the
687 * same as all other PHYs in the same port.
700 * other phys in the port OR this is the first phy in the port, in sci_port_general_link_up_handler()
702 * in this port. in sci_port_general_link_up_handler()
706 iport->active_phy_mask == 0) { in sci_port_general_link_up_handler()
707 struct sci_base_state_machine *sm = &iport->sm; in sci_port_general_link_up_handler()
710 if (sm->current_state_id == SCI_PORT_RESETTING) in sci_port_general_link_up_handler()
719 * This method returns false if the port only has a single phy object assigned.
720 * If there are no phys or more than one phy then the method will return
722 * @sci_port: The port for which the wide port condition is to be checked.
724 * bool true Is returned if this is a wide ported port. false Is returned if
725 * this is a narrow port.
733 if (iport->phy_table[index] != NULL) { in sci_port_is_wide()
743 * port wants the PHY to continue on to the link up state then the port
744 * layer must return true. If the port object returns false the phy object
746 * @sci_port: The port associated with the phy object.
752 * wide ports and direct attached phys. Since there are no wide ported SATA
753 * devices this could become an invalid port configuration.
757 if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && in sci_port_link_detected()
758 (iphy->protocol == SAS_PROTOCOL_SATA)) { in sci_port_link_detected()
763 struct isci_host *ihost = iport->owning_controller; in sci_port_link_detected()
764 struct isci_port *dst_port = &(ihost->ports[iphy->phy_index]); in sci_port_link_detected()
765 writel(iphy->phy_index, in sci_port_link_detected()
766 &dst_port->port_pe_configuration_register[iphy->phy_index]); in sci_port_link_detected()
777 struct isci_host *ihost = iport->owning_controller; in port_timeout()
781 spin_lock_irqsave(&ihost->scic_lock, flags); in port_timeout()
783 if (tmr->cancel) in port_timeout()
786 current_state = iport->sm.current_state_id; in port_timeout()
789 /* if the port is still in the resetting state then the timeout in port_timeout()
794 /* if the port is stopped then the start request failed In this in port_timeout()
798 "%s: SCIC Port 0x%p failed to stop before timeout.\n", in port_timeout()
803 "%s: port%d: stop complete timeout\n", in port_timeout()
804 __func__, iport->physical_port_index); in port_timeout()
806 /* The port is in the ready state and we have a timer in port_timeout()
810 "%s: SCIC Port 0x%p is processing a timeout operation " in port_timeout()
815 spin_unlock_irqrestore(&ihost->scic_lock, flags); in port_timeout()
818 /* --------------------------------------------------------------------------- */
821 * This function updates the hardwares VIIT entry for this port.
832 &iport->viit_registers->initiator_sas_address_hi); in sci_port_update_viit_entry()
834 &iport->viit_registers->initiator_sas_address_lo); in sci_port_update_viit_entry()
837 writel(0, &iport->viit_registers->reserved); in sci_port_update_viit_entry()
842 ((1 << iport->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | in sci_port_update_viit_entry()
844 &iport->viit_registers->status); in sci_port_update_viit_entry()
854 * Loop through all of the phys in this port and find the phy with the in sci_port_get_max_allowed_speed()
857 iphy = iport->phy_table[index]; in sci_port_get_max_allowed_speed()
859 iphy->max_negotiated_speed < max_allowed_speed) in sci_port_get_max_allowed_speed()
860 max_allowed_speed = iphy->max_negotiated_speed; in sci_port_get_max_allowed_speed()
870 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
872 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
876 * sci_port_post_dummy_request() - post dummy/workaround request
877 * @sci_port: port to post task
886 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_request()
887 u16 tag = iport->reserved_tag; in sci_port_post_dummy_request()
891 tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_post_dummy_request()
892 tc->abort = 0; in sci_port_post_dummy_request()
895 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_post_dummy_request()
905 * @sci_port: The port on which the task must be aborted.
910 struct isci_host *ihost = iport->owning_controller; in sci_port_abort_dummy_request()
911 u16 tag = iport->reserved_tag; in sci_port_abort_dummy_request()
915 tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_abort_dummy_request()
916 tc->abort = 1; in sci_port_abort_dummy_request()
919 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_abort_dummy_request()
929 * This method will resume the port task scheduler for this port object. none
936 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
938 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
947 iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; in sci_port_ready_substate_waiting_enter()
949 if (iport->active_phy_mask != 0) { in sci_port_ready_substate_waiting_enter()
950 /* At least one of the phys on the port is ready */ in sci_port_ready_substate_waiting_enter()
967 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_enter()
969 dev_dbg(&ihost->pdev->dev, "%s: port%d ready\n", in sci_port_ready_substate_operational_enter()
970 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_enter()
973 if (iport->phy_table[index]) { in sci_port_ready_substate_operational_enter()
974 writel(iport->physical_port_index, in sci_port_ready_substate_operational_enter()
975 &iport->port_pe_configuration_register[ in sci_port_ready_substate_operational_enter()
976 iport->phy_table[index]->phy_index]); in sci_port_ready_substate_operational_enter()
977 if (((iport->active_phy_mask^iport->enabled_phy_mask) & (1 << index)) != 0) in sci_port_ready_substate_operational_enter()
978 sci_port_resume_phy(iport, iport->phy_table[index]); in sci_port_ready_substate_operational_enter()
985 * Post the dummy task for the port so the hardware can schedule in sci_port_ready_substate_operational_enter()
993 struct isci_host *ihost = iport->owning_controller; in sci_port_invalidate_dummy_remote_node()
994 u8 phys_index = iport->physical_port_index; in sci_port_invalidate_dummy_remote_node()
996 u16 rni = iport->reserved_rni; in sci_port_invalidate_dummy_remote_node()
999 rnc = &ihost->remote_node_context_table[rni]; in sci_port_invalidate_dummy_remote_node()
1001 rnc->ssp.is_valid = false; in sci_port_invalidate_dummy_remote_node()
1007 readl(&ihost->smu_registers->interrupt_status); /* flush */ in sci_port_invalidate_dummy_remote_node()
1022 * the port not ready and suspends the port task scheduler. none
1027 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_exit()
1030 * Kill the dummy task for this port if it has not yet posted in sci_port_ready_substate_operational_exit()
1036 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_substate_operational_exit()
1037 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_exit()
1039 if (iport->ready_exit) in sci_port_ready_substate_operational_exit()
1046 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_configuring_enter()
1048 if (iport->active_phy_mask == 0) { in sci_port_ready_substate_configuring_enter()
1049 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_substate_configuring_enter()
1050 __func__, iport->physical_port_index); in sci_port_ready_substate_configuring_enter()
1059 struct isci_host *ihost = iport->owning_controller; in sci_port_start()
1064 state = iport->sm.current_state_id; in sci_port_start()
1071 if (iport->assigned_device_count > 0) { in sci_port_start()
1073 * there are still devices assigned to this port. in sci_port_start()
1074 * There must be no devices assigned to a port on a in sci_port_start()
1080 if (iport->reserved_rni == SCU_DUMMY_INDEX) { in sci_port_start()
1082 &ihost->available_remote_nodes, 1); in sci_port_start()
1088 iport->reserved_rni = rni; in sci_port_start()
1091 if (iport->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { in sci_port_start()
1099 iport->reserved_tag = tag; in sci_port_start()
1106 * There are one or more phys assigned to this port. Make sure in sci_port_start()
1107 * the port's phy mask is in fact legal and supported by the in sci_port_start()
1129 state = iport->sm.current_state_id; in sci_port_stop()
1154 state = iport->sm.current_state_id; in sci_port_hard_reset()
1163 iphy = iport->phy_table[phy_index]; in sci_port_hard_reset()
1181 sci_mod_timer(&iport->timer, timeout); in sci_port_hard_reset()
1182 iport->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; in sci_port_hard_reset()
1189 * sci_port_add_phy() -
1190 * @sci_port: This parameter specifies the port in which the phy will be added.
1191 * @sci_phy: This parameter is the phy which is to be added to the port.
1193 * This method will add a PHY to the selected port. This method returns an
1194 * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other
1195 * status is a failure to add the phy to the port.
1205 state = iport->sm.current_state_id; in sci_port_add_phy()
1210 /* Read the port assigned SAS Address if there is one */ in sci_port_add_phy()
1217 * for this port in sci_port_add_phy()
1235 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_add_phy()
1246 /* Re-enter the configuring state since this may be the last phy in in sci_port_add_phy()
1247 * the port. in sci_port_add_phy()
1260 * sci_port_remove_phy() -
1261 * @sci_port: This parameter specifies the port in which the phy will be added.
1262 * @sci_phy: This parameter is the phy which is to be added to the port.
1264 * This method will remove the PHY from the selected PORT. This method returns
1265 * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any
1266 * other status is a failure to add the phy to the port.
1274 state = iport->sm.current_state_id; in sci_port_remove_phy()
1285 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_remove_phy()
1296 /* Re-enter the configuring state since this may be the last phy in in sci_port_remove_phy()
1297 * the port in sci_port_remove_phy()
1314 state = iport->sm.current_state_id; in sci_port_link_up()
1317 /* Since this is the first phy going link up for the port we in sci_port_link_up()
1335 * get a link up on the port because of a hot plug event. in sci_port_link_up()
1357 state = iport->sm.current_state_id; in sci_port_link_down()
1362 /* If there are no active phys left in the port, then in sci_port_link_down()
1363 * transition the port to the WAITING state until such time in sci_port_link_down()
1366 if (iport->active_phy_mask == 0) in sci_port_link_down()
1388 state = iport->sm.current_state_id; in sci_port_start_io()
1393 iport->started_request_count++; in sci_port_start_io()
1408 state = iport->sm.current_state_id; in sci_port_complete_io()
1417 if (iport->started_request_count == 0) in sci_port_complete_io()
1430 if (iport->started_request_count == 0) { in sci_port_complete_io()
1443 /* enable the port task scheduler in a suspended state */ in sci_port_enable_port_task_scheduler()
1444 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1446 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1453 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1456 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1461 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_remote_node()
1462 u8 phys_index = iport->physical_port_index; in sci_port_post_dummy_remote_node()
1464 u16 rni = iport->reserved_rni; in sci_port_post_dummy_remote_node()
1467 rnc = &ihost->remote_node_context_table[rni]; in sci_port_post_dummy_remote_node()
1468 rnc->ssp.is_valid = true; in sci_port_post_dummy_remote_node()
1478 readl(&ihost->smu_registers->interrupt_status); /* flush */ in sci_port_post_dummy_remote_node()
1491 if (iport->sm.previous_state_id == SCI_PORT_STOPPING) { in sci_port_stopped_state_enter()
1494 * the port then we want to disable the hardwares port in sci_port_stopped_state_enter()
1504 /* Enable and suspend the port task scheduler */ in sci_port_stopped_state_exit()
1511 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_state_enter()
1514 prev_state = iport->sm.previous_state_id; in sci_port_ready_state_enter()
1518 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_state_enter()
1519 __func__, iport->physical_port_index); in sci_port_ready_state_enter()
1521 /* Post and suspend the dummy remote node context for this port. */ in sci_port_ready_state_enter()
1533 sci_del_timer(&iport->timer); in sci_port_resetting_state_exit()
1540 sci_del_timer(&iport->timer); in sci_port_stopping_state_exit()
1555 u32 phy_mask = iport->active_phy_mask; in sci_port_set_hang_detection_timeout()
1558 ++iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1559 else if (iport->hang_detect_users > 1) in sci_port_set_hang_detection_timeout()
1560 --iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1562 iport->hang_detect_users = 0; in sci_port_set_hang_detection_timeout()
1564 if (timeout || (iport->hang_detect_users == 0)) { in sci_port_set_hang_detection_timeout()
1568 &iport->phy_table[phy_index] in sci_port_set_hang_detection_timeout()
1569 ->link_layer_registers in sci_port_set_hang_detection_timeout()
1570 ->link_layer_hang_detection_timeout); in sci_port_set_hang_detection_timeout()
1575 /* --------------------------------------------------------------------------- */
1610 sci_init_sm(&iport->sm, sci_port_state_table, SCI_PORT_STOPPED); in sci_port_construct()
1612 iport->logical_port_index = SCIC_SDS_DUMMY_PORT; in sci_port_construct()
1613 iport->physical_port_index = index; in sci_port_construct()
1614 iport->active_phy_mask = 0; in sci_port_construct()
1615 iport->enabled_phy_mask = 0; in sci_port_construct()
1616 iport->last_active_phy = 0; in sci_port_construct()
1617 iport->ready_exit = false; in sci_port_construct()
1619 iport->owning_controller = ihost; in sci_port_construct()
1621 iport->started_request_count = 0; in sci_port_construct()
1622 iport->assigned_device_count = 0; in sci_port_construct()
1623 iport->hang_detect_users = 0; in sci_port_construct()
1625 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_construct()
1626 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_construct()
1628 sci_init_timer(&iport->timer, port_timeout); in sci_port_construct()
1630 iport->port_task_scheduler_registers = NULL; in sci_port_construct()
1633 iport->phy_table[index] = NULL; in sci_port_construct()
1638 struct isci_host *ihost = iport->owning_controller; in sci_port_broadcast_change_received()
1646 wait_event(ihost->eventq, !test_bit(IPORT_RESET_PENDING, &iport->state)); in wait_port_reset()
1656 dev_dbg(&ihost->pdev->dev, "%s: iport = %p\n", in isci_port_perform_hard_reset()
1659 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_perform_hard_reset()
1660 set_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1665 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_perform_hard_reset()
1670 dev_dbg(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1674 if (iport->hard_reset_status != SCI_SUCCESS) { in isci_port_perform_hard_reset()
1677 dev_err(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1679 __func__, iport, iport->hard_reset_status); in isci_port_perform_hard_reset()
1682 clear_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1683 wake_up(&ihost->eventq); in isci_port_perform_hard_reset()
1686 dev_err(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1697 struct isci_port *iport = dev->port->lldd_port; in isci_ata_check_ready()
1703 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_ata_check_ready()
1705 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_ata_check_ready()
1710 if (test_bit(IPORT_RESET_PENDING, &iport->state)) in isci_ata_check_ready()
1713 rc = !!iport->active_phy_mask; in isci_ata_check_ready()
1722 struct isci_host *ihost = phy->ha->lldd_ha; in isci_port_deformed()
1723 struct isci_port *iport = phy->port->lldd_port; in isci_port_deformed()
1727 /* we got a port notification on a port that was subsequently in isci_port_deformed()
1733 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_deformed()
1735 if (iport->active_phy_mask & 1 << i) in isci_port_deformed()
1738 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_deformed()
1741 dev_dbg(&ihost->pdev->dev, "%s: port: %ld\n", in isci_port_deformed()
1742 __func__, (long) (iport - &ihost->ports[0])); in isci_port_deformed()
1747 struct isci_host *ihost = phy->ha->lldd_ha; in isci_port_formed()
1749 struct asd_sas_port *port = phy->port; in isci_port_formed() local
1759 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_formed()
1761 iport = &ihost->ports[i]; in isci_port_formed()
1762 if (iport->active_phy_mask & 1 << iphy->phy_index) in isci_port_formed()
1765 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_formed()
1770 port->lldd_port = iport; in isci_port_formed()