Lines Matching refs:qc

615 			struct ata_queued_cmd *qc;  in ata_scsi_cmd_error_handler()  local
617 ata_qc_for_each_raw(ap, qc, i) { in ata_scsi_cmd_error_handler()
618 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
619 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
625 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
627 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
628 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
820 struct ata_queued_cmd *qc; in ata_eh_nr_in_flight() local
825 ata_qc_for_each(ap, qc, tag) { in ata_eh_nr_in_flight()
826 if (qc) in ata_eh_nr_in_flight()
848 struct ata_queued_cmd *qc; in ata_eh_fastdrain_timerfn() local
854 ata_qc_for_each(ap, qc, tag) { in ata_eh_fastdrain_timerfn()
855 if (qc) in ata_eh_fastdrain_timerfn()
856 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
919 void ata_qc_schedule_eh(struct ata_queued_cmd *qc) in ata_qc_schedule_eh() argument
921 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
922 struct request_queue *q = qc->scsicmd->device->request_queue; in ata_qc_schedule_eh()
927 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
936 blk_abort_request(qc->scsicmd->request); in ata_qc_schedule_eh()
1000 struct ata_queued_cmd *qc; in ata_do_link_abort() local
1009 ata_qc_for_each_with_internal(ap, qc, tag) { in ata_do_link_abort()
1010 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
1011 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
1012 ata_qc_complete(qc); in ata_do_link_abort()
1240 static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) in __ata_eh_qc_complete() argument
1242 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1243 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1247 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1248 __ata_qc_complete(qc); in __ata_eh_qc_complete()
1249 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1262 void ata_eh_qc_complete(struct ata_queued_cmd *qc) in ata_eh_qc_complete() argument
1264 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1266 __ata_eh_qc_complete(qc); in ata_eh_qc_complete()
1280 void ata_eh_qc_retry(struct ata_queued_cmd *qc) in ata_eh_qc_retry() argument
1282 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1283 if (!qc->err_mask) in ata_eh_qc_retry()
1285 __ata_eh_qc_complete(qc); in ata_eh_qc_retry()
1541 static void ata_eh_request_sense(struct ata_queued_cmd *qc, in ata_eh_request_sense() argument
1544 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1548 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1553 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1557 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1573 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1699 struct ata_queued_cmd *qc; in ata_eh_analyze_ncq_error() local
1712 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1713 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_analyze_ncq_error()
1716 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1736 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1737 memcpy(&qc->result_tf, &tf, sizeof(tf)); in ata_eh_analyze_ncq_error()
1738 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_eh_analyze_ncq_error()
1739 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; in ata_eh_analyze_ncq_error()
1740 if ((qc->result_tf.command & ATA_SENSE) || qc->result_tf.auxiliary) { in ata_eh_analyze_ncq_error()
1743 sense_key = (qc->result_tf.auxiliary >> 16) & 0xff; in ata_eh_analyze_ncq_error()
1744 asc = (qc->result_tf.auxiliary >> 8) & 0xff; in ata_eh_analyze_ncq_error()
1745 ascq = qc->result_tf.auxiliary & 0xff; in ata_eh_analyze_ncq_error()
1746 ata_scsi_set_sense(dev, qc->scsicmd, sense_key, asc, ascq); in ata_eh_analyze_ncq_error()
1747 ata_scsi_set_sense_information(dev, qc->scsicmd, in ata_eh_analyze_ncq_error()
1748 &qc->result_tf); in ata_eh_analyze_ncq_error()
1749 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_ncq_error()
1770 static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, in ata_eh_analyze_tf() argument
1777 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1782 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1793 switch (qc->dev->class) { in ata_eh_analyze_tf()
1797 ata_eh_request_sense(qc, qc->scsicmd); in ata_eh_analyze_tf()
1799 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1801 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1803 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1807 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1808 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1809 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1810 qc->result_tf.feature >> 4); in ata_eh_analyze_tf()
1812 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1814 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1818 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1819 int ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1830 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1831 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1833 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1836 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
2093 static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) in ata_eh_worth_retry() argument
2095 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
2097 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
2099 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
2101 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
2111 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) in ata_eh_quiet() argument
2113 if (qc->scsicmd && in ata_eh_quiet()
2114 qc->scsicmd->request->rq_flags & RQF_QUIET) in ata_eh_quiet()
2115 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
2116 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
2134 struct ata_queued_cmd *qc; in ata_eh_link_autopsy() local
2167 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_autopsy()
2168 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
2169 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2173 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
2176 ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); in ata_eh_link_autopsy()
2179 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
2180 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
2184 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
2185 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
2194 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
2195 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
2196 else if (ata_eh_worth_retry(qc)) in ata_eh_link_autopsy()
2197 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
2200 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
2201 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
2202 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
2204 trace_ata_eh_link_autopsy_qc(qc); in ata_eh_link_autopsy()
2207 if (ata_eh_quiet(qc)) in ata_eh_link_autopsy()
2433 struct ata_queued_cmd *qc; in ata_eh_link_report() local
2445 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2446 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2447 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2448 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2449 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2451 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2507 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_link_report()
2508 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2512 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2513 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2516 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2524 switch (qc->tf.protocol) { in ata_eh_link_report()
2554 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2557 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2558 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2559 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2561 if (qc->scsicmd) { in ata_eh_link_report()
2562 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2563 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2570 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2574 ata_dev_err(qc->dev, in ata_eh_link_report()
2583 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2588 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2589 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2595 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2597 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2608 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
3373 struct ata_queued_cmd *qc; in ata_eh_maybe_retry_flush() local
3382 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3383 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3384 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3388 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3394 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3399 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3411 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3419 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3420 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3987 struct ata_queued_cmd *qc; in ata_eh_finish() local
3991 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_finish()
3992 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3995 if (qc->err_mask) { in ata_eh_finish()
4000 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
4001 ata_eh_qc_retry(qc); in ata_eh_finish()
4003 ata_eh_qc_complete(qc); in ata_eh_finish()
4005 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
4006 ata_eh_qc_complete(qc); in ata_eh_finish()
4009 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
4010 ata_eh_qc_retry(qc); in ata_eh_finish()