Lines Matching +full:phy +full:- +full:s
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.
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
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()
164 "%s: isci_phy = %p, sas_phy = %p\n", in isci_port_bc_change_received()
165 __func__, iphy, &iphy->sas_phy); in isci_port_bc_change_received()
167 sas_notify_port_event(&iphy->sas_phy, in isci_port_bc_change_received()
180 dev_dbg(&isci_host->pdev->dev, in isci_port_link_up()
181 "%s: isci_port = %p\n", 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()
198 * will not be the same as assigned to the PHY and needs 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(&iphy->sas_phy, in isci_port_link_up()
233 * isci_port_link_down() - This function is called by the sci core when a link
236 * @isci_phy: This parameter specifies the isci phy with the active link.
246 dev_dbg(&isci_host->pdev->dev, in isci_port_link_down()
247 "%s: isci_port = %p\n", __func__, isci_port); 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()
260 &isci_port->remote_dev_list, in isci_port_link_down()
262 dev_dbg(&isci_host->pdev->dev, in isci_port_link_down()
263 "%s: isci_device = %p\n", 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(&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
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()
322 "%s: isci_port = %p, completion_status=%x\n", in isci_port_hard_reset_complete()
326 isci_port->hard_reset_status = completion_status; 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()
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()
352 /* This method will return a true value if the specified phy can be assigned to
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
355 * doesn't preclude all configurations. It merely ensures that a phy is part
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
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()
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 * @iport: This is the port object for which to determine if the phy mask
401 * @phy_mask: Phy mask belonging to this port
403 * This method will return a true value if the port's phy mask can be supported
404 * by the SCU. The following is a list of valid PHY mask configurations for
405 * each port: - Port 0 - [[3 2] 1] 0 - Port 1 - [1] - Port 2 - [[3] 2]
406 * - Port 3 - [3] This method returns a boolean indication specifying if the
407 * phy mask can be supported. true if this is a valid phy assignment for the
408 * port false if this is not a valid phy assignment for the port
414 if (iport->physical_port_index == 0) { in sci_port_is_phy_mask_valid()
420 } else if (iport->physical_port_index == 1) { in sci_port_is_phy_mask_valid()
424 } else if (iport->physical_port_index == 2) { in sci_port_is_phy_mask_valid()
429 } else if (iport->physical_port_index == 3) { in sci_port_is_phy_mask_valid()
439 * This method retrieves a currently active (i.e. connected) phy contained in
440 * the port. Currently, the lowest order phy that is connected is returned.
452 /* Ensure that the phy is both part of the port and currently in sci_port_get_a_connected_phy()
453 * connected to the remote end-point. in sci_port_get_a_connected_phy()
455 iphy = iport->phy_table[index]; in sci_port_get_a_connected_phy()
465 /* Check to see if we can add this phy to a port in sci_port_set_phy()
466 * that means that the phy is not part of a port and that the port does in sci_port_set_phy()
467 * not already have a phy assinged to the phy index. in sci_port_set_phy()
469 if (!iport->phy_table[iphy->phy_index] && in sci_port_set_phy()
471 sci_port_is_valid_phy_assignment(iport, iphy->phy_index)) { in sci_port_set_phy()
472 /* Phy is being added in the stopped state so we are in MPC mode in sci_port_set_phy()
475 iport->logical_port_index = iport->physical_port_index; in sci_port_set_phy()
476 iport->phy_table[iphy->phy_index] = iphy; in sci_port_set_phy()
487 /* Make sure that this phy is part of this port */ in sci_port_clear_phy()
488 if (iport->phy_table[iphy->phy_index] == iphy && in sci_port_clear_phy()
490 struct isci_host *ihost = iport->owning_controller; in sci_port_clear_phy()
493 sci_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); in sci_port_clear_phy()
494 iport->phy_table[iphy->phy_index] = NULL; in sci_port_clear_phy()
505 sas->high = 0; in sci_port_get_sas_address()
506 sas->low = 0; in sci_port_get_sas_address()
508 if (iport->phy_table[index]) in sci_port_get_sas_address()
509 sci_phy_get_sas_address(iport->phy_table[index], sas); in sci_port_get_sas_address()
517 * Ensure that the phy is both part of the port and currently in sci_port_get_attached_sas_address()
518 * connected to the remote end-point. in sci_port_get_attached_sas_address()
522 if (iphy->protocol != SAS_PROTOCOL_SATA) { in sci_port_get_attached_sas_address()
526 sas->low += iphy->phy_index; in sci_port_get_attached_sas_address()
529 sas->high = 0; in sci_port_get_attached_sas_address()
530 sas->low = 0; in sci_port_get_attached_sas_address()
535 * sci_port_construct_dummy_rnc() - create dummy rnc for si workaround
548 rnc = &iport->owning_controller->remote_node_context_table[rni]; in sci_port_construct_dummy_rnc()
552 rnc->ssp.remote_sas_address_hi = 0; in sci_port_construct_dummy_rnc()
553 rnc->ssp.remote_sas_address_lo = 0; in sci_port_construct_dummy_rnc()
555 rnc->ssp.remote_node_index = rni; in sci_port_construct_dummy_rnc()
556 rnc->ssp.remote_node_port_width = 1; in sci_port_construct_dummy_rnc()
557 rnc->ssp.logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_rnc()
559 rnc->ssp.nexus_loss_timer_enable = false; in sci_port_construct_dummy_rnc()
560 rnc->ssp.check_bit = false; in sci_port_construct_dummy_rnc()
561 rnc->ssp.is_valid = true; in sci_port_construct_dummy_rnc()
562 rnc->ssp.is_remote_node_context = true; in sci_port_construct_dummy_rnc()
563 rnc->ssp.function_number = 0; in sci_port_construct_dummy_rnc()
564 rnc->ssp.arbitration_wait_time = 0; in sci_port_construct_dummy_rnc()
574 struct isci_host *ihost = iport->owning_controller; in sci_port_construct_dummy_task()
577 task_context = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_construct_dummy_task()
580 task_context->initiator_request = 1; in sci_port_construct_dummy_task()
581 task_context->connection_rate = 1; in sci_port_construct_dummy_task()
582 task_context->logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_task()
583 task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; in sci_port_construct_dummy_task()
584 task_context->task_index = ISCI_TAG_TCI(tag); in sci_port_construct_dummy_task()
585 task_context->valid = SCU_TASK_CONTEXT_VALID; in sci_port_construct_dummy_task()
586 task_context->context_type = SCU_TASK_CONTEXT_TYPE; in sci_port_construct_dummy_task()
587 task_context->remote_node_index = iport->reserved_rni; in sci_port_construct_dummy_task()
588 task_context->do_not_dma_ssp_good_response = 1; in sci_port_construct_dummy_task()
589 task_context->task_phase = 0x01; in sci_port_construct_dummy_task()
594 struct isci_host *ihost = iport->owning_controller; in sci_port_destroy_dummy_resources()
596 if (iport->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) in sci_port_destroy_dummy_resources()
597 isci_free_tag(ihost, iport->reserved_tag); in sci_port_destroy_dummy_resources()
599 if (iport->reserved_rni != SCU_DUMMY_INDEX) in sci_port_destroy_dummy_resources()
600 sci_remote_node_table_release_remote_node_index(&ihost->available_remote_nodes, in sci_port_destroy_dummy_resources()
601 1, iport->reserved_rni); in sci_port_destroy_dummy_resources()
603 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_destroy_dummy_resources()
604 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_destroy_dummy_resources()
612 if (iport->active_phy_mask & (1 << index)) in sci_port_setup_transports()
613 sci_phy_setup_transport(iport->phy_table[index], device_id); in sci_port_setup_transports()
620 iport->enabled_phy_mask |= 1 << iphy->phy_index; in sci_port_resume_phy()
627 struct isci_host *ihost = iport->owning_controller; in sci_port_activate_phy()
629 if (iphy->protocol != SAS_PROTOCOL_SATA && (flags & PF_RESUME)) in sci_port_activate_phy()
632 iport->active_phy_mask |= 1 << iphy->phy_index; in sci_port_activate_phy()
643 struct isci_host *ihost = iport->owning_controller; in sci_port_deactivate_phy()
645 iport->active_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
646 iport->enabled_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
647 if (!iport->active_phy_mask) in sci_port_deactivate_phy()
648 iport->last_active_phy = iphy->phy_index; in sci_port_deactivate_phy()
650 iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; in sci_port_deactivate_phy()
652 /* Re-assign the phy back to the LP as if it were a narrow port for APC in sci_port_deactivate_phy()
653 * mode. For MPC mode, the phy will remain in the port. in sci_port_deactivate_phy()
655 if (iport->owning_controller->oem_parameters.controller.mode_type == in sci_port_deactivate_phy()
657 writel(iphy->phy_index, in sci_port_deactivate_phy()
658 &iport->port_pe_configuration_register[iphy->phy_index]); in sci_port_deactivate_phy()
666 struct isci_host *ihost = iport->owning_controller; in sci_port_invalid_link_up()
673 if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { in sci_port_invalid_link_up()
674 ihost->invalid_phy_mask |= 1 << iphy->phy_index; in sci_port_invalid_link_up()
675 dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); in sci_port_invalid_link_up()
680 * sci_port_general_link_up_handler - phy can be assigned to port?
681 * @iport: sci_port object for which has a phy that has gone link up.
685 * Determine if this phy can be assigned to this port . If the phy is
686 * not a valid PHY for this port then the function will notify the user.
687 * A PHY can only be part of a port if it's attached SAS ADDRESS is the
700 /* If the SAS address of the new phy matches the SAS address of in sci_port_general_link_up_handler()
701 * other phys in the port OR this is the first phy in the port, in sci_port_general_link_up_handler()
702 * then activate the phy and allow it to be used for operations in sci_port_general_link_up_handler()
707 iport->active_phy_mask == 0) { in sci_port_general_link_up_handler()
708 struct sci_base_state_machine *sm = &iport->sm; in sci_port_general_link_up_handler()
711 if (sm->current_state_id == SCI_PORT_RESETTING) in sci_port_general_link_up_handler()
721 * This method returns false if the port only has a single phy object assigned.
722 * If there are no phys or more than one phy then the method will return
735 if (iport->phy_table[index] != NULL) { in sci_port_is_wide()
745 * This method is called by the PHY object when the link is detected. if the
746 * port wants the PHY to continue on to the link up state then the port
747 * layer must return true. If the port object returns false the phy object
749 * @iport: The port associated with the phy object.
750 * @iphy: The phy object that is trying to go link up.
752 * true if the phy object can continue to the link up condition. true Is
753 * returned if this phy can continue to the ready state. false Is returned if
760 if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && in sci_port_link_detected()
761 (iphy->protocol == SAS_PROTOCOL_SATA)) { in sci_port_link_detected()
766 struct isci_host *ihost = iport->owning_controller; in sci_port_link_detected()
767 struct isci_port *dst_port = &(ihost->ports[iphy->phy_index]); in sci_port_link_detected()
768 writel(iphy->phy_index, in sci_port_link_detected()
769 &dst_port->port_pe_configuration_register[iphy->phy_index]); in sci_port_link_detected()
780 struct isci_host *ihost = iport->owning_controller; in port_timeout()
784 spin_lock_irqsave(&ihost->scic_lock, flags); in port_timeout()
786 if (tmr->cancel) in port_timeout()
789 current_state = iport->sm.current_state_id; in port_timeout()
801 "%s: SCIC Port 0x%p failed to stop before timeout.\n", in port_timeout()
806 "%s: port%d: stop complete timeout\n", in port_timeout()
807 __func__, iport->physical_port_index); in port_timeout()
813 "%s: SCIC Port 0x%p is processing a timeout operation " in port_timeout()
818 spin_unlock_irqrestore(&ihost->scic_lock, flags); in port_timeout()
821 /* --------------------------------------------------------------------------- */
833 &iport->viit_registers->initiator_sas_address_hi); in sci_port_update_viit_entry()
835 &iport->viit_registers->initiator_sas_address_lo); in sci_port_update_viit_entry()
838 writel(0, &iport->viit_registers->reserved); in sci_port_update_viit_entry()
843 ((1 << iport->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | in sci_port_update_viit_entry()
845 &iport->viit_registers->status); in sci_port_update_viit_entry()
855 * Loop through all of the phys in this port and find the phy with the in sci_port_get_max_allowed_speed()
858 iphy = iport->phy_table[index]; in sci_port_get_max_allowed_speed()
860 iphy->max_negotiated_speed < max_allowed_speed) in sci_port_get_max_allowed_speed()
861 max_allowed_speed = iphy->max_negotiated_speed; in sci_port_get_max_allowed_speed()
871 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
873 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
877 * sci_port_post_dummy_request() - post dummy/workaround request
887 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_request()
888 u16 tag = iport->reserved_tag; in sci_port_post_dummy_request()
892 tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_post_dummy_request()
893 tc->abort = 0; in sci_port_post_dummy_request()
896 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_post_dummy_request()
912 struct isci_host *ihost = iport->owning_controller; in sci_port_abort_dummy_request()
913 u16 tag = iport->reserved_tag; in sci_port_abort_dummy_request()
917 tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; in sci_port_abort_dummy_request()
918 tc->abort = 1; in sci_port_abort_dummy_request()
921 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_abort_dummy_request()
938 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
940 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
949 iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; in sci_port_ready_substate_waiting_enter()
951 if (iport->active_phy_mask != 0) { in sci_port_ready_substate_waiting_enter()
969 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_enter()
971 dev_dbg(&ihost->pdev->dev, "%s: port%d ready\n", in sci_port_ready_substate_operational_enter()
972 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_enter()
975 if (iport->phy_table[index]) { in sci_port_ready_substate_operational_enter()
976 writel(iport->physical_port_index, in sci_port_ready_substate_operational_enter()
977 &iport->port_pe_configuration_register[ in sci_port_ready_substate_operational_enter()
978 iport->phy_table[index]->phy_index]); in sci_port_ready_substate_operational_enter()
979 if (((iport->active_phy_mask^iport->enabled_phy_mask) & (1 << index)) != 0) in sci_port_ready_substate_operational_enter()
980 sci_port_resume_phy(iport, iport->phy_table[index]); in sci_port_ready_substate_operational_enter()
995 struct isci_host *ihost = iport->owning_controller; in sci_port_invalidate_dummy_remote_node()
996 u8 phys_index = iport->physical_port_index; in sci_port_invalidate_dummy_remote_node()
998 u16 rni = iport->reserved_rni; in sci_port_invalidate_dummy_remote_node()
1001 rnc = &ihost->remote_node_context_table[rni]; in sci_port_invalidate_dummy_remote_node()
1003 rnc->ssp.is_valid = false; in sci_port_invalidate_dummy_remote_node()
1009 readl(&ihost->smu_registers->interrupt_status); /* flush */ in sci_port_invalidate_dummy_remote_node()
1029 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_exit()
1038 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_substate_operational_exit()
1039 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_exit()
1041 if (iport->ready_exit) in sci_port_ready_substate_operational_exit()
1048 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_configuring_enter()
1050 if (iport->active_phy_mask == 0) { in sci_port_ready_substate_configuring_enter()
1051 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_substate_configuring_enter()
1052 __func__, iport->physical_port_index); in sci_port_ready_substate_configuring_enter()
1061 struct isci_host *ihost = iport->owning_controller; in sci_port_start()
1066 state = iport->sm.current_state_id; in sci_port_start()
1068 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_start()
1073 if (iport->assigned_device_count > 0) { in sci_port_start()
1082 if (iport->reserved_rni == SCU_DUMMY_INDEX) { in sci_port_start()
1084 &ihost->available_remote_nodes, 1); in sci_port_start()
1090 iport->reserved_rni = rni; in sci_port_start()
1093 if (iport->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { in sci_port_start()
1101 iport->reserved_tag = tag; in sci_port_start()
1109 * the port's phy mask is in fact legal and supported by the in sci_port_start()
1131 state = iport->sm.current_state_id; in sci_port_stop()
1143 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_stop()
1156 state = iport->sm.current_state_id; in sci_port_hard_reset()
1158 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_hard_reset()
1163 /* Select a phy on which we can send the hard reset request. */ in sci_port_hard_reset()
1165 iphy = iport->phy_table[phy_index]; in sci_port_hard_reset()
1168 * We found a phy but it is not ready select in sci_port_hard_reset()
1169 * different phy in sci_port_hard_reset()
1175 /* If we have a phy then go ahead and start the reset procedure */ in sci_port_hard_reset()
1183 sci_mod_timer(&iport->timer, timeout); in sci_port_hard_reset()
1184 iport->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; in sci_port_hard_reset()
1192 * @iport: This parameter specifies the port in which the phy will be added.
1193 * @iphy: This parameter is the phy which is to be added to the port.
1195 * This method will add a PHY to the selected port. This method returns an
1196 * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other
1197 * status is a failure to add the phy to the port.
1207 state = iport->sm.current_state_id; in sci_port_add_phy()
1218 /* Make sure that the PHY SAS Address matches the SAS Address in sci_port_add_phy()
1237 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_add_phy()
1248 /* Re-enter the configuring state since this may be the last phy in in sci_port_add_phy()
1255 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_add_phy()
1263 * @iport: This parameter specifies the port in which the phy will be added.
1264 * @iphy: This parameter is the phy which is to be added to the port.
1266 * This method will remove the PHY from the selected PORT. This method returns
1267 * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any
1268 * other status is a failure to add the phy to the port.
1276 state = iport->sm.current_state_id; in sci_port_remove_phy()
1287 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_remove_phy()
1298 /* Re-enter the configuring state since this may be the last phy in in sci_port_remove_phy()
1305 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_remove_phy()
1316 state = iport->sm.current_state_id; in sci_port_link_up()
1319 /* Since this is the first phy going link up for the port we in sci_port_link_up()
1331 /* TODO We should make sure that the phy that has gone in sci_port_link_up()
1333 * possible that the phy on which we sent the reset is not the in sci_port_link_up()
1335 * phy being reset comes back. Consider the case where a in sci_port_link_up()
1338 * because of the reset request this phy will go link down in sci_port_link_up()
1348 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_up()
1359 state = iport->sm.current_state_id; in sci_port_link_down()
1366 * as a phy goes link up in sci_port_link_down()
1368 if (iport->active_phy_mask == 0) in sci_port_link_down()
1378 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_down()
1390 state = iport->sm.current_state_id; in sci_port_start_io()
1395 iport->started_request_count++; in sci_port_start_io()
1398 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_start_io()
1410 state = iport->sm.current_state_id; in sci_port_complete_io()
1413 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_complete_io()
1419 if (iport->started_request_count == 0) in sci_port_complete_io()
1432 if (iport->started_request_count == 0) { in sci_port_complete_io()
1446 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1448 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1455 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1458 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1463 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_remote_node()
1464 u8 phys_index = iport->physical_port_index; in sci_port_post_dummy_remote_node()
1466 u16 rni = iport->reserved_rni; in sci_port_post_dummy_remote_node()
1469 rnc = &ihost->remote_node_context_table[rni]; in sci_port_post_dummy_remote_node()
1470 rnc->ssp.is_valid = true; in sci_port_post_dummy_remote_node()
1480 readl(&ihost->smu_registers->interrupt_status); /* flush */ in sci_port_post_dummy_remote_node()
1493 if (iport->sm.previous_state_id == SCI_PORT_STOPPING) { in sci_port_stopped_state_enter()
1513 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_state_enter()
1516 prev_state = iport->sm.previous_state_id; in sci_port_ready_state_enter()
1520 dev_dbg(&ihost->pdev->dev, "%s: port%d !ready\n", in sci_port_ready_state_enter()
1521 __func__, iport->physical_port_index); in sci_port_ready_state_enter()
1535 sci_del_timer(&iport->timer); in sci_port_resetting_state_exit()
1542 sci_del_timer(&iport->timer); in sci_port_stopping_state_exit()
1557 u32 phy_mask = iport->active_phy_mask; in sci_port_set_hang_detection_timeout()
1560 ++iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1561 else if (iport->hang_detect_users > 1) in sci_port_set_hang_detection_timeout()
1562 --iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1564 iport->hang_detect_users = 0; in sci_port_set_hang_detection_timeout()
1566 if (timeout || (iport->hang_detect_users == 0)) { in sci_port_set_hang_detection_timeout()
1570 &iport->phy_table[phy_index] in sci_port_set_hang_detection_timeout()
1571 ->link_layer_registers in sci_port_set_hang_detection_timeout()
1572 ->link_layer_hang_detection_timeout); in sci_port_set_hang_detection_timeout()
1577 /* --------------------------------------------------------------------------- */
1612 sci_init_sm(&iport->sm, sci_port_state_table, SCI_PORT_STOPPED); in sci_port_construct()
1614 iport->logical_port_index = SCIC_SDS_DUMMY_PORT; in sci_port_construct()
1615 iport->physical_port_index = index; in sci_port_construct()
1616 iport->active_phy_mask = 0; in sci_port_construct()
1617 iport->enabled_phy_mask = 0; in sci_port_construct()
1618 iport->last_active_phy = 0; in sci_port_construct()
1619 iport->ready_exit = false; in sci_port_construct()
1621 iport->owning_controller = ihost; in sci_port_construct()
1623 iport->started_request_count = 0; in sci_port_construct()
1624 iport->assigned_device_count = 0; in sci_port_construct()
1625 iport->hang_detect_users = 0; in sci_port_construct()
1627 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_construct()
1628 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_construct()
1630 sci_init_timer(&iport->timer, port_timeout); in sci_port_construct()
1632 iport->port_task_scheduler_registers = NULL; in sci_port_construct()
1635 iport->phy_table[index] = NULL; in sci_port_construct()
1640 struct isci_host *ihost = iport->owning_controller; in sci_port_broadcast_change_received()
1648 wait_event(ihost->eventq, !test_bit(IPORT_RESET_PENDING, &iport->state)); in wait_port_reset()
1658 dev_dbg(&ihost->pdev->dev, "%s: iport = %p\n", in isci_port_perform_hard_reset()
1661 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_perform_hard_reset()
1662 set_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1667 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_perform_hard_reset()
1672 dev_dbg(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1673 "%s: iport = %p; hard reset completion\n", in isci_port_perform_hard_reset()
1676 if (iport->hard_reset_status != SCI_SUCCESS) { in isci_port_perform_hard_reset()
1679 dev_err(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1680 "%s: iport = %p; hard reset failed (0x%x)\n", in isci_port_perform_hard_reset()
1681 __func__, iport, iport->hard_reset_status); in isci_port_perform_hard_reset()
1684 clear_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1685 wake_up(&ihost->eventq); in isci_port_perform_hard_reset()
1688 dev_err(&ihost->pdev->dev, in isci_port_perform_hard_reset()
1689 "%s: iport = %p; sci_port_hard_reset call" in isci_port_perform_hard_reset()
1699 struct isci_port *iport = dev->port->lldd_port; in isci_ata_check_ready()
1705 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_ata_check_ready()
1707 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_ata_check_ready()
1712 if (test_bit(IPORT_RESET_PENDING, &iport->state)) in isci_ata_check_ready()
1715 rc = !!iport->active_phy_mask; in isci_ata_check_ready()
1722 void isci_port_deformed(struct asd_sas_phy *phy) in isci_port_deformed() argument
1724 struct isci_host *ihost = phy->ha->lldd_ha; in isci_port_deformed()
1725 struct isci_port *iport = phy->port->lldd_port; in isci_port_deformed()
1735 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_deformed()
1737 if (iport->active_phy_mask & 1 << i) in isci_port_deformed()
1740 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_deformed()
1743 dev_dbg(&ihost->pdev->dev, "%s: port: %ld\n", in isci_port_deformed()
1744 __func__, (long) (iport - &ihost->ports[0])); in isci_port_deformed()
1747 void isci_port_formed(struct asd_sas_phy *phy) in isci_port_formed() argument
1749 struct isci_host *ihost = phy->ha->lldd_ha; in isci_port_formed()
1750 struct isci_phy *iphy = to_iphy(phy); in isci_port_formed()
1751 struct asd_sas_port *port = phy->port; in isci_port_formed()
1761 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_port_formed()
1763 iport = &ihost->ports[i]; in isci_port_formed()
1764 if (iport->active_phy_mask & 1 << iphy->phy_index) in isci_port_formed()
1767 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_port_formed()
1772 port->lldd_port = iport; in isci_port_formed()