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(qc->scsicmd->request); 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 int 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 && in ata_eh_quiet()
1905 qc->scsicmd->request->rq_flags & RQF_QUIET) in ata_eh_quiet()
1906 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
1907 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
1925 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
1958 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
1959 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
1960 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
1964 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1967 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
1970 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
1971 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
1975 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1976 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1985 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
1986 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
1987 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
1988 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
1991 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
1992 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
1993 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
1995 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
1998 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2225 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2237 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2238 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2239 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2240 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2241 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2243 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2299 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2300 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2304 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2305 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2308 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2316 switch (qc->tf.protocol) { in ata_eh_link_report()
2346 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2349 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2350 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2351 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2353 if (qc->scsicmd) { in ata_eh_link_report()
2354 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2355 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2362 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2366 ata_dev_err(qc->dev, in ata_eh_link_report()
2375 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2380 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2381 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2387 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2389 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2400 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3165 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3174 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3175 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3176 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3180 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3186 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3191 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3203 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3211 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3212 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3780 struct ata_queued_cmd *qc; in ata_eh_finish() local
3784 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3785 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3788 if (qc->err_mask) { in ata_eh_finish()
3793 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3794 ata_eh_qc_retry(qc); in ata_eh_finish()
3796 ata_eh_qc_complete(qc); in ata_eh_finish()
3798 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3799 ata_eh_qc_complete(qc); in ata_eh_finish()
3802 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3803 ata_eh_qc_retry(qc); in ata_eh_finish()