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 | |
| 40 | DEFINE_EVENT(dwc3_log_msg, dwc3_readl, |
| 41 | TP_PROTO(struct va_format *vaf), |
| 42 | TP_ARGS(vaf) |
| 43 | ); |
| 44 | |
| 45 | DEFINE_EVENT(dwc3_log_msg, dwc3_writel, |
| 46 | TP_PROTO(struct va_format *vaf), |
| 47 | TP_ARGS(vaf) |
| 48 | ); |
| 49 | |
Felipe Balbi | 6bac4ff | 2015-01-27 13:47:02 -0600 | [diff] [blame] | 50 | DEFINE_EVENT(dwc3_log_msg, dwc3_gadget, |
| 51 | TP_PROTO(struct va_format *vaf), |
| 52 | TP_ARGS(vaf) |
| 53 | ); |
| 54 | |
| 55 | DEFINE_EVENT(dwc3_log_msg, dwc3_core, |
| 56 | TP_PROTO(struct va_format *vaf), |
| 57 | TP_ARGS(vaf) |
| 58 | ); |
| 59 | |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 60 | DEFINE_EVENT(dwc3_log_msg, dwc3_ep0, |
| 61 | TP_PROTO(struct va_format *vaf), |
| 62 | TP_ARGS(vaf) |
| 63 | ); |
| 64 | |
| 65 | DECLARE_EVENT_CLASS(dwc3_log_event, |
| 66 | TP_PROTO(u32 event), |
| 67 | TP_ARGS(event), |
| 68 | TP_STRUCT__entry( |
| 69 | __field(u32, event) |
| 70 | ), |
| 71 | TP_fast_assign( |
| 72 | __entry->event = event; |
| 73 | ), |
Felipe Balbi | dab716c | 2014-09-24 11:22:23 -0500 | [diff] [blame] | 74 | TP_printk("event %08x", __entry->event) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 75 | ); |
| 76 | |
| 77 | DEFINE_EVENT(dwc3_log_event, dwc3_event, |
| 78 | TP_PROTO(u32 event), |
| 79 | TP_ARGS(event) |
| 80 | ); |
| 81 | |
| 82 | DECLARE_EVENT_CLASS(dwc3_log_ctrl, |
| 83 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 84 | TP_ARGS(ctrl), |
| 85 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 86 | __field(__u8, bRequestType) |
| 87 | __field(__u8, bRequest) |
| 88 | __field(__le16, wValue) |
| 89 | __field(__le16, wIndex) |
| 90 | __field(__le16, wLength) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 91 | ), |
| 92 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 93 | __entry->bRequestType = ctrl->bRequestType; |
| 94 | __entry->bRequest = ctrl->bRequest; |
| 95 | __entry->wValue = ctrl->wValue; |
| 96 | __entry->wIndex = ctrl->wIndex; |
| 97 | __entry->wLength = ctrl->wLength; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 98 | ), |
| 99 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 100 | __entry->bRequestType, __entry->bRequest, |
| 101 | le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex), |
| 102 | le16_to_cpu(__entry->wLength) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 103 | ) |
| 104 | ); |
| 105 | |
| 106 | DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req, |
| 107 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 108 | TP_ARGS(ctrl) |
| 109 | ); |
| 110 | |
| 111 | DECLARE_EVENT_CLASS(dwc3_log_request, |
| 112 | TP_PROTO(struct dwc3_request *req), |
| 113 | TP_ARGS(req), |
| 114 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 115 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 116 | __field(struct dwc3_request *, req) |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 117 | __field(unsigned, actual) |
| 118 | __field(unsigned, length) |
| 119 | __field(int, status) |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 120 | __field(int, zero) |
| 121 | __field(int, short_not_ok) |
| 122 | __field(int, no_interrupt) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 123 | ), |
| 124 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 125 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 126 | __entry->req = req; |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 127 | __entry->actual = req->request.actual; |
| 128 | __entry->length = req->request.length; |
| 129 | __entry->status = req->request.status; |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 130 | __entry->zero = req->request.zero; |
| 131 | __entry->short_not_ok = req->request.short_not_ok; |
| 132 | __entry->no_interrupt = req->request.no_interrupt; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 133 | ), |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 134 | TP_printk("%s: req %p length %u/%u %s%s%s ==> %d", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 135 | __get_str(name), __entry->req, __entry->actual, __entry->length, |
Felipe Balbi | 46a0142 | 2015-12-03 15:27:32 -0600 | [diff] [blame] | 136 | __entry->zero ? "Z" : "z", |
| 137 | __entry->short_not_ok ? "S" : "s", |
| 138 | __entry->no_interrupt ? "i" : "I", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 139 | __entry->status |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 140 | ) |
| 141 | ); |
| 142 | |
| 143 | DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request, |
| 144 | TP_PROTO(struct dwc3_request *req), |
| 145 | TP_ARGS(req) |
| 146 | ); |
| 147 | |
| 148 | DEFINE_EVENT(dwc3_log_request, dwc3_free_request, |
| 149 | TP_PROTO(struct dwc3_request *req), |
| 150 | TP_ARGS(req) |
| 151 | ); |
| 152 | |
| 153 | DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue, |
| 154 | TP_PROTO(struct dwc3_request *req), |
| 155 | TP_ARGS(req) |
| 156 | ); |
| 157 | |
| 158 | DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue, |
| 159 | TP_PROTO(struct dwc3_request *req), |
| 160 | TP_ARGS(req) |
| 161 | ); |
| 162 | |
| 163 | DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback, |
| 164 | TP_PROTO(struct dwc3_request *req), |
| 165 | TP_ARGS(req) |
| 166 | ); |
| 167 | |
| 168 | DECLARE_EVENT_CLASS(dwc3_log_generic_cmd, |
| 169 | TP_PROTO(unsigned int cmd, u32 param), |
| 170 | TP_ARGS(cmd, param), |
| 171 | TP_STRUCT__entry( |
| 172 | __field(unsigned int, cmd) |
| 173 | __field(u32, param) |
| 174 | ), |
| 175 | TP_fast_assign( |
| 176 | __entry->cmd = cmd; |
| 177 | __entry->param = param; |
| 178 | ), |
Felipe Balbi | dab716c | 2014-09-24 11:22:23 -0500 | [diff] [blame] | 179 | TP_printk("cmd '%s' [%d] param %08x", |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 180 | dwc3_gadget_generic_cmd_string(__entry->cmd), |
| 181 | __entry->cmd, __entry->param |
| 182 | ) |
| 183 | ); |
| 184 | |
| 185 | DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd, |
| 186 | TP_PROTO(unsigned int cmd, u32 param), |
| 187 | TP_ARGS(cmd, param) |
| 188 | ); |
| 189 | |
| 190 | DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, |
| 191 | TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, |
| 192 | struct dwc3_gadget_ep_cmd_params *params), |
| 193 | TP_ARGS(dep, cmd, params), |
| 194 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 195 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 196 | __field(unsigned int, cmd) |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 197 | __field(u32, param0) |
| 198 | __field(u32, param1) |
| 199 | __field(u32, param2) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 200 | ), |
| 201 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 202 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 203 | __entry->cmd = cmd; |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 204 | __entry->param0 = params->param0; |
| 205 | __entry->param1 = params->param1; |
| 206 | __entry->param2 = params->param2; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 207 | ), |
Felipe Balbi | dab716c | 2014-09-24 11:22:23 -0500 | [diff] [blame] | 208 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 209 | __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), |
Felipe Balbi | a4722fd3 | 2014-11-20 10:12:32 -0600 | [diff] [blame] | 210 | __entry->cmd, __entry->param0, |
| 211 | __entry->param1, __entry->param2 |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 212 | ) |
| 213 | ); |
| 214 | |
| 215 | DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd, |
| 216 | TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, |
| 217 | struct dwc3_gadget_ep_cmd_params *params), |
| 218 | TP_ARGS(dep, cmd, params) |
| 219 | ); |
| 220 | |
| 221 | DECLARE_EVENT_CLASS(dwc3_log_trb, |
| 222 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 223 | TP_ARGS(dep, trb), |
| 224 | TP_STRUCT__entry( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 225 | __dynamic_array(char, name, DWC3_MSG_MAX) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 226 | __field(struct dwc3_trb *, trb) |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 227 | __field(u32, bpl) |
| 228 | __field(u32, bph) |
| 229 | __field(u32, size) |
| 230 | __field(u32, ctrl) |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 231 | ), |
| 232 | TP_fast_assign( |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 233 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 234 | __entry->trb = trb; |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 235 | __entry->bpl = trb->bpl; |
| 236 | __entry->bph = trb->bph; |
| 237 | __entry->size = trb->size; |
| 238 | __entry->ctrl = trb->ctrl; |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 239 | ), |
Felipe Balbi | dab716c | 2014-09-24 11:22:23 -0500 | [diff] [blame] | 240 | TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x", |
Felipe Balbi | 4ac4fc9 | 2014-09-17 16:28:38 -0500 | [diff] [blame] | 241 | __get_str(name), __entry->trb, __entry->bph, __entry->bpl, |
| 242 | __entry->size, __entry->ctrl |
Felipe Balbi | 2c4cbe6e5 | 2014-04-30 17:45:10 -0500 | [diff] [blame] | 243 | ) |
| 244 | ); |
| 245 | |
| 246 | DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb, |
| 247 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 248 | TP_ARGS(dep, trb) |
| 249 | ); |
| 250 | |
| 251 | DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb, |
| 252 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
| 253 | TP_ARGS(dep, trb) |
| 254 | ); |
| 255 | |
| 256 | #endif /* __DWC3_TRACE_H */ |
| 257 | |
| 258 | /* this part has to be here */ |
| 259 | |
| 260 | #undef TRACE_INCLUDE_PATH |
| 261 | #define TRACE_INCLUDE_PATH . |
| 262 | |
| 263 | #undef TRACE_INCLUDE_FILE |
| 264 | #define TRACE_INCLUDE_FILE trace |
| 265 | |
| 266 | #include <trace/define_trace.h> |