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()
1757 struct ata_queued_cmd *qc; in ata_eh_analyze_ncq_error() local
1771 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1773 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_analyze_ncq_error()
1776 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1796 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1797 memcpy(&qc->result_tf, &tf, sizeof(tf)); in ata_eh_analyze_ncq_error()
1798 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_eh_analyze_ncq_error()
1799 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; in ata_eh_analyze_ncq_error()
1818 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1825 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1830 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1834 switch (qc->dev->class) { in ata_eh_analyze_tf()
1838 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1840 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1842 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1846 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1847 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1848 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1849 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1858 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1860 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1864 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
2121 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
2123 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
2125 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
2127 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
2129 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
2180 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_autopsy() local
2182 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
2183 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2187 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
2190 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
2193 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
2194 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
2198 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
2199 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
2202 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
2203 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
2206 if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
2207 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
2210 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
2211 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
2212 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
2214 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
2444 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_report() local
2446 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2447 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2448 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2449 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2451 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2508 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_link_report() local
2509 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2513 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2514 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2517 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2532 prot_str[qc->tf.protocol], qc->nbytes, in ata_eh_link_report()
2533 dma_str[qc->dma_dir]); in ata_eh_link_report()
2536 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2537 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2538 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2540 if (qc->scsicmd) { in ata_eh_link_report()
2541 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2542 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2549 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2553 ata_dev_err(qc->dev, in ata_eh_link_report()
2562 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2567 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2568 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2574 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2576 ata_dev_err(qc->dev, "status: { %s%s%s%s}\n", in ata_eh_link_report()
2586 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3351 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3360 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3361 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3362 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3366 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3372 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3377 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3389 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3397 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3398 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3967 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); in ata_eh_finish() local
3969 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3972 if (qc->err_mask) { in ata_eh_finish()
3977 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3978 ata_eh_qc_retry(qc); in ata_eh_finish()
3980 ata_eh_qc_complete(qc); in ata_eh_finish()
3982 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3983 ata_eh_qc_complete(qc); in ata_eh_finish()
3986 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3987 ata_eh_qc_retry(qc); in ata_eh_finish()