Merge tag 'vfio-v6.0-rc1' of https://github.com/awilliam/linux-vfio
[linux-2.6-microblaze.git] / drivers / ata / sata_nv.c
index 16272c1..7f14d0d 100644 (file)
@@ -31,6 +31,7 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_device.h>
 #include <linux/libata.h>
+#include <trace/events/libata.h>
 
 #define DRV_NAME                       "sata_nv"
 #define DRV_VERSION                    "3.5"
@@ -808,7 +809,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
        struct nv_adma_port_priv *pp = ap->private_data;
        u8 flags = pp->cpb[cpb_num].resp_flags;
 
-       VPRINTK("CPB %d, flags=0x%x\n", cpb_num, flags);
+       ata_port_dbg(ap, "CPB %d, flags=0x%x\n", cpb_num, flags);
 
        if (unlikely((force_err ||
                     flags & (NV_CPB_RESP_ATA_ERR |
@@ -1100,8 +1101,6 @@ static int nv_adma_port_start(struct ata_port *ap)
        struct pci_dev *pdev = to_pci_dev(dev);
        u16 tmp;
 
-       VPRINTK("ENTER\n");
-
        /*
         * Ensure DMA mask is set to 32-bit before allocating legacy PRD and
         * pad buffers.
@@ -1190,7 +1189,6 @@ static void nv_adma_port_stop(struct ata_port *ap)
        struct nv_adma_port_priv *pp = ap->private_data;
        void __iomem *mmio = pp->ctl_block;
 
-       VPRINTK("ENTER\n");
        writew(0, mmio + NV_ADMA_CTL);
 }
 
@@ -1252,8 +1250,6 @@ static void nv_adma_setup_port(struct ata_port *ap)
        void __iomem *mmio = ap->host->iomap[NV_MMIO_BAR];
        struct ata_ioports *ioport = &ap->ioaddr;
 
-       VPRINTK("ENTER\n");
-
        mmio += NV_ADMA_PORT + ap->port_no * NV_ADMA_PORT_SIZE;
 
        ioport->cmd_addr        = mmio;
@@ -1277,8 +1273,6 @@ static int nv_adma_host_init(struct ata_host *host)
        unsigned int i;
        u32 tmp32;
 
-       VPRINTK("ENTER\n");
-
        /* enable ADMA on the ports */
        pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32);
        tmp32 |= NV_MCP_SATA_CFG_20_PORT0_EN |
@@ -1320,8 +1314,6 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
        struct scatterlist *sg;
        unsigned int si;
 
-       VPRINTK("ENTER\n");
-
        for_each_sg(qc->sg, sg, qc->n_elem, si) {
                aprd = (si < 5) ? &cpb->aprd[si] :
                        &pp->aprd[NV_ADMA_SGTBL_LEN * qc->hw_tag + (si-5)];
@@ -1378,8 +1370,6 @@ static enum ata_completion_errors nv_adma_qc_prep(struct ata_queued_cmd *qc)
        if (qc->tf.protocol == ATA_PROT_NCQ)
                ctl_flags |= NV_CPB_CTL_QUEUE | NV_CPB_CTL_FPDMA;
 
-       VPRINTK("qc->flags = 0x%lx\n", qc->flags);
-
        nv_adma_tf_to_cpb(&qc->tf, cpb->tf);
 
        if (qc->flags & ATA_QCFLAG_DMAMAP) {
@@ -1404,8 +1394,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
        void __iomem *mmio = pp->ctl_block;
        int curr_ncq = (qc->tf.protocol == ATA_PROT_NCQ);
 
-       VPRINTK("ENTER\n");
-
        /* We can't handle result taskfile with NCQ commands, since
           retrieving the taskfile switches us out of ADMA mode and would abort
           existing commands. */
@@ -1417,7 +1405,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
 
        if (nv_adma_use_reg_mode(qc)) {
                /* use ATA register mode */
-               VPRINTK("using ATA register mode: 0x%lx\n", qc->flags);
                BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) &&
                        (qc->flags & ATA_QCFLAG_DMAMAP));
                nv_adma_register_mode(qc->ap);
@@ -1438,8 +1425,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
 
        writew(qc->hw_tag, mmio + NV_ADMA_APPEND);
 
-       DPRINTK("Issued tag %u\n", qc->hw_tag);
-
        return 0;
 }
 
@@ -1871,12 +1856,12 @@ static void nv_swncq_host_init(struct ata_host *host)
 
        /* enable swncq */
        tmp = readl(mmio + NV_CTL_MCP55);
-       VPRINTK("HOST_CTL:0x%X\n", tmp);
+       dev_dbg(&pdev->dev, "HOST_CTL:0x%X\n", tmp);
        writel(tmp | NV_CTL_PRI_SWNCQ | NV_CTL_SEC_SWNCQ, mmio + NV_CTL_MCP55);
 
        /* enable irq intr */
        tmp = readl(mmio + NV_INT_ENABLE_MCP55);
-       VPRINTK("HOST_ENABLE:0x%X\n", tmp);
+       dev_dbg(&pdev->dev, "HOST_ENABLE:0x%X\n", tmp);
        writel(tmp | 0x00fd00fd, mmio + NV_INT_ENABLE_MCP55);
 
        /*  clear port irq */
@@ -2017,19 +2002,17 @@ static unsigned int nv_swncq_issue_atacmd(struct ata_port *ap,
        if (qc == NULL)
                return 0;
 
-       DPRINTK("Enter\n");
-
        writel((1 << qc->hw_tag), pp->sactive_block);
        pp->last_issue_tag = qc->hw_tag;
        pp->dhfis_bits &= ~(1 << qc->hw_tag);
        pp->dmafis_bits &= ~(1 << qc->hw_tag);
        pp->qc_active |= (0x1 << qc->hw_tag);
 
+       trace_ata_tf_load(ap, &qc->tf);
        ap->ops->sff_tf_load(ap, &qc->tf);       /* load tf registers */
+       trace_ata_exec_command(ap, &qc->tf, qc->hw_tag);
        ap->ops->sff_exec_command(ap, &qc->tf);
 
-       DPRINTK("Issued tag %u\n", qc->hw_tag);
-
        return 0;
 }
 
@@ -2041,8 +2024,6 @@ static unsigned int nv_swncq_qc_issue(struct ata_queued_cmd *qc)
        if (qc->tf.protocol != ATA_PROT_NCQ)
                return ata_bmdma_qc_issue(qc);
 
-       DPRINTK("Enter\n");
-
        if (!pp->qc_active)
                nv_swncq_issue_atacmd(ap, qc);
        else
@@ -2087,6 +2068,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
        u8 lack_dhfis = 0;
 
        host_stat = ap->ops->bmdma_status(ap);
+       trace_ata_bmdma_status(ap, host_stat);
        if (unlikely(host_stat & ATA_DMA_ERR)) {
                /* error when transferring data to/from memory */
                ata_ehi_clear_desc(ehi);
@@ -2109,7 +2091,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
        ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
 
        if (!ap->qc_active) {
-               DPRINTK("over\n");
+               ata_port_dbg(ap, "over\n");
                nv_swncq_pp_reinit(ap);
                return 0;
        }
@@ -2124,12 +2106,12 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
                 */
                lack_dhfis = 1;
 
-       DPRINTK("id 0x%x QC: qc_active 0x%llx,"
-               "SWNCQ:qc_active 0x%X defer_bits %X "
-               "dhfis 0x%X dmafis 0x%X last_issue_tag %x\n",
-               ap->print_id, ap->qc_active, pp->qc_active,
-               pp->defer_queue.defer_bits, pp->dhfis_bits,
-               pp->dmafis_bits, pp->last_issue_tag);
+       ata_port_dbg(ap, "QC: qc_active 0x%llx,"
+                    "SWNCQ:qc_active 0x%X defer_bits %X "
+                    "dhfis 0x%X dmafis 0x%X last_issue_tag %x\n",
+                    ap->qc_active, pp->qc_active,
+                    pp->defer_queue.defer_bits, pp->dhfis_bits,
+                    pp->dmafis_bits, pp->last_issue_tag);
 
        nv_swncq_fis_reinit(ap);
 
@@ -2169,7 +2151,7 @@ static void nv_swncq_dmafis(struct ata_port *ap)
        __ata_bmdma_stop(ap);
        tag = nv_swncq_tag(ap);
 
-       DPRINTK("dma setup tag 0x%x\n", tag);
+       ata_port_dbg(ap, "dma setup tag 0x%x\n", tag);
        qc = ata_qc_from_tag(ap, tag);
 
        if (unlikely(!qc))
@@ -2237,9 +2219,9 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
 
        if (fis & NV_SWNCQ_IRQ_SDBFIS) {
                pp->ncq_flags |= ncq_saw_sdb;
-               DPRINTK("id 0x%x SWNCQ: qc_active 0x%X "
+               ata_port_dbg(ap, "SWNCQ: qc_active 0x%X "
                        "dhfis 0x%X dmafis 0x%X sactive 0x%X\n",
-                       ap->print_id, pp->qc_active, pp->dhfis_bits,
+                       pp->qc_active, pp->dhfis_bits,
                        pp->dmafis_bits, readl(pp->sactive_block));
                if (nv_swncq_sdbfis(ap) < 0)
                        goto irq_error;
@@ -2265,7 +2247,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
                                goto irq_exit;
 
                        if (pp->defer_queue.defer_bits) {
-                               DPRINTK("send next command\n");
+                               ata_port_dbg(ap, "send next command\n");
                                qc = nv_swncq_qc_from_dq(ap);
                                nv_swncq_issue_atacmd(ap, qc);
                        }