diff options
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r-- | drivers/scsi/isci/request.c | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 7c500bb6a8e0..33c8ed1741e6 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #include "isci.h" | 56 | #include "isci.h" |
57 | #include "task.h" | 57 | #include "task.h" |
58 | #include "request.h" | 58 | #include "request.h" |
59 | #include "sata.h" | ||
60 | #include "scu_completion_codes.h" | 59 | #include "scu_completion_codes.h" |
61 | #include "scu_event_codes.h" | 60 | #include "scu_event_codes.h" |
62 | #include "sas.h" | 61 | #include "sas.h" |
@@ -1092,16 +1091,6 @@ smp_request_await_tc_event(struct isci_request *ireq, | |||
1092 | return SCI_SUCCESS; | 1091 | return SCI_SUCCESS; |
1093 | } | 1092 | } |
1094 | 1093 | ||
1095 | void sci_stp_io_request_set_ncq_tag(struct isci_request *ireq, | ||
1096 | u16 ncq_tag) | ||
1097 | { | ||
1098 | /** | ||
1099 | * @note This could be made to return an error to the user if the user | ||
1100 | * attempts to set the NCQ tag in the wrong state. | ||
1101 | */ | ||
1102 | ireq->tc->type.stp.ncq_tag = ncq_tag; | ||
1103 | } | ||
1104 | |||
1105 | static struct scu_sgl_element *pio_sgl_next(struct isci_stp_request *stp_req) | 1094 | static struct scu_sgl_element *pio_sgl_next(struct isci_stp_request *stp_req) |
1106 | { | 1095 | { |
1107 | struct scu_sgl_element *sgl; | 1096 | struct scu_sgl_element *sgl; |
@@ -2410,6 +2399,29 @@ static void isci_task_save_for_upper_layer_completion( | |||
2410 | } | 2399 | } |
2411 | } | 2400 | } |
2412 | 2401 | ||
2402 | static void isci_request_process_stp_response(struct sas_task *task, | ||
2403 | void *response_buffer) | ||
2404 | { | ||
2405 | struct dev_to_host_fis *d2h_reg_fis = response_buffer; | ||
2406 | struct task_status_struct *ts = &task->task_status; | ||
2407 | struct ata_task_resp *resp = (void *)&ts->buf[0]; | ||
2408 | |||
2409 | resp->frame_len = le16_to_cpu(*(__le16 *)(response_buffer + 6)); | ||
2410 | memcpy(&resp->ending_fis[0], response_buffer + 16, 24); | ||
2411 | ts->buf_valid_size = sizeof(*resp); | ||
2412 | |||
2413 | /** | ||
2414 | * If the device fault bit is set in the status register, then | ||
2415 | * set the sense data and return. | ||
2416 | */ | ||
2417 | if (d2h_reg_fis->status & ATA_DF) | ||
2418 | ts->stat = SAS_PROTO_RESPONSE; | ||
2419 | else | ||
2420 | ts->stat = SAM_STAT_GOOD; | ||
2421 | |||
2422 | ts->resp = SAS_TASK_COMPLETE; | ||
2423 | } | ||
2424 | |||
2413 | static void isci_request_io_request_complete(struct isci_host *ihost, | 2425 | static void isci_request_io_request_complete(struct isci_host *ihost, |
2414 | struct isci_request *request, | 2426 | struct isci_request *request, |
2415 | enum sci_io_status completion_status) | 2427 | enum sci_io_status completion_status) |
@@ -2985,34 +2997,29 @@ static enum sci_status isci_request_ssp_request_construct( | |||
2985 | return status; | 2997 | return status; |
2986 | } | 2998 | } |
2987 | 2999 | ||
2988 | static enum sci_status isci_request_stp_request_construct( | 3000 | static enum sci_status isci_request_stp_request_construct(struct isci_request *ireq) |
2989 | struct isci_request *request) | ||
2990 | { | 3001 | { |
2991 | struct sas_task *task = isci_request_access_task(request); | 3002 | struct sas_task *task = isci_request_access_task(ireq); |
3003 | struct host_to_dev_fis *fis = &ireq->stp.cmd; | ||
3004 | struct ata_queued_cmd *qc = task->uldd_task; | ||
2992 | enum sci_status status; | 3005 | enum sci_status status; |
2993 | struct host_to_dev_fis *register_fis; | ||
2994 | 3006 | ||
2995 | dev_dbg(&request->isci_host->pdev->dev, | 3007 | dev_dbg(&ireq->isci_host->pdev->dev, |
2996 | "%s: request = %p\n", | 3008 | "%s: ireq = %p\n", |
2997 | __func__, | 3009 | __func__, |
2998 | request); | 3010 | ireq); |
2999 | |||
3000 | /* Get the host_to_dev_fis from the core and copy | ||
3001 | * the fis from the task into it. | ||
3002 | */ | ||
3003 | register_fis = isci_sata_task_to_fis_copy(task); | ||
3004 | 3011 | ||
3005 | status = sci_io_request_construct_basic_sata(request); | 3012 | memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis)); |
3013 | if (!task->ata_task.device_control_reg_update) | ||
3014 | fis->flags |= 0x80; | ||
3015 | fis->flags &= 0xF0; | ||
3006 | 3016 | ||
3007 | /* Set the ncq tag in the fis, from the queue | 3017 | status = sci_io_request_construct_basic_sata(ireq); |
3008 | * command in the task. | ||
3009 | */ | ||
3010 | if (isci_sata_is_task_ncq(task)) { | ||
3011 | 3018 | ||
3012 | isci_sata_set_ncq_tag( | 3019 | if (qc && (qc->tf.command == ATA_CMD_FPDMA_WRITE || |
3013 | register_fis, | 3020 | qc->tf.command == ATA_CMD_FPDMA_READ)) { |
3014 | task | 3021 | fis->sector_count = qc->tag << 3; |
3015 | ); | 3022 | ireq->tc->type.stp.ncq_tag = qc->tag; |
3016 | } | 3023 | } |
3017 | 3024 | ||
3018 | return status; | 3025 | return status; |