]>
Commit | Line | Data |
---|---|---|
84a99f6f XR |
1 | /* |
2 | * xHCI host controller driver | |
3 | * | |
4 | * Copyright (C) 2013 Xenia Ragiadakou | |
5 | * | |
6 | * Author: Xenia Ragiadakou | |
7 | * Email : burzalodowa@gmail.com | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | */ | |
13 | ||
14 | #undef TRACE_SYSTEM | |
15 | #define TRACE_SYSTEM xhci-hcd | |
16 | ||
7267b238 SRRH |
17 | /* |
18 | * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a | |
19 | * legitimate C variable. It is not exported to user space. | |
20 | */ | |
21 | #undef TRACE_SYSTEM_VAR | |
22 | #define TRACE_SYSTEM_VAR xhci_hcd | |
23 | ||
84a99f6f XR |
24 | #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
25 | #define __XHCI_TRACE_H | |
26 | ||
27 | #include <linux/tracepoint.h> | |
1d27fabe | 28 | #include "xhci.h" |
84a99f6f XR |
29 | |
30 | #define XHCI_MSG_MAX 500 | |
31 | ||
32 | DECLARE_EVENT_CLASS(xhci_log_msg, | |
33 | TP_PROTO(struct va_format *vaf), | |
34 | TP_ARGS(vaf), | |
35 | TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)), | |
36 | TP_fast_assign( | |
37 | vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va); | |
38 | ), | |
39 | TP_printk("%s", __get_str(msg)) | |
40 | ); | |
41 | ||
42 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, | |
43 | TP_PROTO(struct va_format *vaf), | |
44 | TP_ARGS(vaf) | |
45 | ); | |
46 | ||
3a7fa5be XR |
47 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change, |
48 | TP_PROTO(struct va_format *vaf), | |
49 | TP_ARGS(vaf) | |
50 | ); | |
51 | ||
4bdfe4c3 XR |
52 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks, |
53 | TP_PROTO(struct va_format *vaf), | |
54 | TP_ARGS(vaf) | |
55 | ); | |
56 | ||
a0254324 XR |
57 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep, |
58 | TP_PROTO(struct va_format *vaf), | |
59 | TP_ARGS(vaf) | |
60 | ); | |
61 | ||
aa50b290 XR |
62 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, |
63 | TP_PROTO(struct va_format *vaf), | |
64 | TP_ARGS(vaf) | |
65 | ); | |
66 | ||
d195fcff XR |
67 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_init, |
68 | TP_PROTO(struct va_format *vaf), | |
69 | TP_ARGS(vaf) | |
70 | ); | |
71 | ||
68ffb011 XR |
72 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, |
73 | TP_PROTO(struct va_format *vaf), | |
74 | TP_ARGS(vaf) | |
75 | ); | |
76 | ||
1d27fabe XR |
77 | DECLARE_EVENT_CLASS(xhci_log_ctx, |
78 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, | |
79 | unsigned int ep_num), | |
80 | TP_ARGS(xhci, ctx, ep_num), | |
81 | TP_STRUCT__entry( | |
82 | __field(int, ctx_64) | |
83 | __field(unsigned, ctx_type) | |
84 | __field(dma_addr_t, ctx_dma) | |
85 | __field(u8 *, ctx_va) | |
86 | __field(unsigned, ctx_ep_num) | |
87 | __field(int, slot_id) | |
88 | __dynamic_array(u32, ctx_data, | |
89 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * | |
90 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) | |
91 | ), | |
92 | TP_fast_assign( | |
93 | struct usb_device *udev; | |
94 | ||
95 | udev = to_usb_device(xhci_to_hcd(xhci)->self.controller); | |
96 | __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); | |
97 | __entry->ctx_type = ctx->type; | |
98 | __entry->ctx_dma = ctx->dma; | |
99 | __entry->ctx_va = ctx->bytes; | |
100 | __entry->slot_id = udev->slot_id; | |
101 | __entry->ctx_ep_num = ep_num; | |
102 | memcpy(__get_dynamic_array(ctx_data), ctx->bytes, | |
103 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * | |
104 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)); | |
105 | ), | |
d4d93e6c | 106 | TP_printk("ctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p", |
1d27fabe XR |
107 | __entry->ctx_64, __entry->ctx_type, |
108 | (unsigned long long) __entry->ctx_dma, __entry->ctx_va | |
109 | ) | |
110 | ); | |
111 | ||
112 | DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx, | |
113 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, | |
114 | unsigned int ep_num), | |
115 | TP_ARGS(xhci, ctx, ep_num) | |
116 | ); | |
117 | ||
a37c3f76 FB |
118 | DECLARE_EVENT_CLASS(xhci_log_trb, |
119 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), | |
120 | TP_ARGS(ring, trb), | |
63a23b9a | 121 | TP_STRUCT__entry( |
a37c3f76 FB |
122 | __field(u32, type) |
123 | __field(u32, field0) | |
124 | __field(u32, field1) | |
125 | __field(u32, field2) | |
126 | __field(u32, field3) | |
63a23b9a XR |
127 | ), |
128 | TP_fast_assign( | |
a37c3f76 FB |
129 | __entry->type = ring->type; |
130 | __entry->field0 = le32_to_cpu(trb->field[0]); | |
131 | __entry->field1 = le32_to_cpu(trb->field[1]); | |
132 | __entry->field2 = le32_to_cpu(trb->field[2]); | |
133 | __entry->field3 = le32_to_cpu(trb->field[3]); | |
63a23b9a | 134 | ), |
a37c3f76 FB |
135 | TP_printk("%s: %s", xhci_ring_type_string(__entry->type), |
136 | xhci_decode_trb(__entry->field0, __entry->field1, | |
137 | __entry->field2, __entry->field3) | |
63a23b9a XR |
138 | ) |
139 | ); | |
140 | ||
a37c3f76 FB |
141 | DEFINE_EVENT(xhci_log_trb, xhci_handle_event, |
142 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), | |
143 | TP_ARGS(ring, trb) | |
144 | ); | |
145 | ||
146 | DEFINE_EVENT(xhci_log_trb, xhci_handle_command, | |
147 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), | |
148 | TP_ARGS(ring, trb) | |
149 | ); | |
150 | ||
151 | DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer, | |
152 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), | |
153 | TP_ARGS(ring, trb) | |
154 | ); | |
155 | ||
156 | DEFINE_EVENT(xhci_log_trb, xhci_queue_trb, | |
157 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), | |
158 | TP_ARGS(ring, trb) | |
63a23b9a XR |
159 | ); |
160 | ||
5abdc2e6 FB |
161 | DECLARE_EVENT_CLASS(xhci_log_urb, |
162 | TP_PROTO(struct urb *urb), | |
163 | TP_ARGS(urb), | |
164 | TP_STRUCT__entry( | |
165 | __field(void *, urb) | |
166 | __field(unsigned int, pipe) | |
167 | __field(unsigned int, stream) | |
168 | __field(int, status) | |
169 | __field(unsigned int, flags) | |
170 | __field(int, num_mapped_sgs) | |
171 | __field(int, num_sgs) | |
172 | __field(int, length) | |
173 | __field(int, actual) | |
174 | __field(int, epnum) | |
175 | __field(int, dir_in) | |
176 | __field(int, type) | |
177 | ), | |
178 | TP_fast_assign( | |
179 | __entry->urb = urb; | |
180 | __entry->pipe = urb->pipe; | |
181 | __entry->stream = urb->stream_id; | |
182 | __entry->status = urb->status; | |
183 | __entry->flags = urb->transfer_flags; | |
184 | __entry->num_mapped_sgs = urb->num_mapped_sgs; | |
185 | __entry->num_sgs = urb->num_sgs; | |
186 | __entry->length = urb->transfer_buffer_length; | |
187 | __entry->actual = urb->actual_length; | |
188 | __entry->epnum = usb_endpoint_num(&urb->ep->desc); | |
189 | __entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc); | |
190 | __entry->type = usb_endpoint_type(&urb->ep->desc); | |
191 | ), | |
192 | TP_printk("ep%d%s-%s: urb %p pipe %u length %d/%d sgs %d/%d stream %d flags %08x", | |
193 | __entry->epnum, __entry->dir_in ? "in" : "out", | |
194 | ({ char *s; | |
195 | switch (__entry->type) { | |
196 | case USB_ENDPOINT_XFER_INT: | |
197 | s = "intr"; | |
198 | break; | |
199 | case USB_ENDPOINT_XFER_CONTROL: | |
200 | s = "control"; | |
201 | break; | |
202 | case USB_ENDPOINT_XFER_BULK: | |
203 | s = "bulk"; | |
204 | break; | |
205 | case USB_ENDPOINT_XFER_ISOC: | |
206 | s = "isoc"; | |
207 | break; | |
208 | default: | |
209 | s = "UNKNOWN"; | |
210 | } s; }), __entry->urb, __entry->pipe, __entry->actual, | |
211 | __entry->length, __entry->num_mapped_sgs, | |
212 | __entry->num_sgs, __entry->stream, __entry->flags | |
213 | ) | |
214 | ); | |
215 | ||
216 | DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue, | |
217 | TP_PROTO(struct urb *urb), | |
218 | TP_ARGS(urb) | |
219 | ); | |
220 | ||
221 | DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback, | |
222 | TP_PROTO(struct urb *urb), | |
223 | TP_ARGS(urb) | |
224 | ); | |
225 | ||
226 | DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue, | |
227 | TP_PROTO(struct urb *urb), | |
228 | TP_ARGS(urb) | |
229 | ); | |
230 | ||
84a99f6f XR |
231 | #endif /* __XHCI_TRACE_H */ |
232 | ||
233 | /* this part must be outside header guard */ | |
234 | ||
235 | #undef TRACE_INCLUDE_PATH | |
236 | #define TRACE_INCLUDE_PATH . | |
237 | ||
238 | #undef TRACE_INCLUDE_FILE | |
239 | #define TRACE_INCLUDE_FILE xhci-trace | |
240 | ||
241 | #include <trace/define_trace.h> |