aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/request.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r--drivers/scsi/isci/request.c52
1 files changed, 15 insertions, 37 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 565a9f0a9bc2..192cb48d849a 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -191,7 +191,7 @@ static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
191 191
192 task_iu->task_func = isci_tmf->tmf_code; 192 task_iu->task_func = isci_tmf->tmf_code;
193 task_iu->task_tag = 193 task_iu->task_tag =
194 (ireq->ttype == tmf_task) ? 194 (test_bit(IREQ_TMF, &ireq->flags)) ?
195 isci_tmf->io_tag : 195 isci_tmf->io_tag :
196 SCI_CONTROLLER_INVALID_IO_TAG; 196 SCI_CONTROLLER_INVALID_IO_TAG;
197} 197}
@@ -516,7 +516,7 @@ sci_io_request_construct_sata(struct isci_request *ireq,
516 struct domain_device *dev = ireq->target_device->domain_dev; 516 struct domain_device *dev = ireq->target_device->domain_dev;
517 517
518 /* check for management protocols */ 518 /* check for management protocols */
519 if (ireq->ttype == tmf_task) { 519 if (test_bit(IREQ_TMF, &ireq->flags)) {
520 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 520 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
521 521
522 if (tmf->tmf_code == isci_tmf_sata_srst_high || 522 if (tmf->tmf_code == isci_tmf_sata_srst_high ||
@@ -632,7 +632,7 @@ enum sci_status sci_task_request_construct_sata(struct isci_request *ireq)
632 enum sci_status status = SCI_SUCCESS; 632 enum sci_status status = SCI_SUCCESS;
633 633
634 /* check for management protocols */ 634 /* check for management protocols */
635 if (ireq->ttype == tmf_task) { 635 if (test_bit(IREQ_TMF, &ireq->flags)) {
636 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 636 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
637 637
638 if (tmf->tmf_code == isci_tmf_sata_srst_high || 638 if (tmf->tmf_code == isci_tmf_sata_srst_high ||
@@ -2630,14 +2630,8 @@ static void isci_task_save_for_upper_layer_completion(
2630 switch (task_notification_selection) { 2630 switch (task_notification_selection) {
2631 2631
2632 case isci_perform_normal_io_completion: 2632 case isci_perform_normal_io_completion:
2633
2634 /* Normal notification (task_done) */ 2633 /* Normal notification (task_done) */
2635 dev_dbg(&host->pdev->dev, 2634
2636 "%s: Normal - task = %p, response=%d (%d), status=%d (%d)\n",
2637 __func__,
2638 task,
2639 task->task_status.resp, response,
2640 task->task_status.stat, status);
2641 /* Add to the completed list. */ 2635 /* Add to the completed list. */
2642 list_add(&request->completed_node, 2636 list_add(&request->completed_node,
2643 &host->requests_to_complete); 2637 &host->requests_to_complete);
@@ -2650,13 +2644,6 @@ static void isci_task_save_for_upper_layer_completion(
2650 /* No notification to libsas because this request is 2644 /* No notification to libsas because this request is
2651 * already in the abort path. 2645 * already in the abort path.
2652 */ 2646 */
2653 dev_dbg(&host->pdev->dev,
2654 "%s: Aborted - task = %p, response=%d (%d), status=%d (%d)\n",
2655 __func__,
2656 task,
2657 task->task_status.resp, response,
2658 task->task_status.stat, status);
2659
2660 /* Wake up whatever process was waiting for this 2647 /* Wake up whatever process was waiting for this
2661 * request to complete. 2648 * request to complete.
2662 */ 2649 */
@@ -2673,30 +2660,22 @@ static void isci_task_save_for_upper_layer_completion(
2673 2660
2674 case isci_perform_error_io_completion: 2661 case isci_perform_error_io_completion:
2675 /* Use sas_task_abort */ 2662 /* Use sas_task_abort */
2676 dev_dbg(&host->pdev->dev,
2677 "%s: Error - task = %p, response=%d (%d), status=%d (%d)\n",
2678 __func__,
2679 task,
2680 task->task_status.resp, response,
2681 task->task_status.stat, status);
2682 /* Add to the aborted list. */ 2663 /* Add to the aborted list. */
2683 list_add(&request->completed_node, 2664 list_add(&request->completed_node,
2684 &host->requests_to_errorback); 2665 &host->requests_to_errorback);
2685 break; 2666 break;
2686 2667
2687 default: 2668 default:
2688 dev_dbg(&host->pdev->dev,
2689 "%s: Unknown - task = %p, response=%d (%d), status=%d (%d)\n",
2690 __func__,
2691 task,
2692 task->task_status.resp, response,
2693 task->task_status.stat, status);
2694
2695 /* Add to the error to libsas list. */ 2669 /* Add to the error to libsas list. */
2696 list_add(&request->completed_node, 2670 list_add(&request->completed_node,
2697 &host->requests_to_errorback); 2671 &host->requests_to_errorback);
2698 break; 2672 break;
2699 } 2673 }
2674 dev_dbg(&host->pdev->dev,
2675 "%s: %d - task = %p, response=%d (%d), status=%d (%d)\n",
2676 __func__, task_notification_selection, task,
2677 (task) ? task->task_status.resp : 0, response,
2678 (task) ? task->task_status.stat : 0, status);
2700} 2679}
2701 2680
2702static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis) 2681static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis)
@@ -2728,9 +2707,9 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
2728 struct sas_task *task = isci_request_access_task(request); 2707 struct sas_task *task = isci_request_access_task(request);
2729 struct ssp_response_iu *resp_iu; 2708 struct ssp_response_iu *resp_iu;
2730 unsigned long task_flags; 2709 unsigned long task_flags;
2731 struct isci_remote_device *idev = isci_lookup_device(task->dev); 2710 struct isci_remote_device *idev = request->target_device;
2732 enum service_response response = SAS_TASK_UNDELIVERED; 2711 enum service_response response = SAS_TASK_UNDELIVERED;
2733 enum exec_status status = SAS_ABORTED_TASK; 2712 enum exec_status status = SAS_ABORTED_TASK;
2734 enum isci_request_status request_status; 2713 enum isci_request_status request_status;
2735 enum isci_completion_selection complete_to_host 2714 enum isci_completion_selection complete_to_host
2736 = isci_perform_normal_io_completion; 2715 = isci_perform_normal_io_completion;
@@ -3061,7 +3040,6 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
3061 3040
3062 /* complete the io request to the core. */ 3041 /* complete the io request to the core. */
3063 sci_controller_complete_io(ihost, request->target_device, request); 3042 sci_controller_complete_io(ihost, request->target_device, request);
3064 isci_put_device(idev);
3065 3043
3066 /* set terminated handle so it cannot be completed or 3044 /* set terminated handle so it cannot be completed or
3067 * terminated again, and to cause any calls into abort 3045 * terminated again, and to cause any calls into abort
@@ -3080,7 +3058,7 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
3080 /* XXX as hch said always creating an internal sas_task for tmf 3058 /* XXX as hch said always creating an internal sas_task for tmf
3081 * requests would simplify the driver 3059 * requests would simplify the driver
3082 */ 3060 */
3083 task = ireq->ttype == io_task ? isci_request_access_task(ireq) : NULL; 3061 task = (test_bit(IREQ_TMF, &ireq->flags)) ? NULL : isci_request_access_task(ireq);
3084 3062
3085 /* all unaccelerated request types (non ssp or ncq) handled with 3063 /* all unaccelerated request types (non ssp or ncq) handled with
3086 * substates 3064 * substates
@@ -3564,7 +3542,7 @@ static struct isci_request *isci_io_request_from_tag(struct isci_host *ihost,
3564 3542
3565 ireq = isci_request_from_tag(ihost, tag); 3543 ireq = isci_request_from_tag(ihost, tag);
3566 ireq->ttype_ptr.io_task_ptr = task; 3544 ireq->ttype_ptr.io_task_ptr = task;
3567 ireq->ttype = io_task; 3545 clear_bit(IREQ_TMF, &ireq->flags);
3568 task->lldd_task = ireq; 3546 task->lldd_task = ireq;
3569 3547
3570 return ireq; 3548 return ireq;
@@ -3578,7 +3556,7 @@ struct isci_request *isci_tmf_request_from_tag(struct isci_host *ihost,
3578 3556
3579 ireq = isci_request_from_tag(ihost, tag); 3557 ireq = isci_request_from_tag(ihost, tag);
3580 ireq->ttype_ptr.tmf_task_ptr = isci_tmf; 3558 ireq->ttype_ptr.tmf_task_ptr = isci_tmf;
3581 ireq->ttype = tmf_task; 3559 set_bit(IREQ_TMF, &ireq->flags);
3582 3560
3583 return ireq; 3561 return ireq;
3584} 3562}