Unverified Commit 15bd6d7f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14107 ata: libata-core: Set ATA_QCFLAG_RTF_FILLED in fill_result_tf()

Merge Pull Request from: @xia-bing1 
 
ATA_QCFLAG_RTF_FILLED is not specific to ahci and can be used generally
to check if qc->result_tf contains valid data.
 
 
Link:https://gitee.com/openeuler/kernel/pulls/14107

 

Reviewed-by: default avatarYihang Li <liyihang9@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 39c261e6 c7e334f3
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -2088,13 +2088,6 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
	struct ahci_port_priv *pp = qc->ap->private_data;
	u8 *rx_fis = pp->rx_fis;

	/*
	 * rtf may already be filled (e.g. for successful NCQ commands).
	 * If that is the case, we have nothing to do.
	 */
	if (qc->flags & ATA_QCFLAG_RTF_FILLED)
		return;

	if (pp->fbs_enabled)
		rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ;

@@ -2108,7 +2101,6 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
	    !(qc->flags & ATA_QCFLAG_EH)) {
		ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf);
		qc->result_tf.status = (rx_fis + RX_FIS_PIO_SETUP)[15];
		qc->flags |= ATA_QCFLAG_RTF_FILLED;
		return;
	}

@@ -2131,12 +2123,10 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
		 */
		qc->result_tf.status = fis[2];
		qc->result_tf.error = fis[3];
		qc->flags |= ATA_QCFLAG_RTF_FILLED;
		return;
	}

	ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf);
	qc->flags |= ATA_QCFLAG_RTF_FILLED;
}

static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
@@ -2171,6 +2161,7 @@ static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
			if (qc && ata_is_ncq(qc->tf.protocol)) {
				qc->result_tf.status = status;
				qc->result_tf.error = error;
				qc->result_tf.flags = qc->tf.flags;
				qc->flags |= ATA_QCFLAG_RTF_FILLED;
			}
			done_mask &= ~(1ULL << tag);
@@ -2195,6 +2186,7 @@ static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
			fis += RX_FIS_SDB;
			qc->result_tf.status = fis[2];
			qc->result_tf.error = fis[3];
			qc->result_tf.flags = qc->tf.flags;
			qc->flags |= ATA_QCFLAG_RTF_FILLED;
		}
		done_mask &= ~(1ULL << tag);
+8 −0
Original line number Diff line number Diff line
@@ -4792,8 +4792,16 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
{
	struct ata_port *ap = qc->ap;

	/*
	 * rtf may already be filled (e.g. for successful NCQ commands).
	 * If that is the case, we have nothing to do.
	 */
	if (qc->flags & ATA_QCFLAG_RTF_FILLED)
		return;

	qc->result_tf.flags = qc->tf.flags;
	ap->ops->qc_fill_rtf(qc);
	qc->flags |= ATA_QCFLAG_RTF_FILLED;
}

static void ata_verify_xfer(struct ata_queued_cmd *qc)