Lines Matching refs:idev
75 enum sci_status sci_remote_device_suspend(struct isci_remote_device *idev, in sci_remote_device_suspend() argument
78 return sci_remote_node_context_suspend(&idev->rnc, reason, in sci_remote_device_suspend()
90 static void isci_remote_device_ready(struct isci_host *ihost, struct isci_remote_device *idev) in isci_remote_device_ready() argument
93 "%s: idev = %p\n", __func__, idev); in isci_remote_device_ready()
95 clear_bit(IDEV_IO_NCQERROR, &idev->flags); in isci_remote_device_ready()
96 set_bit(IDEV_IO_READY, &idev->flags); in isci_remote_device_ready()
97 if (test_and_clear_bit(IDEV_START_PENDING, &idev->flags)) in isci_remote_device_ready()
103 struct isci_remote_device *idev, in sci_remote_device_terminate_req() argument
108 (ireq->target_device != idev) || in sci_remote_device_terminate_req()
114 __func__, idev, idev->flags, ireq, ireq->target_device); in sci_remote_device_terminate_req()
118 return sci_controller_terminate_request(ihost, idev, ireq); in sci_remote_device_terminate_req()
122 struct isci_remote_device *idev, in sci_remote_device_terminate_reqs_checkabort() argument
125 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_terminate_reqs_checkabort()
133 s = sci_remote_device_terminate_req(ihost, idev, chk, ireq); in sci_remote_device_terminate_reqs_checkabort()
141 struct isci_remote_device *idev, in isci_compare_suspendcount() argument
149 return (localcount != idev->rnc.suspend_count) in isci_compare_suspendcount()
150 || sci_remote_node_context_is_being_destroyed(&idev->rnc); in isci_compare_suspendcount()
155 struct isci_remote_device *idev, in isci_check_reqterm() argument
163 res = isci_compare_suspendcount(idev, localcount) in isci_check_reqterm()
172 struct isci_remote_device *idev, in isci_check_devempty() argument
179 res = isci_compare_suspendcount(idev, localcount) in isci_check_devempty()
180 && idev->started_request_count == 0; in isci_check_devempty()
188 struct isci_remote_device *idev, in isci_remote_device_terminate_requests() argument
197 if (isci_get_device(idev) == NULL) { in isci_remote_device_terminate_requests()
199 __func__, idev); in isci_remote_device_terminate_requests()
206 = sci_remote_node_context_is_suspended(&idev->rnc) in isci_remote_device_terminate_requests()
207 ? 0 : idev->rnc.suspend_count; in isci_remote_device_terminate_requests()
213 __func__, idev, ireq, idev->started_request_count, in isci_remote_device_terminate_requests()
214 rnc_suspend_count, idev->rnc.suspend_count); in isci_remote_device_terminate_requests()
220 sci_remote_device_terminate_req(ihost, idev, 0, ireq); in isci_remote_device_terminate_requests()
223 isci_check_reqterm(ihost, idev, ireq, in isci_remote_device_terminate_requests()
237 __func__, idev, in isci_remote_device_terminate_requests()
238 dev_state_name(idev->sm.current_state_id), in isci_remote_device_terminate_requests()
239 idev->started_request_count, idev->flags, in isci_remote_device_terminate_requests()
240 rnc_suspend_count, idev->rnc.suspend_count, in isci_remote_device_terminate_requests()
241 rnc_state_name(idev->rnc.sm.current_state_id), in isci_remote_device_terminate_requests()
242 idev->rnc.suspend_type, in isci_remote_device_terminate_requests()
243 idev->rnc.destination_state, in isci_remote_device_terminate_requests()
253 sci_remote_device_terminate_requests(idev); in isci_remote_device_terminate_requests()
256 isci_check_devempty(ihost, idev, in isci_remote_device_terminate_requests()
270 __func__, idev, in isci_remote_device_terminate_requests()
271 dev_state_name(idev->sm.current_state_id), in isci_remote_device_terminate_requests()
272 idev->started_request_count, idev->flags, in isci_remote_device_terminate_requests()
274 rnc_state_name(idev->rnc.sm.current_state_id), in isci_remote_device_terminate_requests()
275 idev->rnc.suspend_count, in isci_remote_device_terminate_requests()
276 idev->rnc.suspend_type, in isci_remote_device_terminate_requests()
277 idev->rnc.destination_state); in isci_remote_device_terminate_requests()
281 __func__, idev); in isci_remote_device_terminate_requests()
282 isci_put_device(idev); in isci_remote_device_terminate_requests()
298 struct isci_remote_device *idev, in isci_remote_device_not_ready() argument
302 "%s: isci_device = %p; reason = %d\n", __func__, idev, reason); in isci_remote_device_not_ready()
306 set_bit(IDEV_IO_NCQERROR, &idev->flags); in isci_remote_device_not_ready()
309 sci_remote_device_suspend(idev, SCI_SW_SUSPEND_NORMAL); in isci_remote_device_not_ready()
312 sci_remote_device_terminate_requests(idev); in isci_remote_device_not_ready()
316 clear_bit(IDEV_IO_READY, &idev->flags); in isci_remote_device_not_ready()
326 struct isci_remote_device *idev = _dev; in rnc_destruct_done() local
328 BUG_ON(idev->started_request_count != 0); in rnc_destruct_done()
329 sci_change_state(&idev->sm, SCI_DEV_STOPPED); in rnc_destruct_done()
333 struct isci_remote_device *idev) in sci_remote_device_terminate_requests() argument
335 return sci_remote_device_terminate_reqs_checkabort(idev, 0); in sci_remote_device_terminate_requests()
338 enum sci_status sci_remote_device_stop(struct isci_remote_device *idev, in sci_remote_device_stop() argument
341 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_stop()
349 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_stop()
356 BUG_ON(idev->started_request_count != 0); in sci_remote_device_stop()
357 sci_remote_node_context_destruct(&idev->rnc, in sci_remote_device_stop()
358 rnc_destruct_done, idev); in sci_remote_device_stop()
373 if (idev->started_request_count == 0) in sci_remote_device_stop()
374 sci_remote_node_context_destruct(&idev->rnc, in sci_remote_device_stop()
376 idev); in sci_remote_device_stop()
379 idev, SCI_SW_SUSPEND_LINKHANG_DETECT); in sci_remote_device_stop()
380 sci_remote_device_terminate_requests(idev); in sci_remote_device_stop()
388 return sci_remote_device_terminate_requests(idev); in sci_remote_device_stop()
395 enum sci_status sci_remote_device_reset(struct isci_remote_device *idev) in sci_remote_device_reset() argument
397 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_reset()
411 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_reset()
425 enum sci_status sci_remote_device_reset_complete(struct isci_remote_device *idev) in sci_remote_device_reset_complete() argument
427 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_reset_complete()
431 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_reset_complete()
440 enum sci_status sci_remote_device_frame_handler(struct isci_remote_device *idev, in sci_remote_device_frame_handler() argument
443 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_frame_handler()
445 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_frame_handler()
456 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_frame_handler()
482 if (ireq && ireq->target_device == idev) { in sci_remote_device_frame_handler()
504 idev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; in sci_remote_device_frame_handler()
514 idev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; in sci_remote_device_frame_handler()
515 sci_change_state(&idev->sm, SCI_STP_DEV_NCQ_ERROR); in sci_remote_device_frame_handler()
528 status = sci_io_request_frame_handler(idev->working_request, frame_index); in sci_remote_device_frame_handler()
535 static bool is_remote_device_ready(struct isci_remote_device *idev) in is_remote_device_ready() argument
538 struct sci_base_state_machine *sm = &idev->sm; in is_remote_device_ready()
562 struct isci_remote_device *idev = _dev; in atapi_remote_device_resume_done() local
563 struct isci_request *ireq = idev->working_request; in atapi_remote_device_resume_done()
568 enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev, in sci_remote_device_event_handler() argument
572 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_event_handler()
579 status = sci_remote_node_context_event_handler(&idev->rnc, event_code); in sci_remote_device_event_handler()
586 sci_remote_device_suspend(idev, SCI_SW_SUSPEND_NORMAL); in sci_remote_device_event_handler()
588 dev_dbg(scirdev_to_dev(idev), in sci_remote_device_event_handler()
590 __func__, idev, event_code, in sci_remote_device_event_handler()
591 is_remote_device_ready(idev) in sci_remote_device_event_handler()
599 dev_dbg(scirdev_to_dev(idev), in sci_remote_device_event_handler()
601 __func__, idev, event_code, in sci_remote_device_event_handler()
602 is_remote_device_ready(idev) in sci_remote_device_event_handler()
620 return sci_remote_node_context_resume(&idev->rnc, in sci_remote_device_event_handler()
622 idev); in sci_remote_device_event_handler()
633 status = sci_remote_node_context_resume(&idev->rnc, NULL, NULL); in sci_remote_device_event_handler()
639 static void sci_remote_device_start_request(struct isci_remote_device *idev, in sci_remote_device_start_request() argument
643 struct isci_port *iport = idev->owning_port; in sci_remote_device_start_request()
647 sci_port_complete_io(iport, idev, ireq); in sci_remote_device_start_request()
649 kref_get(&idev->kref); in sci_remote_device_start_request()
650 idev->started_request_count++; in sci_remote_device_start_request()
655 struct isci_remote_device *idev, in sci_remote_device_start_io() argument
658 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_start_io()
660 struct isci_port *iport = idev->owning_port; in sci_remote_device_start_io()
673 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_start_io()
682 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_io()
686 status = sci_remote_node_context_start_io(&idev->rnc, ireq); in sci_remote_device_start_io()
704 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_io()
708 status = sci_remote_node_context_start_io(&idev->rnc, ireq); in sci_remote_device_start_io()
719 idev->working_request = ireq; in sci_remote_device_start_io()
729 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_io()
733 status = sci_remote_node_context_start_io(&idev->rnc, ireq); in sci_remote_device_start_io()
745 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_io()
749 status = sci_remote_node_context_start_io(&idev->rnc, ireq); in sci_remote_device_start_io()
757 idev->working_request = ireq; in sci_remote_device_start_io()
758 sci_change_state(&idev->sm, SCI_SMP_DEV_CMD); in sci_remote_device_start_io()
768 sci_remote_device_start_request(idev, ireq, status); in sci_remote_device_start_io()
773 struct isci_remote_device *idev, in common_complete_io() argument
782 status = sci_port_complete_io(iport, idev, ireq); in common_complete_io()
786 sci_remote_device_decrement_request_count(idev); in common_complete_io()
791 struct isci_remote_device *idev, in sci_remote_device_complete_io() argument
794 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_complete_io()
796 struct isci_port *iport = idev->owning_port; in sci_remote_device_complete_io()
808 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_complete_io()
814 status = common_complete_io(iport, idev, ireq); in sci_remote_device_complete_io()
820 status = common_complete_io(iport, idev, ireq); in sci_remote_device_complete_io()
831 } else if (idev->started_request_count == 0) in sci_remote_device_complete_io()
835 status = common_complete_io(iport, idev, ireq); in sci_remote_device_complete_io()
841 status = common_complete_io(iport, idev, ireq); in sci_remote_device_complete_io()
845 if (idev->started_request_count == 0) in sci_remote_device_complete_io()
846 sci_remote_node_context_destruct(&idev->rnc, in sci_remote_device_complete_io()
848 idev); in sci_remote_device_complete_io()
853 dev_err(scirdev_to_dev(idev), in sci_remote_device_complete_io()
856 idev, ireq, status); in sci_remote_device_complete_io()
858 isci_put_device(idev); in sci_remote_device_complete_io()
865 struct isci_remote_device *idev = dev; in sci_remote_device_continue_request() local
868 if (idev->working_request) in sci_remote_device_continue_request()
869 sci_controller_continue_io(idev->working_request); in sci_remote_device_continue_request()
873 struct isci_remote_device *idev, in sci_remote_device_start_task() argument
876 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_start_task()
878 struct isci_port *iport = idev->owning_port; in sci_remote_device_start_task()
892 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_start_task()
900 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_task()
912 idev->working_request = ireq; in sci_remote_device_start_task()
922 sci_remote_device_suspend(idev, in sci_remote_device_start_task()
925 status = sci_remote_node_context_start_task(&idev->rnc, ireq, in sci_remote_device_start_task()
926 sci_remote_device_continue_request, idev); in sci_remote_device_start_task()
929 sci_remote_device_start_request(idev, ireq, status); in sci_remote_device_start_task()
936 status = sci_port_start_io(iport, idev, ireq); in sci_remote_device_start_task()
941 status = sci_remote_node_context_start_task(&idev->rnc, ireq, in sci_remote_device_start_task()
949 sci_remote_device_start_request(idev, ireq, status); in sci_remote_device_start_task()
954 void sci_remote_device_post_request(struct isci_remote_device *idev, u32 request) in sci_remote_device_post_request() argument
956 struct isci_port *iport = idev->owning_port; in sci_remote_device_post_request()
962 idev->rnc.remote_node_index; in sci_remote_device_post_request()
973 struct isci_remote_device *idev = _dev; in remote_device_resume_done() local
975 if (is_remote_device_ready(idev)) in remote_device_resume_done()
979 sci_change_state(&idev->sm, SCI_DEV_READY); in remote_device_resume_done()
984 struct isci_remote_device *idev = _dev; in sci_stp_remote_device_ready_idle_substate_resume_complete_handler() local
985 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_stp_remote_device_ready_idle_substate_resume_complete_handler()
990 if (idev->sm.previous_state_id != SCI_STP_DEV_NCQ) in sci_stp_remote_device_ready_idle_substate_resume_complete_handler()
991 isci_remote_device_ready(ihost, idev); in sci_stp_remote_device_ready_idle_substate_resume_complete_handler()
996 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_initial_state_enter() local
999 sci_change_state(&idev->sm, SCI_DEV_STOPPED); in sci_remote_device_initial_state_enter()
1015 static enum sci_status sci_remote_device_destruct(struct isci_remote_device *idev) in sci_remote_device_destruct() argument
1017 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_destruct()
1022 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_destruct()
1027 ihost = idev->owning_port->owning_controller; in sci_remote_device_destruct()
1028 sci_controller_free_remote_node_context(ihost, idev, in sci_remote_device_destruct()
1029 idev->rnc.remote_node_index); in sci_remote_device_destruct()
1030 idev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; in sci_remote_device_destruct()
1042 static void isci_remote_device_deconstruct(struct isci_host *ihost, struct isci_remote_device *idev) in isci_remote_device_deconstruct() argument
1045 "%s: isci_device = %p\n", __func__, idev); in isci_remote_device_deconstruct()
1051 BUG_ON(idev->started_request_count > 0); in isci_remote_device_deconstruct()
1053 sci_remote_device_destruct(idev); in isci_remote_device_deconstruct()
1054 list_del_init(&idev->node); in isci_remote_device_deconstruct()
1055 isci_put_device(idev); in isci_remote_device_deconstruct()
1060 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_stopped_state_enter() local
1061 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_stopped_state_enter()
1067 prev_state = idev->sm.previous_state_id; in sci_remote_device_stopped_state_enter()
1069 isci_remote_device_deconstruct(ihost, idev); in sci_remote_device_stopped_state_enter()
1071 sci_controller_remote_device_stopped(ihost, idev); in sci_remote_device_stopped_state_enter()
1076 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_starting_state_enter() local
1077 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_starting_state_enter()
1079 isci_remote_device_not_ready(ihost, idev, in sci_remote_device_starting_state_enter()
1085 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_ready_state_enter() local
1086 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_ready_state_enter()
1087 struct domain_device *dev = idev->domain_dev; in sci_remote_device_ready_state_enter()
1090 sci_change_state(&idev->sm, SCI_STP_DEV_IDLE); in sci_remote_device_ready_state_enter()
1092 sci_change_state(&idev->sm, SCI_SMP_DEV_IDLE); in sci_remote_device_ready_state_enter()
1094 isci_remote_device_ready(ihost, idev); in sci_remote_device_ready_state_enter()
1099 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_ready_state_exit() local
1100 struct domain_device *dev = idev->domain_dev; in sci_remote_device_ready_state_exit()
1103 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_ready_state_exit()
1105 isci_remote_device_not_ready(ihost, idev, in sci_remote_device_ready_state_exit()
1112 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_resetting_state_enter() local
1113 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_resetting_state_enter()
1116 "%s: isci_device = %p\n", __func__, idev); in sci_remote_device_resetting_state_enter()
1118 sci_remote_device_suspend(idev, SCI_SW_SUSPEND_LINKHANG_DETECT); in sci_remote_device_resetting_state_enter()
1123 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_remote_device_resetting_state_exit() local
1124 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_remote_device_resetting_state_exit()
1127 "%s: isci_device = %p\n", __func__, idev); in sci_remote_device_resetting_state_exit()
1129 sci_remote_node_context_resume(&idev->rnc, NULL, NULL); in sci_remote_device_resetting_state_exit()
1134 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_stp_remote_device_ready_idle_substate_enter() local
1136 idev->working_request = NULL; in sci_stp_remote_device_ready_idle_substate_enter()
1137 if (sci_remote_node_context_is_ready(&idev->rnc)) { in sci_stp_remote_device_ready_idle_substate_enter()
1141 sci_stp_remote_device_ready_idle_substate_resume_complete_handler(idev); in sci_stp_remote_device_ready_idle_substate_enter()
1143 sci_remote_node_context_resume(&idev->rnc, in sci_stp_remote_device_ready_idle_substate_enter()
1145 idev); in sci_stp_remote_device_ready_idle_substate_enter()
1151 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_stp_remote_device_ready_cmd_substate_enter() local
1152 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_stp_remote_device_ready_cmd_substate_enter()
1154 BUG_ON(idev->working_request == NULL); in sci_stp_remote_device_ready_cmd_substate_enter()
1156 isci_remote_device_not_ready(ihost, idev, in sci_stp_remote_device_ready_cmd_substate_enter()
1162 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_stp_remote_device_ready_ncq_error_substate_enter() local
1163 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_stp_remote_device_ready_ncq_error_substate_enter()
1165 if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) in sci_stp_remote_device_ready_ncq_error_substate_enter()
1166 isci_remote_device_not_ready(ihost, idev, in sci_stp_remote_device_ready_ncq_error_substate_enter()
1167 idev->not_ready_reason); in sci_stp_remote_device_ready_ncq_error_substate_enter()
1172 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_smp_remote_device_ready_idle_substate_enter() local
1173 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_smp_remote_device_ready_idle_substate_enter()
1175 isci_remote_device_ready(ihost, idev); in sci_smp_remote_device_ready_idle_substate_enter()
1180 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_smp_remote_device_ready_cmd_substate_enter() local
1181 struct isci_host *ihost = idev->owning_port->owning_controller; in sci_smp_remote_device_ready_cmd_substate_enter()
1183 BUG_ON(idev->working_request == NULL); in sci_smp_remote_device_ready_cmd_substate_enter()
1185 isci_remote_device_not_ready(ihost, idev, in sci_smp_remote_device_ready_cmd_substate_enter()
1191 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); in sci_smp_remote_device_ready_cmd_substate_exit() local
1193 idev->working_request = NULL; in sci_smp_remote_device_ready_cmd_substate_exit()
1249 struct isci_remote_device *idev) in sci_remote_device_construct() argument
1251 idev->owning_port = iport; in sci_remote_device_construct()
1252 idev->started_request_count = 0; in sci_remote_device_construct()
1254 sci_init_sm(&idev->sm, sci_remote_device_state_table, SCI_DEV_INITIAL); in sci_remote_device_construct()
1256 sci_remote_node_context_construct(&idev->rnc, in sci_remote_device_construct()
1275 struct isci_remote_device *idev) in sci_remote_device_da_construct() argument
1280 sci_remote_device_construct(iport, idev); in sci_remote_device_da_construct()
1284 idev->device_port_width = hweight32(properties.phy_mask); in sci_remote_device_da_construct()
1287 idev, in sci_remote_device_da_construct()
1288 &idev->rnc.remote_node_index); in sci_remote_device_da_construct()
1293 idev->connection_rate = sci_port_get_max_allowed_speed(iport); in sci_remote_device_da_construct()
1311 struct isci_remote_device *idev) in sci_remote_device_ea_construct() argument
1313 struct domain_device *dev = idev->domain_dev; in sci_remote_device_ea_construct()
1316 sci_remote_device_construct(iport, idev); in sci_remote_device_ea_construct()
1319 idev, in sci_remote_device_ea_construct()
1320 &idev->rnc.remote_node_index); in sci_remote_device_ea_construct()
1331 idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport), in sci_remote_device_ea_construct()
1335 idev->device_port_width = 1; in sci_remote_device_ea_construct()
1341 struct isci_remote_device *idev, in sci_remote_device_resume() argument
1347 status = sci_remote_node_context_resume(&idev->rnc, cb_fn, cb_p); in sci_remote_device_resume()
1349 dev_dbg(scirdev_to_dev(idev), "%s: failed to resume: %d\n", in sci_remote_device_resume()
1356 struct isci_remote_device *idev = cbparam; in isci_remote_device_resume_from_abort_complete() local
1357 struct isci_host *ihost = idev->owning_port->owning_controller; in isci_remote_device_resume_from_abort_complete()
1359 idev->abort_resume_cb; in isci_remote_device_resume_from_abort_complete()
1361 dev_dbg(scirdev_to_dev(idev), "%s: passing-along resume: %p\n", in isci_remote_device_resume_from_abort_complete()
1365 idev->abort_resume_cb = NULL; in isci_remote_device_resume_from_abort_complete()
1366 abort_resume_cb(idev->abort_resume_cbparam); in isci_remote_device_resume_from_abort_complete()
1368 clear_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags); in isci_remote_device_resume_from_abort_complete()
1374 struct isci_remote_device *idev) in isci_remote_device_test_resume_done() argument
1380 done = !test_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags) in isci_remote_device_test_resume_done()
1381 || test_bit(IDEV_STOP_PENDING, &idev->flags) in isci_remote_device_test_resume_done()
1382 || sci_remote_node_context_is_being_destroyed(&idev->rnc); in isci_remote_device_test_resume_done()
1390 struct isci_remote_device *idev) in isci_remote_device_wait_for_resume_from_abort() argument
1393 __func__, idev); in isci_remote_device_wait_for_resume_from_abort()
1397 isci_remote_device_test_resume_done(ihost, idev), in isci_remote_device_wait_for_resume_from_abort()
1401 "resume: %p\n", __func__, idev); in isci_remote_device_wait_for_resume_from_abort()
1403 clear_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags); in isci_remote_device_wait_for_resume_from_abort()
1406 __func__, idev); in isci_remote_device_wait_for_resume_from_abort()
1411 struct isci_remote_device *idev) in isci_remote_device_resume_from_abort() argument
1421 idev->abort_resume_cb = idev->rnc.user_callback; in isci_remote_device_resume_from_abort()
1422 idev->abort_resume_cbparam = idev->rnc.user_cookie; in isci_remote_device_resume_from_abort()
1423 set_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags); in isci_remote_device_resume_from_abort()
1424 clear_bit(IDEV_ABORT_PATH_ACTIVE, &idev->flags); in isci_remote_device_resume_from_abort()
1425 destroyed = sci_remote_node_context_is_being_destroyed(&idev->rnc); in isci_remote_device_resume_from_abort()
1428 idev, isci_remote_device_resume_from_abort_complete, in isci_remote_device_resume_from_abort()
1429 idev); in isci_remote_device_resume_from_abort()
1432 isci_remote_device_wait_for_resume_from_abort(ihost, idev); in isci_remote_device_resume_from_abort()
1434 clear_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags); in isci_remote_device_resume_from_abort()
1452 static enum sci_status sci_remote_device_start(struct isci_remote_device *idev, in sci_remote_device_start() argument
1455 struct sci_base_state_machine *sm = &idev->sm; in sci_remote_device_start()
1460 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", in sci_remote_device_start()
1465 status = sci_remote_device_resume(idev, remote_device_resume_done, in sci_remote_device_start()
1466 idev); in sci_remote_device_start()
1476 struct isci_remote_device *idev) in isci_remote_device_construct() argument
1479 struct domain_device *dev = idev->domain_dev; in isci_remote_device_construct()
1483 status = sci_remote_device_ea_construct(iport, idev); in isci_remote_device_construct()
1485 status = sci_remote_device_da_construct(iport, idev); in isci_remote_device_construct()
1495 status = sci_remote_device_start(idev, ISCI_REMOTE_DEVICE_START_TIMEOUT); in isci_remote_device_construct()
1516 struct isci_remote_device *idev; in isci_remote_device_alloc() local
1520 idev = &ihost->devices[i]; in isci_remote_device_alloc()
1521 if (!test_and_set_bit(IDEV_ALLOCATED, &idev->flags)) in isci_remote_device_alloc()
1529 if (WARN_ONCE(!list_empty(&idev->node), "found non-idle remote device\n")) in isci_remote_device_alloc()
1532 return idev; in isci_remote_device_alloc()
1537 struct isci_remote_device *idev = container_of(kref, typeof(*idev), kref); in isci_remote_device_release() local
1538 struct isci_host *ihost = idev->isci_port->isci_host; in isci_remote_device_release()
1540 idev->domain_dev = NULL; in isci_remote_device_release()
1541 idev->isci_port = NULL; in isci_remote_device_release()
1542 clear_bit(IDEV_START_PENDING, &idev->flags); in isci_remote_device_release()
1543 clear_bit(IDEV_STOP_PENDING, &idev->flags); in isci_remote_device_release()
1544 clear_bit(IDEV_IO_READY, &idev->flags); in isci_remote_device_release()
1545 clear_bit(IDEV_GONE, &idev->flags); in isci_remote_device_release()
1547 clear_bit(IDEV_ALLOCATED, &idev->flags); in isci_remote_device_release()
1559 enum sci_status isci_remote_device_stop(struct isci_host *ihost, struct isci_remote_device *idev) in isci_remote_device_stop() argument
1565 "%s: isci_device = %p\n", __func__, idev); in isci_remote_device_stop()
1568 idev->domain_dev->lldd_dev = NULL; /* disable new lookups */ in isci_remote_device_stop()
1569 set_bit(IDEV_GONE, &idev->flags); in isci_remote_device_stop()
1571 set_bit(IDEV_STOP_PENDING, &idev->flags); in isci_remote_device_stop()
1572 status = sci_remote_device_stop(idev, 50); in isci_remote_device_stop()
1579 wait_for_device_stop(ihost, idev); in isci_remote_device_stop()
1582 "%s: isci_device = %p, waiting done.\n", __func__, idev); in isci_remote_device_stop()
1595 struct isci_remote_device *idev = dev->lldd_dev; in isci_remote_device_gone() local
1599 __func__, dev, idev, idev->isci_port); in isci_remote_device_gone()
1601 isci_remote_device_stop(ihost, idev); in isci_remote_device_gone()
1661 struct isci_remote_device *idev, in isci_remote_device_suspend_terminate() argument
1669 set_bit(IDEV_ABORT_PATH_ACTIVE, &idev->flags); in isci_remote_device_suspend_terminate()
1670 sci_remote_device_suspend(idev, SCI_SW_SUSPEND_LINKHANG_DETECT); in isci_remote_device_suspend_terminate()
1674 status = isci_remote_device_terminate_requests(ihost, idev, ireq); in isci_remote_device_suspend_terminate()
1679 __func__, idev, status); in isci_remote_device_suspend_terminate()
1686 struct isci_remote_device *idev) in isci_remote_device_is_safe_to_abort() argument
1688 return sci_remote_node_context_is_safe_to_abort(&idev->rnc); in isci_remote_device_is_safe_to_abort()
1692 struct isci_remote_device *idev) in sci_remote_device_abort_requests_pending_abort() argument
1694 return sci_remote_device_terminate_reqs_checkabort(idev, 1); in sci_remote_device_abort_requests_pending_abort()
1699 struct isci_remote_device *idev) in isci_remote_device_reset_complete() argument
1705 status = sci_remote_device_reset_complete(idev); in isci_remote_device_reset_complete()
1712 struct isci_remote_device *idev, in isci_dev_set_hang_detection_timeout() argument
1715 if (dev_is_sata(idev->domain_dev)) { in isci_dev_set_hang_detection_timeout()
1718 &idev->flags)) in isci_dev_set_hang_detection_timeout()
1721 &idev->flags)) in isci_dev_set_hang_detection_timeout()
1724 sci_port_set_hang_detection_timeout(idev->owning_port, in isci_dev_set_hang_detection_timeout()