Lines Matching refs:qc

619 		struct ata_queued_cmd *qc;  in ata_scsi_cmd_error_handler()  local
621 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
622 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
623 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
629 if (!(qc->flags & ATA_QCFLAG_EH)) { in ata_scsi_cmd_error_handler()
631 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
632 qc->flags |= ATA_QCFLAG_EH; in ata_scsi_cmd_error_handler()
822 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
827 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
828 if (qc) in ata_eh_nr_in_flight()
850 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
856 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
857 if (qc) in ata_eh_fastdrain_timerfn()
858 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
921 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
923 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
925 qc->flags |= ATA_QCFLAG_EH; in ata_qc_schedule_eh()
933 blk_abort_request(scsi_cmd_to_rq(qc->scsicmd)); in ata_qc_schedule_eh()
995 struct ata_queued_cmd *qc; in ata_do_link_abort() local
1002 ata_qc_for_each_with_internal(ap, qc, tag) { in ata_do_link_abort()
1003 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
1004 qc->flags |= ATA_QCFLAG_EH; in ata_do_link_abort()
1005 ata_qc_complete(qc); in ata_do_link_abort()
1151 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1153 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1154 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1158 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1159 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1160 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1173 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1175 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1177 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1191 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1193 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1194 if (!qc->err_mask) in ata_eh_qc_retry()
1196 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1409 static bool ata_eh_request_sense(struct ata_queued_cmd *qc) in ata_eh_request_sense() argument
1411 struct scsi_cmnd *cmd = qc->scsicmd; in ata_eh_request_sense()
1412 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1416 if (ata_port_is_frozen(qc->ap)) { in ata_eh_request_sense()
1422 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1440 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1565 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc) in ata_eh_analyze_tf() argument
1567 const struct ata_taskfile *tf = &qc->result_tf; in ata_eh_analyze_tf()
1572 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1577 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1588 switch (qc->dev->class) { in ata_eh_analyze_tf()
1598 if (!(qc->flags & ATA_QCFLAG_SENSE_VALID) && in ata_eh_analyze_tf()
1599 (stat & ATA_SENSE) && ata_eh_request_sense(qc)) in ata_eh_analyze_tf()
1600 set_status_byte(qc->scsicmd, SAM_STAT_CHECK_CONDITION); in ata_eh_analyze_tf()
1602 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1604 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1606 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1610 if (!ata_port_is_frozen(qc->ap)) { in ata_eh_analyze_tf()
1611 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1612 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1613 qc->result_tf.error >> 4); in ata_eh_analyze_tf()
1615 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1617 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1621 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1622 enum scsi_disposition ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1633 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1634 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1636 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1639 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
1894 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
1896 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
1898 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
1900 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
1902 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
1912 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
1914 if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET) in ata_eh_quiet()
1915 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
1916 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
1922 struct ata_queued_cmd *qc; in ata_eh_read_sense_success_non_ncq() local
1924 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_read_sense_success_non_ncq()
1925 if (!qc) in ata_eh_read_sense_success_non_ncq()
1928 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_read_sense_success_non_ncq()
1929 !(qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) || in ata_eh_read_sense_success_non_ncq()
1930 qc->err_mask) in ata_eh_read_sense_success_non_ncq()
1933 if (!ata_eh_request_sense(qc)) in ata_eh_read_sense_success_non_ncq()
1941 scsi_check_sense(qc->scsicmd); in ata_eh_read_sense_success_non_ncq()
1951 struct ata_queued_cmd *qc; in ata_eh_get_success_sense() local
1990 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_get_success_sense()
1991 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_get_success_sense()
1992 !(qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) || in ata_eh_get_success_sense()
1993 qc->err_mask || in ata_eh_get_success_sense()
1994 ata_dev_phys_link(qc->dev) != link) in ata_eh_get_success_sense()
1998 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_get_success_sense()
2002 if (!(qc->result_tf.status & ATA_SENSE)) in ata_eh_get_success_sense()
2006 ata_scsi_set_sense(dev, qc->scsicmd, ABORTED_COMMAND, 0, 0); in ata_eh_get_success_sense()
2007 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_get_success_sense()
2027 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
2066 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
2067 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_link_autopsy()
2068 qc->flags & ATA_QCFLAG_RETRY || in ata_eh_link_autopsy()
2069 qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD || in ata_eh_link_autopsy()
2070 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2074 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
2077 ehc->i.action |= ata_eh_analyze_tf(qc); in ata_eh_link_autopsy()
2080 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
2081 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
2085 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
2086 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
2095 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
2096 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
2097 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
2098 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
2101 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
2102 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
2103 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
2105 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
2108 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2333 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2345 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2346 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_link_report()
2347 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2348 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2349 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2351 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2407 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2408 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2412 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_link_report()
2413 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2416 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2424 switch (qc->tf.protocol) { in ata_eh_link_report()
2454 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2457 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2458 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2459 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2461 if (qc->scsicmd) { in ata_eh_link_report()
2462 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2463 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2468 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2471 ata_dev_err(qc->dev, in ata_eh_link_report()
2480 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2485 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2486 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2492 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2494 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2505 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3298 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3307 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3308 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3309 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3313 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3319 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3324 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3336 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3344 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3345 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3910 struct ata_queued_cmd *qc; in ata_eh_finish() local
3914 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3915 if (!(qc->flags & ATA_QCFLAG_EH)) in ata_eh_finish()
3918 if (qc->err_mask) { in ata_eh_finish()
3923 if (qc->flags & ATA_QCFLAG_RETRY) { in ata_eh_finish()
3930 ata_eh_qc_retry(qc); in ata_eh_finish()
3932 ata_eh_qc_complete(qc); in ata_eh_finish()
3935 if (qc->flags & ATA_QCFLAG_SENSE_VALID || in ata_eh_finish()
3936 qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) { in ata_eh_finish()
3937 ata_eh_qc_complete(qc); in ata_eh_finish()
3940 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3947 ata_eh_qc_retry(qc); in ata_eh_finish()