ata: libata: tracepoints for bus-master DMA
[sfrench/cifs-2.6.git] / drivers / ata / sata_dwc_460ex.c
index bd48595637960586fe3cf69f98879ea62ab4d1c6..c33dc98e0d9d1a5d90b0065e77e5c54d3c50f8ec 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/phy/phy.h>
 #include <linux/libata.h>
 #include <linux/slab.h>
+#include <trace/events/libata.h>
 
 #include "libata.h"
 
@@ -295,6 +296,7 @@ static const char *get_prot_descript(u8 protocol)
        }
 }
 
+#ifdef DEBUG_NCQ
 static const char *get_dma_dir_descript(int dma_dir)
 {
        switch ((enum dma_data_direction)dma_dir) {
@@ -308,21 +310,7 @@ static const char *get_dma_dir_descript(int dma_dir)
                return "none";
        }
 }
-
-static void sata_dwc_tf_dump(struct ata_port *ap, struct ata_taskfile *tf)
-{
-       dev_vdbg(ap->dev,
-               "taskfile cmd: 0x%02x protocol: %s flags: 0x%lx device: %x\n",
-               tf->command, get_prot_descript(tf->protocol), tf->flags,
-               tf->device);
-       dev_vdbg(ap->dev,
-               "feature: 0x%02x nsect: 0x%x lbal: 0x%x lbam: 0x%x lbah: 0x%x\n",
-               tf->feature, tf->nsect, tf->lbal, tf->lbam, tf->lbah);
-       dev_vdbg(ap->dev,
-               "hob_feature: 0x%02x hob_nsect: 0x%x hob_lbal: 0x%x hob_lbam: 0x%x hob_lbah: 0x%x\n",
-               tf->hob_feature, tf->hob_nsect, tf->hob_lbal, tf->hob_lbam,
-               tf->hob_lbah);
-}
+#endif
 
 static void dma_dwc_xfer_done(void *hsdev_instance)
 {
@@ -551,6 +539,7 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
                 * active tag.  It is the tag that matches the command about to
                 * be completed.
                 */
+               trace_ata_bmdma_start(ap, &qc->tf, tag);
                qc->ap->link.active_tag = tag;
                sata_dwc_bmdma_start_by_tag(qc, tag);
 
@@ -978,9 +967,6 @@ static void sata_dwc_exec_command_by_tag(struct ata_port *ap,
 {
        struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
 
-       dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command,
-               ata_get_cmd_descript(tf->command), tag);
-
        hsdevp->cmd_issued[tag] = cmd_issued;
 
        /*
@@ -1003,12 +989,9 @@ static void sata_dwc_bmdma_setup(struct ata_queued_cmd *qc)
 {
        u8 tag = qc->hw_tag;
 
-       if (ata_is_ncq(qc->tf.protocol)) {
-               dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
-                       __func__, qc->ap->link.sactive, tag);
-       } else {
+       if (!ata_is_ncq(qc->tf.protocol))
                tag = 0;
-       }
+
        sata_dwc_bmdma_setup_by_tag(qc, tag);
 }
 
@@ -1035,12 +1018,6 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag)
                start_dma = 0;
        }
 
-       dev_dbg(ap->dev,
-               "%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s start_dma? %x\n",
-               __func__, qc, tag, qc->tf.command,
-               get_dma_dir_descript(qc->dma_dir), start_dma);
-       sata_dwc_tf_dump(ap, &qc->tf);
-
        if (start_dma) {
                sata_dwc_scr_read(&ap->link, SCR_ERROR, &reg);
                if (reg & SATA_DWC_SERROR_ERR_BITS) {
@@ -1065,13 +1042,9 @@ static void sata_dwc_bmdma_start(struct ata_queued_cmd *qc)
 {
        u8 tag = qc->hw_tag;
 
-       if (ata_is_ncq(qc->tf.protocol)) {
-               dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
-                       __func__, qc->ap->link.sactive, tag);
-       } else {
+       if (!ata_is_ncq(qc->tf.protocol))
                tag = 0;
-       }
-       dev_dbg(qc->ap->dev, "%s\n", __func__);
+
        sata_dwc_bmdma_start_by_tag(qc, tag);
 }
 
@@ -1082,16 +1055,6 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
        struct ata_port *ap = qc->ap;
        struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
 
-#ifdef DEBUG_NCQ
-       if (qc->hw_tag > 0 || ap->link.sactive > 1)
-               dev_info(ap->dev,
-                        "%s ap id=%d cmd(0x%02x)=%s qc tag=%d prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n",
-                        __func__, ap->print_id, qc->tf.command,
-                        ata_get_cmd_descript(qc->tf.command),
-                        qc->hw_tag, get_prot_descript(qc->tf.protocol),
-                        ap->link.active_tag, ap->link.sactive);
-#endif
-
        if (!ata_is_ncq(qc->tf.protocol))
                tag = 0;
 
@@ -1108,11 +1071,9 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
                sactive |= (0x00000001 << tag);
                sata_dwc_scr_write(&ap->link, SCR_ACTIVE, sactive);
 
-               dev_dbg(qc->ap->dev,
-                       "%s: tag=%d ap->link.sactive = 0x%08x sactive=0x%08x\n",
-                       __func__, tag, qc->ap->link.sactive, sactive);
-
+               trace_ata_tf_load(ap, &qc->tf);
                ap->ops->sff_tf_load(ap, &qc->tf);
+               trace_ata_exec_command(ap, &qc->tf, tag);
                sata_dwc_exec_command_by_tag(ap, &qc->tf, tag,
                                             SATA_DWC_CMD_ISSUED_PEND);
        } else {