Lines Matching full:qc

58 static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc);
62 static enum ata_completion_errors ahci_qc_prep(struct ata_queued_cmd *qc);
63 static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc);
78 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
1656 static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl) in ahci_fill_sg() argument
1665 for_each_sg(qc->sg, sg, qc->n_elem, si) { in ahci_fill_sg()
1677 static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc) in ahci_pmp_qc_defer() argument
1679 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer()
1683 return ata_std_qc_defer(qc); in ahci_pmp_qc_defer()
1685 return sata_pmp_qc_defer_cmd_switch(qc); in ahci_pmp_qc_defer()
1688 static enum ata_completion_errors ahci_qc_prep(struct ata_queued_cmd *qc) in ahci_qc_prep() argument
1690 struct ata_port *ap = qc->ap; in ahci_qc_prep()
1692 int is_atapi = ata_is_atapi(qc->tf.protocol); in ahci_qc_prep()
1702 cmd_tbl = pp->cmd_tbl + qc->hw_tag * AHCI_CMD_TBL_SZ; in ahci_qc_prep()
1704 ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, cmd_tbl); in ahci_qc_prep()
1707 memcpy(cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, qc->dev->cdb_len); in ahci_qc_prep()
1711 if (qc->flags & ATA_QCFLAG_DMAMAP) in ahci_qc_prep()
1712 n_elem = ahci_fill_sg(qc, cmd_tbl); in ahci_qc_prep()
1717 opts = cmd_fis_len | n_elem << 16 | (qc->dev->link->pmp << 12); in ahci_qc_prep()
1718 if (qc->tf.flags & ATA_TFLAG_WRITE) in ahci_qc_prep()
1723 ahci_fill_cmd_slot(pp, qc->hw_tag, opts); in ahci_qc_prep()
1798 /* If qc is active, charge it; otherwise, the active in ahci_error_intr()
1799 * link. There's no active qc on NCQ errors. It will in ahci_error_intr()
2048 unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) in ahci_qc_issue() argument
2050 struct ata_port *ap = qc->ap; in ahci_qc_issue()
2058 pp->active_link = qc->dev->link; in ahci_qc_issue()
2060 if (ata_is_ncq(qc->tf.protocol)) in ahci_qc_issue()
2061 writel(1 << qc->hw_tag, port_mmio + PORT_SCR_ACT); in ahci_qc_issue()
2063 if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) { in ahci_qc_issue()
2066 fbs |= qc->dev->link->pmp << PORT_FBS_DEV_OFFSET; in ahci_qc_issue()
2068 pp->fbs_last_dev = qc->dev->link->pmp; in ahci_qc_issue()
2071 writel(1 << qc->hw_tag, port_mmio + PORT_CMD_ISSUE); in ahci_qc_issue()
2073 ahci_sw_activity(qc->dev->link); in ahci_qc_issue()
2079 static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc) in ahci_qc_fill_rtf() argument
2081 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2085 rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; in ahci_qc_fill_rtf()
2093 if (qc->tf.protocol == ATA_PROT_PIO && qc->dma_dir == DMA_FROM_DEVICE && in ahci_qc_fill_rtf()
2094 !(qc->flags & ATA_QCFLAG_EH)) { in ahci_qc_fill_rtf()
2095 ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf); in ahci_qc_fill_rtf()
2096 qc->result_tf.status = (rx_fis + RX_FIS_PIO_SETUP)[15]; in ahci_qc_fill_rtf()
2108 if (ata_is_ncq(qc->tf.protocol)) { in ahci_qc_fill_rtf()
2117 qc->result_tf.status = fis[2]; in ahci_qc_fill_rtf()
2118 qc->result_tf.error = fis[3]; in ahci_qc_fill_rtf()
2122 ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf); in ahci_qc_fill_rtf()
2150 struct ata_queued_cmd *qc; in ahci_qc_ncq_fill_rtf() local
2153 qc = ata_qc_from_tag(ap, tag); in ahci_qc_ncq_fill_rtf()
2154 if (qc && ata_is_ncq(qc->tf.protocol)) { in ahci_qc_ncq_fill_rtf()
2155 qc->result_tf.status = status; in ahci_qc_ncq_fill_rtf()
2156 qc->result_tf.error = error; in ahci_qc_ncq_fill_rtf()
2157 qc->result_tf.flags = qc->tf.flags; in ahci_qc_ncq_fill_rtf()
2158 qc->flags |= ATA_QCFLAG_RTF_FILLED; in ahci_qc_ncq_fill_rtf()
2167 * FBS enabled, so read the status and error for each QC, since the QCs in ahci_qc_ncq_fill_rtf()
2172 struct ata_queued_cmd *qc; in ahci_qc_ncq_fill_rtf() local
2175 qc = ata_qc_from_tag(ap, tag); in ahci_qc_ncq_fill_rtf()
2176 if (qc && ata_is_ncq(qc->tf.protocol)) { in ahci_qc_ncq_fill_rtf()
2178 fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; in ahci_qc_ncq_fill_rtf()
2180 qc->result_tf.status = fis[2]; in ahci_qc_ncq_fill_rtf()
2181 qc->result_tf.error = fis[3]; in ahci_qc_ncq_fill_rtf()
2182 qc->result_tf.flags = qc->tf.flags; in ahci_qc_ncq_fill_rtf()
2183 qc->flags |= ATA_QCFLAG_RTF_FILLED; in ahci_qc_ncq_fill_rtf()
2231 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) in ahci_post_internal_cmd() argument
2233 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd()
2236 if (qc->flags & ATA_QCFLAG_EH) in ahci_post_internal_cmd()