Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 1 | /** |
| 2 | * trace.h - DesignWare USB3 DRD Controller Trace Support |
| 3 | * |
| 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com |
| 5 | * |
| 6 | * Author: Felipe Balbi <balbi@ti.com> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 of |
| 10 | * the License as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | #undef TRACE_SYSTEM |
| 19 | #define TRACE_SYSTEM dwc3 |
| 20 | |
| 21 | #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 22 | #define __DWC3_TRACE_H |
| 23 | |
| 24 | #include <linux/types.h> |
| 25 | #include <linux/tracepoint.h> |
| 26 | #include <asm/byteorder.h> |
| 27 | #include "core.h" |
| 28 | #include "debug.h" |
| 29 | |
| 30 | DECLARE_EVENT_CLASS(dwc3_log_msg, |
| 31 | TP_PROTO(struct va_format *vaf), |
| 32 | TP_ARGS(vaf), |
| 33 | TP_STRUCT__entry(__dynamic_array(char, msg, DWC3_MSG_MAX)), |
| 34 | TP_fast_assign( |
| 35 | vsnprintf(__get_str(msg), DWC3_MSG_MAX, vaf->fmt, *vaf->va); |
| 36 | ), |
| 37 | TP_printk("%s", __get_str(msg)) |
| 38 | ); |
| 39 | |
Felipe Balbi | 6bac4ff | 2015-01-27 13:47:02 -0600 | [diff] [blame] | 40 | DEFINE_EVENT(dwc3_log_msg, dwc3_gadget, |
| 41 | TP_PROTO(struct va_format *vaf), |
| 42 | TP_ARGS(vaf) |
| 43 | ); |
| 44 | |
| 45 | DEFINE_EVENT(dwc3_log_msg, dwc3_core, |
| 46 | TP_PROTO(struct va_format *vaf), |
| 47 | TP_ARGS(vaf) |
| 48 | ); |
| 49 | |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 50 | DEFINE_EVENT(dwc3_log_msg, dwc3_ep0, |
| 51 | TP_PROTO(struct va_format *vaf), |
| 52 | TP_ARGS(vaf) |
| 53 | ); |
| 54 | |
Felipe Balbi | 4dd5a69 | 2016-09-30 15:52:19 +0300 | [diff] [blame] | 55 | DECLARE_EVENT_CLASS(dwc3_log_io, |
| 56 | TP_PROTO(void *base, u32 offset, u32 value), |
| 57 | TP_ARGS(base, offset, value), |
| 58 | TP_STRUCT__entry( |
| 59 | __field(void *, base) |
| 60 | __field(u32, offset) |
| 61 | __field(u32, value) |
| 62 | ), |
| 63 | TP_fast_assign( |
| 64 | __entry->base = base; |
| 65 | __entry->offset = offset; |
| 66 | __entry->value = value; |
| 67 | ), |
| 68 | TP_printk("addr %p value %08x", __entry->base + __entry->offset, |
| 69 | __entry->value) |
| 70 | ); |
| 71 | |
| 72 | DEFINE_EVENT(dwc3_log_io, dwc3_readl, |
| 73 | TP_PROTO(void *base, u32 offset, u32 value), |
| 74 | TP_ARGS(base, offset, value) |
| 75 | ); |
| 76 | |
| 77 | DEFINE_EVENT(dwc3_log_io, dwc3_writel, |
| 78 | TP_PROTO(void *base, u32 offset, u32 value), |
| 79 | TP_ARGS(base, offset, value) |
| 80 | ); |
| 81 | |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 82 | DECLARE_EVENT_CLASS(dwc3_log_event, |
Felipe Balbi | 43c96be | 2016-09-26 13:23:34 +0300 | [diff] [blame] | 83 | TP_PROTO(u32 event, struct dwc3 *dwc), |
| 84 | TP_ARGS(event, dwc), |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 85 | TP_STRUCT__entry( |
| 86 | __field(u32, event) |
Felipe Balbi | 43c96be | 2016-09-26 13:23:34 +0300 | [diff] [blame] | 87 | __field(u32, ep0state) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 88 | ), |
| 89 | TP_fast_assign( |
| 90 | __entry->event = event; |
Felipe Balbi | 43c96be | 2016-09-26 13:23:34 +0300 | [diff] [blame] | 91 | __entry->ep0state = dwc->ep0state; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 92 | ), |
Felipe Balbi | f75cacc | 2016-05-23 11:10:08 +0300 | [diff] [blame] | 93 | TP_printk("event (%08x): %s", __entry->event, |
Felipe Balbi | 43c96be | 2016-09-26 13:23:34 +0300 | [diff] [blame] | 94 | dwc3_decode_event(__entry->event, __entry->ep0state)) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 95 | ); |
| 96 | |
| 97 | DEFINE_EVENT(dwc3_log_event, dwc3_event, |
Felipe Balbi | 43c96be | 2016-09-26 13:23:34 +0300 | [diff] [blame] | 98 | TP_PROTO(u32 event, struct dwc3 *dwc), |
| 99 | TP_ARGS(event, dwc) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 100 | ); |
| 101 | |
| 102 | DECLARE_EVENT_CLASS(dwc3_log_ctrl, |
| 103 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 104 | TP_ARGS(ctrl), |
| 105 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 106 | __field(__u8, bRequestType) |
| 107 | __field(__u8, bRequest) |
John Youn | 96bedb6 | 2016-05-23 11:32:47 -0700 | [diff] [blame] | 108 | __field(__u16, wValue) |
| 109 | __field(__u16, wIndex) |
| 110 | __field(__u16, wLength) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 111 | ), |
| 112 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 113 | __entry->bRequestType = ctrl->bRequestType; |
| 114 | __entry->bRequest = ctrl->bRequest; |
John Youn | 96bedb6 | 2016-05-23 11:32:47 -0700 | [diff] [blame] | 115 | __entry->wValue = le16_to_cpu(ctrl->wValue); |
| 116 | __entry->wIndex = le16_to_cpu(ctrl->wIndex); |
| 117 | __entry->wLength = le16_to_cpu(ctrl->wLength); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 118 | ), |
| 119 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 120 | __entry->bRequestType, __entry->bRequest, |
John Youn | 96bedb6 | 2016-05-23 11:32:47 -0700 | [diff] [blame] | 121 | __entry->wValue, __entry->wIndex, |
| 122 | __entry->wLength |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 123 | ) |
| 124 | ); |
| 125 | |
| 126 | DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req, |
| 127 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 128 | TP_ARGS(ctrl) |
| 129 | ); |
| 130 | |
| 131 | DECLARE_EVENT_CLASS(dwc3_log_request, |
| 132 | TP_PROTO(struct dwc3_request *req), |
| 133 | TP_ARGS(req), |
| 134 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 135 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 136 | __field(struct dwc3_request *, req) |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 137 | __field(unsigned, actual) |
| 138 | __field(unsigned, length) |
| 139 | __field(int, status) |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 140 | __field(int, zero) |
| 141 | __field(int, short_not_ok) |
| 142 | __field(int, no_interrupt) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 143 | ), |
| 144 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 145 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 146 | __entry->req = req; |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 147 | __entry->actual = req->request.actual; |
| 148 | __entry->length = req->request.length; |
| 149 | __entry->status = req->request.status; |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 150 | __entry->zero = req->request.zero; |
| 151 | __entry->short_not_ok = req->request.short_not_ok; |
| 152 | __entry->no_interrupt = req->request.no_interrupt; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 153 | ), |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 154 | TP_printk("%s: req %p length %u/%u %s%s%s ==> %d", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 155 | __get_str(name), __entry->req, __entry->actual, __entry->length, |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 156 | __entry->zero ? "Z" : "z", |
| 157 | __entry->short_not_ok ? "S" : "s", |
| 158 | __entry->no_interrupt ? "i" : "I", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 159 | __entry->status |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 160 | ) |
| 161 | ); |
| 162 | |
| 163 | DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request, |
| 164 | TP_PROTO(struct dwc3_request *req), |
| 165 | TP_ARGS(req) |
| 166 | ); |
| 167 | |
| 168 | DEFINE_EVENT(dwc3_log_request, dwc3_free_request, |
| 169 | TP_PROTO(struct dwc3_request *req), |
| 170 | TP_ARGS(req) |
| 171 | ); |
| 172 | |
| 173 | DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue, |
| 174 | TP_PROTO(struct dwc3_request *req), |
| 175 | TP_ARGS(req) |
| 176 | ); |
| 177 | |
| 178 | DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue, |
| 179 | TP_PROTO(struct dwc3_request *req), |
| 180 | TP_ARGS(req) |
| 181 | ); |
| 182 | |
| 183 | DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback, |
| 184 | TP_PROTO(struct dwc3_request *req), |
| 185 | TP_ARGS(req) |
| 186 | ); |
| 187 | |
| 188 | DECLARE_EVENT_CLASS(dwc3_log_generic_cmd, |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 189 | TP_PROTO(unsigned int cmd, u32 param, int status), |
| 190 | TP_ARGS(cmd, param, status), |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 191 | TP_STRUCT__entry( |
| 192 | __field(unsigned int, cmd) |
| 193 | __field(u32, param) |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 194 | __field(int, status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 195 | ), |
| 196 | TP_fast_assign( |
| 197 | __entry->cmd = cmd; |
| 198 | __entry->param = param; |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 199 | __entry->status = status; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 200 | ), |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 201 | TP_printk("cmd '%s' [%d] param %08x --> status: %s", |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 202 | dwc3_gadget_generic_cmd_string(__entry->cmd), |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 203 | __entry->cmd, __entry->param, |
| 204 | dwc3_gadget_generic_cmd_status_string(__entry->status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 205 | ) |
| 206 | ); |
| 207 | |
| 208 | DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd, |
Felipe Balbi | 71f7e70 | 2016-05-23 14:16:19 +0300 | [diff] [blame] | 209 | TP_PROTO(unsigned int cmd, u32 param, int status), |
| 210 | TP_ARGS(cmd, param, status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 211 | ); |
| 212 | |
| 213 | DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, |
| 214 | TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 215 | struct dwc3_gadget_ep_cmd_params *params, int cmd_status), |
| 216 | TP_ARGS(dep, cmd, params, cmd_status), |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 217 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 218 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 219 | __field(unsigned int, cmd) |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 220 | __field(u32, param0) |
| 221 | __field(u32, param1) |
| 222 | __field(u32, param2) |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 223 | __field(int, cmd_status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 224 | ), |
| 225 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 226 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 227 | __entry->cmd = cmd; |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 228 | __entry->param0 = params->param0; |
| 229 | __entry->param1 = params->param1; |
| 230 | __entry->param2 = params->param2; |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 231 | __entry->cmd_status = cmd_status; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 232 | ), |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 233 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 234 | __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 235 | __entry->cmd, __entry->param0, |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 236 | __entry->param1, __entry->param2, |
| 237 | dwc3_ep_cmd_status_string(__entry->cmd_status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 238 | ) |
| 239 | ); |
| 240 | |
| 241 | DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd, |
| 242 | TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, |
Felipe Balbi | 0933df1 | 2016-05-23 14:02:33 +0300 | [diff] [blame] | 243 | struct dwc3_gadget_ep_cmd_params *params, int cmd_status), |
| 244 | TP_ARGS(dep, cmd, params, cmd_status) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 245 | ); |
| 246 | |
| 247 | DECLARE_EVENT_CLASS(dwc3_log_trb, |
| 248 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 249 | TP_ARGS(dep, trb), |
| 250 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 251 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 252 | __field(struct dwc3_trb *, trb) |
Felipe Balbi | 68d34c8 | 2016-05-30 13:34:58 +0300 | [diff] [blame] | 253 | __field(u32, allocated) |
| 254 | __field(u32, queued) |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 255 | __field(u32, bpl) |
| 256 | __field(u32, bph) |
| 257 | __field(u32, size) |
| 258 | __field(u32, ctrl) |
Felipe Balbi | fa8d965 | 2016-09-28 14:58:33 +0300 | [diff] [blame] | 259 | __field(u32, type) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 260 | ), |
| 261 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 262 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 263 | __entry->trb = trb; |
Felipe Balbi | 68d34c8 | 2016-05-30 13:34:58 +0300 | [diff] [blame] | 264 | __entry->allocated = dep->allocated_requests; |
| 265 | __entry->queued = dep->queued_requests; |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 266 | __entry->bpl = trb->bpl; |
| 267 | __entry->bph = trb->bph; |
| 268 | __entry->size = trb->size; |
| 269 | __entry->ctrl = trb->ctrl; |
Felipe Balbi | fa8d965 | 2016-09-28 14:58:33 +0300 | [diff] [blame] | 270 | __entry->type = usb_endpoint_type(dep->endpoint.desc); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 271 | ), |
Felipe Balbi | fa8d965 | 2016-09-28 14:58:33 +0300 | [diff] [blame] | 272 | TP_printk("%s: %d/%d trb %p buf %08x%08x size %s%d ctrl %08x (%c%c%c%c:%c%c:%s)", |
Felipe Balbi | 68d34c8 | 2016-05-30 13:34:58 +0300 | [diff] [blame] | 273 | __get_str(name), __entry->queued, __entry->allocated, |
| 274 | __entry->trb, __entry->bph, __entry->bpl, |
Felipe Balbi | fa8d965 | 2016-09-28 14:58:33 +0300 | [diff] [blame] | 275 | ({char *s; |
| 276 | int pcm = ((__entry->size >> 24) & 3) + 1; |
| 277 | switch (__entry->type) { |
| 278 | case USB_ENDPOINT_XFER_INT: |
| 279 | case USB_ENDPOINT_XFER_ISOC: |
| 280 | switch (pcm) { |
| 281 | case 1: |
| 282 | s = "1x "; |
| 283 | break; |
| 284 | case 2: |
| 285 | s = "2x "; |
| 286 | break; |
| 287 | case 3: |
| 288 | s = "3x "; |
| 289 | break; |
| 290 | } |
| 291 | default: |
| 292 | s = ""; |
| 293 | } s; }), |
| 294 | DWC3_TRB_SIZE_LENGTH(__entry->size), __entry->ctrl, |
Janusz Dziedzic | 22f2c61 | 2016-05-20 10:37:13 +0200 | [diff] [blame] | 295 | __entry->ctrl & DWC3_TRB_CTRL_HWO ? 'H' : 'h', |
| 296 | __entry->ctrl & DWC3_TRB_CTRL_LST ? 'L' : 'l', |
| 297 | __entry->ctrl & DWC3_TRB_CTRL_CHN ? 'C' : 'c', |
| 298 | __entry->ctrl & DWC3_TRB_CTRL_CSP ? 'S' : 's', |
| 299 | __entry->ctrl & DWC3_TRB_CTRL_ISP_IMI ? 'S' : 's', |
| 300 | __entry->ctrl & DWC3_TRB_CTRL_IOC ? 'C' : 'c', |
| 301 | ({char *s; |
| 302 | switch (__entry->ctrl & 0x3f0) { |
| 303 | case DWC3_TRBCTL_NORMAL: |
| 304 | s = "normal"; |
| 305 | break; |
| 306 | case DWC3_TRBCTL_CONTROL_SETUP: |
| 307 | s = "setup"; |
| 308 | break; |
| 309 | case DWC3_TRBCTL_CONTROL_STATUS2: |
| 310 | s = "status2"; |
| 311 | break; |
| 312 | case DWC3_TRBCTL_CONTROL_STATUS3: |
| 313 | s = "status3"; |
| 314 | break; |
| 315 | case DWC3_TRBCTL_CONTROL_DATA: |
| 316 | s = "data"; |
| 317 | break; |
| 318 | case DWC3_TRBCTL_ISOCHRONOUS_FIRST: |
| 319 | s = "isoc-first"; |
| 320 | break; |
| 321 | case DWC3_TRBCTL_ISOCHRONOUS: |
| 322 | s = "isoc"; |
| 323 | break; |
| 324 | case DWC3_TRBCTL_LINK_TRB: |
| 325 | s = "link"; |
| 326 | break; |
| 327 | default: |
| 328 | s = "UNKNOWN"; |
| 329 | break; |
| 330 | } s; }) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 331 | ) |
| 332 | ); |
| 333 | |
| 334 | DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb, |
| 335 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 336 | TP_ARGS(dep, trb) |
| 337 | ); |
| 338 | |
| 339 | DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb, |
| 340 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 341 | TP_ARGS(dep, trb) |
| 342 | ); |
| 343 | |
Felipe Balbi | 2870e50 | 2016-11-03 13:53:29 +0200 | [diff] [blame^] | 344 | DECLARE_EVENT_CLASS(dwc3_log_ep, |
| 345 | TP_PROTO(struct dwc3_ep *dep), |
| 346 | TP_ARGS(dep), |
| 347 | TP_STRUCT__entry( |
| 348 | __dynamic_array(char, name, DWC3_MSG_MAX) |
| 349 | __field(unsigned, maxpacket) |
| 350 | __field(unsigned, maxpacket_limit) |
| 351 | __field(unsigned, max_streams) |
| 352 | __field(unsigned, maxburst) |
| 353 | __field(unsigned, flags) |
| 354 | __field(unsigned, direction) |
| 355 | __field(u8, trb_enqueue) |
| 356 | __field(u8, trb_dequeue) |
| 357 | ), |
| 358 | TP_fast_assign( |
| 359 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
| 360 | __entry->maxpacket = dep->endpoint.maxpacket; |
| 361 | __entry->maxpacket_limit = dep->endpoint.maxpacket_limit; |
| 362 | __entry->max_streams = dep->endpoint.max_streams; |
| 363 | __entry->maxburst = dep->endpoint.maxburst; |
| 364 | __entry->flags = dep->flags; |
| 365 | __entry->direction = dep->direction; |
| 366 | __entry->trb_enqueue = dep->trb_enqueue; |
| 367 | __entry->trb_dequeue = dep->trb_dequeue; |
| 368 | ), |
| 369 | TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c%c:%c:%c", |
| 370 | __get_str(name), __entry->maxpacket, |
| 371 | __entry->maxpacket_limit, __entry->max_streams, |
| 372 | __entry->maxburst, __entry->trb_enqueue, |
| 373 | __entry->trb_dequeue, |
| 374 | __entry->flags & DWC3_EP_ENABLED ? 'E' : 'e', |
| 375 | __entry->flags & DWC3_EP_STALL ? 'S' : 's', |
| 376 | __entry->flags & DWC3_EP_WEDGE ? 'W' : 'w', |
| 377 | __entry->flags & DWC3_EP_BUSY ? 'B' : 'b', |
| 378 | __entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p', |
| 379 | __entry->flags & DWC3_EP_MISSED_ISOC ? 'M' : 'm', |
| 380 | __entry->flags & DWC3_EP_END_TRANSFER_PENDING ? 'E' : 'e', |
| 381 | __entry->direction ? '<' : '>' |
| 382 | ) |
| 383 | ); |
| 384 | |
| 385 | DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_enable, |
| 386 | TP_PROTO(struct dwc3_ep *dep), |
| 387 | TP_ARGS(dep) |
| 388 | ); |
| 389 | |
| 390 | DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_disable, |
| 391 | TP_PROTO(struct dwc3_ep *dep), |
| 392 | TP_ARGS(dep) |
| 393 | ); |
| 394 | |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 395 | #endif /* __DWC3_TRACE_H */ |
| 396 | |
| 397 | /* this part has to be here */ |
| 398 | |
| 399 | #undef TRACE_INCLUDE_PATH |
| 400 | #define TRACE_INCLUDE_PATH . |
| 401 | |
| 402 | #undef TRACE_INCLUDE_FILE |
| 403 | #define TRACE_INCLUDE_FILE trace |
| 404 | |
| 405 | #include <trace/define_trace.h> |