diff options
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r-- | drivers/scsi/isci/request.c | 328 |
1 files changed, 127 insertions, 201 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index bcb3c08c19a7..7c500bb6a8e0 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -211,22 +211,21 @@ static void scu_ssp_reqeust_construct_task_context( | |||
211 | struct isci_remote_device *idev; | 211 | struct isci_remote_device *idev; |
212 | struct isci_port *iport; | 212 | struct isci_port *iport; |
213 | 213 | ||
214 | idev = sci_request_get_device(ireq); | 214 | idev = ireq->target_device; |
215 | iport = sci_request_get_port(ireq); | 215 | iport = idev->owning_port; |
216 | 216 | ||
217 | /* Fill in the TC with the its required data */ | 217 | /* Fill in the TC with the its required data */ |
218 | task_context->abort = 0; | 218 | task_context->abort = 0; |
219 | task_context->priority = 0; | 219 | task_context->priority = 0; |
220 | task_context->initiator_request = 1; | 220 | task_context->initiator_request = 1; |
221 | task_context->connection_rate = idev->connection_rate; | 221 | task_context->connection_rate = idev->connection_rate; |
222 | task_context->protocol_engine_index = | 222 | task_context->protocol_engine_index = ISCI_PEG; |
223 | sci_controller_get_protocol_engine_group(controller); | 223 | task_context->logical_port_index = iport->physical_port_index; |
224 | task_context->logical_port_index = sci_port_get_index(iport); | ||
225 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; | 224 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; |
226 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 225 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
227 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 226 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
228 | 227 | ||
229 | task_context->remote_node_index = sci_remote_device_get_index(idev); | 228 | task_context->remote_node_index = idev->rnc.remote_node_index; |
230 | task_context->command_code = 0; | 229 | task_context->command_code = 0; |
231 | 230 | ||
232 | task_context->link_layer_control = 0; | 231 | task_context->link_layer_control = 0; |
@@ -242,9 +241,8 @@ static void scu_ssp_reqeust_construct_task_context( | |||
242 | task_context->task_phase = 0x01; | 241 | task_context->task_phase = 0x01; |
243 | 242 | ||
244 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 243 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
245 | (sci_controller_get_protocol_engine_group(controller) << | 244 | (ISCI_PEG << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | |
246 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | 245 | (iport->physical_port_index << |
247 | (sci_port_get_index(iport) << | ||
248 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | 246 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | |
249 | ISCI_TAG_TCI(ireq->io_tag)); | 247 | ISCI_TAG_TCI(ireq->io_tag)); |
250 | 248 | ||
@@ -349,23 +347,21 @@ static void scu_sata_reqeust_construct_task_context( | |||
349 | struct isci_remote_device *idev; | 347 | struct isci_remote_device *idev; |
350 | struct isci_port *iport; | 348 | struct isci_port *iport; |
351 | 349 | ||
352 | idev = sci_request_get_device(ireq); | 350 | idev = ireq->target_device; |
353 | iport = sci_request_get_port(ireq); | 351 | iport = idev->owning_port; |
354 | 352 | ||
355 | /* Fill in the TC with the its required data */ | 353 | /* Fill in the TC with the its required data */ |
356 | task_context->abort = 0; | 354 | task_context->abort = 0; |
357 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; | 355 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; |
358 | task_context->initiator_request = 1; | 356 | task_context->initiator_request = 1; |
359 | task_context->connection_rate = idev->connection_rate; | 357 | task_context->connection_rate = idev->connection_rate; |
360 | task_context->protocol_engine_index = | 358 | task_context->protocol_engine_index = ISCI_PEG; |
361 | sci_controller_get_protocol_engine_group(controller); | 359 | task_context->logical_port_index = iport->physical_port_index; |
362 | task_context->logical_port_index = | ||
363 | sci_port_get_index(iport); | ||
364 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_STP; | 360 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_STP; |
365 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 361 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
366 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 362 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
367 | 363 | ||
368 | task_context->remote_node_index = sci_remote_device_get_index(idev); | 364 | task_context->remote_node_index = idev->rnc.remote_node_index; |
369 | task_context->command_code = 0; | 365 | task_context->command_code = 0; |
370 | 366 | ||
371 | task_context->link_layer_control = 0; | 367 | task_context->link_layer_control = 0; |
@@ -385,11 +381,10 @@ static void scu_sata_reqeust_construct_task_context( | |||
385 | task_context->type.words[0] = *(u32 *)&ireq->stp.cmd; | 381 | task_context->type.words[0] = *(u32 *)&ireq->stp.cmd; |
386 | 382 | ||
387 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 383 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
388 | (sci_controller_get_protocol_engine_group(controller) << | 384 | (ISCI_PEG << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | |
389 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | 385 | (iport->physical_port_index << |
390 | (sci_port_get_index(iport) << | 386 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | |
391 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | 387 | ISCI_TAG_TCI(ireq->io_tag)); |
392 | ISCI_TAG_TCI(ireq->io_tag)); | ||
393 | /* | 388 | /* |
394 | * Copy the physical address for the command buffer to the SCU Task | 389 | * Copy the physical address for the command buffer to the SCU Task |
395 | * Context. We must offset the command buffer by 4 bytes because the | 390 | * Context. We must offset the command buffer by 4 bytes because the |
@@ -716,10 +711,8 @@ sci_io_request_terminate(struct isci_request *ireq) | |||
716 | 711 | ||
717 | switch (state) { | 712 | switch (state) { |
718 | case SCI_REQ_CONSTRUCTED: | 713 | case SCI_REQ_CONSTRUCTED: |
719 | sci_request_set_status(ireq, | 714 | ireq->scu_status = SCU_TASK_DONE_TASK_ABORT; |
720 | SCU_TASK_DONE_TASK_ABORT, | 715 | ireq->sci_status = SCI_FAILURE_IO_TERMINATED; |
721 | SCI_FAILURE_IO_TERMINATED); | ||
722 | |||
723 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 716 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
724 | return SCI_SUCCESS; | 717 | return SCI_SUCCESS; |
725 | case SCI_REQ_STARTED: | 718 | case SCI_REQ_STARTED: |
@@ -848,9 +841,8 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
848 | */ | 841 | */ |
849 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 842 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
850 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 843 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
851 | sci_request_set_status(ireq, | 844 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
852 | SCU_TASK_DONE_GOOD, | 845 | ireq->sci_status = SCI_SUCCESS; |
853 | SCI_SUCCESS); | ||
854 | break; | 846 | break; |
855 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP): { | 847 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP): { |
856 | /* There are times when the SCU hardware will return an early | 848 | /* There are times when the SCU hardware will return an early |
@@ -868,13 +860,11 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
868 | word_cnt); | 860 | word_cnt); |
869 | 861 | ||
870 | if (resp->status == 0) { | 862 | if (resp->status == 0) { |
871 | sci_request_set_status(ireq, | 863 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
872 | SCU_TASK_DONE_GOOD, | 864 | ireq->sci_status = SCI_SUCCESS_IO_DONE_EARLY; |
873 | SCI_SUCCESS_IO_DONE_EARLY); | ||
874 | } else { | 865 | } else { |
875 | sci_request_set_status(ireq, | 866 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
876 | SCU_TASK_DONE_CHECK_RESPONSE, | 867 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
877 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
878 | } | 868 | } |
879 | break; | 869 | break; |
880 | } | 870 | } |
@@ -885,9 +875,8 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
885 | &ireq->ssp.rsp, | 875 | &ireq->ssp.rsp, |
886 | word_cnt); | 876 | word_cnt); |
887 | 877 | ||
888 | sci_request_set_status(ireq, | 878 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
889 | SCU_TASK_DONE_CHECK_RESPONSE, | 879 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
890 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
891 | break; | 880 | break; |
892 | } | 881 | } |
893 | 882 | ||
@@ -900,13 +889,12 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
900 | datapres = resp_iu->datapres; | 889 | datapres = resp_iu->datapres; |
901 | 890 | ||
902 | if (datapres == 1 || datapres == 2) { | 891 | if (datapres == 1 || datapres == 2) { |
903 | sci_request_set_status(ireq, | 892 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
904 | SCU_TASK_DONE_CHECK_RESPONSE, | 893 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
905 | SCI_FAILURE_IO_RESPONSE_VALID); | 894 | } else { |
906 | } else | 895 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
907 | sci_request_set_status(ireq, | 896 | ireq->sci_status = SCI_SUCCESS; |
908 | SCU_TASK_DONE_GOOD, | 897 | } |
909 | SCI_SUCCESS); | ||
910 | break; | 898 | break; |
911 | /* only stp device gets suspended. */ | 899 | /* only stp device gets suspended. */ |
912 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): | 900 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): |
@@ -921,15 +909,13 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
921 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): | 909 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): |
922 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR): | 910 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR): |
923 | if (ireq->protocol == SCIC_STP_PROTOCOL) { | 911 | if (ireq->protocol == SCIC_STP_PROTOCOL) { |
924 | sci_request_set_status(ireq, | 912 | ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
925 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 913 | SCU_COMPLETION_TL_STATUS_SHIFT; |
926 | SCU_COMPLETION_TL_STATUS_SHIFT, | 914 | ireq->sci_status = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
927 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); | ||
928 | } else { | 915 | } else { |
929 | sci_request_set_status(ireq, | 916 | ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
930 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 917 | SCU_COMPLETION_TL_STATUS_SHIFT; |
931 | SCU_COMPLETION_TL_STATUS_SHIFT, | 918 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
932 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
933 | } | 919 | } |
934 | break; | 920 | break; |
935 | 921 | ||
@@ -944,10 +930,9 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
944 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY): | 930 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY): |
945 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED): | 931 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED): |
946 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED): | 932 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED): |
947 | sci_request_set_status(ireq, | 933 | ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
948 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 934 | SCU_COMPLETION_TL_STATUS_SHIFT; |
949 | SCU_COMPLETION_TL_STATUS_SHIFT, | 935 | ireq->sci_status = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
950 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); | ||
951 | break; | 936 | break; |
952 | 937 | ||
953 | /* neither ssp nor stp gets suspended. */ | 938 | /* neither ssp nor stp gets suspended. */ |
@@ -967,11 +952,9 @@ request_started_state_tc_event(struct isci_request *ireq, | |||
967 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_IIT_ENTRY_NV): | 952 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_IIT_ENTRY_NV): |
968 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND): | 953 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND): |
969 | default: | 954 | default: |
970 | sci_request_set_status( | 955 | ireq->scu_status = SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
971 | ireq, | 956 | SCU_COMPLETION_TL_STATUS_SHIFT; |
972 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 957 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
973 | SCU_COMPLETION_TL_STATUS_SHIFT, | ||
974 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
975 | break; | 958 | break; |
976 | } | 959 | } |
977 | 960 | ||
@@ -991,9 +974,8 @@ request_aborting_state_tc_event(struct isci_request *ireq, | |||
991 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 974 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
992 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): | 975 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): |
993 | case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT): | 976 | case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT): |
994 | sci_request_set_status(ireq, SCU_TASK_DONE_TASK_ABORT, | 977 | ireq->scu_status = SCU_TASK_DONE_TASK_ABORT; |
995 | SCI_FAILURE_IO_TERMINATED); | 978 | ireq->sci_status = SCI_FAILURE_IO_TERMINATED; |
996 | |||
997 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 979 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
998 | break; | 980 | break; |
999 | 981 | ||
@@ -1012,9 +994,8 @@ static enum sci_status ssp_task_request_await_tc_event(struct isci_request *ireq | |||
1012 | { | 994 | { |
1013 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 995 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1014 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 996 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1015 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 997 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1016 | SCI_SUCCESS); | 998 | ireq->sci_status = SCI_SUCCESS; |
1017 | |||
1018 | sci_change_state(&ireq->sm, SCI_REQ_TASK_WAIT_TC_RESP); | 999 | sci_change_state(&ireq->sm, SCI_REQ_TASK_WAIT_TC_RESP); |
1019 | break; | 1000 | break; |
1020 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): | 1001 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): |
@@ -1036,10 +1017,8 @@ static enum sci_status ssp_task_request_await_tc_event(struct isci_request *ireq | |||
1036 | * If a NAK was received, then it is up to the user to retry | 1017 | * If a NAK was received, then it is up to the user to retry |
1037 | * the request. | 1018 | * the request. |
1038 | */ | 1019 | */ |
1039 | sci_request_set_status(ireq, | 1020 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1040 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1021 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1041 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1042 | |||
1043 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1022 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1044 | break; | 1023 | break; |
1045 | } | 1024 | } |
@@ -1057,12 +1036,10 @@ smp_request_await_response_tc_event(struct isci_request *ireq, | |||
1057 | * unexpected. but if the TC has success status, we | 1036 | * unexpected. but if the TC has success status, we |
1058 | * complete the IO anyway. | 1037 | * complete the IO anyway. |
1059 | */ | 1038 | */ |
1060 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1039 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1061 | SCI_SUCCESS); | 1040 | ireq->sci_status = SCI_SUCCESS; |
1062 | |||
1063 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1041 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1064 | break; | 1042 | break; |
1065 | |||
1066 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR): | 1043 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR): |
1067 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR): | 1044 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR): |
1068 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR): | 1045 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR): |
@@ -1074,20 +1051,16 @@ smp_request_await_response_tc_event(struct isci_request *ireq, | |||
1074 | * these SMP_XXX_XX_ERR status. For these type of error, | 1051 | * these SMP_XXX_XX_ERR status. For these type of error, |
1075 | * we ask ihost user to retry the request. | 1052 | * we ask ihost user to retry the request. |
1076 | */ | 1053 | */ |
1077 | sci_request_set_status(ireq, SCU_TASK_DONE_SMP_RESP_TO_ERR, | 1054 | ireq->scu_status = SCU_TASK_DONE_SMP_RESP_TO_ERR; |
1078 | SCI_FAILURE_RETRY_REQUIRED); | 1055 | ireq->sci_status = SCI_FAILURE_RETRY_REQUIRED; |
1079 | |||
1080 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1056 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1081 | break; | 1057 | break; |
1082 | |||
1083 | default: | 1058 | default: |
1084 | /* All other completion status cause the IO to be complete. If a NAK | 1059 | /* All other completion status cause the IO to be complete. If a NAK |
1085 | * was received, then it is up to the user to retry the request | 1060 | * was received, then it is up to the user to retry the request |
1086 | */ | 1061 | */ |
1087 | sci_request_set_status(ireq, | 1062 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1088 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1063 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1089 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1090 | |||
1091 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1064 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1092 | break; | 1065 | break; |
1093 | } | 1066 | } |
@@ -1101,9 +1074,8 @@ smp_request_await_tc_event(struct isci_request *ireq, | |||
1101 | { | 1074 | { |
1102 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1075 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1103 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1076 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1104 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1077 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1105 | SCI_SUCCESS); | 1078 | ireq->sci_status = SCI_SUCCESS; |
1106 | |||
1107 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1079 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1108 | break; | 1080 | break; |
1109 | default: | 1081 | default: |
@@ -1111,10 +1083,8 @@ smp_request_await_tc_event(struct isci_request *ireq, | |||
1111 | * complete. If a NAK was received, then it is up to | 1083 | * complete. If a NAK was received, then it is up to |
1112 | * the user to retry the request. | 1084 | * the user to retry the request. |
1113 | */ | 1085 | */ |
1114 | sci_request_set_status(ireq, | 1086 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1115 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1087 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1116 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1117 | |||
1118 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1088 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1119 | break; | 1089 | break; |
1120 | } | 1090 | } |
@@ -1171,9 +1141,8 @@ stp_request_non_data_await_h2d_tc_event(struct isci_request *ireq, | |||
1171 | { | 1141 | { |
1172 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1142 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1173 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1143 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1174 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1144 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1175 | SCI_SUCCESS); | 1145 | ireq->sci_status = SCI_SUCCESS; |
1176 | |||
1177 | sci_change_state(&ireq->sm, SCI_REQ_STP_NON_DATA_WAIT_D2H); | 1146 | sci_change_state(&ireq->sm, SCI_REQ_STP_NON_DATA_WAIT_D2H); |
1178 | break; | 1147 | break; |
1179 | 1148 | ||
@@ -1182,10 +1151,8 @@ stp_request_non_data_await_h2d_tc_event(struct isci_request *ireq, | |||
1182 | * complete. If a NAK was received, then it is up to | 1151 | * complete. If a NAK was received, then it is up to |
1183 | * the user to retry the request. | 1152 | * the user to retry the request. |
1184 | */ | 1153 | */ |
1185 | sci_request_set_status(ireq, | 1154 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1186 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1155 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1187 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1188 | |||
1189 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1156 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1190 | break; | 1157 | break; |
1191 | } | 1158 | } |
@@ -1363,10 +1330,8 @@ stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq, | |||
1363 | 1330 | ||
1364 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1331 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1365 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1332 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1366 | sci_request_set_status(ireq, | 1333 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1367 | SCU_TASK_DONE_GOOD, | 1334 | ireq->sci_status = SCI_SUCCESS; |
1368 | SCI_SUCCESS); | ||
1369 | |||
1370 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); | 1335 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
1371 | break; | 1336 | break; |
1372 | 1337 | ||
@@ -1375,10 +1340,8 @@ stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq, | |||
1375 | * complete. If a NAK was received, then it is up to | 1340 | * complete. If a NAK was received, then it is up to |
1376 | * the user to retry the request. | 1341 | * the user to retry the request. |
1377 | */ | 1342 | */ |
1378 | sci_request_set_status(ireq, | 1343 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1379 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1344 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1380 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1381 | |||
1382 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1345 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1383 | break; | 1346 | break; |
1384 | } | 1347 | } |
@@ -1426,11 +1389,8 @@ pio_data_out_tx_done_tc_event(struct isci_request *ireq, | |||
1426 | * If a NAK was received, then it is up to the user to retry | 1389 | * If a NAK was received, then it is up to the user to retry |
1427 | * the request. | 1390 | * the request. |
1428 | */ | 1391 | */ |
1429 | sci_request_set_status( | 1392 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1430 | ireq, | 1393 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1431 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | ||
1432 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1433 | |||
1434 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1394 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1435 | break; | 1395 | break; |
1436 | } | 1396 | } |
@@ -1438,15 +1398,6 @@ pio_data_out_tx_done_tc_event(struct isci_request *ireq, | |||
1438 | return status; | 1398 | return status; |
1439 | } | 1399 | } |
1440 | 1400 | ||
1441 | static void sci_stp_request_udma_complete_request( | ||
1442 | struct isci_request *ireq, | ||
1443 | u32 scu_status, | ||
1444 | enum sci_status sci_status) | ||
1445 | { | ||
1446 | sci_request_set_status(ireq, scu_status, sci_status); | ||
1447 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | ||
1448 | } | ||
1449 | |||
1450 | static enum sci_status sci_stp_request_udma_general_frame_handler(struct isci_request *ireq, | 1401 | static enum sci_status sci_stp_request_udma_general_frame_handler(struct isci_request *ireq, |
1451 | u32 frame_index) | 1402 | u32 frame_index) |
1452 | { | 1403 | { |
@@ -1512,13 +1463,12 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1512 | 1463 | ||
1513 | if (resp_iu->datapres == 0x01 || | 1464 | if (resp_iu->datapres == 0x01 || |
1514 | resp_iu->datapres == 0x02) { | 1465 | resp_iu->datapres == 0x02) { |
1515 | sci_request_set_status(ireq, | 1466 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1516 | SCU_TASK_DONE_CHECK_RESPONSE, | 1467 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1517 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1468 | } else { |
1518 | } else | 1469 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1519 | sci_request_set_status(ireq, | 1470 | ireq->sci_status = SCI_SUCCESS; |
1520 | SCU_TASK_DONE_GOOD, | 1471 | } |
1521 | SCI_SUCCESS); | ||
1522 | } else { | 1472 | } else { |
1523 | /* not a response frame, why did it get forwarded? */ | 1473 | /* not a response frame, why did it get forwarded? */ |
1524 | dev_err(&ihost->pdev->dev, | 1474 | dev_err(&ihost->pdev->dev, |
@@ -1567,9 +1517,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1567 | sci_swab32_cpy(((u8 *) rsp_hdr) + SMP_RESP_HDR_SZ, | 1517 | sci_swab32_cpy(((u8 *) rsp_hdr) + SMP_RESP_HDR_SZ, |
1568 | smp_resp, word_cnt); | 1518 | smp_resp, word_cnt); |
1569 | 1519 | ||
1570 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1520 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1571 | SCI_SUCCESS); | 1521 | ireq->sci_status = SCI_SUCCESS; |
1572 | |||
1573 | sci_change_state(&ireq->sm, SCI_REQ_SMP_WAIT_TC_COMP); | 1522 | sci_change_state(&ireq->sm, SCI_REQ_SMP_WAIT_TC_COMP); |
1574 | } else { | 1523 | } else { |
1575 | /* | 1524 | /* |
@@ -1584,10 +1533,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1584 | frame_index, | 1533 | frame_index, |
1585 | rsp_hdr->frame_type); | 1534 | rsp_hdr->frame_type); |
1586 | 1535 | ||
1587 | sci_request_set_status(ireq, | 1536 | ireq->scu_status = SCU_TASK_DONE_SMP_FRM_TYPE_ERR; |
1588 | SCU_TASK_DONE_SMP_FRM_TYPE_ERR, | 1537 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1589 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
1590 | |||
1591 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1538 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1592 | } | 1539 | } |
1593 | 1540 | ||
@@ -1602,16 +1549,14 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1602 | 1549 | ||
1603 | case SCI_REQ_STP_UDMA_WAIT_D2H: | 1550 | case SCI_REQ_STP_UDMA_WAIT_D2H: |
1604 | /* Use the general frame handler to copy the resposne data */ | 1551 | /* Use the general frame handler to copy the resposne data */ |
1605 | status = sci_stp_request_udma_general_frame_handler(ireq, | 1552 | status = sci_stp_request_udma_general_frame_handler(ireq, frame_index); |
1606 | frame_index); | ||
1607 | 1553 | ||
1608 | if (status != SCI_SUCCESS) | 1554 | if (status != SCI_SUCCESS) |
1609 | return status; | 1555 | return status; |
1610 | 1556 | ||
1611 | sci_stp_request_udma_complete_request(ireq, | 1557 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1612 | SCU_TASK_DONE_CHECK_RESPONSE, | 1558 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1613 | SCI_FAILURE_IO_RESPONSE_VALID); | 1559 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1614 | |||
1615 | return SCI_SUCCESS; | 1560 | return SCI_SUCCESS; |
1616 | 1561 | ||
1617 | case SCI_REQ_STP_NON_DATA_WAIT_D2H: { | 1562 | case SCI_REQ_STP_NON_DATA_WAIT_D2H: { |
@@ -1645,8 +1590,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1645 | frame_buffer); | 1590 | frame_buffer); |
1646 | 1591 | ||
1647 | /* The command has completed with error */ | 1592 | /* The command has completed with error */ |
1648 | sci_request_set_status(ireq, SCU_TASK_DONE_CHECK_RESPONSE, | 1593 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1649 | SCI_FAILURE_IO_RESPONSE_VALID); | 1594 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1650 | break; | 1595 | break; |
1651 | 1596 | ||
1652 | default: | 1597 | default: |
@@ -1655,8 +1600,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1655 | "violation occurred\n", __func__, stp_req, | 1600 | "violation occurred\n", __func__, stp_req, |
1656 | frame_index); | 1601 | frame_index); |
1657 | 1602 | ||
1658 | sci_request_set_status(ireq, SCU_TASK_DONE_UNEXP_FIS, | 1603 | ireq->scu_status = SCU_TASK_DONE_UNEXP_FIS; |
1659 | SCI_FAILURE_PROTOCOL_VIOLATION); | 1604 | ireq->sci_status = SCI_FAILURE_PROTOCOL_VIOLATION; |
1660 | break; | 1605 | break; |
1661 | } | 1606 | } |
1662 | 1607 | ||
@@ -1753,10 +1698,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1753 | frame_header, | 1698 | frame_header, |
1754 | frame_buffer); | 1699 | frame_buffer); |
1755 | 1700 | ||
1756 | sci_request_set_status(ireq, | 1701 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1757 | SCU_TASK_DONE_CHECK_RESPONSE, | 1702 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1758 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
1759 | |||
1760 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1703 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1761 | break; | 1704 | break; |
1762 | 1705 | ||
@@ -1800,10 +1743,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1800 | frame_index, | 1743 | frame_index, |
1801 | frame_header->fis_type); | 1744 | frame_header->fis_type); |
1802 | 1745 | ||
1803 | sci_request_set_status(ireq, | 1746 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1804 | SCU_TASK_DONE_GOOD, | 1747 | ireq->sci_status = SCI_FAILURE_IO_REQUIRES_SCSI_ABORT; |
1805 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT); | ||
1806 | |||
1807 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1748 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1808 | 1749 | ||
1809 | /* Frame is decoded return it to the controller */ | 1750 | /* Frame is decoded return it to the controller */ |
@@ -1833,10 +1774,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1833 | return status; | 1774 | return status; |
1834 | 1775 | ||
1835 | if ((stp_req->status & ATA_BUSY) == 0) { | 1776 | if ((stp_req->status & ATA_BUSY) == 0) { |
1836 | sci_request_set_status(ireq, | 1777 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1837 | SCU_TASK_DONE_CHECK_RESPONSE, | 1778 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1838 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
1839 | |||
1840 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1779 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1841 | } else { | 1780 | } else { |
1842 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); | 1781 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
@@ -1873,9 +1812,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1873 | frame_buffer); | 1812 | frame_buffer); |
1874 | 1813 | ||
1875 | /* The command has completed with error */ | 1814 | /* The command has completed with error */ |
1876 | sci_request_set_status(ireq, | 1815 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1877 | SCU_TASK_DONE_CHECK_RESPONSE, | 1816 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1878 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
1879 | break; | 1817 | break; |
1880 | 1818 | ||
1881 | default: | 1819 | default: |
@@ -1886,9 +1824,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1886 | stp_req, | 1824 | stp_req, |
1887 | frame_index); | 1825 | frame_index); |
1888 | 1826 | ||
1889 | sci_request_set_status(ireq, | 1827 | ireq->scu_status = SCU_TASK_DONE_UNEXP_FIS; |
1890 | SCU_TASK_DONE_UNEXP_FIS, | 1828 | ireq->sci_status = SCI_FAILURE_PROTOCOL_VIOLATION; |
1891 | SCI_FAILURE_PROTOCOL_VIOLATION); | ||
1892 | break; | 1829 | break; |
1893 | } | 1830 | } |
1894 | 1831 | ||
@@ -1927,9 +1864,9 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq | |||
1927 | 1864 | ||
1928 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1865 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1929 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1866 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1930 | sci_stp_request_udma_complete_request(ireq, | 1867 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1931 | SCU_TASK_DONE_GOOD, | 1868 | ireq->sci_status = SCI_SUCCESS; |
1932 | SCI_SUCCESS); | 1869 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1933 | break; | 1870 | break; |
1934 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_FIS): | 1871 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_FIS): |
1935 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): | 1872 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): |
@@ -1941,9 +1878,9 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq | |||
1941 | sci_remote_device_suspend(ireq->target_device, | 1878 | sci_remote_device_suspend(ireq->target_device, |
1942 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); | 1879 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); |
1943 | 1880 | ||
1944 | sci_stp_request_udma_complete_request(ireq, | 1881 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; |
1945 | SCU_TASK_DONE_CHECK_RESPONSE, | 1882 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; |
1946 | SCI_FAILURE_IO_RESPONSE_VALID); | 1883 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1947 | } else { | 1884 | } else { |
1948 | /* If we have an error completion status for the | 1885 | /* If we have an error completion status for the |
1949 | * TC then we can expect a D2H register FIS from | 1886 | * TC then we can expect a D2H register FIS from |
@@ -1970,9 +1907,9 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq | |||
1970 | /* Fall through to the default case */ | 1907 | /* Fall through to the default case */ |
1971 | default: | 1908 | default: |
1972 | /* All other completion status cause the IO to be complete. */ | 1909 | /* All other completion status cause the IO to be complete. */ |
1973 | sci_stp_request_udma_complete_request(ireq, | 1910 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
1974 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1911 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
1975 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1912 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1976 | break; | 1913 | break; |
1977 | } | 1914 | } |
1978 | 1915 | ||
@@ -1985,9 +1922,8 @@ stp_request_soft_reset_await_h2d_asserted_tc_event(struct isci_request *ireq, | |||
1985 | { | 1922 | { |
1986 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1923 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1987 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1924 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1988 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1925 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
1989 | SCI_SUCCESS); | 1926 | ireq->sci_status = SCI_SUCCESS; |
1990 | |||
1991 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG); | 1927 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG); |
1992 | break; | 1928 | break; |
1993 | 1929 | ||
@@ -1997,10 +1933,8 @@ stp_request_soft_reset_await_h2d_asserted_tc_event(struct isci_request *ireq, | |||
1997 | * If a NAK was received, then it is up to the user to retry | 1933 | * If a NAK was received, then it is up to the user to retry |
1998 | * the request. | 1934 | * the request. |
1999 | */ | 1935 | */ |
2000 | sci_request_set_status(ireq, | 1936 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
2001 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1937 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
2002 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
2003 | |||
2004 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1938 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
2005 | break; | 1939 | break; |
2006 | } | 1940 | } |
@@ -2014,9 +1948,8 @@ stp_request_soft_reset_await_h2d_diagnostic_tc_event(struct isci_request *ireq, | |||
2014 | { | 1948 | { |
2015 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1949 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
2016 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1950 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
2017 | sci_request_set_status(ireq, SCU_TASK_DONE_GOOD, | 1951 | ireq->scu_status = SCU_TASK_DONE_GOOD; |
2018 | SCI_SUCCESS); | 1952 | ireq->sci_status = SCI_SUCCESS; |
2019 | |||
2020 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_D2H); | 1953 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_D2H); |
2021 | break; | 1954 | break; |
2022 | 1955 | ||
@@ -2025,10 +1958,8 @@ stp_request_soft_reset_await_h2d_diagnostic_tc_event(struct isci_request *ireq, | |||
2025 | * a NAK was received, then it is up to the user to retry the | 1958 | * a NAK was received, then it is up to the user to retry the |
2026 | * request. | 1959 | * request. |
2027 | */ | 1960 | */ |
2028 | sci_request_set_status(ireq, | 1961 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); |
2029 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1962 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; |
2030 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | ||
2031 | |||
2032 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1963 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
2033 | break; | 1964 | break; |
2034 | } | 1965 | } |
@@ -2504,7 +2435,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost, | |||
2504 | completion_status); | 2435 | completion_status); |
2505 | 2436 | ||
2506 | spin_lock(&request->state_lock); | 2437 | spin_lock(&request->state_lock); |
2507 | request_status = isci_request_get_state(request); | 2438 | request_status = request->status; |
2508 | 2439 | ||
2509 | /* Decode the request status. Note that if the request has been | 2440 | /* Decode the request status. Note that if the request has been |
2510 | * aborted by a task management function, we don't care | 2441 | * aborted by a task management function, we don't care |
@@ -2904,24 +2835,21 @@ static void sci_stp_request_started_non_data_await_h2d_completion_enter(struct s | |||
2904 | { | 2835 | { |
2905 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | 2836 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); |
2906 | 2837 | ||
2907 | sci_remote_device_set_working_request(ireq->target_device, | 2838 | ireq->target_device->working_request = ireq; |
2908 | ireq); | ||
2909 | } | 2839 | } |
2910 | 2840 | ||
2911 | static void sci_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm) | 2841 | static void sci_stp_request_started_pio_await_h2d_completion_enter(struct sci_base_state_machine *sm) |
2912 | { | 2842 | { |
2913 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | 2843 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); |
2914 | 2844 | ||
2915 | sci_remote_device_set_working_request(ireq->target_device, | 2845 | ireq->target_device->working_request = ireq; |
2916 | ireq); | ||
2917 | } | 2846 | } |
2918 | 2847 | ||
2919 | static void sci_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm) | 2848 | static void sci_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm) |
2920 | { | 2849 | { |
2921 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | 2850 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); |
2922 | 2851 | ||
2923 | sci_remote_device_set_working_request(ireq->target_device, | 2852 | ireq->target_device->working_request = ireq; |
2924 | ireq); | ||
2925 | } | 2853 | } |
2926 | 2854 | ||
2927 | static void sci_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm) | 2855 | static void sci_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm) |
@@ -3141,8 +3069,8 @@ sci_io_request_construct_smp(struct device *dev, | |||
3141 | 3069 | ||
3142 | task_context = ireq->tc; | 3070 | task_context = ireq->tc; |
3143 | 3071 | ||
3144 | idev = sci_request_get_device(ireq); | 3072 | idev = ireq->target_device; |
3145 | iport = sci_request_get_port(ireq); | 3073 | iport = idev->owning_port; |
3146 | 3074 | ||
3147 | /* | 3075 | /* |
3148 | * Fill in the TC with the its required data | 3076 | * Fill in the TC with the its required data |
@@ -3151,9 +3079,8 @@ sci_io_request_construct_smp(struct device *dev, | |||
3151 | task_context->priority = 0; | 3079 | task_context->priority = 0; |
3152 | task_context->initiator_request = 1; | 3080 | task_context->initiator_request = 1; |
3153 | task_context->connection_rate = idev->connection_rate; | 3081 | task_context->connection_rate = idev->connection_rate; |
3154 | task_context->protocol_engine_index = | 3082 | task_context->protocol_engine_index = ISCI_PEG; |
3155 | sci_controller_get_protocol_engine_group(ihost); | 3083 | task_context->logical_port_index = iport->physical_port_index; |
3156 | task_context->logical_port_index = sci_port_get_index(iport); | ||
3157 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP; | 3084 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP; |
3158 | task_context->abort = 0; | 3085 | task_context->abort = 0; |
3159 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 3086 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
@@ -3195,11 +3122,10 @@ sci_io_request_construct_smp(struct device *dev, | |||
3195 | task_context->task_phase = 0; | 3122 | task_context->task_phase = 0; |
3196 | 3123 | ||
3197 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 3124 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
3198 | (sci_controller_get_protocol_engine_group(ihost) << | 3125 | (ISCI_PEG << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | |
3199 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | 3126 | (iport->physical_port_index << |
3200 | (sci_port_get_index(iport) << | 3127 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | |
3201 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | 3128 | ISCI_TAG_TCI(ireq->io_tag)); |
3202 | ISCI_TAG_TCI(ireq->io_tag)); | ||
3203 | /* | 3129 | /* |
3204 | * Copy the physical address for the command buffer to the SCU Task | 3130 | * Copy the physical address for the command buffer to the SCU Task |
3205 | * Context command buffer should not contain command header. | 3131 | * Context command buffer should not contain command header. |