diff options
-rw-r--r-- | drivers/scsi/isci/request.c | 531 | ||||
-rw-r--r-- | drivers/scsi/isci/request.h | 3 |
2 files changed, 197 insertions, 337 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index b9f97e8cc5e0..cb13b78d8026 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -932,27 +932,14 @@ static void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req) | |||
932 | memcpy(resp_buf, ssp_response->resp_data, len); | 932 | memcpy(resp_buf, ssp_response->resp_data, len); |
933 | } | 933 | } |
934 | 934 | ||
935 | /* | 935 | static enum sci_status request_started_state_tc_event(struct scic_sds_request *sci_req, |
936 | * scic_sds_request_started_state_tc_completion_handler() - This method process | 936 | u32 completion_code) |
937 | * TC (task context) completions for normal IO request (i.e. Task/Abort | ||
938 | * Completions of type 0). This method will update the | ||
939 | * SCIC_SDS_IO_REQUEST_T::status field. | ||
940 | * @sci_req: This parameter specifies the request for which a completion | ||
941 | * occurred. | ||
942 | * @completion_code: This parameter specifies the completion code received from | ||
943 | * the SCU. | ||
944 | * | ||
945 | */ | ||
946 | static enum sci_status | ||
947 | scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sci_req, | ||
948 | u32 completion_code) | ||
949 | { | 937 | { |
950 | u8 datapres; | ||
951 | struct ssp_response_iu *resp_iu; | 938 | struct ssp_response_iu *resp_iu; |
939 | u8 datapres; | ||
952 | 940 | ||
953 | /* | 941 | /* TODO: Any SDMA return code of other than 0 is bad decode 0x003C0000 |
954 | * TODO: Any SDMA return code of other than 0 is bad | 942 | * to determine SDMA status |
955 | * decode 0x003C0000 to determine SDMA status | ||
956 | */ | 943 | */ |
957 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 944 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
958 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 945 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
@@ -960,11 +947,8 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
960 | SCU_TASK_DONE_GOOD, | 947 | SCU_TASK_DONE_GOOD, |
961 | SCI_SUCCESS); | 948 | SCI_SUCCESS); |
962 | break; | 949 | break; |
963 | 950 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP): { | |
964 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP): | 951 | /* There are times when the SCU hardware will return an early |
965 | { | ||
966 | /* | ||
967 | * There are times when the SCU hardware will return an early | ||
968 | * response because the io request specified more data than is | 952 | * response because the io request specified more data than is |
969 | * returned by the target device (mode pages, inquiry data, | 953 | * returned by the target device (mode pages, inquiry data, |
970 | * etc.). We must check the response stats to see if this is | 954 | * etc.). We must check the response stats to see if this is |
@@ -979,21 +963,17 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
979 | word_cnt); | 963 | word_cnt); |
980 | 964 | ||
981 | if (resp->status == 0) { | 965 | if (resp->status == 0) { |
982 | scic_sds_request_set_status( | 966 | scic_sds_request_set_status(sci_req, |
983 | sci_req, | 967 | SCU_TASK_DONE_GOOD, |
984 | SCU_TASK_DONE_GOOD, | 968 | SCI_SUCCESS_IO_DONE_EARLY); |
985 | SCI_SUCCESS_IO_DONE_EARLY); | ||
986 | } else { | 969 | } else { |
987 | scic_sds_request_set_status( | 970 | scic_sds_request_set_status(sci_req, |
988 | sci_req, | 971 | SCU_TASK_DONE_CHECK_RESPONSE, |
989 | SCU_TASK_DONE_CHECK_RESPONSE, | 972 | SCI_FAILURE_IO_RESPONSE_VALID); |
990 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
991 | } | 973 | } |
974 | break; | ||
992 | } | 975 | } |
993 | break; | 976 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE): { |
994 | |||
995 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE): | ||
996 | { | ||
997 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); | 977 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); |
998 | 978 | ||
999 | sci_swab32_cpy(&sci_req->ssp.rsp, | 979 | sci_swab32_cpy(&sci_req->ssp.rsp, |
@@ -1007,24 +987,22 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
1007 | } | 987 | } |
1008 | 988 | ||
1009 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RESP_LEN_ERR): | 989 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RESP_LEN_ERR): |
1010 | /* | 990 | /* TODO With TASK_DONE_RESP_LEN_ERR is the response frame |
1011 | * / @todo With TASK_DONE_RESP_LEN_ERR is the response frame | ||
1012 | * guaranteed to be received before this completion status is | 991 | * guaranteed to be received before this completion status is |
1013 | * posted? | 992 | * posted? |
1014 | */ | 993 | */ |
1015 | resp_iu = &sci_req->ssp.rsp; | 994 | resp_iu = &sci_req->ssp.rsp; |
1016 | datapres = resp_iu->datapres; | 995 | datapres = resp_iu->datapres; |
1017 | 996 | ||
1018 | if ((datapres == 0x01) || (datapres == 0x02)) { | 997 | if (datapres == 1 || datapres == 2) { |
1019 | scic_sds_request_set_status( | 998 | scic_sds_request_set_status(sci_req, |
1020 | sci_req, | 999 | SCU_TASK_DONE_CHECK_RESPONSE, |
1021 | SCU_TASK_DONE_CHECK_RESPONSE, | 1000 | SCI_FAILURE_IO_RESPONSE_VALID); |
1022 | SCI_FAILURE_IO_RESPONSE_VALID); | ||
1023 | } else | 1001 | } else |
1024 | scic_sds_request_set_status( | 1002 | scic_sds_request_set_status(sci_req, |
1025 | sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS); | 1003 | SCU_TASK_DONE_GOOD, |
1004 | SCI_SUCCESS); | ||
1026 | break; | 1005 | break; |
1027 | |||
1028 | /* only stp device gets suspended. */ | 1006 | /* only stp device gets suspended. */ |
1029 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): | 1007 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): |
1030 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_PERR): | 1008 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_PERR): |
@@ -1038,14 +1016,12 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
1038 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): | 1016 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): |
1039 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR): | 1017 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR): |
1040 | if (sci_req->protocol == SCIC_STP_PROTOCOL) { | 1018 | if (sci_req->protocol == SCIC_STP_PROTOCOL) { |
1041 | scic_sds_request_set_status( | 1019 | scic_sds_request_set_status(sci_req, |
1042 | sci_req, | ||
1043 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 1020 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
1044 | SCU_COMPLETION_TL_STATUS_SHIFT, | 1021 | SCU_COMPLETION_TL_STATUS_SHIFT, |
1045 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); | 1022 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); |
1046 | } else { | 1023 | } else { |
1047 | scic_sds_request_set_status( | 1024 | scic_sds_request_set_status(sci_req, |
1048 | sci_req, | ||
1049 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 1025 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
1050 | SCU_COMPLETION_TL_STATUS_SHIFT, | 1026 | SCU_COMPLETION_TL_STATUS_SHIFT, |
1051 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); | 1027 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
@@ -1063,11 +1039,10 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
1063 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY): | 1039 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY): |
1064 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED): | 1040 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED): |
1065 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED): | 1041 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED): |
1066 | scic_sds_request_set_status( | 1042 | scic_sds_request_set_status(sci_req, |
1067 | sci_req, | 1043 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> |
1068 | SCU_GET_COMPLETION_TL_STATUS(completion_code) >> | 1044 | SCU_COMPLETION_TL_STATUS_SHIFT, |
1069 | SCU_COMPLETION_TL_STATUS_SHIFT, | 1045 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); |
1070 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED); | ||
1071 | break; | 1046 | break; |
1072 | 1047 | ||
1073 | /* neither ssp nor stp gets suspended. */ | 1048 | /* neither ssp nor stp gets suspended. */ |
@@ -1105,22 +1080,6 @@ scic_sds_request_started_state_tc_completion_handler(struct scic_sds_request *sc | |||
1105 | return SCI_SUCCESS; | 1080 | return SCI_SUCCESS; |
1106 | } | 1081 | } |
1107 | 1082 | ||
1108 | enum sci_status | ||
1109 | scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completion_code) | ||
1110 | { | ||
1111 | if (request->state_handlers->tc_completion_handler) | ||
1112 | return request->state_handlers->tc_completion_handler(request, completion_code); | ||
1113 | |||
1114 | dev_warn(scic_to_dev(request->owning_controller), | ||
1115 | "%s: SCIC IO Request given task completion notification %x " | ||
1116 | "while in wrong state %d\n", | ||
1117 | __func__, | ||
1118 | completion_code, | ||
1119 | sci_base_state_machine_get_state(&request->state_machine)); | ||
1120 | |||
1121 | return SCI_FAILURE_INVALID_STATE; | ||
1122 | } | ||
1123 | |||
1124 | /* | 1083 | /* |
1125 | * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T | 1084 | * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T |
1126 | * object receives a scic_sds_request_complete() request. This method frees up | 1085 | * object receives a scic_sds_request_complete() request. This method frees up |
@@ -1146,54 +1105,32 @@ static enum sci_status scic_sds_request_completed_state_complete_handler( | |||
1146 | return SCI_SUCCESS; | 1105 | return SCI_SUCCESS; |
1147 | } | 1106 | } |
1148 | 1107 | ||
1149 | /* | 1108 | static enum sci_status request_aborting_state_tc_event( |
1150 | * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T | ||
1151 | * object receives a scic_sds_request_task_completion() request. This method | ||
1152 | * decodes the completion type waiting for the abort task complete | ||
1153 | * notification. When the abort task complete is received the io request | ||
1154 | * transitions to the completed state. enum sci_status SCI_SUCCESS | ||
1155 | */ | ||
1156 | static enum sci_status scic_sds_request_aborting_state_tc_completion_handler( | ||
1157 | struct scic_sds_request *sci_req, | 1109 | struct scic_sds_request *sci_req, |
1158 | u32 completion_code) | 1110 | u32 completion_code) |
1159 | { | 1111 | { |
1160 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1112 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1161 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): | 1113 | case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): |
1162 | case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT): | 1114 | case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT): |
1163 | scic_sds_request_set_status( | 1115 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_TASK_ABORT, |
1164 | sci_req, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED | 1116 | SCI_FAILURE_IO_TERMINATED); |
1165 | ); | ||
1166 | 1117 | ||
1167 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1118 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1168 | SCI_BASE_REQUEST_STATE_COMPLETED); | 1119 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1169 | break; | 1120 | break; |
1170 | 1121 | ||
1171 | default: | 1122 | default: |
1172 | /* | 1123 | /* Unless we get some strange error wait for the task abort to complete |
1173 | * Unless we get some strange error wait for the task abort to complete | 1124 | * TODO: Should there be a state change for this completion? |
1174 | * TODO: Should there be a state change for this completion? */ | 1125 | */ |
1175 | break; | 1126 | break; |
1176 | } | 1127 | } |
1177 | 1128 | ||
1178 | return SCI_SUCCESS; | 1129 | return SCI_SUCCESS; |
1179 | } | 1130 | } |
1180 | 1131 | ||
1181 | /** | 1132 | static enum sci_status ssp_task_request_await_tc_event(struct scic_sds_request *sci_req, |
1182 | * This method processes the completions transport layer (TL) status to | 1133 | u32 completion_code) |
1183 | * determine if the RAW task management frame was sent successfully. If the | ||
1184 | * raw frame was sent successfully, then the state for the task request | ||
1185 | * transitions to waiting for a response frame. | ||
1186 | * @sci_req: This parameter specifies the request for which the TC | ||
1187 | * completion was received. | ||
1188 | * @completion_code: This parameter indicates the completion status information | ||
1189 | * for the TC. | ||
1190 | * | ||
1191 | * Indicate if the tc completion handler was successful. SCI_SUCCESS currently | ||
1192 | * this method always returns success. | ||
1193 | */ | ||
1194 | static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler( | ||
1195 | struct scic_sds_request *sci_req, | ||
1196 | u32 completion_code) | ||
1197 | { | 1134 | { |
1198 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1135 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1199 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1136 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
@@ -1203,33 +1140,27 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi | |||
1203 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1140 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1204 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); | 1141 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); |
1205 | break; | 1142 | break; |
1206 | |||
1207 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): | 1143 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO): |
1208 | /* | 1144 | /* Currently, the decision is to simply allow the task request |
1209 | * Currently, the decision is to simply allow the task request to | 1145 | * to timeout if the task IU wasn't received successfully. |
1210 | * timeout if the task IU wasn't received successfully. | 1146 | * There is a potential for receiving multiple task responses if |
1211 | * There is a potential for receiving multiple task responses if we | 1147 | * we decide to send the task IU again. |
1212 | * decide to send the task IU again. */ | 1148 | */ |
1213 | dev_warn(scic_to_dev(sci_req->owning_controller), | 1149 | dev_warn(scic_to_dev(sci_req->owning_controller), |
1214 | "%s: TaskRequest:0x%p CompletionCode:%x - " | 1150 | "%s: TaskRequest:0x%p CompletionCode:%x - " |
1215 | "ACK/NAK timeout\n", | 1151 | "ACK/NAK timeout\n", __func__, sci_req, |
1216 | __func__, | ||
1217 | sci_req, | ||
1218 | completion_code); | 1152 | completion_code); |
1219 | 1153 | ||
1220 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1154 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1221 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); | 1155 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE); |
1222 | break; | 1156 | break; |
1223 | |||
1224 | default: | 1157 | default: |
1225 | /* | 1158 | /* All other completion status cause the IO to be complete. If a NAK |
1226 | * All other completion status cause the IO to be complete. If a NAK | 1159 | * was received, then it is up to the user to retry the request. |
1227 | * was received, then it is up to the user to retry the request. */ | 1160 | */ |
1228 | scic_sds_request_set_status( | 1161 | scic_sds_request_set_status(sci_req, |
1229 | sci_req, | ||
1230 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1162 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1231 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 1163 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1232 | ); | ||
1233 | 1164 | ||
1234 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1165 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1235 | SCI_BASE_REQUEST_STATE_COMPLETED); | 1166 | SCI_BASE_REQUEST_STATE_COMPLETED); |
@@ -1239,27 +1170,15 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi | |||
1239 | return SCI_SUCCESS; | 1170 | return SCI_SUCCESS; |
1240 | } | 1171 | } |
1241 | 1172 | ||
1242 | /** | 1173 | static enum sci_status smp_request_await_response_tc_event(struct scic_sds_request *sci_req, |
1243 | * This method processes an abnormal TC completion while the SMP request is | 1174 | u32 completion_code) |
1244 | * waiting for a response frame. It decides what happened to the IO based | ||
1245 | * on TC completion status. | ||
1246 | * @sci_req: This parameter specifies the request for which the TC | ||
1247 | * completion was received. | ||
1248 | * @completion_code: This parameter indicates the completion status information | ||
1249 | * for the TC. | ||
1250 | * | ||
1251 | * Indicate if the tc completion handler was successful. SCI_SUCCESS currently | ||
1252 | * this method always returns success. | ||
1253 | */ | ||
1254 | static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler( | ||
1255 | struct scic_sds_request *sci_req, | ||
1256 | u32 completion_code) | ||
1257 | { | 1175 | { |
1258 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1176 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1259 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1177 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1260 | /* | 1178 | /* In the AWAIT RESPONSE state, any TC completion is |
1261 | * In the AWAIT RESPONSE state, any TC completion is unexpected. | 1179 | * unexpected. but if the TC has success status, we |
1262 | * but if the TC has success status, we complete the IO anyway. */ | 1180 | * complete the IO anyway. |
1181 | */ | ||
1263 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, | 1182 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1264 | SCI_SUCCESS); | 1183 | SCI_SUCCESS); |
1265 | 1184 | ||
@@ -1271,11 +1190,13 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler | |||
1271 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR): | 1190 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR): |
1272 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR): | 1191 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR): |
1273 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_LL_RX_ERR): | 1192 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_LL_RX_ERR): |
1274 | /* | 1193 | /* These status has been seen in a specific LSI |
1275 | * These status has been seen in a specific LSI expander, which sometimes | 1194 | * expander, which sometimes is not able to send smp |
1276 | * is not able to send smp response within 2 ms. This causes our hardware | 1195 | * response within 2 ms. This causes our hardware break |
1277 | * break the connection and set TC completion with one of these SMP_XXX_XX_ERR | 1196 | * the connection and set TC completion with one of |
1278 | * status. For these type of error, we ask scic user to retry the request. */ | 1197 | * these SMP_XXX_XX_ERR status. For these type of error, |
1198 | * we ask scic user to retry the request. | ||
1199 | */ | ||
1279 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_SMP_RESP_TO_ERR, | 1200 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_SMP_RESP_TO_ERR, |
1280 | SCI_FAILURE_RETRY_REQUIRED); | 1201 | SCI_FAILURE_RETRY_REQUIRED); |
1281 | 1202 | ||
@@ -1284,14 +1205,12 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler | |||
1284 | break; | 1205 | break; |
1285 | 1206 | ||
1286 | default: | 1207 | default: |
1287 | /* | 1208 | /* All other completion status cause the IO to be complete. If a NAK |
1288 | * All other completion status cause the IO to be complete. If a NAK | 1209 | * was received, then it is up to the user to retry the request |
1289 | * was received, then it is up to the user to retry the request. */ | 1210 | */ |
1290 | scic_sds_request_set_status( | 1211 | scic_sds_request_set_status(sci_req, |
1291 | sci_req, | 1212 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1292 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1213 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1293 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | ||
1294 | ); | ||
1295 | 1214 | ||
1296 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1215 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1297 | SCI_BASE_REQUEST_STATE_COMPLETED); | 1216 | SCI_BASE_REQUEST_STATE_COMPLETED); |
@@ -1301,22 +1220,8 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler | |||
1301 | return SCI_SUCCESS; | 1220 | return SCI_SUCCESS; |
1302 | } | 1221 | } |
1303 | 1222 | ||
1304 | /** | 1223 | static enum sci_status smp_request_await_tc_event(struct scic_sds_request *sci_req, |
1305 | * This method processes the completions transport layer (TL) status to | 1224 | u32 completion_code) |
1306 | * determine if the SMP request was sent successfully. If the SMP request | ||
1307 | * was sent successfully, then the state for the SMP request transits to | ||
1308 | * waiting for a response frame. | ||
1309 | * @sci_req: This parameter specifies the request for which the TC | ||
1310 | * completion was received. | ||
1311 | * @completion_code: This parameter indicates the completion status information | ||
1312 | * for the TC. | ||
1313 | * | ||
1314 | * Indicate if the tc completion handler was successful. SCI_SUCCESS currently | ||
1315 | * this method always returns success. | ||
1316 | */ | ||
1317 | static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_handler( | ||
1318 | struct scic_sds_request *sci_req, | ||
1319 | u32 completion_code) | ||
1320 | { | 1225 | { |
1321 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1226 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1322 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1227 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
@@ -1326,20 +1231,17 @@ static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_ha | |||
1326 | sci_base_state_machine_change_state(&sci_req->state_machine, | 1231 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1327 | SCI_BASE_REQUEST_STATE_COMPLETED); | 1232 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1328 | break; | 1233 | break; |
1329 | |||
1330 | default: | 1234 | default: |
1331 | /* | 1235 | /* All other completion status cause the IO to be |
1332 | * All other completion status cause the IO to be complete. If a NAK | 1236 | * complete. If a NAK was received, then it is up to |
1333 | * was received, then it is up to the user to retry the request. */ | 1237 | * the user to retry the request. |
1334 | scic_sds_request_set_status( | 1238 | */ |
1335 | sci_req, | 1239 | scic_sds_request_set_status(sci_req, |
1336 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1240 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1337 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 1241 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1338 | ); | ||
1339 | 1242 | ||
1340 | sci_base_state_machine_change_state( | 1243 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1341 | &sci_req->state_machine, | 1244 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1342 | SCI_BASE_REQUEST_STATE_COMPLETED); | ||
1343 | break; | 1245 | break; |
1344 | } | 1246 | } |
1345 | 1247 | ||
@@ -1400,44 +1302,29 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic | |||
1400 | return current_sgl; | 1302 | return current_sgl; |
1401 | } | 1303 | } |
1402 | 1304 | ||
1403 | /** | 1305 | static enum sci_status stp_request_non_data_await_h2d_tc_event(struct scic_sds_request *sci_req, |
1404 | * | 1306 | u32 completion_code) |
1405 | * @sci_req: | ||
1406 | * @completion_code: | ||
1407 | * | ||
1408 | * This method processes a TC completion. The expected TC completion is for | ||
1409 | * the transmission of the H2D register FIS containing the SATA/STP non-data | ||
1410 | * request. This method always successfully processes the TC completion. | ||
1411 | * SCI_SUCCESS This value is always returned. | ||
1412 | */ | ||
1413 | static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_handler( | ||
1414 | struct scic_sds_request *sci_req, | ||
1415 | u32 completion_code) | ||
1416 | { | 1307 | { |
1417 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1308 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1418 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1309 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1419 | scic_sds_request_set_status( | 1310 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
1420 | sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS | 1311 | SCI_SUCCESS); |
1421 | ); | ||
1422 | 1312 | ||
1423 | sci_base_state_machine_change_state( | 1313 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1424 | &sci_req->state_machine, | 1314 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE); |
1425 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE | ||
1426 | ); | ||
1427 | break; | 1315 | break; |
1428 | 1316 | ||
1429 | default: | 1317 | default: |
1430 | /* | 1318 | /* All other completion status cause the IO to be |
1431 | * All other completion status cause the IO to be complete. If a NAK | 1319 | * complete. If a NAK was received, then it is up to |
1432 | * was received, then it is up to the user to retry the request. */ | 1320 | * the user to retry the request. |
1433 | scic_sds_request_set_status( | 1321 | */ |
1434 | sci_req, | 1322 | scic_sds_request_set_status(sci_req, |
1435 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1323 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1436 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 1324 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1437 | ); | ||
1438 | 1325 | ||
1439 | sci_base_state_machine_change_state( | 1326 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1440 | &sci_req->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED); | 1327 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1441 | break; | 1328 | break; |
1442 | } | 1329 | } |
1443 | 1330 | ||
@@ -1613,55 +1500,38 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data( | |||
1613 | return status; | 1500 | return status; |
1614 | } | 1501 | } |
1615 | 1502 | ||
1616 | /** | 1503 | static enum sci_status stp_request_pio_await_h2d_completion_tc_event(struct scic_sds_request *sci_req, |
1617 | * | 1504 | u32 completion_code) |
1618 | * @sci_req: | ||
1619 | * @completion_code: | ||
1620 | * | ||
1621 | * enum sci_status | ||
1622 | */ | ||
1623 | static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler( | ||
1624 | struct scic_sds_request *sci_req, | ||
1625 | u32 completion_code) | ||
1626 | { | 1505 | { |
1627 | enum sci_status status = SCI_SUCCESS; | 1506 | enum sci_status status = SCI_SUCCESS; |
1628 | 1507 | ||
1629 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1508 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1630 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1509 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
1631 | scic_sds_request_set_status( | 1510 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS); |
1632 | sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS | ||
1633 | ); | ||
1634 | 1511 | ||
1635 | sci_base_state_machine_change_state( | 1512 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1636 | &sci_req->state_machine, | 1513 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); |
1637 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE | ||
1638 | ); | ||
1639 | break; | 1514 | break; |
1640 | 1515 | ||
1641 | default: | 1516 | default: |
1642 | /* | 1517 | /* All other completion status cause the IO to be |
1643 | * All other completion status cause the IO to be complete. If a NAK | 1518 | * complete. If a NAK was received, then it is up to |
1644 | * was received, then it is up to the user to retry the request. */ | 1519 | * the user to retry the request. |
1645 | scic_sds_request_set_status( | 1520 | */ |
1646 | sci_req, | 1521 | scic_sds_request_set_status(sci_req, |
1647 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 1522 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
1648 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 1523 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
1649 | ); | ||
1650 | 1524 | ||
1651 | sci_base_state_machine_change_state( | 1525 | sci_base_state_machine_change_state(&sci_req->state_machine, |
1652 | &sci_req->state_machine, | 1526 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1653 | SCI_BASE_REQUEST_STATE_COMPLETED | ||
1654 | ); | ||
1655 | break; | 1527 | break; |
1656 | } | 1528 | } |
1657 | 1529 | ||
1658 | return status; | 1530 | return status; |
1659 | } | 1531 | } |
1660 | 1532 | ||
1661 | static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler( | 1533 | static enum sci_status pio_data_out_tx_done_tc_event(struct scic_sds_request *sci_req, |
1662 | 1534 | u32 completion_code) | |
1663 | struct scic_sds_request *sci_req, | ||
1664 | u32 completion_code) | ||
1665 | { | 1535 | { |
1666 | enum sci_status status = SCI_SUCCESS; | 1536 | enum sci_status status = SCI_SUCCESS; |
1667 | bool all_frames_transferred = false; | 1537 | bool all_frames_transferred = false; |
@@ -1695,7 +1565,6 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com | |||
1695 | ); | 1565 | ); |
1696 | } | 1566 | } |
1697 | break; | 1567 | break; |
1698 | |||
1699 | default: | 1568 | default: |
1700 | /* | 1569 | /* |
1701 | * All other completion status cause the IO to be complete. If a NAK | 1570 | * All other completion status cause the IO to be complete. If a NAK |
@@ -2209,12 +2078,8 @@ enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_r | |||
2209 | } | 2078 | } |
2210 | } | 2079 | } |
2211 | 2080 | ||
2212 | 2081 | static enum sci_status stp_request_udma_await_tc_event(struct scic_sds_request *sci_req, | |
2213 | 2082 | u32 completion_code) | |
2214 | |||
2215 | static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completion_handler( | ||
2216 | struct scic_sds_request *sci_req, | ||
2217 | u32 completion_code) | ||
2218 | { | 2083 | { |
2219 | enum sci_status status = SCI_SUCCESS; | 2084 | enum sci_status status = SCI_SUCCESS; |
2220 | 2085 | ||
@@ -2226,9 +2091,10 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
2226 | break; | 2091 | break; |
2227 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_FIS): | 2092 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_FIS): |
2228 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): | 2093 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): |
2229 | /* | 2094 | /* We must check ther response buffer to see if the D2H |
2230 | * We must check ther response buffer to see if the D2H Register FIS was | 2095 | * Register FIS was received before we got the TC |
2231 | * received before we got the TC completion. */ | 2096 | * completion. |
2097 | */ | ||
2232 | if (sci_req->stp.rsp.fis_type == FIS_REGD2H) { | 2098 | if (sci_req->stp.rsp.fis_type == FIS_REGD2H) { |
2233 | scic_sds_remote_device_suspend(sci_req->target_device, | 2099 | scic_sds_remote_device_suspend(sci_req->target_device, |
2234 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); | 2100 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); |
@@ -2237,18 +2103,22 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
2237 | SCU_TASK_DONE_CHECK_RESPONSE, | 2103 | SCU_TASK_DONE_CHECK_RESPONSE, |
2238 | SCI_FAILURE_IO_RESPONSE_VALID); | 2104 | SCI_FAILURE_IO_RESPONSE_VALID); |
2239 | } else { | 2105 | } else { |
2240 | /* | 2106 | /* If we have an error completion status for the |
2241 | * If we have an error completion status for the TC then we can expect a | 2107 | * TC then we can expect a D2H register FIS from |
2242 | * D2H register FIS from the device so we must change state to wait for it */ | 2108 | * the device so we must change state to wait |
2109 | * for it | ||
2110 | */ | ||
2243 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2111 | sci_base_state_machine_change_state(&sci_req->state_machine, |
2244 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE); | 2112 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE); |
2245 | } | 2113 | } |
2246 | break; | 2114 | break; |
2247 | 2115 | ||
2248 | /* | 2116 | /* TODO Check to see if any of these completion status need to |
2249 | * / @todo Check to see if any of these completion status need to wait for | 2117 | * wait for the device to host register fis. |
2250 | * / the device to host register fis. */ | 2118 | */ |
2251 | /* / @todo We can retry the command for SCU_TASK_DONE_CMD_LL_R_ERR - this comes only for B0 */ | 2119 | /* TODO We can retry the command for SCU_TASK_DONE_CMD_LL_R_ERR |
2120 | * - this comes only for B0 | ||
2121 | */ | ||
2252 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_INV_FIS_LEN): | 2122 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_INV_FIS_LEN): |
2253 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_MAX_PLD_ERR): | 2123 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_MAX_PLD_ERR): |
2254 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_R_ERR): | 2124 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_R_ERR): |
@@ -2268,61 +2138,35 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
2268 | return status; | 2138 | return status; |
2269 | } | 2139 | } |
2270 | 2140 | ||
2271 | /** | 2141 | static enum sci_status stp_request_soft_reset_await_h2d_asserted_tc_event(struct scic_sds_request *sci_req, |
2272 | * | 2142 | u32 completion_code) |
2273 | * @sci_req: | ||
2274 | * @completion_code: | ||
2275 | * | ||
2276 | * This method processes a TC completion. The expected TC completion is for | ||
2277 | * the transmission of the H2D register FIS containing the SATA/STP non-data | ||
2278 | * request. This method always successfully processes the TC completion. | ||
2279 | * SCI_SUCCESS This value is always returned. | ||
2280 | */ | ||
2281 | static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler( | ||
2282 | struct scic_sds_request *sci_req, | ||
2283 | u32 completion_code) | ||
2284 | { | 2143 | { |
2285 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 2144 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
2286 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 2145 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
2287 | scic_sds_request_set_status( | 2146 | scic_sds_request_set_status(sci_req, SCU_TASK_DONE_GOOD, |
2288 | sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS | 2147 | SCI_SUCCESS); |
2289 | ); | ||
2290 | 2148 | ||
2291 | sci_base_state_machine_change_state( | 2149 | sci_base_state_machine_change_state(&sci_req->state_machine, |
2292 | &sci_req->state_machine, | 2150 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE); |
2293 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE | ||
2294 | ); | ||
2295 | break; | 2151 | break; |
2296 | 2152 | ||
2297 | default: | 2153 | default: |
2298 | /* | 2154 | /* |
2299 | * All other completion status cause the IO to be complete. If a NAK | 2155 | * All other completion status cause the IO to be complete. If a NAK |
2300 | * was received, then it is up to the user to retry the request. */ | 2156 | * was received, then it is up to the user to retry the request. */ |
2301 | scic_sds_request_set_status( | 2157 | scic_sds_request_set_status(sci_req, |
2302 | sci_req, | ||
2303 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 2158 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
2304 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 2159 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
2305 | ); | ||
2306 | 2160 | ||
2307 | sci_base_state_machine_change_state( | 2161 | sci_base_state_machine_change_state(&sci_req->state_machine, |
2308 | &sci_req->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED); | 2162 | SCI_BASE_REQUEST_STATE_COMPLETED); |
2309 | break; | 2163 | break; |
2310 | } | 2164 | } |
2311 | 2165 | ||
2312 | return SCI_SUCCESS; | 2166 | return SCI_SUCCESS; |
2313 | } | 2167 | } |
2314 | 2168 | ||
2315 | /** | 2169 | static enum sci_status stp_request_soft_reset_await_h2d_diagnostic_tc_event( |
2316 | * | ||
2317 | * @sci_req: | ||
2318 | * @completion_code: | ||
2319 | * | ||
2320 | * This method processes a TC completion. The expected TC completion is for | ||
2321 | * the transmission of the H2D register FIS containing the SATA/STP non-data | ||
2322 | * request. This method always successfully processes the TC completion. | ||
2323 | * SCI_SUCCESS This value is always returned. | ||
2324 | */ | ||
2325 | static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler( | ||
2326 | struct scic_sds_request *sci_req, | 2170 | struct scic_sds_request *sci_req, |
2327 | u32 completion_code) | 2171 | u32 completion_code) |
2328 | { | 2172 | { |
@@ -2336,70 +2180,89 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_c | |||
2336 | break; | 2180 | break; |
2337 | 2181 | ||
2338 | default: | 2182 | default: |
2339 | /* | 2183 | /* All other completion status cause the IO to be complete. If |
2340 | * All other completion status cause the IO to be complete. If a NAK | 2184 | * a NAK was received, then it is up to the user to retry the |
2341 | * was received, then it is up to the user to retry the request. */ | 2185 | * request. |
2342 | scic_sds_request_set_status( | 2186 | */ |
2343 | sci_req, | 2187 | scic_sds_request_set_status(sci_req, |
2344 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), | 2188 | SCU_NORMALIZE_COMPLETION_STATUS(completion_code), |
2345 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR | 2189 | SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR); |
2346 | ); | ||
2347 | 2190 | ||
2348 | sci_base_state_machine_change_state(&sci_req->state_machine, | 2191 | sci_base_state_machine_change_state(&sci_req->state_machine, |
2349 | SCI_BASE_REQUEST_STATE_COMPLETED); | 2192 | SCI_BASE_REQUEST_STATE_COMPLETED); |
2350 | break; | 2193 | break; |
2351 | } | 2194 | } |
2352 | 2195 | ||
2353 | return SCI_SUCCESS; | 2196 | return SCI_SUCCESS; |
2354 | } | 2197 | } |
2355 | 2198 | ||
2199 | enum sci_status | ||
2200 | scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 completion_code) | ||
2201 | { | ||
2202 | enum sci_base_request_states state; | ||
2203 | struct scic_sds_controller *scic = sci_req->owning_controller; | ||
2204 | |||
2205 | state = sci_req->state_machine.current_state_id; | ||
2206 | |||
2207 | switch (state) { | ||
2208 | case SCI_BASE_REQUEST_STATE_STARTED: | ||
2209 | return request_started_state_tc_event(sci_req, completion_code); | ||
2210 | case SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION: | ||
2211 | return ssp_task_request_await_tc_event(sci_req, completion_code); | ||
2212 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE: | ||
2213 | return smp_request_await_response_tc_event(sci_req, completion_code); | ||
2214 | case SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION: | ||
2215 | return smp_request_await_tc_event(sci_req, completion_code); | ||
2216 | case SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE: | ||
2217 | return stp_request_udma_await_tc_event(sci_req, completion_code); | ||
2218 | case SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE: | ||
2219 | return stp_request_non_data_await_h2d_tc_event(sci_req, completion_code); | ||
2220 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE: | ||
2221 | return stp_request_pio_await_h2d_completion_tc_event(sci_req, completion_code); | ||
2222 | case SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE: | ||
2223 | return pio_data_out_tx_done_tc_event(sci_req, completion_code); | ||
2224 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE: | ||
2225 | return stp_request_soft_reset_await_h2d_asserted_tc_event(sci_req, completion_code); | ||
2226 | case SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE: | ||
2227 | return stp_request_soft_reset_await_h2d_diagnostic_tc_event(sci_req, completion_code); | ||
2228 | case SCI_BASE_REQUEST_STATE_ABORTING: | ||
2229 | return request_aborting_state_tc_event(sci_req, completion_code); | ||
2230 | default: | ||
2231 | dev_warn(scic_to_dev(scic), | ||
2232 | "%s: SCIC IO Request given task completion notification %x " | ||
2233 | "while in wrong state %d\n", __func__, completion_code, | ||
2234 | state); | ||
2235 | return SCI_FAILURE_INVALID_STATE; | ||
2236 | } | ||
2237 | } | ||
2238 | |||
2239 | |||
2240 | |||
2356 | static const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = { | 2241 | static const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = { |
2357 | [SCI_BASE_REQUEST_STATE_INITIAL] = {}, | 2242 | [SCI_BASE_REQUEST_STATE_INITIAL] = {}, |
2358 | [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {}, | 2243 | [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {}, |
2359 | [SCI_BASE_REQUEST_STATE_STARTED] = { | 2244 | [SCI_BASE_REQUEST_STATE_STARTED] = { }, |
2360 | .tc_completion_handler = scic_sds_request_started_state_tc_completion_handler, | 2245 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION] = { }, |
2361 | }, | ||
2362 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION] = { | ||
2363 | .tc_completion_handler = scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler, | ||
2364 | }, | ||
2365 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE] = { }, | 2246 | [SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE] = { }, |
2366 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = { | 2247 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = { }, |
2367 | .tc_completion_handler = scic_sds_smp_request_await_response_tc_completion_handler, | 2248 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION] = { }, |
2368 | }, | 2249 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = { }, |
2369 | [SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION] = { | ||
2370 | .tc_completion_handler = scic_sds_smp_request_await_tc_completion_tc_completion_handler, | ||
2371 | }, | ||
2372 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = { | ||
2373 | .tc_completion_handler = scic_sds_stp_request_udma_await_tc_completion_tc_completion_handler, | ||
2374 | }, | ||
2375 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE] = { }, | 2250 | [SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE] = { }, |
2376 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = { | 2251 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = { }, |
2377 | .tc_completion_handler = scic_sds_stp_request_non_data_await_h2d_tc_completion_handler, | ||
2378 | }, | ||
2379 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE] = { }, | 2252 | [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE] = { }, |
2380 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = { | 2253 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = { }, |
2381 | .tc_completion_handler = scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler, | ||
2382 | }, | ||
2383 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE] = { }, | 2254 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE] = { }, |
2384 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE] = { | 2255 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE] = { |
2385 | .event_handler = scic_sds_stp_request_pio_data_in_await_data_event_handler, | 2256 | .event_handler = scic_sds_stp_request_pio_data_in_await_data_event_handler, |
2386 | }, | 2257 | }, |
2387 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE] = { | 2258 | [SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE] = { }, |
2388 | .tc_completion_handler = scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler, | 2259 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = { }, |
2389 | }, | 2260 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE] = { }, |
2390 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = { | ||
2391 | .tc_completion_handler = scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler, | ||
2392 | }, | ||
2393 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE] = { | ||
2394 | .tc_completion_handler = scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler, | ||
2395 | }, | ||
2396 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE] = { }, | 2261 | [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE] = { }, |
2397 | [SCI_BASE_REQUEST_STATE_COMPLETED] = { | 2262 | [SCI_BASE_REQUEST_STATE_COMPLETED] = { |
2398 | .complete_handler = scic_sds_request_completed_state_complete_handler, | 2263 | .complete_handler = scic_sds_request_completed_state_complete_handler, |
2399 | }, | 2264 | }, |
2400 | [SCI_BASE_REQUEST_STATE_ABORTING] = { | 2265 | [SCI_BASE_REQUEST_STATE_ABORTING] = { }, |
2401 | .tc_completion_handler = scic_sds_request_aborting_state_tc_completion_handler, | ||
2402 | }, | ||
2403 | [SCI_BASE_REQUEST_STATE_FINAL] = { }, | 2266 | [SCI_BASE_REQUEST_STATE_FINAL] = { }, |
2404 | }; | 2267 | }; |
2405 | 2268 | ||
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index c9070e708948..e13ca3f7c8d7 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -426,8 +426,6 @@ typedef enum sci_status (*scic_sds_io_request_handler_t) | |||
426 | (struct scic_sds_request *request); | 426 | (struct scic_sds_request *request); |
427 | typedef enum sci_status (*scic_sds_io_request_event_handler_t) | 427 | typedef enum sci_status (*scic_sds_io_request_event_handler_t) |
428 | (struct scic_sds_request *req, u32 event); | 428 | (struct scic_sds_request *req, u32 event); |
429 | typedef enum sci_status (*scic_sds_io_request_task_completion_handler_t) | ||
430 | (struct scic_sds_request *req, u32 completion_code); | ||
431 | 429 | ||
432 | /** | 430 | /** |
433 | * struct scic_sds_io_request_state_handler - This is the SDS core definition | 431 | * struct scic_sds_io_request_state_handler - This is the SDS core definition |
@@ -442,7 +440,6 @@ struct scic_sds_io_request_state_handler { | |||
442 | */ | 440 | */ |
443 | scic_sds_io_request_handler_t complete_handler; | 441 | scic_sds_io_request_handler_t complete_handler; |
444 | 442 | ||
445 | scic_sds_io_request_task_completion_handler_t tc_completion_handler; | ||
446 | scic_sds_io_request_event_handler_t event_handler; | 443 | scic_sds_io_request_event_handler_t event_handler; |
447 | }; | 444 | }; |
448 | 445 | ||