Lines Matching refs:qc
597 struct ata_queued_cmd *qc; in ata_scsi_cmd_error_handler() local
599 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
600 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
601 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
607 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
609 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
610 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
802 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
807 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
808 if (qc) in ata_eh_nr_in_flight()
830 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
836 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
837 if (qc) in ata_eh_fastdrain_timerfn()
838 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
901 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
903 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
907 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
915 blk_abort_request(qc->scsicmd->request); in ata_qc_schedule_eh()
979 struct ata_queued_cmd *qc; in ata_do_link_abort() local
988 ata_qc_for_each_with_internal(ap, qc, tag) { in ata_do_link_abort()
989 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
990 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
991 ata_qc_complete(qc); in ata_do_link_abort()
1150 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1152 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1153 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1157 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1158 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1159 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1172 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1174 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1176 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1190 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1192 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1193 if (!qc->err_mask) in ata_eh_qc_retry()
1195 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1396 static void ata_eh_request_sense(struct ata_queued_cmd *qc, in ata_eh_request_sense() argument
1399 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1403 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1408 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1412 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1428 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1552 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1559 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1564 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1575 switch (qc->dev->class) { in ata_eh_analyze_tf()
1578 ata_eh_request_sense(qc, qc->scsicmd); in ata_eh_analyze_tf()
1582 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1584 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1586 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1590 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1591 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1592 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1593 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1595 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1597 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1601 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1602 int ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1613 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1614 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1616 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1619 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
1876 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
1878 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
1880 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
1882 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
1884 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
1894 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
1896 if (qc->scsicmd && in ata_eh_quiet()
1897 qc->scsicmd->request->rq_flags & RQF_QUIET) in ata_eh_quiet()
1898 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
1899 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
1917 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
1950 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
1951 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
1952 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
1956 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1959 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
1962 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
1963 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
1967 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1968 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1977 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
1978 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
1979 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
1980 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
1983 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
1984 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
1985 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
1987 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
1990 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2216 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2228 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2229 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2230 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2231 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2232 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2234 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2290 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2291 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2295 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2296 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2299 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2307 switch (qc->tf.protocol) { in ata_eh_link_report()
2337 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2340 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2341 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2342 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2344 if (qc->scsicmd) { in ata_eh_link_report()
2345 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2346 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2353 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2357 ata_dev_err(qc->dev, in ata_eh_link_report()
2366 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2371 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2372 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2378 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2380 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2391 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3156 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3165 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3166 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3167 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3171 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3177 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3182 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3194 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3202 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3203 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3771 struct ata_queued_cmd *qc; in ata_eh_finish() local
3775 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3776 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3779 if (qc->err_mask) { in ata_eh_finish()
3784 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3785 ata_eh_qc_retry(qc); in ata_eh_finish()
3787 ata_eh_qc_complete(qc); in ata_eh_finish()
3789 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3790 ata_eh_qc_complete(qc); in ata_eh_finish()
3793 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3794 ata_eh_qc_retry(qc); in ata_eh_finish()