diff options
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r-- | drivers/scsi/isci/request.c | 370 |
1 files changed, 169 insertions, 201 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index ee0dc05c6269..2def1e3960f6 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -53,6 +53,7 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <scsi/scsi_cmnd.h> | ||
56 | #include "isci.h" | 57 | #include "isci.h" |
57 | #include "task.h" | 58 | #include "task.h" |
58 | #include "request.h" | 59 | #include "request.h" |
@@ -60,6 +61,16 @@ | |||
60 | #include "scu_event_codes.h" | 61 | #include "scu_event_codes.h" |
61 | #include "sas.h" | 62 | #include "sas.h" |
62 | 63 | ||
64 | #undef C | ||
65 | #define C(a) (#a) | ||
66 | const char *req_state_name(enum sci_base_request_states state) | ||
67 | { | ||
68 | static const char * const strings[] = REQUEST_STATES; | ||
69 | |||
70 | return strings[state]; | ||
71 | } | ||
72 | #undef C | ||
73 | |||
63 | static struct scu_sgl_element_pair *to_sgl_element_pair(struct isci_request *ireq, | 74 | static struct scu_sgl_element_pair *to_sgl_element_pair(struct isci_request *ireq, |
64 | int idx) | 75 | int idx) |
65 | { | 76 | { |
@@ -264,6 +275,141 @@ static void scu_ssp_reqeust_construct_task_context( | |||
264 | task_context->response_iu_lower = lower_32_bits(dma_addr); | 275 | task_context->response_iu_lower = lower_32_bits(dma_addr); |
265 | } | 276 | } |
266 | 277 | ||
278 | static u8 scu_bg_blk_size(struct scsi_device *sdp) | ||
279 | { | ||
280 | switch (sdp->sector_size) { | ||
281 | case 512: | ||
282 | return 0; | ||
283 | case 1024: | ||
284 | return 1; | ||
285 | case 4096: | ||
286 | return 3; | ||
287 | default: | ||
288 | return 0xff; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | static u32 scu_dif_bytes(u32 len, u32 sector_size) | ||
293 | { | ||
294 | return (len >> ilog2(sector_size)) * 8; | ||
295 | } | ||
296 | |||
297 | static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op) | ||
298 | { | ||
299 | struct scu_task_context *tc = ireq->tc; | ||
300 | struct scsi_cmnd *scmd = ireq->ttype_ptr.io_task_ptr->uldd_task; | ||
301 | u8 blk_sz = scu_bg_blk_size(scmd->device); | ||
302 | |||
303 | tc->block_guard_enable = 1; | ||
304 | tc->blk_prot_en = 1; | ||
305 | tc->blk_sz = blk_sz; | ||
306 | /* DIF write insert */ | ||
307 | tc->blk_prot_func = 0x2; | ||
308 | |||
309 | tc->transfer_length_bytes += scu_dif_bytes(tc->transfer_length_bytes, | ||
310 | scmd->device->sector_size); | ||
311 | |||
312 | /* always init to 0, used by hw */ | ||
313 | tc->interm_crc_val = 0; | ||
314 | |||
315 | tc->init_crc_seed = 0; | ||
316 | tc->app_tag_verify = 0; | ||
317 | tc->app_tag_gen = 0; | ||
318 | tc->ref_tag_seed_verify = 0; | ||
319 | |||
320 | /* always init to same as bg_blk_sz */ | ||
321 | tc->UD_bytes_immed_val = scmd->device->sector_size; | ||
322 | |||
323 | tc->reserved_DC_0 = 0; | ||
324 | |||
325 | /* always init to 8 */ | ||
326 | tc->DIF_bytes_immed_val = 8; | ||
327 | |||
328 | tc->reserved_DC_1 = 0; | ||
329 | tc->bgc_blk_sz = scmd->device->sector_size; | ||
330 | tc->reserved_E0_0 = 0; | ||
331 | tc->app_tag_gen_mask = 0; | ||
332 | |||
333 | /** setup block guard control **/ | ||
334 | tc->bgctl = 0; | ||
335 | |||
336 | /* DIF write insert */ | ||
337 | tc->bgctl_f.op = 0x2; | ||
338 | |||
339 | tc->app_tag_verify_mask = 0; | ||
340 | |||
341 | /* must init to 0 for hw */ | ||
342 | tc->blk_guard_err = 0; | ||
343 | |||
344 | tc->reserved_E8_0 = 0; | ||
345 | |||
346 | if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) | ||
347 | tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff; | ||
348 | else if (type & SCSI_PROT_DIF_TYPE3) | ||
349 | tc->ref_tag_seed_gen = 0; | ||
350 | } | ||
351 | |||
352 | static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op) | ||
353 | { | ||
354 | struct scu_task_context *tc = ireq->tc; | ||
355 | struct scsi_cmnd *scmd = ireq->ttype_ptr.io_task_ptr->uldd_task; | ||
356 | u8 blk_sz = scu_bg_blk_size(scmd->device); | ||
357 | |||
358 | tc->block_guard_enable = 1; | ||
359 | tc->blk_prot_en = 1; | ||
360 | tc->blk_sz = blk_sz; | ||
361 | /* DIF read strip */ | ||
362 | tc->blk_prot_func = 0x1; | ||
363 | |||
364 | tc->transfer_length_bytes += scu_dif_bytes(tc->transfer_length_bytes, | ||
365 | scmd->device->sector_size); | ||
366 | |||
367 | /* always init to 0, used by hw */ | ||
368 | tc->interm_crc_val = 0; | ||
369 | |||
370 | tc->init_crc_seed = 0; | ||
371 | tc->app_tag_verify = 0; | ||
372 | tc->app_tag_gen = 0; | ||
373 | |||
374 | if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) | ||
375 | tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff; | ||
376 | else if (type & SCSI_PROT_DIF_TYPE3) | ||
377 | tc->ref_tag_seed_verify = 0; | ||
378 | |||
379 | /* always init to same as bg_blk_sz */ | ||
380 | tc->UD_bytes_immed_val = scmd->device->sector_size; | ||
381 | |||
382 | tc->reserved_DC_0 = 0; | ||
383 | |||
384 | /* always init to 8 */ | ||
385 | tc->DIF_bytes_immed_val = 8; | ||
386 | |||
387 | tc->reserved_DC_1 = 0; | ||
388 | tc->bgc_blk_sz = scmd->device->sector_size; | ||
389 | tc->reserved_E0_0 = 0; | ||
390 | tc->app_tag_gen_mask = 0; | ||
391 | |||
392 | /** setup block guard control **/ | ||
393 | tc->bgctl = 0; | ||
394 | |||
395 | /* DIF read strip */ | ||
396 | tc->bgctl_f.crc_verify = 1; | ||
397 | tc->bgctl_f.op = 0x1; | ||
398 | if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) { | ||
399 | tc->bgctl_f.ref_tag_chk = 1; | ||
400 | tc->bgctl_f.app_f_detect = 1; | ||
401 | } else if (type & SCSI_PROT_DIF_TYPE3) | ||
402 | tc->bgctl_f.app_ref_f_detect = 1; | ||
403 | |||
404 | tc->app_tag_verify_mask = 0; | ||
405 | |||
406 | /* must init to 0 for hw */ | ||
407 | tc->blk_guard_err = 0; | ||
408 | |||
409 | tc->reserved_E8_0 = 0; | ||
410 | tc->ref_tag_seed_gen = 0; | ||
411 | } | ||
412 | |||
267 | /** | 413 | /** |
268 | * This method is will fill in the SCU Task Context for a SSP IO request. | 414 | * This method is will fill in the SCU Task Context for a SSP IO request. |
269 | * @sci_req: | 415 | * @sci_req: |
@@ -274,6 +420,10 @@ static void scu_ssp_io_request_construct_task_context(struct isci_request *ireq, | |||
274 | u32 len) | 420 | u32 len) |
275 | { | 421 | { |
276 | struct scu_task_context *task_context = ireq->tc; | 422 | struct scu_task_context *task_context = ireq->tc; |
423 | struct sas_task *sas_task = ireq->ttype_ptr.io_task_ptr; | ||
424 | struct scsi_cmnd *scmd = sas_task->uldd_task; | ||
425 | u8 prot_type = scsi_get_prot_type(scmd); | ||
426 | u8 prot_op = scsi_get_prot_op(scmd); | ||
277 | 427 | ||
278 | scu_ssp_reqeust_construct_task_context(ireq, task_context); | 428 | scu_ssp_reqeust_construct_task_context(ireq, task_context); |
279 | 429 | ||
@@ -296,6 +446,13 @@ static void scu_ssp_io_request_construct_task_context(struct isci_request *ireq, | |||
296 | 446 | ||
297 | if (task_context->transfer_length_bytes > 0) | 447 | if (task_context->transfer_length_bytes > 0) |
298 | sci_request_build_sgl(ireq); | 448 | sci_request_build_sgl(ireq); |
449 | |||
450 | if (prot_type != SCSI_PROT_DIF_TYPE0) { | ||
451 | if (prot_op == SCSI_PROT_READ_STRIP) | ||
452 | scu_ssp_ireq_dif_strip(ireq, prot_type, prot_op); | ||
453 | else if (prot_op == SCSI_PROT_WRITE_INSERT) | ||
454 | scu_ssp_ireq_dif_insert(ireq, prot_type, prot_op); | ||
455 | } | ||
299 | } | 456 | } |
300 | 457 | ||
301 | /** | 458 | /** |
@@ -519,18 +676,12 @@ sci_io_request_construct_sata(struct isci_request *ireq, | |||
519 | if (test_bit(IREQ_TMF, &ireq->flags)) { | 676 | if (test_bit(IREQ_TMF, &ireq->flags)) { |
520 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); | 677 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); |
521 | 678 | ||
522 | if (tmf->tmf_code == isci_tmf_sata_srst_high || | 679 | dev_err(&ireq->owning_controller->pdev->dev, |
523 | tmf->tmf_code == isci_tmf_sata_srst_low) { | 680 | "%s: Request 0x%p received un-handled SAT " |
524 | scu_stp_raw_request_construct_task_context(ireq); | 681 | "management protocol 0x%x.\n", |
525 | return SCI_SUCCESS; | 682 | __func__, ireq, tmf->tmf_code); |
526 | } else { | ||
527 | dev_err(&ireq->owning_controller->pdev->dev, | ||
528 | "%s: Request 0x%p received un-handled SAT " | ||
529 | "management protocol 0x%x.\n", | ||
530 | __func__, ireq, tmf->tmf_code); | ||
531 | 683 | ||
532 | return SCI_FAILURE; | 684 | return SCI_FAILURE; |
533 | } | ||
534 | } | 685 | } |
535 | 686 | ||
536 | if (!sas_protocol_ata(task->task_proto)) { | 687 | if (!sas_protocol_ata(task->task_proto)) { |
@@ -627,34 +778,6 @@ static enum sci_status sci_io_request_construct_basic_sata(struct isci_request * | |||
627 | return status; | 778 | return status; |
628 | } | 779 | } |
629 | 780 | ||
630 | enum sci_status sci_task_request_construct_sata(struct isci_request *ireq) | ||
631 | { | ||
632 | enum sci_status status = SCI_SUCCESS; | ||
633 | |||
634 | /* check for management protocols */ | ||
635 | if (test_bit(IREQ_TMF, &ireq->flags)) { | ||
636 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); | ||
637 | |||
638 | if (tmf->tmf_code == isci_tmf_sata_srst_high || | ||
639 | tmf->tmf_code == isci_tmf_sata_srst_low) { | ||
640 | scu_stp_raw_request_construct_task_context(ireq); | ||
641 | } else { | ||
642 | dev_err(&ireq->owning_controller->pdev->dev, | ||
643 | "%s: Request 0x%p received un-handled SAT " | ||
644 | "Protocol 0x%x.\n", | ||
645 | __func__, ireq, tmf->tmf_code); | ||
646 | |||
647 | return SCI_FAILURE; | ||
648 | } | ||
649 | } | ||
650 | |||
651 | if (status != SCI_SUCCESS) | ||
652 | return status; | ||
653 | sci_change_state(&ireq->sm, SCI_REQ_CONSTRUCTED); | ||
654 | |||
655 | return status; | ||
656 | } | ||
657 | |||
658 | /** | 781 | /** |
659 | * sci_req_tx_bytes - bytes transferred when reply underruns request | 782 | * sci_req_tx_bytes - bytes transferred when reply underruns request |
660 | * @ireq: request that was terminated early | 783 | * @ireq: request that was terminated early |
@@ -756,9 +879,6 @@ sci_io_request_terminate(struct isci_request *ireq) | |||
756 | case SCI_REQ_STP_PIO_WAIT_FRAME: | 879 | case SCI_REQ_STP_PIO_WAIT_FRAME: |
757 | case SCI_REQ_STP_PIO_DATA_IN: | 880 | case SCI_REQ_STP_PIO_DATA_IN: |
758 | case SCI_REQ_STP_PIO_DATA_OUT: | 881 | case SCI_REQ_STP_PIO_DATA_OUT: |
759 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED: | ||
760 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG: | ||
761 | case SCI_REQ_STP_SOFT_RESET_WAIT_D2H: | ||
762 | case SCI_REQ_ATAPI_WAIT_H2D: | 882 | case SCI_REQ_ATAPI_WAIT_H2D: |
763 | case SCI_REQ_ATAPI_WAIT_PIO_SETUP: | 883 | case SCI_REQ_ATAPI_WAIT_PIO_SETUP: |
764 | case SCI_REQ_ATAPI_WAIT_D2H: | 884 | case SCI_REQ_ATAPI_WAIT_D2H: |
@@ -800,7 +920,8 @@ enum sci_status sci_request_complete(struct isci_request *ireq) | |||
800 | 920 | ||
801 | state = ireq->sm.current_state_id; | 921 | state = ireq->sm.current_state_id; |
802 | if (WARN_ONCE(state != SCI_REQ_COMPLETED, | 922 | if (WARN_ONCE(state != SCI_REQ_COMPLETED, |
803 | "isci: request completion from wrong state (%d)\n", state)) | 923 | "isci: request completion from wrong state (%s)\n", |
924 | req_state_name(state))) | ||
804 | return SCI_FAILURE_INVALID_STATE; | 925 | return SCI_FAILURE_INVALID_STATE; |
805 | 926 | ||
806 | if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) | 927 | if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) |
@@ -821,8 +942,8 @@ enum sci_status sci_io_request_event_handler(struct isci_request *ireq, | |||
821 | state = ireq->sm.current_state_id; | 942 | state = ireq->sm.current_state_id; |
822 | 943 | ||
823 | if (state != SCI_REQ_STP_PIO_DATA_IN) { | 944 | if (state != SCI_REQ_STP_PIO_DATA_IN) { |
824 | dev_warn(&ihost->pdev->dev, "%s: (%x) in wrong state %d\n", | 945 | dev_warn(&ihost->pdev->dev, "%s: (%x) in wrong state %s\n", |
825 | __func__, event_code, state); | 946 | __func__, event_code, req_state_name(state)); |
826 | 947 | ||
827 | return SCI_FAILURE_INVALID_STATE; | 948 | return SCI_FAILURE_INVALID_STATE; |
828 | } | 949 | } |
@@ -1938,59 +2059,6 @@ sci_io_request_frame_handler(struct isci_request *ireq, | |||
1938 | return status; | 2059 | return status; |
1939 | } | 2060 | } |
1940 | 2061 | ||
1941 | case SCI_REQ_STP_SOFT_RESET_WAIT_D2H: { | ||
1942 | struct dev_to_host_fis *frame_header; | ||
1943 | u32 *frame_buffer; | ||
1944 | |||
1945 | status = sci_unsolicited_frame_control_get_header(&ihost->uf_control, | ||
1946 | frame_index, | ||
1947 | (void **)&frame_header); | ||
1948 | if (status != SCI_SUCCESS) { | ||
1949 | dev_err(&ihost->pdev->dev, | ||
1950 | "%s: SCIC IO Request 0x%p could not get frame " | ||
1951 | "header for frame index %d, status %x\n", | ||
1952 | __func__, | ||
1953 | stp_req, | ||
1954 | frame_index, | ||
1955 | status); | ||
1956 | return status; | ||
1957 | } | ||
1958 | |||
1959 | switch (frame_header->fis_type) { | ||
1960 | case FIS_REGD2H: | ||
1961 | sci_unsolicited_frame_control_get_buffer(&ihost->uf_control, | ||
1962 | frame_index, | ||
1963 | (void **)&frame_buffer); | ||
1964 | |||
1965 | sci_controller_copy_sata_response(&ireq->stp.rsp, | ||
1966 | frame_header, | ||
1967 | frame_buffer); | ||
1968 | |||
1969 | /* The command has completed with error */ | ||
1970 | ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; | ||
1971 | ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; | ||
1972 | break; | ||
1973 | |||
1974 | default: | ||
1975 | dev_warn(&ihost->pdev->dev, | ||
1976 | "%s: IO Request:0x%p Frame Id:%d protocol " | ||
1977 | "violation occurred\n", | ||
1978 | __func__, | ||
1979 | stp_req, | ||
1980 | frame_index); | ||
1981 | |||
1982 | ireq->scu_status = SCU_TASK_DONE_UNEXP_FIS; | ||
1983 | ireq->sci_status = SCI_FAILURE_PROTOCOL_VIOLATION; | ||
1984 | break; | ||
1985 | } | ||
1986 | |||
1987 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | ||
1988 | |||
1989 | /* Frame has been decoded return it to the controller */ | ||
1990 | sci_controller_release_frame(ihost, frame_index); | ||
1991 | |||
1992 | return status; | ||
1993 | } | ||
1994 | case SCI_REQ_ATAPI_WAIT_PIO_SETUP: { | 2062 | case SCI_REQ_ATAPI_WAIT_PIO_SETUP: { |
1995 | struct sas_task *task = isci_request_access_task(ireq); | 2063 | struct sas_task *task = isci_request_access_task(ireq); |
1996 | 2064 | ||
@@ -2088,57 +2156,6 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq | |||
2088 | return status; | 2156 | return status; |
2089 | } | 2157 | } |
2090 | 2158 | ||
2091 | static enum sci_status | ||
2092 | stp_request_soft_reset_await_h2d_asserted_tc_event(struct isci_request *ireq, | ||
2093 | u32 completion_code) | ||
2094 | { | ||
2095 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | ||
2096 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | ||
2097 | ireq->scu_status = SCU_TASK_DONE_GOOD; | ||
2098 | ireq->sci_status = SCI_SUCCESS; | ||
2099 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG); | ||
2100 | break; | ||
2101 | |||
2102 | default: | ||
2103 | /* | ||
2104 | * All other completion status cause the IO to be complete. | ||
2105 | * If a NAK was received, then it is up to the user to retry | ||
2106 | * the request. | ||
2107 | */ | ||
2108 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); | ||
2109 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; | ||
2110 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | ||
2111 | break; | ||
2112 | } | ||
2113 | |||
2114 | return SCI_SUCCESS; | ||
2115 | } | ||
2116 | |||
2117 | static enum sci_status | ||
2118 | stp_request_soft_reset_await_h2d_diagnostic_tc_event(struct isci_request *ireq, | ||
2119 | u32 completion_code) | ||
2120 | { | ||
2121 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | ||
2122 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | ||
2123 | ireq->scu_status = SCU_TASK_DONE_GOOD; | ||
2124 | ireq->sci_status = SCI_SUCCESS; | ||
2125 | sci_change_state(&ireq->sm, SCI_REQ_STP_SOFT_RESET_WAIT_D2H); | ||
2126 | break; | ||
2127 | |||
2128 | default: | ||
2129 | /* All other completion status cause the IO to be complete. If | ||
2130 | * a NAK was received, then it is up to the user to retry the | ||
2131 | * request. | ||
2132 | */ | ||
2133 | ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code); | ||
2134 | ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; | ||
2135 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | ||
2136 | break; | ||
2137 | } | ||
2138 | |||
2139 | return SCI_SUCCESS; | ||
2140 | } | ||
2141 | |||
2142 | static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 completion_code, | 2159 | static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 completion_code, |
2143 | enum sci_base_request_states next) | 2160 | enum sci_base_request_states next) |
2144 | { | 2161 | { |
@@ -2284,14 +2301,6 @@ sci_io_request_tc_completion(struct isci_request *ireq, | |||
2284 | case SCI_REQ_STP_PIO_DATA_OUT: | 2301 | case SCI_REQ_STP_PIO_DATA_OUT: |
2285 | return pio_data_out_tx_done_tc_event(ireq, completion_code); | 2302 | return pio_data_out_tx_done_tc_event(ireq, completion_code); |
2286 | 2303 | ||
2287 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED: | ||
2288 | return stp_request_soft_reset_await_h2d_asserted_tc_event(ireq, | ||
2289 | completion_code); | ||
2290 | |||
2291 | case SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG: | ||
2292 | return stp_request_soft_reset_await_h2d_diagnostic_tc_event(ireq, | ||
2293 | completion_code); | ||
2294 | |||
2295 | case SCI_REQ_ABORTING: | 2304 | case SCI_REQ_ABORTING: |
2296 | return request_aborting_state_tc_event(ireq, | 2305 | return request_aborting_state_tc_event(ireq, |
2297 | completion_code); | 2306 | completion_code); |
@@ -2308,12 +2317,8 @@ sci_io_request_tc_completion(struct isci_request *ireq, | |||
2308 | return atapi_data_tc_completion_handler(ireq, completion_code); | 2317 | return atapi_data_tc_completion_handler(ireq, completion_code); |
2309 | 2318 | ||
2310 | default: | 2319 | default: |
2311 | dev_warn(&ihost->pdev->dev, | 2320 | dev_warn(&ihost->pdev->dev, "%s: %x in wrong state %s\n", |
2312 | "%s: SCIC IO Request given task completion " | 2321 | __func__, completion_code, req_state_name(state)); |
2313 | "notification %x while in wrong state %d\n", | ||
2314 | __func__, | ||
2315 | completion_code, | ||
2316 | state); | ||
2317 | return SCI_FAILURE_INVALID_STATE; | 2322 | return SCI_FAILURE_INVALID_STATE; |
2318 | } | 2323 | } |
2319 | } | 2324 | } |
@@ -3065,10 +3070,6 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm) | |||
3065 | */ | 3070 | */ |
3066 | if (!task && dev->dev_type == SAS_END_DEV) { | 3071 | if (!task && dev->dev_type == SAS_END_DEV) { |
3067 | state = SCI_REQ_TASK_WAIT_TC_COMP; | 3072 | state = SCI_REQ_TASK_WAIT_TC_COMP; |
3068 | } else if (!task && | ||
3069 | (isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_high || | ||
3070 | isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_low)) { | ||
3071 | state = SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED; | ||
3072 | } else if (task && task->task_proto == SAS_PROTOCOL_SMP) { | 3073 | } else if (task && task->task_proto == SAS_PROTOCOL_SMP) { |
3073 | state = SCI_REQ_SMP_WAIT_RESP; | 3074 | state = SCI_REQ_SMP_WAIT_RESP; |
3074 | } else if (task && sas_protocol_ata(task->task_proto) && | 3075 | } else if (task && sas_protocol_ata(task->task_proto) && |
@@ -3125,31 +3126,6 @@ static void sci_stp_request_started_pio_await_h2d_completion_enter(struct sci_ba | |||
3125 | ireq->target_device->working_request = ireq; | 3126 | ireq->target_device->working_request = ireq; |
3126 | } | 3127 | } |
3127 | 3128 | ||
3128 | static void sci_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(struct sci_base_state_machine *sm) | ||
3129 | { | ||
3130 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | ||
3131 | |||
3132 | ireq->target_device->working_request = ireq; | ||
3133 | } | ||
3134 | |||
3135 | static void sci_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(struct sci_base_state_machine *sm) | ||
3136 | { | ||
3137 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | ||
3138 | struct scu_task_context *tc = ireq->tc; | ||
3139 | struct host_to_dev_fis *h2d_fis; | ||
3140 | enum sci_status status; | ||
3141 | |||
3142 | /* Clear the SRST bit */ | ||
3143 | h2d_fis = &ireq->stp.cmd; | ||
3144 | h2d_fis->control = 0; | ||
3145 | |||
3146 | /* Clear the TC control bit */ | ||
3147 | tc->control_frame = 0; | ||
3148 | |||
3149 | status = sci_controller_continue_io(ireq); | ||
3150 | WARN_ONCE(status != SCI_SUCCESS, "isci: continue io failure\n"); | ||
3151 | } | ||
3152 | |||
3153 | static const struct sci_base_state sci_request_state_table[] = { | 3129 | static const struct sci_base_state sci_request_state_table[] = { |
3154 | [SCI_REQ_INIT] = { }, | 3130 | [SCI_REQ_INIT] = { }, |
3155 | [SCI_REQ_CONSTRUCTED] = { }, | 3131 | [SCI_REQ_CONSTRUCTED] = { }, |
@@ -3168,13 +3144,6 @@ static const struct sci_base_state sci_request_state_table[] = { | |||
3168 | [SCI_REQ_STP_PIO_DATA_OUT] = { }, | 3144 | [SCI_REQ_STP_PIO_DATA_OUT] = { }, |
3169 | [SCI_REQ_STP_UDMA_WAIT_TC_COMP] = { }, | 3145 | [SCI_REQ_STP_UDMA_WAIT_TC_COMP] = { }, |
3170 | [SCI_REQ_STP_UDMA_WAIT_D2H] = { }, | 3146 | [SCI_REQ_STP_UDMA_WAIT_D2H] = { }, |
3171 | [SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED] = { | ||
3172 | .enter_state = sci_stp_request_started_soft_reset_await_h2d_asserted_completion_enter, | ||
3173 | }, | ||
3174 | [SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG] = { | ||
3175 | .enter_state = sci_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter, | ||
3176 | }, | ||
3177 | [SCI_REQ_STP_SOFT_RESET_WAIT_D2H] = { }, | ||
3178 | [SCI_REQ_TASK_WAIT_TC_COMP] = { }, | 3147 | [SCI_REQ_TASK_WAIT_TC_COMP] = { }, |
3179 | [SCI_REQ_TASK_WAIT_TC_RESP] = { }, | 3148 | [SCI_REQ_TASK_WAIT_TC_RESP] = { }, |
3180 | [SCI_REQ_SMP_WAIT_RESP] = { }, | 3149 | [SCI_REQ_SMP_WAIT_RESP] = { }, |
@@ -3649,8 +3618,7 @@ int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *ide | |||
3649 | /* Cause this task to be scheduled in the SCSI error | 3618 | /* Cause this task to be scheduled in the SCSI error |
3650 | * handler thread. | 3619 | * handler thread. |
3651 | */ | 3620 | */ |
3652 | isci_execpath_callback(ihost, task, | 3621 | sas_task_abort(task); |
3653 | sas_task_abort); | ||
3654 | 3622 | ||
3655 | /* Change the status, since we are holding | 3623 | /* Change the status, since we are holding |
3656 | * the I/O until it is managed by the SCSI | 3624 | * the I/O until it is managed by the SCSI |