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
168 sci_port_bcn_enable(iport); in isci_port_bc_change_received()
172 struct isci_port *iport, in isci_port_link_up() argument
181 __func__, iport); in isci_port_link_up()
185 sci_port_get_properties(iport, &properties); in isci_port_link_up()
294 static void port_state_machine_change(struct isci_port *iport, in port_state_machine_change() argument
297 struct sci_base_state_machine *sm = &iport->sm; in port_state_machine_change()
301 iport->ready_exit = true; in port_state_machine_change()
304 iport->ready_exit = false; in port_state_machine_change()
362 bool sci_port_is_valid_phy_assignment(struct isci_port *iport, u32 phy_index) in sci_port_is_valid_phy_assignment() argument
364 struct isci_host *ihost = iport->owning_controller; in sci_port_is_valid_phy_assignment()
371 if ((iport->physical_port_index == 1) && (phy_index != 1)) in sci_port_is_valid_phy_assignment()
374 if (iport->physical_port_index == 3 && phy_index != 3) in sci_port_is_valid_phy_assignment()
377 if (iport->physical_port_index == 2 && in sci_port_is_valid_phy_assignment()
382 if (iport->phy_table[index] && index != phy_index) in sci_port_is_valid_phy_assignment()
409 struct isci_port *iport, in sci_port_is_phy_mask_valid() argument
412 if (iport->physical_port_index == 0) { in sci_port_is_phy_mask_valid()
418 } else if (iport->physical_port_index == 1) { in sci_port_is_phy_mask_valid()
422 } else if (iport->physical_port_index == 2) { in sci_port_is_phy_mask_valid()
427 } else if (iport->physical_port_index == 3) { in sci_port_is_phy_mask_valid()
444 static struct isci_phy *sci_port_get_a_connected_phy(struct isci_port *iport) in sci_port_get_a_connected_phy() argument
453 iphy = iport->phy_table[index]; in sci_port_get_a_connected_phy()
454 if (iphy && sci_port_active_phy(iport, iphy)) in sci_port_get_a_connected_phy()
461 static enum sci_status sci_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_set_phy() argument
467 if (!iport->phy_table[iphy->phy_index] && in sci_port_set_phy()
469 sci_port_is_valid_phy_assignment(iport, iphy->phy_index)) { in sci_port_set_phy()
473 iport->logical_port_index = iport->physical_port_index; in sci_port_set_phy()
474 iport->phy_table[iphy->phy_index] = iphy; in sci_port_set_phy()
475 sci_phy_set_port(iphy, iport); in sci_port_set_phy()
483 static enum sci_status sci_port_clear_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_clear_phy() argument
486 if (iport->phy_table[iphy->phy_index] == iphy && in sci_port_clear_phy()
487 phy_get_non_dummy_port(iphy) == iport) { in sci_port_clear_phy()
488 struct isci_host *ihost = iport->owning_controller; in sci_port_clear_phy()
492 iport->phy_table[iphy->phy_index] = NULL; in sci_port_clear_phy()
499 void sci_port_get_sas_address(struct isci_port *iport, struct sci_sas_address *sas) in sci_port_get_sas_address() argument
506 if (iport->phy_table[index]) in sci_port_get_sas_address()
507 sci_phy_get_sas_address(iport->phy_table[index], sas); in sci_port_get_sas_address()
510 void sci_port_get_attached_sas_address(struct isci_port *iport, struct sci_sas_address *sas) in sci_port_get_attached_sas_address() argument
518 iphy = sci_port_get_a_connected_phy(iport); in sci_port_get_attached_sas_address()
542 static void sci_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) in sci_port_construct_dummy_rnc() argument
546 rnc = &iport->owning_controller->remote_node_context_table[rni]; in sci_port_construct_dummy_rnc()
555 rnc->ssp.logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_rnc()
570 static void sci_port_construct_dummy_task(struct isci_port *iport, u16 tag) in sci_port_construct_dummy_task() argument
572 struct isci_host *ihost = iport->owning_controller; in sci_port_construct_dummy_task()
580 task_context->logical_port_index = iport->physical_port_index; in sci_port_construct_dummy_task()
585 task_context->remote_node_index = iport->reserved_rni; in sci_port_construct_dummy_task()
590 static void sci_port_destroy_dummy_resources(struct isci_port *iport) in sci_port_destroy_dummy_resources() argument
592 struct isci_host *ihost = iport->owning_controller; in sci_port_destroy_dummy_resources()
594 if (iport->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) in sci_port_destroy_dummy_resources()
595 isci_free_tag(ihost, iport->reserved_tag); in sci_port_destroy_dummy_resources()
597 if (iport->reserved_rni != SCU_DUMMY_INDEX) in sci_port_destroy_dummy_resources()
599 1, iport->reserved_rni); in sci_port_destroy_dummy_resources()
601 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_destroy_dummy_resources()
602 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_destroy_dummy_resources()
605 void sci_port_setup_transports(struct isci_port *iport, u32 device_id) in sci_port_setup_transports() argument
610 if (iport->active_phy_mask & (1 << index)) in sci_port_setup_transports()
611 sci_phy_setup_transport(iport->phy_table[index], device_id); in sci_port_setup_transports()
615 static void sci_port_resume_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_resume_phy() argument
618 iport->enabled_phy_mask |= 1 << iphy->phy_index; in sci_port_resume_phy()
621 static void sci_port_activate_phy(struct isci_port *iport, in sci_port_activate_phy() argument
625 struct isci_host *ihost = iport->owning_controller; in sci_port_activate_phy()
630 iport->active_phy_mask |= 1 << iphy->phy_index; in sci_port_activate_phy()
635 isci_port_link_up(ihost, iport, iphy); in sci_port_activate_phy()
638 void sci_port_deactivate_phy(struct isci_port *iport, struct isci_phy *iphy, in sci_port_deactivate_phy() argument
641 struct isci_host *ihost = iport->owning_controller; in sci_port_deactivate_phy()
643 iport->active_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
644 iport->enabled_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
645 if (!iport->active_phy_mask) in sci_port_deactivate_phy()
646 iport->last_active_phy = iphy->phy_index; in sci_port_deactivate_phy()
653 if (iport->owning_controller->oem_parameters.controller.mode_type == in sci_port_deactivate_phy()
656 &iport->port_pe_configuration_register[iphy->phy_index]); in sci_port_deactivate_phy()
659 isci_port_link_down(ihost, iphy, iport); in sci_port_deactivate_phy()
662 static void sci_port_invalid_link_up(struct isci_port *iport, struct isci_phy *iphy) in sci_port_invalid_link_up() argument
664 struct isci_host *ihost = iport->owning_controller; in sci_port_invalid_link_up()
688 static void sci_port_general_link_up_handler(struct isci_port *iport, in sci_port_general_link_up_handler() argument
695 sci_port_get_attached_sas_address(iport, &port_sas_address); in sci_port_general_link_up_handler()
705 iport->active_phy_mask == 0) { in sci_port_general_link_up_handler()
706 struct sci_base_state_machine *sm = &iport->sm; in sci_port_general_link_up_handler()
708 sci_port_activate_phy(iport, iphy, flags); in sci_port_general_link_up_handler()
710 port_state_machine_change(iport, SCI_PORT_READY); in sci_port_general_link_up_handler()
712 sci_port_invalid_link_up(iport, iphy); in sci_port_general_link_up_handler()
726 static bool sci_port_is_wide(struct isci_port *iport) in sci_port_is_wide() argument
732 if (iport->phy_table[index] != NULL) { in sci_port_is_wide()
754 bool sci_port_link_detected(struct isci_port *iport, struct isci_phy *iphy) in sci_port_link_detected() argument
756 if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && in sci_port_link_detected()
758 if (sci_port_is_wide(iport)) { in sci_port_link_detected()
759 sci_port_invalid_link_up(iport, iphy); in sci_port_link_detected()
762 struct isci_host *ihost = iport->owning_controller; in sci_port_link_detected()
775 struct isci_port *iport = container_of(tmr, typeof(*iport), timer); in port_timeout() local
776 struct isci_host *ihost = iport->owning_controller; in port_timeout()
785 current_state = iport->sm.current_state_id; in port_timeout()
791 port_state_machine_change(iport, SCI_PORT_FAILED); in port_timeout()
796 dev_err(sciport_to_dev(iport), in port_timeout()
799 iport); in port_timeout()
801 dev_dbg(sciport_to_dev(iport), in port_timeout()
803 __func__, iport->physical_port_index); in port_timeout()
808 dev_err(sciport_to_dev(iport), in port_timeout()
810 "in state %d.\n", __func__, iport, current_state); in port_timeout()
824 static void sci_port_update_viit_entry(struct isci_port *iport) in sci_port_update_viit_entry() argument
828 sci_port_get_sas_address(iport, &sas_address); in sci_port_update_viit_entry()
831 &iport->viit_registers->initiator_sas_address_hi); in sci_port_update_viit_entry()
833 &iport->viit_registers->initiator_sas_address_lo); in sci_port_update_viit_entry()
836 writel(0, &iport->viit_registers->reserved); in sci_port_update_viit_entry()
841 ((1 << iport->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | in sci_port_update_viit_entry()
843 &iport->viit_registers->status); in sci_port_update_viit_entry()
846 enum sas_linkrate sci_port_get_max_allowed_speed(struct isci_port *iport) in sci_port_get_max_allowed_speed() argument
856 iphy = iport->phy_table[index]; in sci_port_get_max_allowed_speed()
857 if (iphy && sci_port_active_phy(iport, iphy) && in sci_port_get_max_allowed_speed()
865 static void sci_port_suspend_port_task_scheduler(struct isci_port *iport) in sci_port_suspend_port_task_scheduler() argument
869 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
871 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_suspend_port_task_scheduler()
883 static void sci_port_post_dummy_request(struct isci_port *iport) in sci_port_post_dummy_request() argument
885 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_request()
886 u16 tag = iport->reserved_tag; in sci_port_post_dummy_request()
894 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_post_dummy_request()
907 static void sci_port_abort_dummy_request(struct isci_port *iport) in sci_port_abort_dummy_request() argument
909 struct isci_host *ihost = iport->owning_controller; in sci_port_abort_dummy_request()
910 u16 tag = iport->reserved_tag; in sci_port_abort_dummy_request()
918 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | in sci_port_abort_dummy_request()
931 sci_port_resume_port_task_scheduler(struct isci_port *iport) in sci_port_resume_port_task_scheduler() argument
935 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
937 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_resume_port_task_scheduler()
942 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_waiting_enter() local
944 sci_port_suspend_port_task_scheduler(iport); in sci_port_ready_substate_waiting_enter()
946 iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; in sci_port_ready_substate_waiting_enter()
948 if (iport->active_phy_mask != 0) { in sci_port_ready_substate_waiting_enter()
950 port_state_machine_change(iport, in sci_port_ready_substate_waiting_enter()
958 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in scic_sds_port_ready_substate_waiting_exit() local
959 sci_port_resume_port_task_scheduler(iport); in scic_sds_port_ready_substate_waiting_exit()
965 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_operational_enter() local
966 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_enter()
969 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_enter()
972 if (iport->phy_table[index]) { in sci_port_ready_substate_operational_enter()
973 writel(iport->physical_port_index, in sci_port_ready_substate_operational_enter()
974 &iport->port_pe_configuration_register[ in sci_port_ready_substate_operational_enter()
975 iport->phy_table[index]->phy_index]); in sci_port_ready_substate_operational_enter()
976 if (((iport->active_phy_mask^iport->enabled_phy_mask) & (1 << index)) != 0) in sci_port_ready_substate_operational_enter()
977 sci_port_resume_phy(iport, iport->phy_table[index]); in sci_port_ready_substate_operational_enter()
981 sci_port_update_viit_entry(iport); in sci_port_ready_substate_operational_enter()
987 sci_port_post_dummy_request(iport); in sci_port_ready_substate_operational_enter()
990 static void sci_port_invalidate_dummy_remote_node(struct isci_port *iport) in sci_port_invalidate_dummy_remote_node() argument
992 struct isci_host *ihost = iport->owning_controller; in sci_port_invalidate_dummy_remote_node()
993 u8 phys_index = iport->physical_port_index; in sci_port_invalidate_dummy_remote_node()
995 u16 rni = iport->reserved_rni; in sci_port_invalidate_dummy_remote_node()
1025 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_operational_exit() local
1026 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_operational_exit()
1033 sci_port_abort_dummy_request(iport); in sci_port_ready_substate_operational_exit()
1036 __func__, iport->physical_port_index); in sci_port_ready_substate_operational_exit()
1038 if (iport->ready_exit) in sci_port_ready_substate_operational_exit()
1039 sci_port_invalidate_dummy_remote_node(iport); in sci_port_ready_substate_operational_exit()
1044 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_substate_configuring_enter() local
1045 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_substate_configuring_enter()
1047 if (iport->active_phy_mask == 0) { in sci_port_ready_substate_configuring_enter()
1049 __func__, iport->physical_port_index); in sci_port_ready_substate_configuring_enter()
1051 port_state_machine_change(iport, SCI_PORT_SUB_WAITING); in sci_port_ready_substate_configuring_enter()
1053 port_state_machine_change(iport, SCI_PORT_SUB_OPERATIONAL); in sci_port_ready_substate_configuring_enter()
1056 enum sci_status sci_port_start(struct isci_port *iport) in sci_port_start() argument
1058 struct isci_host *ihost = iport->owning_controller; in sci_port_start()
1063 state = iport->sm.current_state_id; in sci_port_start()
1065 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_start()
1070 if (iport->assigned_device_count > 0) { in sci_port_start()
1079 if (iport->reserved_rni == SCU_DUMMY_INDEX) { in sci_port_start()
1084 sci_port_construct_dummy_rnc(iport, rni); in sci_port_start()
1087 iport->reserved_rni = rni; in sci_port_start()
1090 if (iport->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { in sci_port_start()
1097 sci_port_construct_dummy_task(iport, tag); in sci_port_start()
1098 iport->reserved_tag = tag; in sci_port_start()
1102 phy_mask = sci_port_get_phys(iport); in sci_port_start()
1109 if (sci_port_is_phy_mask_valid(iport, phy_mask) == true) { in sci_port_start()
1110 port_state_machine_change(iport, in sci_port_start()
1119 sci_port_destroy_dummy_resources(iport); in sci_port_start()
1124 enum sci_status sci_port_stop(struct isci_port *iport) in sci_port_stop() argument
1128 state = iport->sm.current_state_id; in sci_port_stop()
1136 port_state_machine_change(iport, in sci_port_stop()
1140 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_stop()
1146 static enum sci_status sci_port_hard_reset(struct isci_port *iport, u32 timeout) in sci_port_hard_reset() argument
1153 state = iport->sm.current_state_id; in sci_port_hard_reset()
1155 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_hard_reset()
1162 iphy = iport->phy_table[phy_index]; in sci_port_hard_reset()
1163 if (iphy && !sci_port_active_phy(iport, iphy)) { in sci_port_hard_reset()
1180 sci_mod_timer(&iport->timer, timeout); in sci_port_hard_reset()
1181 iport->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; in sci_port_hard_reset()
1183 port_state_machine_change(iport, SCI_PORT_RESETTING); in sci_port_hard_reset()
1196 enum sci_status sci_port_add_phy(struct isci_port *iport, in sci_port_add_phy() argument
1202 sci_port_bcn_enable(iport); in sci_port_add_phy()
1204 state = iport->sm.current_state_id; in sci_port_add_phy()
1210 sci_port_get_sas_address(iport, &port_sas_address); in sci_port_add_phy()
1224 return sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1228 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1233 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_add_phy()
1234 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_add_phy()
1235 port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); in sci_port_add_phy()
1239 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1243 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY); in sci_port_add_phy()
1248 port_state_machine_change(iport, in sci_port_add_phy()
1252 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_add_phy()
1267 enum sci_status sci_port_remove_phy(struct isci_port *iport, in sci_port_remove_phy() argument
1273 state = iport->sm.current_state_id; in sci_port_remove_phy()
1277 return sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1279 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1283 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1284 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; in sci_port_remove_phy()
1285 port_state_machine_change(iport, in sci_port_remove_phy()
1289 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1293 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1298 port_state_machine_change(iport, in sci_port_remove_phy()
1302 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_remove_phy()
1308 enum sci_status sci_port_link_up(struct isci_port *iport, in sci_port_link_up() argument
1313 state = iport->sm.current_state_id; in sci_port_link_up()
1319 sci_port_activate_phy(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1321 port_state_machine_change(iport, in sci_port_link_up()
1325 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1342 sci_port_general_link_up_handler(iport, iphy, PF_RESUME); in sci_port_link_up()
1345 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_up()
1351 enum sci_status sci_port_link_down(struct isci_port *iport, in sci_port_link_down() argument
1356 state = iport->sm.current_state_id; in sci_port_link_down()
1359 sci_port_deactivate_phy(iport, iphy, true); in sci_port_link_down()
1365 if (iport->active_phy_mask == 0) in sci_port_link_down()
1366 port_state_machine_change(iport, in sci_port_link_down()
1372 sci_port_deactivate_phy(iport, iphy, false); in sci_port_link_down()
1375 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_link_down()
1381 enum sci_status sci_port_start_io(struct isci_port *iport, in sci_port_start_io() argument
1387 state = iport->sm.current_state_id; in sci_port_start_io()
1392 iport->started_request_count++; in sci_port_start_io()
1395 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_start_io()
1401 enum sci_status sci_port_complete_io(struct isci_port *iport, in sci_port_complete_io() argument
1407 state = iport->sm.current_state_id; in sci_port_complete_io()
1410 dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", in sci_port_complete_io()
1414 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1416 if (iport->started_request_count == 0) in sci_port_complete_io()
1417 port_state_machine_change(iport, in sci_port_complete_io()
1425 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1428 sci_port_decrement_request_count(iport); in sci_port_complete_io()
1429 if (iport->started_request_count == 0) { in sci_port_complete_io()
1430 port_state_machine_change(iport, in sci_port_complete_io()
1438 static void sci_port_enable_port_task_scheduler(struct isci_port *iport) in sci_port_enable_port_task_scheduler() argument
1443 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1445 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_enable_port_task_scheduler()
1448 static void sci_port_disable_port_task_scheduler(struct isci_port *iport) in sci_port_disable_port_task_scheduler() argument
1452 pts_control_value = readl(&iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1455 writel(pts_control_value, &iport->port_task_scheduler_registers->control); in sci_port_disable_port_task_scheduler()
1458 static void sci_port_post_dummy_remote_node(struct isci_port *iport) in sci_port_post_dummy_remote_node() argument
1460 struct isci_host *ihost = iport->owning_controller; in sci_port_post_dummy_remote_node()
1461 u8 phys_index = iport->physical_port_index; in sci_port_post_dummy_remote_node()
1463 u16 rni = iport->reserved_rni; in sci_port_post_dummy_remote_node()
1488 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopped_state_enter() local
1490 if (iport->sm.previous_state_id == SCI_PORT_STOPPING) { in sci_port_stopped_state_enter()
1495 sci_port_disable_port_task_scheduler(iport); in sci_port_stopped_state_enter()
1501 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopped_state_exit() local
1504 sci_port_enable_port_task_scheduler(iport); in sci_port_stopped_state_exit()
1509 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_ready_state_enter() local
1510 struct isci_host *ihost = iport->owning_controller; in sci_port_ready_state_enter()
1513 prev_state = iport->sm.previous_state_id; in sci_port_ready_state_enter()
1515 isci_port_hard_reset_complete(iport, SCI_SUCCESS); in sci_port_ready_state_enter()
1518 __func__, iport->physical_port_index); in sci_port_ready_state_enter()
1521 sci_port_post_dummy_remote_node(iport); in sci_port_ready_state_enter()
1524 port_state_machine_change(iport, in sci_port_ready_state_enter()
1530 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_resetting_state_exit() local
1532 sci_del_timer(&iport->timer); in sci_port_resetting_state_exit()
1537 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_stopping_state_exit() local
1539 sci_del_timer(&iport->timer); in sci_port_stopping_state_exit()
1541 sci_port_destroy_dummy_resources(iport); in sci_port_stopping_state_exit()
1546 struct isci_port *iport = container_of(sm, typeof(*iport), sm); in sci_port_failed_state_enter() local
1548 isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); in sci_port_failed_state_enter()
1551 void sci_port_set_hang_detection_timeout(struct isci_port *iport, u32 timeout) in sci_port_set_hang_detection_timeout() argument
1554 u32 phy_mask = iport->active_phy_mask; in sci_port_set_hang_detection_timeout()
1557 ++iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1558 else if (iport->hang_detect_users > 1) in sci_port_set_hang_detection_timeout()
1559 --iport->hang_detect_users; in sci_port_set_hang_detection_timeout()
1561 iport->hang_detect_users = 0; in sci_port_set_hang_detection_timeout()
1563 if (timeout || (iport->hang_detect_users == 0)) { in sci_port_set_hang_detection_timeout()
1567 &iport->phy_table[phy_index] in sci_port_set_hang_detection_timeout()
1606 void sci_port_construct(struct isci_port *iport, u8 index, in sci_port_construct() argument
1609 sci_init_sm(&iport->sm, sci_port_state_table, SCI_PORT_STOPPED); in sci_port_construct()
1611 iport->logical_port_index = SCIC_SDS_DUMMY_PORT; in sci_port_construct()
1612 iport->physical_port_index = index; in sci_port_construct()
1613 iport->active_phy_mask = 0; in sci_port_construct()
1614 iport->enabled_phy_mask = 0; in sci_port_construct()
1615 iport->last_active_phy = 0; in sci_port_construct()
1616 iport->ready_exit = false; in sci_port_construct()
1618 iport->owning_controller = ihost; in sci_port_construct()
1620 iport->started_request_count = 0; in sci_port_construct()
1621 iport->assigned_device_count = 0; in sci_port_construct()
1622 iport->hang_detect_users = 0; in sci_port_construct()
1624 iport->reserved_rni = SCU_DUMMY_INDEX; in sci_port_construct()
1625 iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; in sci_port_construct()
1627 sci_init_timer(&iport->timer, port_timeout); in sci_port_construct()
1629 iport->port_task_scheduler_registers = NULL; in sci_port_construct()
1632 iport->phy_table[index] = NULL; in sci_port_construct()
1635 void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) in sci_port_broadcast_change_received() argument
1637 struct isci_host *ihost = iport->owning_controller; in sci_port_broadcast_change_received()
1640 isci_port_bc_change_received(ihost, iport, iphy); in sci_port_broadcast_change_received()
1643 static void wait_port_reset(struct isci_host *ihost, struct isci_port *iport) in wait_port_reset() argument
1645 wait_event(ihost->eventq, !test_bit(IPORT_RESET_PENDING, &iport->state)); in wait_port_reset()
1648 int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, in isci_port_perform_hard_reset() argument
1656 __func__, iport); in isci_port_perform_hard_reset()
1659 set_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1662 status = sci_port_hard_reset(iport, ISCI_PORT_RESET_TIMEOUT); in isci_port_perform_hard_reset()
1667 wait_port_reset(ihost, iport); in isci_port_perform_hard_reset()
1671 __func__, iport); in isci_port_perform_hard_reset()
1673 if (iport->hard_reset_status != SCI_SUCCESS) { in isci_port_perform_hard_reset()
1678 __func__, iport, iport->hard_reset_status); in isci_port_perform_hard_reset()
1681 clear_bit(IPORT_RESET_PENDING, &iport->state); in isci_port_perform_hard_reset()
1688 __func__, iport, status); in isci_port_perform_hard_reset()
1696 struct isci_port *iport = dev->port->lldd_port; in isci_ata_check_ready() local
1709 if (test_bit(IPORT_RESET_PENDING, &iport->state)) in isci_ata_check_ready()
1712 rc = !!iport->active_phy_mask; in isci_ata_check_ready()
1722 struct isci_port *iport = phy->port->lldd_port; in isci_port_deformed() local
1729 if (!iport) in isci_port_deformed()
1734 if (iport->active_phy_mask & 1 << i) in isci_port_deformed()
1741 __func__, (long) (iport - &ihost->ports[0])); in isci_port_deformed()
1749 struct isci_port *iport = NULL; in isci_port_formed() local
1760 iport = &ihost->ports[i]; in isci_port_formed()
1761 if (iport->active_phy_mask & 1 << iphy->phy_index) in isci_port_formed()
1767 iport = NULL; in isci_port_formed()
1769 port->lldd_port = iport; in isci_port_formed()