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