Lines Matching refs:qc

605 			struct ata_queued_cmd *qc;  in ata_scsi_cmd_error_handler()  local
607 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
608 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
609 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
615 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
617 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
618 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
810 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
815 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
816 if (qc) in ata_eh_nr_in_flight()
838 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
844 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
845 if (qc) in ata_eh_fastdrain_timerfn()
846 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
909 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
911 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
915 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
923 blk_abort_request(scsi_cmd_to_rq(qc->scsicmd)); in ata_qc_schedule_eh()
987 struct ata_queued_cmd *qc; in ata_do_link_abort() local
996 ata_qc_for_each_with_internal(ap, qc, tag) { in ata_do_link_abort()
997 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
998 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
999 ata_qc_complete(qc); in ata_do_link_abort()
1158 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1160 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1161 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1165 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1166 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1167 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1180 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1182 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1184 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1198 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1200 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1201 if (!qc->err_mask) in ata_eh_qc_retry()
1203 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1404 static void ata_eh_request_sense(struct ata_queued_cmd *qc, in ata_eh_request_sense() argument
1407 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1411 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1416 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1420 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1436 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1560 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1567 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1572 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1583 switch (qc->dev->class) { in ata_eh_analyze_tf()
1586 ata_eh_request_sense(qc, qc->scsicmd); in ata_eh_analyze_tf()
1590 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1592 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1594 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1598 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1599 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1600 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1601 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1603 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1605 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1609 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1610 enum scsi_disposition ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1621 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1622 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1624 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1627 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
1884 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
1886 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
1888 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
1890 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
1892 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
1902 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
1904 if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET) in ata_eh_quiet()
1905 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
1906 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
1924 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
1957 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
1958 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
1959 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
1963 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1966 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
1969 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
1970 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
1974 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1975 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1984 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
1985 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
1986 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
1987 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
1990 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
1991 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
1992 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
1994 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
1997 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2223 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2235 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2236 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2237 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2238 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2239 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2241 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2297 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2298 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2302 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2303 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2306 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2314 switch (qc->tf.protocol) { in ata_eh_link_report()
2344 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2347 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2348 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2349 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2351 if (qc->scsicmd) { in ata_eh_link_report()
2352 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2353 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2360 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2364 ata_dev_err(qc->dev, in ata_eh_link_report()
2373 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2378 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2379 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2385 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2387 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2398 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3164 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3173 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3174 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3175 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3179 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3185 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3190 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3202 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3210 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3211 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3779 struct ata_queued_cmd *qc; in ata_eh_finish() local
3783 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3784 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3787 if (qc->err_mask) { in ata_eh_finish()
3792 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3793 ata_eh_qc_retry(qc); in ata_eh_finish()
3795 ata_eh_qc_complete(qc); in ata_eh_finish()
3797 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3798 ata_eh_qc_complete(qc); in ata_eh_finish()
3801 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3802 ata_eh_qc_retry(qc); in ata_eh_finish()