1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2016 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  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  *  Intel Linux Wireless <linuxwifi@intel.com>
24  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25  *
26  *****************************************************************************/
27 
28 #if !defined(__IWLWIFI_DEVICE_TRACE_IO) || defined(TRACE_HEADER_MULTI_READ)
29 #define __IWLWIFI_DEVICE_TRACE_IO
30 
31 #include <linux/tracepoint.h>
32 
33 #undef TRACE_SYSTEM
34 #define TRACE_SYSTEM iwlwifi_io
35 
36 TRACE_EVENT(iwlwifi_dev_ioread32,
37 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
38 	TP_ARGS(dev, offs, val),
39 	TP_STRUCT__entry(
40 		DEV_ENTRY
41 		__field(u32, offs)
42 		__field(u32, val)
43 	),
44 	TP_fast_assign(
45 		DEV_ASSIGN;
46 		__entry->offs = offs;
47 		__entry->val = val;
48 	),
49 	TP_printk("[%s] read io[%#x] = %#x",
50 		  __get_str(dev), __entry->offs, __entry->val)
51 );
52 
53 TRACE_EVENT(iwlwifi_dev_iowrite8,
54 	TP_PROTO(const struct device *dev, u32 offs, u8 val),
55 	TP_ARGS(dev, offs, val),
56 	TP_STRUCT__entry(
57 		DEV_ENTRY
58 		__field(u32, offs)
59 		__field(u8, val)
60 	),
61 	TP_fast_assign(
62 		DEV_ASSIGN;
63 		__entry->offs = offs;
64 		__entry->val = val;
65 	),
66 	TP_printk("[%s] write io[%#x] = %#x)",
67 		  __get_str(dev), __entry->offs, __entry->val)
68 );
69 
70 TRACE_EVENT(iwlwifi_dev_iowrite32,
71 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
72 	TP_ARGS(dev, offs, val),
73 	TP_STRUCT__entry(
74 		DEV_ENTRY
75 		__field(u32, offs)
76 		__field(u32, val)
77 	),
78 	TP_fast_assign(
79 		DEV_ASSIGN;
80 		__entry->offs = offs;
81 		__entry->val = val;
82 	),
83 	TP_printk("[%s] write io[%#x] = %#x)",
84 		  __get_str(dev), __entry->offs, __entry->val)
85 );
86 
87 TRACE_EVENT(iwlwifi_dev_iowrite64,
88 	TP_PROTO(const struct device *dev, u64 offs, u64 val),
89 	TP_ARGS(dev, offs, val),
90 	TP_STRUCT__entry(
91 		DEV_ENTRY
92 		__field(u64, offs)
93 		__field(u64, val)
94 	),
95 	TP_fast_assign(
96 		DEV_ASSIGN;
97 		__entry->offs = offs;
98 		__entry->val = val;
99 	),
100 	TP_printk("[%s] write io[%llu] = %llu)",
101 		  __get_str(dev), __entry->offs, __entry->val)
102 );
103 
104 TRACE_EVENT(iwlwifi_dev_iowrite_prph32,
105 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
106 	TP_ARGS(dev, offs, val),
107 	TP_STRUCT__entry(
108 		DEV_ENTRY
109 		__field(u32, offs)
110 		__field(u32, val)
111 	),
112 	TP_fast_assign(
113 		DEV_ASSIGN;
114 		__entry->offs = offs;
115 		__entry->val = val;
116 	),
117 	TP_printk("[%s] write PRPH[%#x] = %#x)",
118 		  __get_str(dev), __entry->offs, __entry->val)
119 );
120 
121 TRACE_EVENT(iwlwifi_dev_iowrite_prph64,
122 	TP_PROTO(const struct device *dev, u64 offs, u64 val),
123 	TP_ARGS(dev, offs, val),
124 	TP_STRUCT__entry(
125 		DEV_ENTRY
126 		__field(u64, offs)
127 		__field(u64, val)
128 	),
129 	TP_fast_assign(
130 		DEV_ASSIGN;
131 		__entry->offs = offs;
132 		__entry->val = val;
133 	),
134 	TP_printk("[%s] write PRPH[%llu] = %llu)",
135 		  __get_str(dev), __entry->offs, __entry->val)
136 );
137 
138 TRACE_EVENT(iwlwifi_dev_ioread_prph32,
139 	TP_PROTO(const struct device *dev, u32 offs, u32 val),
140 	TP_ARGS(dev, offs, val),
141 	TP_STRUCT__entry(
142 		DEV_ENTRY
143 		__field(u32, offs)
144 		__field(u32, val)
145 	),
146 	TP_fast_assign(
147 		DEV_ASSIGN;
148 		__entry->offs = offs;
149 		__entry->val = val;
150 	),
151 	TP_printk("[%s] read PRPH[%#x] = %#x",
152 		  __get_str(dev), __entry->offs, __entry->val)
153 );
154 
155 TRACE_EVENT(iwlwifi_dev_irq,
156 	TP_PROTO(const struct device *dev),
157 	TP_ARGS(dev),
158 	TP_STRUCT__entry(
159 		DEV_ENTRY
160 	),
161 	TP_fast_assign(
162 		DEV_ASSIGN;
163 	),
164 	/* TP_printk("") doesn't compile */
165 	TP_printk("%d", 0)
166 );
167 
168 TRACE_EVENT(iwlwifi_dev_ict_read,
169 	TP_PROTO(const struct device *dev, u32 index, u32 value),
170 	TP_ARGS(dev, index, value),
171 	TP_STRUCT__entry(
172 		DEV_ENTRY
173 		__field(u32, index)
174 		__field(u32, value)
175 	),
176 	TP_fast_assign(
177 		DEV_ASSIGN;
178 		__entry->index = index;
179 		__entry->value = value;
180 	),
181 	TP_printk("[%s] read ict[%d] = %#.8x",
182 		  __get_str(dev), __entry->index, __entry->value)
183 );
184 #endif /* __IWLWIFI_DEVICE_TRACE_IO */
185 
186 #undef TRACE_INCLUDE_PATH
187 #define TRACE_INCLUDE_PATH .
188 #undef TRACE_INCLUDE_FILE
189 #define TRACE_INCLUDE_FILE iwl-devtrace-io
190 #include <trace/define_trace.h>
191