Lines Matching refs:qc

527 	struct ata_queued_cmd *qc;  in ata_scsi_timed_out()  local
539 qc = ata_qc_from_tag(ap, ap->link.active_tag); in ata_scsi_timed_out()
540 if (qc) { in ata_scsi_timed_out()
541 WARN_ON(qc->scsicmd != cmd); in ata_scsi_timed_out()
542 qc->flags |= ATA_QCFLAG_EH_SCHEDULED; in ata_scsi_timed_out()
543 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_timed_out()
666 struct ata_queued_cmd *qc; in ata_scsi_cmd_error_handler() local
669 qc = __ata_qc_from_tag(ap, i); in ata_scsi_cmd_error_handler()
670 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
671 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
677 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
679 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
680 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
904 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); in ata_eh_fastdrain_timerfn() local
905 if (qc) in ata_eh_fastdrain_timerfn()
906 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
969 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
971 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
972 struct request_queue *q = qc->scsicmd->device->request_queue; in ata_qc_schedule_eh()
977 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
986 blk_abort_request(qc->scsicmd->request); in ata_qc_schedule_eh()
1058 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); in ata_do_link_abort() local
1060 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
1061 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
1062 ata_qc_complete(qc); in ata_do_link_abort()
1290 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1292 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1293 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1297 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1298 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1299 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1312 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1314 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1316 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1330 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1332 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1333 if (!qc->err_mask) in ata_eh_qc_retry()
1335 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1749 struct ata_queued_cmd *qc; in ata_eh_analyze_ncq_error() local
1763 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1765 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_analyze_ncq_error()
1768 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1788 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1789 memcpy(&qc->result_tf, &tf, sizeof(tf)); in ata_eh_analyze_ncq_error()
1790 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_eh_analyze_ncq_error()
1791 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; in ata_eh_analyze_ncq_error()
1810 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1817 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1822 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1826 switch (qc->dev->class) { in ata_eh_analyze_tf()
1830 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1832 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1834 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1838 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1839 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1840 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1841 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1850 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1852 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1856 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
2113 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
2115 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
2117 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
2119 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
2121 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
2172 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_autopsy() local
2174 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
2175 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2179 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
2182 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
2185 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
2186 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
2190 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
2191 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
2194 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
2195 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
2198 if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
2199 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
2202 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
2203 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
2204 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
2206 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
2436 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_report() local
2438 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2439 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2440 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2441 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2443 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2500 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_report() local
2501 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2505 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2506 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2509 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2524 prot_str[qc->tf.protocol], qc->nbytes, in ata_eh_link_report()
2525 dma_str[qc->dma_dir]); in ata_eh_link_report()
2528 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2529 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2530 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2532 if (qc->scsicmd) { in ata_eh_link_report()
2533 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2534 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2541 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2545 ata_dev_err(qc->dev, in ata_eh_link_report()
2554 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2559 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2560 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2566 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2568 ata_dev_err(qc->dev, "status: { %s%s%s%s}\n", in ata_eh_link_report()
2578 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3343 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3352 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3353 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3354 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3358 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3364 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3369 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3381 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3389 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3390 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3959 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_finish() local
3961 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3964 if (qc->err_mask) { in ata_eh_finish()
3969 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3970 ata_eh_qc_retry(qc); in ata_eh_finish()
3972 ata_eh_qc_complete(qc); in ata_eh_finish()
3974 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3975 ata_eh_qc_complete(qc); in ata_eh_finish()
3978 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3979 ata_eh_qc_retry(qc); in ata_eh_finish()