Lines Matching refs:ireq
74 static struct scu_sgl_element_pair *to_sgl_element_pair(struct isci_request *ireq, in to_sgl_element_pair() argument
78 return &ireq->tc->sgl_pair_ab; in to_sgl_element_pair()
80 return &ireq->tc->sgl_pair_cd; in to_sgl_element_pair()
84 return &ireq->sg_table[idx - 2]; in to_sgl_element_pair()
88 struct isci_request *ireq, u32 idx) in to_sgl_element_pair_dma() argument
93 offset = (void *) &ireq->tc->sgl_pair_ab - in to_sgl_element_pair_dma()
97 offset = (void *) &ireq->tc->sgl_pair_cd - in to_sgl_element_pair_dma()
102 return sci_io_request_get_dma_addr(ireq, &ireq->sg_table[idx - 2]); in to_sgl_element_pair_dma()
113 static void sci_request_build_sgl(struct isci_request *ireq) in sci_request_build_sgl() argument
115 struct isci_host *ihost = ireq->isci_host; in sci_request_build_sgl()
116 struct sas_task *task = isci_request_access_task(ireq); in sci_request_build_sgl()
127 scu_sg = to_sgl_element_pair(ireq, sg_idx); in sci_request_build_sgl()
138 ireq, in sci_request_build_sgl()
151 scu_sg = to_sgl_element_pair(ireq, sg_idx); in sci_request_build_sgl()
158 ireq->zero_scatter_daddr = dma_addr; in sci_request_build_sgl()
171 static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq) in sci_io_request_build_ssp_command_iu() argument
174 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_build_ssp_command_iu()
176 cmd_iu = &ireq->ssp.cmd; in sci_io_request_build_ssp_command_iu()
191 static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq) in sci_task_request_build_ssp_task_iu() argument
194 struct sas_task *task = isci_request_access_task(ireq); in sci_task_request_build_ssp_task_iu()
195 struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); in sci_task_request_build_ssp_task_iu()
197 task_iu = &ireq->ssp.tmf; in sci_task_request_build_ssp_task_iu()
205 (test_bit(IREQ_TMF, &ireq->flags)) ? in sci_task_request_build_ssp_task_iu()
214 struct isci_request *ireq, in scu_ssp_request_construct_task_context() argument
221 idev = ireq->target_device; in scu_ssp_request_construct_task_context()
250 ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | in scu_ssp_request_construct_task_context()
254 ISCI_TAG_TCI(ireq->io_tag)); in scu_ssp_request_construct_task_context()
260 dma_addr = sci_io_request_get_dma_addr(ireq, &ireq->ssp.cmd); in scu_ssp_request_construct_task_context()
269 dma_addr = sci_io_request_get_dma_addr(ireq, &ireq->ssp.rsp); in scu_ssp_request_construct_task_context()
294 static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op) in scu_ssp_ireq_dif_insert() argument
296 struct scu_task_context *tc = ireq->tc; in scu_ssp_ireq_dif_insert()
297 struct scsi_cmnd *scmd = ireq->ttype_ptr.io_task_ptr->uldd_task; in scu_ssp_ireq_dif_insert()
349 static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op) in scu_ssp_ireq_dif_strip() argument
351 struct scu_task_context *tc = ireq->tc; in scu_ssp_ireq_dif_strip()
352 struct scsi_cmnd *scmd = ireq->ttype_ptr.io_task_ptr->uldd_task; in scu_ssp_ireq_dif_strip()
413 static void scu_ssp_io_request_construct_task_context(struct isci_request *ireq, in scu_ssp_io_request_construct_task_context() argument
417 struct scu_task_context *task_context = ireq->tc; in scu_ssp_io_request_construct_task_context()
418 struct sas_task *sas_task = ireq->ttype_ptr.io_task_ptr; in scu_ssp_io_request_construct_task_context()
423 scu_ssp_request_construct_task_context(ireq, task_context); in scu_ssp_io_request_construct_task_context()
443 sci_request_build_sgl(ireq); in scu_ssp_io_request_construct_task_context()
447 scu_ssp_ireq_dif_strip(ireq, prot_type, prot_op); in scu_ssp_io_request_construct_task_context()
449 scu_ssp_ireq_dif_insert(ireq, prot_type, prot_op); in scu_ssp_io_request_construct_task_context()
465 static void scu_ssp_task_request_construct_task_context(struct isci_request *ireq) in scu_ssp_task_request_construct_task_context() argument
467 struct scu_task_context *task_context = ireq->tc; in scu_ssp_task_request_construct_task_context()
469 scu_ssp_request_construct_task_context(ireq, task_context); in scu_ssp_task_request_construct_task_context()
494 struct isci_request *ireq, in scu_sata_request_construct_task_context() argument
501 idev = ireq->target_device; in scu_sata_request_construct_task_context()
532 task_context->type.words[0] = *(u32 *)&ireq->stp.cmd; in scu_sata_request_construct_task_context()
534 ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | in scu_sata_request_construct_task_context()
538 ISCI_TAG_TCI(ireq->io_tag)); in scu_sata_request_construct_task_context()
544 dma_addr = sci_io_request_get_dma_addr(ireq, in scu_sata_request_construct_task_context()
545 ((char *) &ireq->stp.cmd) + in scu_sata_request_construct_task_context()
556 static void scu_stp_raw_request_construct_task_context(struct isci_request *ireq) in scu_stp_raw_request_construct_task_context() argument
558 struct scu_task_context *task_context = ireq->tc; in scu_stp_raw_request_construct_task_context()
560 scu_sata_request_construct_task_context(ireq, task_context); in scu_stp_raw_request_construct_task_context()
569 static enum sci_status sci_stp_pio_request_construct(struct isci_request *ireq, in sci_stp_pio_request_construct() argument
572 struct isci_stp_request *stp_req = &ireq->stp.req; in sci_stp_pio_request_construct()
574 scu_stp_raw_request_construct_task_context(ireq); in sci_stp_pio_request_construct()
581 sci_request_build_sgl(ireq); in sci_stp_pio_request_construct()
603 static void sci_stp_optimized_request_construct(struct isci_request *ireq, in sci_stp_optimized_request_construct() argument
608 struct scu_task_context *task_context = ireq->tc; in sci_stp_optimized_request_construct()
611 scu_sata_request_construct_task_context(ireq, task_context); in sci_stp_optimized_request_construct()
614 sci_request_build_sgl(ireq); in sci_stp_optimized_request_construct()
636 static void sci_atapi_construct(struct isci_request *ireq) in sci_atapi_construct() argument
638 struct host_to_dev_fis *h2d_fis = &ireq->stp.cmd; in sci_atapi_construct()
648 scu_stp_raw_request_construct_task_context(ireq); in sci_atapi_construct()
650 task = isci_request_access_task(ireq); in sci_atapi_construct()
657 ireq->stp.rsp.fis_type = 0; in sci_atapi_construct()
661 sci_io_request_construct_sata(struct isci_request *ireq, in sci_io_request_construct_sata() argument
667 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_construct_sata()
668 struct domain_device *dev = ireq->target_device->domain_dev; in sci_io_request_construct_sata()
671 if (test_bit(IREQ_TMF, &ireq->flags)) { in sci_io_request_construct_sata()
672 struct isci_tmf *tmf = isci_request_access_tmf(ireq); in sci_io_request_construct_sata()
674 dev_err(&ireq->owning_controller->pdev->dev, in sci_io_request_construct_sata()
677 __func__, ireq, tmf->tmf_code); in sci_io_request_construct_sata()
683 dev_err(&ireq->owning_controller->pdev->dev, in sci_io_request_construct_sata()
694 sci_atapi_construct(ireq); in sci_io_request_construct_sata()
700 scu_stp_raw_request_construct_task_context(ireq); in sci_io_request_construct_sata()
706 sci_stp_optimized_request_construct(ireq, in sci_io_request_construct_sata()
714 sci_stp_optimized_request_construct(ireq, in sci_io_request_construct_sata()
719 return sci_stp_pio_request_construct(ireq, copy); in sci_io_request_construct_sata()
724 static enum sci_status sci_io_request_construct_basic_ssp(struct isci_request *ireq) in sci_io_request_construct_basic_ssp() argument
726 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_construct_basic_ssp()
728 ireq->protocol = SAS_PROTOCOL_SSP; in sci_io_request_construct_basic_ssp()
730 scu_ssp_io_request_construct_task_context(ireq, in sci_io_request_construct_basic_ssp()
734 sci_io_request_build_ssp_command_iu(ireq); in sci_io_request_construct_basic_ssp()
736 sci_change_state(&ireq->sm, SCI_REQ_CONSTRUCTED); in sci_io_request_construct_basic_ssp()
742 struct isci_request *ireq) in sci_task_request_construct_ssp() argument
745 scu_ssp_task_request_construct_task_context(ireq); in sci_task_request_construct_ssp()
748 sci_task_request_build_ssp_task_iu(ireq); in sci_task_request_construct_ssp()
750 sci_change_state(&ireq->sm, SCI_REQ_CONSTRUCTED); in sci_task_request_construct_ssp()
755 static enum sci_status sci_io_request_construct_basic_sata(struct isci_request *ireq) in sci_io_request_construct_basic_sata() argument
759 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_construct_basic_sata()
761 ireq->protocol = SAS_PROTOCOL_STP; in sci_io_request_construct_basic_sata()
765 status = sci_io_request_construct_sata(ireq, in sci_io_request_construct_basic_sata()
771 sci_change_state(&ireq->sm, SCI_REQ_CONSTRUCTED); in sci_io_request_construct_basic_sata()
781 static u32 sci_req_tx_bytes(struct isci_request *ireq) in sci_req_tx_bytes() argument
783 struct isci_host *ihost = ireq->owning_controller; in sci_req_tx_bytes()
797 ((sizeof(struct scu_task_context)) * ISCI_TAG_TCI(ireq->io_tag))); in sci_req_tx_bytes()
803 enum sci_status sci_request_start(struct isci_request *ireq) in sci_request_start() argument
806 struct scu_task_context *tc = ireq->tc; in sci_request_start()
807 struct isci_host *ihost = ireq->owning_controller; in sci_request_start()
809 state = ireq->sm.current_state_id; in sci_request_start()
817 tc->task_index = ISCI_TAG_TCI(ireq->io_tag); in sci_request_start()
823 tc->type.ssp.tag = ireq->io_tag; in sci_request_start()
844 ireq->post_context |= ISCI_TAG_TCI(ireq->io_tag); in sci_request_start()
847 sci_change_state(&ireq->sm, SCI_REQ_STARTED); in sci_request_start()
853 sci_io_request_terminate(struct isci_request *ireq) in sci_io_request_terminate() argument
857 state = ireq->sm.current_state_id; in sci_io_request_terminate()
862 set_bit(IREQ_TC_ABORT_POSTED, &ireq->flags); in sci_io_request_terminate()
863 ireq->scu_status = SCU_TASK_DONE_TASK_ABORT; in sci_io_request_terminate()
864 ireq->sci_status = SCI_FAILURE_IO_TERMINATED; in sci_io_request_terminate()
865 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_terminate()
891 sci_change_state(&ireq->sm, SCI_REQ_ABORTING); in sci_io_request_terminate()
894 if (!isci_remote_device_is_safe_to_abort(ireq->target_device)) in sci_io_request_terminate()
895 set_bit(IREQ_PENDING_ABORT, &ireq->flags); in sci_io_request_terminate()
897 clear_bit(IREQ_PENDING_ABORT, &ireq->flags); in sci_io_request_terminate()
904 dev_warn(&ireq->owning_controller->pdev->dev, in sci_io_request_terminate()
906 "state %d\n", __func__, ireq->sm.current_state_id); in sci_io_request_terminate()
913 enum sci_status sci_request_complete(struct isci_request *ireq) in sci_request_complete() argument
916 struct isci_host *ihost = ireq->owning_controller; in sci_request_complete()
918 state = ireq->sm.current_state_id; in sci_request_complete()
924 if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) in sci_request_complete()
926 ireq->saved_rx_frame_index); in sci_request_complete()
929 sci_change_state(&ireq->sm, SCI_REQ_FINAL); in sci_request_complete()
933 enum sci_status sci_io_request_event_handler(struct isci_request *ireq, in sci_io_request_event_handler() argument
937 struct isci_host *ihost = ireq->owning_controller; in sci_io_request_event_handler()
939 state = ireq->sm.current_state_id; in sci_io_request_event_handler()
953 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); in sci_io_request_event_handler()
973 static void sci_io_request_copy_response(struct isci_request *ireq) in sci_io_request_copy_response() argument
978 struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); in sci_io_request_copy_response()
980 ssp_response = &ireq->ssp.rsp; in sci_io_request_copy_response()
992 request_started_state_tc_event(struct isci_request *ireq, in request_started_state_tc_event() argument
1003 ireq->scu_status = SCU_TASK_DONE_GOOD; in request_started_state_tc_event()
1004 ireq->sci_status = SCI_SUCCESS; in request_started_state_tc_event()
1014 struct ssp_response_iu *resp = &ireq->ssp.rsp; in request_started_state_tc_event()
1017 sci_swab32_cpy(&ireq->ssp.rsp, in request_started_state_tc_event()
1018 &ireq->ssp.rsp, in request_started_state_tc_event()
1022 ireq->scu_status = SCU_TASK_DONE_GOOD; in request_started_state_tc_event()
1023 ireq->sci_status = SCI_SUCCESS_IO_DONE_EARLY; in request_started_state_tc_event()
1025 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in request_started_state_tc_event()
1026 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in request_started_state_tc_event()
1033 sci_swab32_cpy(&ireq->ssp.rsp, in request_started_state_tc_event()
1034 &ireq->ssp.rsp, in request_started_state_tc_event()
1037 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in request_started_state_tc_event()
1038 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in request_started_state_tc_event()
1047 resp_iu = &ireq->ssp.rsp; in request_started_state_tc_event()
1052 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in request_started_state_tc_event()
1053 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in request_started_state_tc_event()
1055 ireq->scu_status = SCU_TASK_DONE_GOOD; in request_started_state_tc_event()
1056 ireq->sci_status = SCI_SUCCESS; in request_started_state_tc_event()
1071 if (ireq->protocol == SAS_PROTOCOL_STP) { in request_started_state_tc_event()
1072 ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> in request_started_state_tc_event()
1074 ireq->sci_status = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; in request_started_state_tc_event()
1076 ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> in request_started_state_tc_event()
1078 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in request_started_state_tc_event()
1093 ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> in request_started_state_tc_event()
1095 ireq->sci_status = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; in request_started_state_tc_event()
1115 ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> in request_started_state_tc_event()
1117 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in request_started_state_tc_event()
1126 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in request_started_state_tc_event()
1131 request_aborting_state_tc_event(struct isci_request *ireq, in request_aborting_state_tc_event() argument
1137 ireq->scu_status = SCU_TASK_DONE_TASK_ABORT; in request_aborting_state_tc_event()
1138 ireq->sci_status = SCI_FAILURE_IO_TERMINATED; in request_aborting_state_tc_event()
1139 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in request_aborting_state_tc_event()
1152 static enum sci_status ssp_task_request_await_tc_event(struct isci_request *ireq, in ssp_task_request_await_tc_event() argument
1157 ireq->scu_status = SCU_TASK_DONE_GOOD; in ssp_task_request_await_tc_event()
1158 ireq->sci_status = SCI_SUCCESS; in ssp_task_request_await_tc_event()
1159 sci_change_state(&ireq->sm, SCI_REQ_TASK_WAIT_TC_RESP); in ssp_task_request_await_tc_event()
1167 dev_warn(&ireq->owning_controller->pdev->dev, in ssp_task_request_await_tc_event()
1169 "ACK/NAK timeout\n", __func__, ireq, in ssp_task_request_await_tc_event()
1172 sci_change_state(&ireq->sm, SCI_REQ_TASK_WAIT_TC_RESP); in ssp_task_request_await_tc_event()
1180 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in ssp_task_request_await_tc_event()
1181 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in ssp_task_request_await_tc_event()
1182 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in ssp_task_request_await_tc_event()
1190 smp_request_await_response_tc_event(struct isci_request *ireq, in smp_request_await_response_tc_event() argument
1199 ireq->scu_status = SCU_TASK_DONE_GOOD; in smp_request_await_response_tc_event()
1200 ireq->sci_status = SCI_SUCCESS; in smp_request_await_response_tc_event()
1201 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in smp_request_await_response_tc_event()
1214 ireq->scu_status = SCU_TASK_DONE_SMP_RESP_TO_ERR; in smp_request_await_response_tc_event()
1215 ireq->sci_status = SCI_FAILURE_RETRY_REQUIRED; in smp_request_await_response_tc_event()
1216 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in smp_request_await_response_tc_event()
1222 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in smp_request_await_response_tc_event()
1223 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in smp_request_await_response_tc_event()
1224 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in smp_request_await_response_tc_event()
1232 smp_request_await_tc_event(struct isci_request *ireq, in smp_request_await_tc_event() argument
1237 ireq->scu_status = SCU_TASK_DONE_GOOD; in smp_request_await_tc_event()
1238 ireq->sci_status = SCI_SUCCESS; in smp_request_await_tc_event()
1239 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in smp_request_await_tc_event()
1246 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in smp_request_await_tc_event()
1247 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in smp_request_await_tc_event()
1248 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in smp_request_await_tc_event()
1259 struct isci_request *ireq = to_ireq(stp_req); in pio_sgl_next() local
1262 sgl_pair = to_sgl_element_pair(ireq, pio_sgl->index); in pio_sgl_next()
1280 sgl_pair = to_sgl_element_pair(ireq, pio_sgl->index); in pio_sgl_next()
1289 stp_request_non_data_await_h2d_tc_event(struct isci_request *ireq, in stp_request_non_data_await_h2d_tc_event() argument
1294 ireq->scu_status = SCU_TASK_DONE_GOOD; in stp_request_non_data_await_h2d_tc_event()
1295 ireq->sci_status = SCI_SUCCESS; in stp_request_non_data_await_h2d_tc_event()
1296 sci_change_state(&ireq->sm, SCI_REQ_STP_NON_DATA_WAIT_D2H); in stp_request_non_data_await_h2d_tc_event()
1304 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in stp_request_non_data_await_h2d_tc_event()
1305 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in stp_request_non_data_await_h2d_tc_event()
1306 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in stp_request_non_data_await_h2d_tc_event()
1319 struct isci_request *ireq, in sci_stp_request_pio_data_out_trasmit_data_frame() argument
1322 struct isci_stp_request *stp_req = &ireq->stp.req; in sci_stp_request_pio_data_out_trasmit_data_frame()
1323 struct scu_task_context *task_context = ireq->tc; in sci_stp_request_pio_data_out_trasmit_data_frame()
1330 sgl_pair = to_sgl_element_pair(ireq, stp_req->sgl.index); in sci_stp_request_pio_data_out_trasmit_data_frame()
1343 return sci_controller_continue_io(ireq); in sci_stp_request_pio_data_out_trasmit_data_frame()
1346 static enum sci_status sci_stp_request_pio_data_out_transmit_data(struct isci_request *ireq) in sci_stp_request_pio_data_out_transmit_data() argument
1348 struct isci_stp_request *stp_req = &ireq->stp.req; in sci_stp_request_pio_data_out_transmit_data()
1356 sgl_pair = to_sgl_element_pair(ireq, stp_req->sgl.index); in sci_stp_request_pio_data_out_transmit_data()
1372 status = sci_stp_request_pio_data_out_trasmit_data_frame(ireq, len); in sci_stp_request_pio_data_out_transmit_data()
1381 sci_stp_request_pio_data_out_trasmit_data_frame(ireq, stp_req->pio_len); in sci_stp_request_pio_data_out_transmit_data()
1407 struct isci_request *ireq; in sci_stp_request_pio_data_in_copy_data_buffer() local
1415 ireq = to_ireq(stp_req); in sci_stp_request_pio_data_in_copy_data_buffer()
1416 task = isci_request_access_task(ireq); in sci_stp_request_pio_data_in_copy_data_buffer()
1476 stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq, in stp_request_pio_await_h2d_completion_tc_event() argument
1481 ireq->scu_status = SCU_TASK_DONE_GOOD; in stp_request_pio_await_h2d_completion_tc_event()
1482 ireq->sci_status = SCI_SUCCESS; in stp_request_pio_await_h2d_completion_tc_event()
1483 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); in stp_request_pio_await_h2d_completion_tc_event()
1491 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in stp_request_pio_await_h2d_completion_tc_event()
1492 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in stp_request_pio_await_h2d_completion_tc_event()
1493 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in stp_request_pio_await_h2d_completion_tc_event()
1501 pio_data_out_tx_done_tc_event(struct isci_request *ireq, in pio_data_out_tx_done_tc_event() argument
1506 struct isci_stp_request *stp_req = &ireq->stp.req; in pio_data_out_tx_done_tc_event()
1512 status = sci_stp_request_pio_data_out_transmit_data(ireq); in pio_data_out_tx_done_tc_event()
1530 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); in pio_data_out_tx_done_tc_event()
1540 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in pio_data_out_tx_done_tc_event()
1541 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in pio_data_out_tx_done_tc_event()
1542 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in pio_data_out_tx_done_tc_event()
1549 static enum sci_status sci_stp_request_udma_general_frame_handler(struct isci_request *ireq, in sci_stp_request_udma_general_frame_handler() argument
1552 struct isci_host *ihost = ireq->owning_controller; in sci_stp_request_udma_general_frame_handler()
1567 sci_controller_copy_sata_response(&ireq->stp.rsp, in sci_stp_request_udma_general_frame_handler()
1577 static enum sci_status process_unsolicited_fis(struct isci_request *ireq, in process_unsolicited_fis() argument
1580 struct isci_host *ihost = ireq->owning_controller; in process_unsolicited_fis()
1593 dev_err(&ireq->isci_host->pdev->dev, in process_unsolicited_fis()
1603 sci_controller_copy_sata_response(&ireq->stp.rsp, in process_unsolicited_fis()
1613 static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq, in atapi_d2h_reg_frame_handler() argument
1616 struct sas_task *task = isci_request_access_task(ireq); in atapi_d2h_reg_frame_handler()
1619 status = process_unsolicited_fis(ireq, frame_index); in atapi_d2h_reg_frame_handler()
1622 if (ireq->stp.rsp.status & ATA_ERR) in atapi_d2h_reg_frame_handler()
1629 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in atapi_d2h_reg_frame_handler()
1630 ireq->sci_status = status; in atapi_d2h_reg_frame_handler()
1632 ireq->scu_status = SCU_TASK_DONE_GOOD; in atapi_d2h_reg_frame_handler()
1633 ireq->sci_status = SCI_SUCCESS; in atapi_d2h_reg_frame_handler()
1638 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in atapi_d2h_reg_frame_handler()
1643 static void scu_atapi_reconstruct_raw_frame_task_context(struct isci_request *ireq) in scu_atapi_reconstruct_raw_frame_task_context() argument
1645 struct ata_device *dev = sas_to_ata_dev(ireq->target_device->domain_dev); in scu_atapi_reconstruct_raw_frame_task_context()
1646 void *atapi_cdb = ireq->ttype_ptr.io_task_ptr->ata_task.atapi_packet; in scu_atapi_reconstruct_raw_frame_task_context()
1647 struct scu_task_context *task_context = ireq->tc; in scu_atapi_reconstruct_raw_frame_task_context()
1653 memset(&ireq->stp.cmd, 0, sizeof(struct host_to_dev_fis)); in scu_atapi_reconstruct_raw_frame_task_context()
1654 memcpy(((u8 *)&ireq->stp.cmd + sizeof(u32)), atapi_cdb, ATAPI_CDB_LEN); in scu_atapi_reconstruct_raw_frame_task_context()
1660 static void scu_atapi_construct_task_context(struct isci_request *ireq) in scu_atapi_construct_task_context() argument
1662 struct ata_device *dev = sas_to_ata_dev(ireq->target_device->domain_dev); in scu_atapi_construct_task_context()
1663 struct sas_task *task = isci_request_access_task(ireq); in scu_atapi_construct_task_context()
1664 struct scu_task_context *task_context = ireq->tc; in scu_atapi_construct_task_context()
1682 memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd)); in scu_atapi_construct_task_context()
1683 memcpy(&ireq->stp.cmd.lbal, task->ata_task.atapi_packet, cdb_len); in scu_atapi_construct_task_context()
1696 sci_request_build_sgl(ireq); in scu_atapi_construct_task_context()
1700 sci_io_request_frame_handler(struct isci_request *ireq, in sci_io_request_frame_handler() argument
1703 struct isci_host *ihost = ireq->owning_controller; in sci_io_request_frame_handler()
1704 struct isci_stp_request *stp_req = &ireq->stp.req; in sci_io_request_frame_handler()
1709 state = ireq->sm.current_state_id; in sci_io_request_frame_handler()
1730 sci_swab32_cpy(&ireq->ssp.rsp, resp_iu, word_cnt); in sci_io_request_frame_handler()
1732 resp_iu = &ireq->ssp.rsp; in sci_io_request_frame_handler()
1736 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in sci_io_request_frame_handler()
1737 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in sci_io_request_frame_handler()
1739 ireq->scu_status = SCU_TASK_DONE_GOOD; in sci_io_request_frame_handler()
1740 ireq->sci_status = SCI_SUCCESS; in sci_io_request_frame_handler()
1746 "frame %d type 0x%02x\n", __func__, ireq, in sci_io_request_frame_handler()
1760 sci_io_request_copy_response(ireq); in sci_io_request_frame_handler()
1761 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
1766 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_frame_handler()
1791 ireq->scu_status = SCU_TASK_DONE_GOOD; in sci_io_request_frame_handler()
1792 ireq->sci_status = SCI_SUCCESS; in sci_io_request_frame_handler()
1793 sci_change_state(&ireq->sm, SCI_REQ_SMP_WAIT_TC_COMP); in sci_io_request_frame_handler()
1803 ireq, in sci_io_request_frame_handler()
1807 ireq->scu_status = SCU_TASK_DONE_SMP_FRM_TYPE_ERR; in sci_io_request_frame_handler()
1808 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in sci_io_request_frame_handler()
1809 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
1819 return sci_stp_request_udma_general_frame_handler(ireq, in sci_io_request_frame_handler()
1824 status = sci_stp_request_udma_general_frame_handler(ireq, frame_index); in sci_io_request_frame_handler()
1829 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in sci_io_request_frame_handler()
1830 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in sci_io_request_frame_handler()
1831 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
1860 sci_controller_copy_sata_response(&ireq->stp.rsp, in sci_io_request_frame_handler()
1865 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in sci_io_request_frame_handler()
1866 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in sci_io_request_frame_handler()
1875 ireq->scu_status = SCU_TASK_DONE_UNEXP_FIS; in sci_io_request_frame_handler()
1876 ireq->sci_status = SCI_FAILURE_PROTOCOL_VIOLATION; in sci_io_request_frame_handler()
1880 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
1889 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_frame_handler()
1924 sci_controller_copy_sata_response(&ireq->stp.rsp, in sci_io_request_frame_handler()
1928 ireq->stp.rsp.status = stp_req->status; in sci_io_request_frame_handler()
1934 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_DATA_IN); in sci_io_request_frame_handler()
1937 status = sci_stp_request_pio_data_out_transmit_data(ireq); in sci_io_request_frame_handler()
1940 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_DATA_OUT); in sci_io_request_frame_handler()
1945 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); in sci_io_request_frame_handler()
1969 sci_controller_copy_sata_response(&ireq->stp.rsp, in sci_io_request_frame_handler()
1973 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in sci_io_request_frame_handler()
1974 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in sci_io_request_frame_handler()
1975 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
2018 ireq->scu_status = SCU_TASK_DONE_GOOD; in sci_io_request_frame_handler()
2019 ireq->sci_status = SCI_FAILURE_IO_REQUIRES_SCSI_ABORT; in sci_io_request_frame_handler()
2020 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
2028 ireq->saved_rx_frame_index = frame_index; in sci_io_request_frame_handler()
2049 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in sci_io_request_frame_handler()
2050 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in sci_io_request_frame_handler()
2051 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in sci_io_request_frame_handler()
2053 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); in sci_io_request_frame_handler()
2059 struct sas_task *task = isci_request_access_task(ireq); in sci_io_request_frame_handler()
2062 ireq->target_device->working_request = ireq; in sci_io_request_frame_handler()
2064 sci_change_state(&ireq->sm, SCI_REQ_ATAPI_WAIT_TC_COMP); in sci_io_request_frame_handler()
2065 scu_atapi_reconstruct_raw_frame_task_context(ireq); in sci_io_request_frame_handler()
2067 sci_change_state(&ireq->sm, SCI_REQ_ATAPI_WAIT_D2H); in sci_io_request_frame_handler()
2068 scu_atapi_construct_task_context(ireq); in sci_io_request_frame_handler()
2071 sci_controller_continue_io(ireq); in sci_io_request_frame_handler()
2075 return atapi_d2h_reg_frame_handler(ireq, frame_index); in sci_io_request_frame_handler()
2097 static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq, in stp_request_udma_await_tc_event() argument
2102 ireq->scu_status = SCU_TASK_DONE_GOOD; in stp_request_udma_await_tc_event()
2103 ireq->sci_status = SCI_SUCCESS; in stp_request_udma_await_tc_event()
2104 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in stp_request_udma_await_tc_event()
2112 if (ireq->stp.rsp.fis_type == FIS_REGD2H) { in stp_request_udma_await_tc_event()
2113 sci_remote_device_suspend(ireq->target_device, in stp_request_udma_await_tc_event()
2116 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in stp_request_udma_await_tc_event()
2117 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in stp_request_udma_await_tc_event()
2118 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in stp_request_udma_await_tc_event()
2125 sci_change_state(&ireq->sm, SCI_REQ_STP_UDMA_WAIT_D2H); in stp_request_udma_await_tc_event()
2137 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in stp_request_udma_await_tc_event()
2138 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in stp_request_udma_await_tc_event()
2139 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in stp_request_udma_await_tc_event()
2146 static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 completion_code, in atapi_raw_completion() argument
2151 ireq->scu_status = SCU_TASK_DONE_GOOD; in atapi_raw_completion()
2152 ireq->sci_status = SCI_SUCCESS; in atapi_raw_completion()
2153 sci_change_state(&ireq->sm, next); in atapi_raw_completion()
2160 ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); in atapi_raw_completion()
2161 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; in atapi_raw_completion()
2163 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in atapi_raw_completion()
2170 static enum sci_status atapi_data_tc_completion_handler(struct isci_request *ireq, in atapi_data_tc_completion_handler() argument
2173 struct isci_remote_device *idev = ireq->target_device; in atapi_data_tc_completion_handler()
2174 struct dev_to_host_fis *d2h = &ireq->stp.rsp; in atapi_data_tc_completion_handler()
2179 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in atapi_data_tc_completion_handler()
2183 u16 len = sci_req_tx_bytes(ireq); in atapi_data_tc_completion_handler()
2208 ireq->scu_status = SCU_TASK_DONE_GOOD; in atapi_data_tc_completion_handler()
2209 ireq->sci_status = SCI_SUCCESS_IO_DONE_EARLY; in atapi_data_tc_completion_handler()
2210 status = ireq->sci_status; in atapi_data_tc_completion_handler()
2222 ireq->scu_status = SCU_TASK_DONE_GOOD; in atapi_data_tc_completion_handler()
2223 ireq->sci_status = SCI_SUCCESS; in atapi_data_tc_completion_handler()
2224 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); in atapi_data_tc_completion_handler()
2230 status = ireq->sci_status; in atapi_data_tc_completion_handler()
2239 ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; in atapi_data_tc_completion_handler()
2240 ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; in atapi_data_tc_completion_handler()
2242 sci_change_state(&ireq->sm, SCI_REQ_ATAPI_WAIT_D2H); in atapi_data_tc_completion_handler()
2339 struct isci_request *ireq, in sci_request_handle_suspending_completions() argument
2345 switch (ireq->protocol) { in sci_request_handle_suspending_completions()
2366 dev_warn(&ireq->isci_host->pdev->dev, in sci_request_handle_suspending_completions()
2368 __func__, ireq); in sci_request_handle_suspending_completions()
2375 &ireq->target_device->rnc, in sci_request_handle_suspending_completions()
2383 sci_io_request_tc_completion(struct isci_request *ireq, in sci_io_request_tc_completion() argument
2387 struct isci_host *ihost = ireq->owning_controller; in sci_io_request_tc_completion()
2389 state = ireq->sm.current_state_id; in sci_io_request_tc_completion()
2393 ireq, SCU_GET_COMPLETION_TL_STATUS(completion_code)); in sci_io_request_tc_completion()
2397 return request_started_state_tc_event(ireq, completion_code); in sci_io_request_tc_completion()
2400 return ssp_task_request_await_tc_event(ireq, in sci_io_request_tc_completion()
2404 return smp_request_await_response_tc_event(ireq, in sci_io_request_tc_completion()
2408 return smp_request_await_tc_event(ireq, completion_code); in sci_io_request_tc_completion()
2411 return stp_request_udma_await_tc_event(ireq, in sci_io_request_tc_completion()
2415 return stp_request_non_data_await_h2d_tc_event(ireq, in sci_io_request_tc_completion()
2419 return stp_request_pio_await_h2d_completion_tc_event(ireq, in sci_io_request_tc_completion()
2423 return pio_data_out_tx_done_tc_event(ireq, completion_code); in sci_io_request_tc_completion()
2426 return request_aborting_state_tc_event(ireq, in sci_io_request_tc_completion()
2430 return atapi_raw_completion(ireq, completion_code, in sci_io_request_tc_completion()
2434 return atapi_raw_completion(ireq, completion_code, in sci_io_request_tc_completion()
2438 return atapi_data_tc_completion_handler(ireq, completion_code); in sci_io_request_tc_completion()
2956 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); in sci_request_started_state_enter() local
2957 struct domain_device *dev = ireq->target_device->domain_dev; in sci_request_started_state_enter()
2964 task = (test_bit(IREQ_TMF, &ireq->flags)) ? NULL : isci_request_access_task(ireq); in sci_request_started_state_enter()
2994 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); in sci_request_completed_state_enter() local
2995 struct isci_host *ihost = ireq->owning_controller; in sci_request_completed_state_enter()
2998 if (!test_bit(IREQ_TMF, &ireq->flags)) in sci_request_completed_state_enter()
2999 isci_request_io_request_complete(ihost, ireq, in sci_request_completed_state_enter()
3000 ireq->sci_status); in sci_request_completed_state_enter()
3002 isci_task_request_complete(ihost, ireq, ireq->sci_status); in sci_request_completed_state_enter()
3007 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); in sci_request_aborting_state_enter() local
3010 ireq->tc->abort = 1; in sci_request_aborting_state_enter()
3015 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); in sci_stp_request_started_non_data_await_h2d_completion_enter() local
3017 ireq->target_device->working_request = ireq; in sci_stp_request_started_non_data_await_h2d_completion_enter()
3022 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); in sci_stp_request_started_pio_await_h2d_completion_enter() local
3024 ireq->target_device->working_request = ireq; in sci_stp_request_started_pio_await_h2d_completion_enter()
3065 struct isci_request *ireq) in sci_general_request_construct() argument
3067 sci_init_sm(&ireq->sm, sci_request_state_table, SCI_REQ_INIT); in sci_general_request_construct()
3069 ireq->target_device = idev; in sci_general_request_construct()
3070 ireq->protocol = SAS_PROTOCOL_NONE; in sci_general_request_construct()
3071 ireq->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX; in sci_general_request_construct()
3073 ireq->sci_status = SCI_SUCCESS; in sci_general_request_construct()
3074 ireq->scu_status = 0; in sci_general_request_construct()
3075 ireq->post_context = 0xFFFFFFFF; in sci_general_request_construct()
3081 struct isci_request *ireq) in sci_io_request_construct() argument
3087 sci_general_request_construct(ihost, idev, ireq); in sci_io_request_construct()
3095 memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd)); in sci_io_request_construct()
3101 memset(ireq->tc, 0, offsetof(struct scu_task_context, sgl_pair_ab)); in sci_io_request_construct()
3108 u16 io_tag, struct isci_request *ireq) in sci_task_request_construct() argument
3114 sci_general_request_construct(ihost, idev, ireq); in sci_task_request_construct()
3117 set_bit(IREQ_TMF, &ireq->flags); in sci_task_request_construct()
3118 memset(ireq->tc, 0, sizeof(struct scu_task_context)); in sci_task_request_construct()
3122 ireq->protocol = SAS_PROTOCOL_STP; in sci_task_request_construct()
3124 ireq->protocol = SAS_PROTOCOL_SSP; in sci_task_request_construct()
3144 static enum sci_status isci_request_stp_request_construct(struct isci_request *ireq) in isci_request_stp_request_construct() argument
3146 struct sas_task *task = isci_request_access_task(ireq); in isci_request_stp_request_construct()
3147 struct host_to_dev_fis *fis = &ireq->stp.cmd; in isci_request_stp_request_construct()
3151 dev_dbg(&ireq->isci_host->pdev->dev, in isci_request_stp_request_construct()
3154 ireq); in isci_request_stp_request_construct()
3161 status = sci_io_request_construct_basic_sata(ireq); in isci_request_stp_request_construct()
3169 ireq->tc->type.stp.ncq_tag = qc->tag; in isci_request_stp_request_construct()
3177 struct isci_request *ireq, in sci_io_request_construct_smp() argument
3220 ireq->protocol = SAS_PROTOCOL_SMP; in sci_io_request_construct_smp()
3224 task_context = ireq->tc; in sci_io_request_construct_smp()
3226 idev = ireq->target_device; in sci_io_request_construct_smp()
3278 ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | in sci_io_request_construct_smp()
3282 ISCI_TAG_TCI(ireq->io_tag)); in sci_io_request_construct_smp()
3294 sci_change_state(&ireq->sm, SCI_REQ_CONSTRUCTED); in sci_io_request_construct_smp()
3306 static enum sci_status isci_smp_request_build(struct isci_request *ireq) in isci_smp_request_build() argument
3308 struct sas_task *task = isci_request_access_task(ireq); in isci_smp_request_build()
3309 struct device *dev = &ireq->isci_host->pdev->dev; in isci_smp_request_build()
3312 status = sci_io_request_construct_smp(dev, ireq, task); in isci_smp_request_build()
3314 dev_dbg(&ireq->isci_host->pdev->dev, in isci_smp_request_build()
3398 struct isci_request *ireq; in isci_request_from_tag() local
3400 ireq = ihost->reqs[ISCI_TAG_TCI(tag)]; in isci_request_from_tag()
3401 ireq->io_tag = tag; in isci_request_from_tag()
3402 ireq->io_request_completion = NULL; in isci_request_from_tag()
3403 ireq->flags = 0; in isci_request_from_tag()
3404 ireq->num_sg_entries = 0; in isci_request_from_tag()
3406 return ireq; in isci_request_from_tag()
3413 struct isci_request *ireq; in isci_io_request_from_tag() local
3415 ireq = isci_request_from_tag(ihost, tag); in isci_io_request_from_tag()
3416 ireq->ttype_ptr.io_task_ptr = task; in isci_io_request_from_tag()
3417 clear_bit(IREQ_TMF, &ireq->flags); in isci_io_request_from_tag()
3418 task->lldd_task = ireq; in isci_io_request_from_tag()
3420 return ireq; in isci_io_request_from_tag()
3427 struct isci_request *ireq; in isci_tmf_request_from_tag() local
3429 ireq = isci_request_from_tag(ihost, tag); in isci_tmf_request_from_tag()
3430 ireq->ttype_ptr.tmf_task_ptr = isci_tmf; in isci_tmf_request_from_tag()
3431 set_bit(IREQ_TMF, &ireq->flags); in isci_tmf_request_from_tag()
3433 return ireq; in isci_tmf_request_from_tag()
3437 struct sas_task *task, struct isci_request *ireq) in isci_request_execute() argument
3443 status = isci_io_request_build(ihost, ireq, idev); in isci_request_execute()
3466 ireq); in isci_request_execute()
3473 ireq); in isci_request_execute()
3492 set_bit(IREQ_TERMINATED, &ireq->flags); in isci_request_execute()