xref: /linux/drivers/dma/fsl-edma-trace.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2023 NXP.
4  */
5 
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM fsl_edma
8 
9 #if !defined(__LINUX_FSL_EDMA_TRACE) || defined(TRACE_HEADER_MULTI_READ)
10 #define __LINUX_FSL_EDMA_TRACE
11 
12 #include <linux/types.h>
13 #include <linux/tracepoint.h>
14 
15 DECLARE_EVENT_CLASS(edma_log_io,
16 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
17 	TP_ARGS(edma, addr, value),
18 	TP_STRUCT__entry(
19 		__field(struct fsl_edma_engine *, edma)
20 		__field(void __iomem *, addr)
21 		__field(u32, value)
22 	),
23 	TP_fast_assign(
24 		__entry->edma = edma;
25 		__entry->addr = addr;
26 		__entry->value = value;
27 	),
28 	TP_printk("offset %08x: value %08x",
29 		(u32)(__entry->addr - __entry->edma->membase), __entry->value)
30 );
31 
32 DEFINE_EVENT(edma_log_io, edma_readl,
33 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
34 	TP_ARGS(edma, addr, value)
35 );
36 
37 DEFINE_EVENT(edma_log_io, edma_writel,
38 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
39 	TP_ARGS(edma, addr, value)
40 );
41 
42 DEFINE_EVENT(edma_log_io, edma_readw,
43 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
44 	TP_ARGS(edma, addr, value)
45 );
46 
47 DEFINE_EVENT(edma_log_io, edma_writew,
48 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
49 	TP_ARGS(edma, addr, value)
50 );
51 
52 DEFINE_EVENT(edma_log_io, edma_readb,
53 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
54 	TP_ARGS(edma, addr, value)
55 );
56 
57 DEFINE_EVENT(edma_log_io, edma_writeb,
58 	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
59 	TP_ARGS(edma, addr, value)
60 );
61 
62 DECLARE_EVENT_CLASS(edma_log_tcd,
63 	TP_PROTO(struct fsl_edma_chan *chan, void *tcd),
64 	TP_ARGS(chan, tcd),
65 	TP_STRUCT__entry(
66 		__field(u64, saddr)
67 		__field(u16, soff)
68 		__field(u16, attr)
69 		__field(u32, nbytes)
70 		__field(u64, slast)
71 		__field(u64, daddr)
72 		__field(u16, doff)
73 		__field(u16, citer)
74 		__field(u64, dlast_sga)
75 		__field(u16, csr)
76 		__field(u16, biter)
77 
78 	),
79 	TP_fast_assign(
80 		__entry->saddr = fsl_edma_get_tcd_to_cpu(chan, tcd, saddr),
81 		__entry->soff = fsl_edma_get_tcd_to_cpu(chan, tcd, soff),
82 		__entry->attr = fsl_edma_get_tcd_to_cpu(chan, tcd, attr),
83 		__entry->nbytes = fsl_edma_get_tcd_to_cpu(chan, tcd, nbytes),
84 		__entry->slast = fsl_edma_get_tcd_to_cpu(chan, tcd, slast),
85 		__entry->daddr = fsl_edma_get_tcd_to_cpu(chan, tcd, daddr),
86 		__entry->doff = fsl_edma_get_tcd_to_cpu(chan, tcd, doff),
87 		__entry->citer = fsl_edma_get_tcd_to_cpu(chan, tcd, citer),
88 		__entry->dlast_sga = fsl_edma_get_tcd_to_cpu(chan, tcd, dlast_sga),
89 		__entry->csr = fsl_edma_get_tcd_to_cpu(chan, tcd, csr),
90 		__entry->biter = fsl_edma_get_tcd_to_cpu(chan, tcd, biter);
91 	),
92 	TP_printk("\n==== TCD =====\n"
93 		  "  saddr:  0x%016llx\n"
94 		  "  soff:               0x%04x\n"
95 		  "  attr:               0x%04x\n"
96 		  "  nbytes:         0x%08x\n"
97 		  "  slast:  0x%016llx\n"
98 		  "  daddr:  0x%016llx\n"
99 		  "  doff:               0x%04x\n"
100 		  "  citer:              0x%04x\n"
101 		  "  dlast:  0x%016llx\n"
102 		  "  csr:                0x%04x\n"
103 		  "  biter:              0x%04x\n",
104 		__entry->saddr,
105 		__entry->soff,
106 		__entry->attr,
107 		__entry->nbytes,
108 		__entry->slast,
109 		__entry->daddr,
110 		__entry->doff,
111 		__entry->citer,
112 		__entry->dlast_sga,
113 		__entry->csr,
114 		__entry->biter)
115 );
116 
117 DEFINE_EVENT(edma_log_tcd, edma_fill_tcd,
118 	TP_PROTO(struct fsl_edma_chan *chan, void *tcd),
119 	TP_ARGS(chan, tcd)
120 );
121 
122 #endif
123 
124 /* this part must be outside header guard */
125 
126 #undef TRACE_INCLUDE_PATH
127 #define TRACE_INCLUDE_PATH .
128 
129 #undef TRACE_INCLUDE_FILE
130 #define TRACE_INCLUDE_FILE fsl-edma-trace
131 
132 #include <trace/define_trace.h>
133