1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
3  *
4  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
5  * Copyright(c) 2016-2017 Intel Deutschland GmbH
6  *
7  * Contact Information:
8  *  Intel Linux Wireless <linuxwifi@intel.com>
9  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
10  *
11  *****************************************************************************/
12 
13 #if !defined(__IWLWIFI_DEVICE_TRACE_IO) || defined(TRACE_HEADER_MULTI_READ)
14 #define __IWLWIFI_DEVICE_TRACE_IO
15 
16 #include <linux/tracepoint.h>
17 #include <linux/pci.h>
18 
19 #undef TRACE_SYSTEM
20 #define TRACE_SYSTEM iwlwifi_io
21 
22 TRACE_EVENT(iwlwifi_dev_ioread32,
23 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
24 	TP_ARGS(dev, offs, val),
25 	TP_STRUCT__entry(
26 		DEV_ENTRY
27 		__field(u32, offs)
28 		__field(u32, val)
29 	),
30 	TP_fast_assign(
31 		DEV_ASSIGN;
32 		__entry->offs = offs;
33 		__entry->val = val;
34 	),
35 	TP_printk("[%s] read io[%#x] = %#x",
36 		  __get_str(dev), __entry->offs, __entry->val)
37 );
38 
39 TRACE_EVENT(iwlwifi_dev_iowrite8,
40 	TP_PROTO(const struct device *dev, u32 offs, u8 val),
41 	TP_ARGS(dev, offs, val),
42 	TP_STRUCT__entry(
43 		DEV_ENTRY
44 		__field(u32, offs)
45 		__field(u8, val)
46 	),
47 	TP_fast_assign(
48 		DEV_ASSIGN;
49 		__entry->offs = offs;
50 		__entry->val = val;
51 	),
52 	TP_printk("[%s] write io[%#x] = %#x)",
53 		  __get_str(dev), __entry->offs, __entry->val)
54 );
55 
56 TRACE_EVENT(iwlwifi_dev_iowrite32,
57 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
58 	TP_ARGS(dev, offs, val),
59 	TP_STRUCT__entry(
60 		DEV_ENTRY
61 		__field(u32, offs)
62 		__field(u32, val)
63 	),
64 	TP_fast_assign(
65 		DEV_ASSIGN;
66 		__entry->offs = offs;
67 		__entry->val = val;
68 	),
69 	TP_printk("[%s] write io[%#x] = %#x)",
70 		  __get_str(dev), __entry->offs, __entry->val)
71 );
72 
73 TRACE_EVENT(iwlwifi_dev_iowrite64,
74 	TP_PROTO(const struct device *dev, u64 offs, u64 val),
75 	TP_ARGS(dev, offs, val),
76 	TP_STRUCT__entry(
77 		DEV_ENTRY
78 		__field(u64, offs)
79 		__field(u64, val)
80 	),
81 	TP_fast_assign(
82 		DEV_ASSIGN;
83 		__entry->offs = offs;
84 		__entry->val = val;
85 	),
86 	TP_printk("[%s] write io[%llu] = %llu)",
87 		  __get_str(dev), __entry->offs, __entry->val)
88 );
89 
90 TRACE_EVENT(iwlwifi_dev_iowrite_prph32,
91 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
92 	TP_ARGS(dev, offs, val),
93 	TP_STRUCT__entry(
94 		DEV_ENTRY
95 		__field(u32, offs)
96 		__field(u32, val)
97 	),
98 	TP_fast_assign(
99 		DEV_ASSIGN;
100 		__entry->offs = offs;
101 		__entry->val = val;
102 	),
103 	TP_printk("[%s] write PRPH[%#x] = %#x)",
104 		  __get_str(dev), __entry->offs, __entry->val)
105 );
106 
107 TRACE_EVENT(iwlwifi_dev_iowrite_prph64,
108 	TP_PROTO(const struct device *dev, u64 offs, u64 val),
109 	TP_ARGS(dev, offs, val),
110 	TP_STRUCT__entry(
111 		DEV_ENTRY
112 		__field(u64, offs)
113 		__field(u64, val)
114 	),
115 	TP_fast_assign(
116 		DEV_ASSIGN;
117 		__entry->offs = offs;
118 		__entry->val = val;
119 	),
120 	TP_printk("[%s] write PRPH[%llu] = %llu)",
121 		  __get_str(dev), __entry->offs, __entry->val)
122 );
123 
124 TRACE_EVENT(iwlwifi_dev_ioread_prph32,
125 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
126 	TP_ARGS(dev, offs, val),
127 	TP_STRUCT__entry(
128 		DEV_ENTRY
129 		__field(u32, offs)
130 		__field(u32, val)
131 	),
132 	TP_fast_assign(
133 		DEV_ASSIGN;
134 		__entry->offs = offs;
135 		__entry->val = val;
136 	),
137 	TP_printk("[%s] read PRPH[%#x] = %#x",
138 		  __get_str(dev), __entry->offs, __entry->val)
139 );
140 
141 TRACE_EVENT(iwlwifi_dev_irq,
142 	TP_PROTO(const struct device *dev),
143 	TP_ARGS(dev),
144 	TP_STRUCT__entry(
145 		DEV_ENTRY
146 	),
147 	TP_fast_assign(
148 		DEV_ASSIGN;
149 	),
150 	/* TP_printk("") doesn't compile */
151 	TP_printk("%d", 0)
152 );
153 
154 TRACE_EVENT(iwlwifi_dev_irq_msix,
155 	TP_PROTO(const struct device *dev, struct msix_entry *msix_entry,
156 		 bool defirq, u32 inta_fh, u32 inta_hw),
157 	TP_ARGS(dev, msix_entry, defirq, inta_fh, inta_hw),
158 	TP_STRUCT__entry(
159 		DEV_ENTRY
160 		__field(u32, entry)
161 		__field(u8, defirq)
162 		__field(u32, inta_fh)
163 		__field(u32, inta_hw)
164 	),
165 	TP_fast_assign(
166 		DEV_ASSIGN;
167 		__entry->entry = msix_entry->entry;
168 		__entry->defirq = defirq;
169 		__entry->inta_fh = inta_fh;
170 		__entry->inta_hw = inta_hw;
171 	),
172 	TP_printk("entry:%d defirq:%d fh:0x%x, hw:0x%x",
173 		  __entry->entry, __entry->defirq,
174 		  __entry->inta_fh, __entry->inta_hw)
175 );
176 
177 TRACE_EVENT(iwlwifi_dev_ict_read,
178 	TP_PROTO(const struct device *dev, u32 index, u32 value),
179 	TP_ARGS(dev, index, value),
180 	TP_STRUCT__entry(
181 		DEV_ENTRY
182 		__field(u32, index)
183 		__field(u32, value)
184 	),
185 	TP_fast_assign(
186 		DEV_ASSIGN;
187 		__entry->index = index;
188 		__entry->value = value;
189 	),
190 	TP_printk("[%s] read ict[%d] = %#.8x",
191 		  __get_str(dev), __entry->index, __entry->value)
192 );
193 #endif /* __IWLWIFI_DEVICE_TRACE_IO */
194 
195 #undef TRACE_INCLUDE_PATH
196 #define TRACE_INCLUDE_PATH .
197 #undef TRACE_INCLUDE_FILE
198 #define TRACE_INCLUDE_FILE iwl-devtrace-io
199 #include <trace/define_trace.h>
200