Lines Matching refs:iport

73 static struct device *sciport_to_dev(struct isci_port *iport)  in sciport_to_dev()  argument
75 int i = iport->physical_port_index; in sciport_to_dev()
82 table = iport - i; in sciport_to_dev()
88 static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto) in sci_port_get_protocols() argument
94 struct isci_phy *iphy = iport->phy_table[index]; in sci_port_get_protocols()
102 static u32 sci_port_get_phys(struct isci_port *iport) in sci_port_get_phys() argument
109 if (iport->phy_table[index]) in sci_port_get_phys()
128 enum sci_status sci_port_get_properties(struct isci_port *iport, in sci_port_get_properties() argument
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()
143 static void sci_port_bcn_enable(struct isci_port *iport) in sci_port_bcn_enable() argument
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()
160 struct isci_port *iport, in isci_port_bc_change_received() argument
169 sci_port_bcn_enable(iport); in isci_port_bc_change_received()
173 struct isci_port *iport, in isci_port_link_up() argument
182 __func__, iport); in isci_port_link_up()
186 sci_port_get_properties(iport, &properties); in isci_port_link_up()
295 static void port_state_machine_change(struct isci_port *iport, in port_state_machine_change() argument
298 struct sci_base_state_machine *sm = &iport->sm; 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()
363 bool sci_port_is_valid_phy_assignment(struct isci_port *iport, u32 phy_index) in sci_port_is_valid_phy_assignment() argument
365 struct isci_host *ihost = iport->owning_controller; 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()
411 struct isci_port *iport, in sci_port_is_phy_mask_valid() argument
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()
446 static struct isci_phy *sci_port_get_a_connected_phy(struct isci_port *iport) in sci_port_get_a_connected_phy() argument
455 iphy = iport->phy_table[index]; in sci_port_get_a_connected_phy()
456 if (iphy && sci_port_active_phy(iport, iphy)) in sci_port_get_a_connected_phy()
463 static enum sci_status sci_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_set_phy() argument
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()
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()
477 sci_phy_set_port(iphy, iport); in sci_port_set_phy()
485 static enum sci_status sci_port_clear_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_clear_phy() argument
488 if (iport->phy_table[iphy->phy_index] == iphy && in sci_port_clear_phy()
489 phy_get_non_dummy_port(iphy) == iport) { in sci_port_clear_phy()
490 struct isci_host *ihost = iport->owning_controller; in sci_port_clear_phy()
494 iport->phy_table[iphy->phy_index] = NULL; in sci_port_clear_phy()
501 void sci_port_get_sas_address(struct isci_port *iport, struct sci_sas_address *sas) in sci_port_get_sas_address() argument
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()
512 void sci_port_get_attached_sas_address(struct isci_port *iport, struct sci_sas_address *sas) in sci_port_get_attached_sas_address() argument
520 iphy = sci_port_get_a_connected_phy(iport); in sci_port_get_attached_sas_address()
544 static void sci_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) in sci_port_construct_dummy_rnc() argument
548 rnc = &iport->owning_controller->remote_node_context_table[rni]; in sci_port_construct_dummy_rnc()
557 rnc->ssp.logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_rnc()
572 static void sci_port_construct_dummy_task(struct isci_port *iport, u16 tag) in sci_port_construct_dummy_task() argument
574 struct isci_host *ihost = iport->owning_controller; in sci_port_construct_dummy_task()
582 task_context->logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_task()
587 task_context->remote_node_index = iport->reserved_rni; in sci_port_construct_dummy_task()
592 static void sci_port_destroy_dummy_resources(struct isci_port *iport) in sci_port_destroy_dummy_resources() argument
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()
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()
607 void sci_port_setup_transports(struct isci_port *iport, u32 device_id) in sci_port_setup_transports() argument
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()
617 static void sci_port_resume_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_resume_phy() argument
620 iport->enabled_phy_mask |= 1 << iphy->phy_index; in sci_port_resume_phy()
623 static void sci_port_activate_phy(struct isci_port *iport, in sci_port_activate_phy() argument
627 struct isci_host *ihost = iport->owning_controller; in sci_port_activate_phy()
632 iport->active_phy_mask |= 1 << iphy->phy_index; in sci_port_activate_phy()
637 isci_port_link_up(ihost, iport, iphy); in sci_port_activate_phy()
640 void sci_port_deactivate_phy(struct isci_port *iport, struct isci_phy *iphy, in sci_port_deactivate_phy() argument
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()
655 if (iport->owning_controller->oem_parameters.controller.mode_type == in sci_port_deactivate_phy()
658 &iport->port_pe_configuration_register[iphy->phy_index]); in sci_port_deactivate_phy()
661 isci_port_link_down(ihost, iphy, iport); in sci_port_deactivate_phy()
664 static void sci_port_invalid_link_up(struct isci_port *iport, struct isci_phy *iphy) in sci_port_invalid_link_up() argument
666 struct isci_host *ihost = iport->owning_controller; in sci_port_invalid_link_up()
690 static void sci_port_general_link_up_handler(struct isci_port *iport, in sci_port_general_link_up_handler() argument
697 sci_port_get_attached_sas_address(iport, &port_sas_address); 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()
710 sci_port_activate_phy(iport, iphy, flags); in sci_port_general_link_up_handler()
712 port_state_machine_change(iport, SCI_PORT_READY); in sci_port_general_link_up_handler()
714 sci_port_invalid_link_up(iport, iphy); in sci_port_general_link_up_handler()
729 static bool sci_port_is_wide(struct isci_port *iport) in sci_port_is_wide() argument
735 if (iport->phy_table[index] != NULL) { in sci_port_is_wide()
758 bool sci_port_link_detected(struct isci_port *iport, struct isci_phy *iphy) in sci_port_link_detected() argument
760 if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && in sci_port_link_detected()
762 if (sci_port_is_wide(iport)) { in sci_port_link_detected()
763 sci_port_invalid_link_up(iport, iphy); in sci_port_link_detected()
766 struct isci_host *ihost = iport->owning_controller; in sci_port_link_detected()
779 struct isci_port *iport = container_of(tmr, typeof(*iport), timer); in port_timeout() local
780 struct isci_host *ihost = iport->owning_controller; in port_timeout()
789 current_state = iport->sm.current_state_id; in port_timeout()
795 port_state_machine_change(iport, SCI_PORT_FAILED); in port_timeout()
800 dev_err(sciport_to_dev(iport), in port_timeout()
803 iport); in port_timeout()
805 dev_dbg(sciport_to_dev(iport), in port_timeout()
807 __func__, iport->physical_port_index); in port_timeout()
812 dev_err(sciport_to_dev(iport), in port_timeout()
814 "in state %d.\n", __func__, iport, current_state); in port_timeout()
826 static void sci_port_update_viit_entry(struct isci_port *iport) in sci_port_update_viit_entry() argument
830 sci_port_get_sas_address(iport, &sas_address); in sci_port_update_viit_entry()
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()
848 enum sas_linkrate sci_port_get_max_allowed_speed(struct isci_port *iport) in sci_port_get_max_allowed_speed() argument
858 iphy = iport->phy_table[index]; in sci_port_get_max_allowed_speed()
859 if (iphy && sci_port_active_phy(iport, iphy) && in sci_port_get_max_allowed_speed()
867 static void sci_port_suspend_port_task_scheduler(struct isci_port *iport) in sci_port_suspend_port_task_scheduler() argument
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()
885 static void sci_port_post_dummy_request(struct isci_port *iport) in sci_port_post_dummy_request() argument
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()
896 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_post_dummy_request()
910 static void sci_port_abort_dummy_request(struct isci_port *iport) in sci_port_abort_dummy_request() argument
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()
921 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_abort_dummy_request()
934 sci_port_resume_port_task_scheduler(struct isci_port *iport) in sci_port_resume_port_task_scheduler() argument
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()
945 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_waiting_enter() local
947 sci_port_suspend_port_task_scheduler(iport); in sci_port_ready_substate_waiting_enter()
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()
953 port_state_machine_change(iport, in sci_port_ready_substate_waiting_enter()
961 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in scic_sds_port_ready_substate_waiting_exit() local
962 sci_port_resume_port_task_scheduler(iport); in scic_sds_port_ready_substate_waiting_exit()
968 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_operational_enter() local
969 struct isci_host *ihost = iport->owning_controller; 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()
984 sci_port_update_viit_entry(iport); in sci_port_ready_substate_operational_enter()
990 sci_port_post_dummy_request(iport); in sci_port_ready_substate_operational_enter()
993 static void sci_port_invalidate_dummy_remote_node(struct isci_port *iport) in sci_port_invalidate_dummy_remote_node() argument
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()
1028 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_operational_exit() local
1029 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_exit()
1036 sci_port_abort_dummy_request(iport); 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()
1042 sci_port_invalidate_dummy_remote_node(iport); in sci_port_ready_substate_operational_exit()
1047 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_configuring_enter() local
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()
1052 __func__, iport->physical_port_index); in sci_port_ready_substate_configuring_enter()
1054 port_state_machine_change(iport, SCI_PORT_SUB_WAITING); in sci_port_ready_substate_configuring_enter()
1056 port_state_machine_change(iport, SCI_PORT_SUB_OPERATIONAL); in sci_port_ready_substate_configuring_enter()
1059 enum sci_status sci_port_start(struct isci_port *iport) in sci_port_start() argument
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()
1087 sci_port_construct_dummy_rnc(iport, rni); 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()
1100 sci_port_construct_dummy_task(iport, tag); in sci_port_start()
1101 iport->reserved_tag = tag; in sci_port_start()
1105 phy_mask = sci_port_get_phys(iport); in sci_port_start()
1112 if (sci_port_is_phy_mask_valid(iport, phy_mask) == true) { in sci_port_start()
1113 port_state_machine_change(iport, in sci_port_start()
1122 sci_port_destroy_dummy_resources(iport); in sci_port_start()
1127 enum sci_status sci_port_stop(struct isci_port *iport) in sci_port_stop() argument
1131 state = iport->sm.current_state_id; in sci_port_stop()
1139 port_state_machine_change(iport, in sci_port_stop()
1143 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_stop()
1149 static enum sci_status sci_port_hard_reset(struct isci_port *iport, u32 timeout) in sci_port_hard_reset() argument
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()
1165 iphy = iport->phy_table[phy_index]; in sci_port_hard_reset()
1166 if (iphy && !sci_port_active_phy(iport, iphy)) { 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()
1186 port_state_machine_change(iport, SCI_PORT_RESETTING); in sci_port_hard_reset()
1199 enum sci_status sci_port_add_phy(struct isci_port *iport, in sci_port_add_phy() argument
1205 sci_port_bcn_enable(iport); in sci_port_add_phy()
1207 state = iport->sm.current_state_id; in sci_port_add_phy()
1213 sci_port_get_sas_address(iport, &port_sas_address); in sci_port_add_phy()
1227 return sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1231 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1236 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_add_phy()
1237 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_add_phy()
1238 port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); in sci_port_add_phy()
1242 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1246 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY); in sci_port_add_phy()
1251 port_state_machine_change(iport, in sci_port_add_phy()
1255 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_add_phy()
1270 enum sci_status sci_port_remove_phy(struct isci_port *iport, in sci_port_remove_phy() argument
1276 state = iport->sm.current_state_id; in sci_port_remove_phy()
1280 return sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1282 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1286 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1287 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_remove_phy()
1288 port_state_machine_change(iport, in sci_port_remove_phy()
1292 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1296 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1301 port_state_machine_change(iport, in sci_port_remove_phy()
1305 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_remove_phy()
1311 enum sci_status sci_port_link_up(struct isci_port *iport, in sci_port_link_up() argument
1316 state = iport->sm.current_state_id; in sci_port_link_up()
1322 sci_port_activate_phy(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1324 port_state_machine_change(iport, in sci_port_link_up()
1328 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1345 sci_port_general_link_up_handler(iport, iphy, PF_RESUME); in sci_port_link_up()
1348 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_up()
1354 enum sci_status sci_port_link_down(struct isci_port *iport, in sci_port_link_down() argument
1359 state = iport->sm.current_state_id; in sci_port_link_down()
1362 sci_port_deactivate_phy(iport, iphy, true); in sci_port_link_down()
1368 if (iport->active_phy_mask == 0) in sci_port_link_down()
1369 port_state_machine_change(iport, in sci_port_link_down()
1375 sci_port_deactivate_phy(iport, iphy, false); in sci_port_link_down()
1378 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_down()
1384 enum sci_status sci_port_start_io(struct isci_port *iport, in sci_port_start_io() argument
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()
1404 enum sci_status sci_port_complete_io(struct isci_port *iport, in sci_port_complete_io() argument
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()
1417 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1419 if (iport->started_request_count == 0) in sci_port_complete_io()
1420 port_state_machine_change(iport, in sci_port_complete_io()
1428 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1431 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1432 if (iport->started_request_count == 0) { in sci_port_complete_io()
1433 port_state_machine_change(iport, in sci_port_complete_io()
1441 static void sci_port_enable_port_task_scheduler(struct isci_port *iport) in sci_port_enable_port_task_scheduler() argument
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()
1451 static void sci_port_disable_port_task_scheduler(struct isci_port *iport) in sci_port_disable_port_task_scheduler() argument
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()
1461 static void sci_port_post_dummy_remote_node(struct isci_port *iport) in sci_port_post_dummy_remote_node() argument
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()
1491 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopped_state_enter() local
1493 if (iport->sm.previous_state_id == SCI_PORT_STOPPING) { in sci_port_stopped_state_enter()
1498 sci_port_disable_port_task_scheduler(iport); in sci_port_stopped_state_enter()
1504 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopped_state_exit() local
1507 sci_port_enable_port_task_scheduler(iport); in sci_port_stopped_state_exit()
1512 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_state_enter() local
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()
1518 isci_port_hard_reset_complete(iport, SCI_SUCCESS); in sci_port_ready_state_enter()
1521 __func__, iport->physical_port_index); in sci_port_ready_state_enter()
1524 sci_port_post_dummy_remote_node(iport); in sci_port_ready_state_enter()
1527 port_state_machine_change(iport, in sci_port_ready_state_enter()
1533 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_resetting_state_exit() local
1535 sci_del_timer(&iport->timer); in sci_port_resetting_state_exit()
1540 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopping_state_exit() local
1542 sci_del_timer(&iport->timer); in sci_port_stopping_state_exit()
1544 sci_port_destroy_dummy_resources(iport); in sci_port_stopping_state_exit()
1549 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_failed_state_enter() local
1551 isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); in sci_port_failed_state_enter()
1554 void sci_port_set_hang_detection_timeout(struct isci_port *iport, u32 timeout) in sci_port_set_hang_detection_timeout() argument
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()
1609 void sci_port_construct(struct isci_port *iport, u8 index, in sci_port_construct() argument
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()
1638 void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) in sci_port_broadcast_change_received() argument
1640 struct isci_host *ihost = iport->owning_controller; in sci_port_broadcast_change_received()
1643 isci_port_bc_change_received(ihost, iport, iphy); in sci_port_broadcast_change_received()
1646 static void wait_port_reset(struct isci_host *ihost, struct isci_port *iport) in wait_port_reset() argument
1648 wait_event(ihost->eventq, !test_bit(IPORT_RESET_PENDING, &iport->state)); in wait_port_reset()
1651 int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, in isci_port_perform_hard_reset() argument
1659 __func__, iport); in isci_port_perform_hard_reset()
1662 set_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1665 status = sci_port_hard_reset(iport, ISCI_PORT_RESET_TIMEOUT); in isci_port_perform_hard_reset()
1670 wait_port_reset(ihost, iport); in isci_port_perform_hard_reset()
1674 __func__, iport); in isci_port_perform_hard_reset()
1676 if (iport->hard_reset_status != SCI_SUCCESS) { 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()
1691 __func__, iport, status); in isci_port_perform_hard_reset()
1699 struct isci_port *iport = dev->port->lldd_port; in isci_ata_check_ready() local
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()
1725 struct isci_port *iport = phy->port->lldd_port; in isci_port_deformed() local
1732 if (!iport) in isci_port_deformed()
1737 if (iport->active_phy_mask & 1 << i) in isci_port_deformed()
1744 __func__, (long) (iport - &ihost->ports[0])); in isci_port_deformed()
1752 struct isci_port *iport = NULL; in isci_port_formed() local
1763 iport = &ihost->ports[i]; in isci_port_formed()
1764 if (iport->active_phy_mask & 1 << iphy->phy_index) in isci_port_formed()
1770 iport = NULL; in isci_port_formed()
1772 port->lldd_port = iport; in isci_port_formed()