Lines Matching refs:qc

598 			struct ata_queued_cmd *qc;  in ata_scsi_cmd_error_handler()  local
600 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
601 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
602 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
608 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
610 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
611 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
803 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
808 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
809 if (qc) in ata_eh_nr_in_flight()
831 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
837 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
838 if (qc) in ata_eh_fastdrain_timerfn()
839 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
902 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
904 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
908 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
916 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()
1219 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1221 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1222 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1226 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1227 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1228 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1241 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1243 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1245 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1259 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1261 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1262 if (!qc->err_mask) in ata_eh_qc_retry()
1264 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1520 static void ata_eh_request_sense(struct ata_queued_cmd *qc, in ata_eh_request_sense() argument
1523 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1527 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1532 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1536 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1552 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1678 struct ata_queued_cmd *qc; in ata_eh_analyze_ncq_error() local
1691 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1692 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_analyze_ncq_error()
1695 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1715 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1716 memcpy(&qc->result_tf, &tf, sizeof(tf)); in ata_eh_analyze_ncq_error()
1717 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_eh_analyze_ncq_error()
1718 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; in ata_eh_analyze_ncq_error()
1720 ((qc->result_tf.command & ATA_SENSE) || qc->result_tf.auxiliary)) { in ata_eh_analyze_ncq_error()
1723 sense_key = (qc->result_tf.auxiliary >> 16) & 0xff; in ata_eh_analyze_ncq_error()
1724 asc = (qc->result_tf.auxiliary >> 8) & 0xff; in ata_eh_analyze_ncq_error()
1725 ascq = qc->result_tf.auxiliary & 0xff; in ata_eh_analyze_ncq_error()
1726 ata_scsi_set_sense(dev, qc->scsicmd, sense_key, asc, ascq); in ata_eh_analyze_ncq_error()
1727 ata_scsi_set_sense_information(dev, qc->scsicmd, in ata_eh_analyze_ncq_error()
1728 &qc->result_tf); in ata_eh_analyze_ncq_error()
1729 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_ncq_error()
1750 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1757 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1762 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1773 switch (qc->dev->class) { in ata_eh_analyze_tf()
1776 ata_eh_request_sense(qc, qc->scsicmd); in ata_eh_analyze_tf()
1780 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1782 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1784 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1788 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1789 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1790 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1791 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1793 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1795 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1799 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1800 int ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1811 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1812 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1814 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1817 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
2074 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
2076 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
2078 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
2080 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
2082 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
2092 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
2094 if (qc->scsicmd && in ata_eh_quiet()
2095 qc->scsicmd->request->rq_flags & RQF_QUIET) in ata_eh_quiet()
2096 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
2097 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
2115 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
2148 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
2149 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
2150 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2154 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
2157 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
2160 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
2161 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
2165 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
2166 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
2175 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
2176 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
2177 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
2178 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
2181 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
2182 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
2183 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
2185 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
2188 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2414 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2426 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2427 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2428 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2429 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2430 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2432 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2488 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2489 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2493 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2494 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2497 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2505 switch (qc->tf.protocol) { in ata_eh_link_report()
2535 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2538 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2539 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2540 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2542 if (qc->scsicmd) { in ata_eh_link_report()
2543 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2544 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2551 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2555 ata_dev_err(qc->dev, in ata_eh_link_report()
2564 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2569 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2570 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2576 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2578 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2589 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3354 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3363 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3364 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3365 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3369 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3375 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3380 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3392 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3400 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3401 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3968 struct ata_queued_cmd *qc; in ata_eh_finish() local
3972 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3973 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3976 if (qc->err_mask) { in ata_eh_finish()
3981 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3982 ata_eh_qc_retry(qc); in ata_eh_finish()
3984 ata_eh_qc_complete(qc); in ata_eh_finish()
3986 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3987 ata_eh_qc_complete(qc); in ata_eh_finish()
3990 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3991 ata_eh_qc_retry(qc); in ata_eh_finish()