Lines Matching refs:qc

604 			struct ata_queued_cmd *qc;  in ata_scsi_cmd_error_handler()  local
606 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
607 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
608 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
614 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
616 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
617 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
809 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
814 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
815 if (qc) in ata_eh_nr_in_flight()
837 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
843 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
844 if (qc) in ata_eh_fastdrain_timerfn()
845 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
908 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
910 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
914 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
922 blk_abort_request(scsi_cmd_to_rq(qc->scsicmd)); in ata_qc_schedule_eh()
986 struct ata_queued_cmd *qc; in ata_do_link_abort() local
995 ata_qc_for_each_with_internal(ap, qc, tag) { in ata_do_link_abort()
996 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
997 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
998 ata_qc_complete(qc); in ata_do_link_abort()
1154 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1156 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1157 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1161 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1162 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1163 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1176 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1178 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1180 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1194 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1196 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1197 if (!qc->err_mask) in ata_eh_qc_retry()
1199 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1402 static void ata_eh_request_sense(struct ata_queued_cmd *qc) in ata_eh_request_sense() argument
1404 struct scsi_cmnd *cmd = qc->scsicmd; in ata_eh_request_sense()
1405 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1409 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1414 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1418 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1432 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1553 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc) in ata_eh_analyze_tf() argument
1555 const struct ata_taskfile *tf = &qc->result_tf; in ata_eh_analyze_tf()
1560 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1565 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1576 switch (qc->dev->class) { in ata_eh_analyze_tf()
1579 ata_eh_request_sense(qc); in ata_eh_analyze_tf()
1583 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1585 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1587 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1591 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1592 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1593 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1594 qc->result_tf.error >> 4); in ata_eh_analyze_tf()
1596 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1598 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1602 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1603 enum scsi_disposition ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1614 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1615 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1617 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1620 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
1877 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
1879 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
1881 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
1883 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
1885 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
1895 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
1897 if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->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
1948 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
1949 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
1950 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
1954 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1957 ehc->i.action |= ata_eh_analyze_tf(qc); in ata_eh_link_autopsy()
1960 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
1961 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
1965 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1966 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1975 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
1976 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
1977 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
1978 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
1981 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
1982 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
1983 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
1985 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
1988 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2213 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2225 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2226 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2227 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2228 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2229 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2231 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2287 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2288 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2292 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2293 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2296 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2304 switch (qc->tf.protocol) { in ata_eh_link_report()
2334 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2337 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2338 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2339 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2341 if (qc->scsicmd) { in ata_eh_link_report()
2342 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2343 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2348 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2351 ata_dev_err(qc->dev, in ata_eh_link_report()
2360 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2365 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2366 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2372 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2374 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2385 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3180 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3189 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3190 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3191 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3195 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3201 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3206 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3218 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3226 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3227 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3792 struct ata_queued_cmd *qc; in ata_eh_finish() local
3796 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3797 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3800 if (qc->err_mask) { in ata_eh_finish()
3805 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3806 ata_eh_qc_retry(qc); in ata_eh_finish()
3808 ata_eh_qc_complete(qc); in ata_eh_finish()
3810 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3811 ata_eh_qc_complete(qc); in ata_eh_finish()
3814 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3815 ata_eh_qc_retry(qc); in ata_eh_finish()