/* * isci_task_request_complete() - This function is called by the sci core when * an task request completes. * @ihost: This parameter specifies the ISCI host object * @ireq: This parameter is the completed isci_request object. * @completion_status: This parameter specifies the completion status from the * sci core. * * none. */ void isci_task_request_complete(struct isci_host *ihost, struct isci_request *ireq, enum sci_task_status completion_status) { struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct completion *tmf_complete = NULL; struct completion *request_complete = ireq->io_request_completion; dev_dbg(&ihost->pdev->dev, "%s: request = %p, status=%d\n", __func__, ireq, completion_status); isci_request_change_state(ireq, completed); set_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags); if (tmf) { tmf->status = completion_status; if (tmf->proto == SAS_PROTOCOL_SSP) { memcpy(&tmf->resp.resp_iu, &ireq->ssp.rsp, SSP_RESP_IU_MAX_SIZE); } else if (tmf->proto == SAS_PROTOCOL_SATA) { memcpy(&tmf->resp.d2h_fis, &ireq->stp.rsp, sizeof(struct dev_to_host_fis)); } /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ tmf_complete = tmf->complete; } sci_controller_complete_io(ihost, ireq->target_device, ireq); /* set the 'terminated' flag handle to make sure it cannot be terminated * or completed again. */ set_bit(IREQ_TERMINATED, &ireq->flags); /* As soon as something is in the terminate path, deallocation is * managed there. Note that the final non-managed state of a task * request is "completed". */ if ((ireq->status == completed) || !isci_request_is_dealloc_managed(ireq->status)) { isci_request_change_state(ireq, unallocated); isci_free_tag(ihost, ireq->io_tag); list_del_init(&ireq->dev_node); } /* "request_complete" is set if the task was being terminated. */ if (request_complete) complete(request_complete); /* The task management part completes last. */ if (tmf_complete) complete(tmf_complete); }
void isci_task_request_complete(struct isci_host *ihost, struct isci_request *ireq, enum sci_task_status completion_status) { struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct completion *tmf_complete = NULL; struct completion *request_complete = ireq->io_request_completion; dev_dbg(&ihost->pdev->dev, "%s: request = %p, status=%d\n", __func__, ireq, completion_status); isci_request_change_state(ireq, completed); set_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags); if (tmf) { tmf->status = completion_status; if (tmf->proto == SAS_PROTOCOL_SSP) { memcpy(&tmf->resp.resp_iu, &ireq->ssp.rsp, SSP_RESP_IU_MAX_SIZE); } else if (tmf->proto == SAS_PROTOCOL_SATA) { memcpy(&tmf->resp.d2h_fis, &ireq->stp.rsp, sizeof(struct dev_to_host_fis)); } tmf_complete = tmf->complete; } sci_controller_complete_io(ihost, ireq->target_device, ireq); set_bit(IREQ_TERMINATED, &ireq->flags); if ((ireq->status == completed) || !isci_request_is_dealloc_managed(ireq->status)) { isci_request_change_state(ireq, unallocated); isci_free_tag(ihost, ireq->io_tag); list_del_init(&ireq->dev_node); } if (request_complete) complete(request_complete); if (tmf_complete) complete(tmf_complete); }
/* * isci_task_request_complete() - This function is called by the sci core when * an task request completes. * @ihost: This parameter specifies the ISCI host object * @ireq: This parameter is the completed isci_request object. * @completion_status: This parameter specifies the completion status from the * sci core. * * none. */ void isci_task_request_complete(struct isci_host *ihost, struct isci_request *ireq, enum sci_task_status completion_status) { struct isci_tmf *tmf = isci_request_access_tmf(ireq); struct completion *tmf_complete = NULL; dev_dbg(&ihost->pdev->dev, "%s: request = %p, status=%d\n", __func__, ireq, completion_status); set_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags); if (tmf) { tmf->status = completion_status; if (tmf->proto == SAS_PROTOCOL_SSP) { memcpy(&tmf->resp.resp_iu, &ireq->ssp.rsp, SSP_RESP_IU_MAX_SIZE); } else if (tmf->proto == SAS_PROTOCOL_SATA) { memcpy(&tmf->resp.d2h_fis, &ireq->stp.rsp, sizeof(struct dev_to_host_fis)); } /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ tmf_complete = tmf->complete; } sci_controller_complete_io(ihost, ireq->target_device, ireq); /* set the 'terminated' flag handle to make sure it cannot be terminated * or completed again. */ set_bit(IREQ_TERMINATED, &ireq->flags); if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags)) wake_up_all(&ihost->eventq); if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags)) isci_free_tag(ihost, ireq->io_tag); /* The task management part completes last. */ if (tmf_complete) complete(tmf_complete); }