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 50 DEFINE_EVENT(dwc3_log_msg, dwc3_ep0, 51 TP_PROTO(struct va_format *vaf), 52 TP_ARGS(vaf) 53 ); 54 55 DECLARE_EVENT_CLASS(dwc3_log_event, 56 TP_PROTO(u32 event), 57 TP_ARGS(event), 58 TP_STRUCT__entry( 59 __field(u32, event) 60 ), 61 TP_fast_assign( 62 __entry->event = event; 63 ), 64 TP_printk("event %08x\n", __entry->event) 65 ); 66 67 DEFINE_EVENT(dwc3_log_event, dwc3_event, 68 TP_PROTO(u32 event), 69 TP_ARGS(event) 70 ); 71 72 DECLARE_EVENT_CLASS(dwc3_log_ctrl, 73 TP_PROTO(struct usb_ctrlrequest *ctrl), 74 TP_ARGS(ctrl), 75 TP_STRUCT__entry( 76 __field(__u8, bRequestType) 77 __field(__u8, bRequest) 78 __field(__le16, wValue) 79 __field(__le16, wIndex) 80 __field(__le16, wLength) 81 ), 82 TP_fast_assign( 83 __entry->bRequestType = ctrl->bRequestType; 84 __entry->bRequest = ctrl->bRequest; 85 __entry->wValue = ctrl->wValue; 86 __entry->wIndex = ctrl->wIndex; 87 __entry->wLength = ctrl->wLength; 88 ), 89 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", 90 __entry->bRequestType, __entry->bRequest, 91 le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex), 92 le16_to_cpu(__entry->wLength) 93 ) 94 ); 95 96 DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req, 97 TP_PROTO(struct usb_ctrlrequest *ctrl), 98 TP_ARGS(ctrl) 99 ); 100 101 DECLARE_EVENT_CLASS(dwc3_log_request, 102 TP_PROTO(struct dwc3_request *req), 103 TP_ARGS(req), 104 TP_STRUCT__entry( 105 __dynamic_array(char, name, DWC3_MSG_MAX) 106 __field(struct dwc3_request *, req) 107 __field(unsigned, actual) 108 __field(unsigned, length) 109 __field(int, status) 110 ), 111 TP_fast_assign( 112 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name); 113 __entry->req = req; 114 __entry->actual = req->request.actual; 115 __entry->length = req->request.length; 116 __entry->status = req->request.status; 117 ), 118 TP_printk("%s: req %p length %u/%u ==> %d", 119 __get_str(name), __entry->req, __entry->actual, __entry->length, 120 __entry->status 121 ) 122 ); 123 124 DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request, 125 TP_PROTO(struct dwc3_request *req), 126 TP_ARGS(req) 127 ); 128 129 DEFINE_EVENT(dwc3_log_request, dwc3_free_request, 130 TP_PROTO(struct dwc3_request *req), 131 TP_ARGS(req) 132 ); 133 134 DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue, 135 TP_PROTO(struct dwc3_request *req), 136 TP_ARGS(req) 137 ); 138 139 DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue, 140 TP_PROTO(struct dwc3_request *req), 141 TP_ARGS(req) 142 ); 143 144 DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback, 145 TP_PROTO(struct dwc3_request *req), 146 TP_ARGS(req) 147 ); 148 149 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd, 150 TP_PROTO(unsigned int cmd, u32 param), 151 TP_ARGS(cmd, param), 152 TP_STRUCT__entry( 153 __field(unsigned int, cmd) 154 __field(u32, param) 155 ), 156 TP_fast_assign( 157 __entry->cmd = cmd; 158 __entry->param = param; 159 ), 160 TP_printk("cmd '%s' [%d] param %08x\n", 161 dwc3_gadget_generic_cmd_string(__entry->cmd), 162 __entry->cmd, __entry->param 163 ) 164 ); 165 166 DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd, 167 TP_PROTO(unsigned int cmd, u32 param), 168 TP_ARGS(cmd, param) 169 ); 170 171 DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, 172 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, 173 struct dwc3_gadget_ep_cmd_params *params), 174 TP_ARGS(dep, cmd, params), 175 TP_STRUCT__entry( 176 __dynamic_array(char, name, DWC3_MSG_MAX) 177 __field(unsigned int, cmd) 178 __field(struct dwc3_gadget_ep_cmd_params *, params) 179 ), 180 TP_fast_assign( 181 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); 182 __entry->cmd = cmd; 183 __entry->params = params; 184 ), 185 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", 186 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), 187 __entry->cmd, __entry->params->param0, 188 __entry->params->param1, __entry->params->param2 189 ) 190 ); 191 192 DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd, 193 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd, 194 struct dwc3_gadget_ep_cmd_params *params), 195 TP_ARGS(dep, cmd, params) 196 ); 197 198 DECLARE_EVENT_CLASS(dwc3_log_trb, 199 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), 200 TP_ARGS(dep, trb), 201 TP_STRUCT__entry( 202 __dynamic_array(char, name, DWC3_MSG_MAX) 203 __field(struct dwc3_trb *, trb) 204 __field(u32, bpl) 205 __field(u32, bph) 206 __field(u32, size) 207 __field(u32, ctrl) 208 ), 209 TP_fast_assign( 210 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); 211 __entry->trb = trb; 212 __entry->bpl = trb->bpl; 213 __entry->bph = trb->bph; 214 __entry->size = trb->size; 215 __entry->ctrl = trb->ctrl; 216 ), 217 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", 218 __get_str(name), __entry->trb, __entry->bph, __entry->bpl, 219 __entry->size, __entry->ctrl 220 ) 221 ); 222 223 DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb, 224 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), 225 TP_ARGS(dep, trb) 226 ); 227 228 DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb, 229 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), 230 TP_ARGS(dep, trb) 231 ); 232 233 #endif /* __DWC3_TRACE_H */ 234 235 /* this part has to be here */ 236 237 #undef TRACE_INCLUDE_PATH 238 #define TRACE_INCLUDE_PATH . 239 240 #undef TRACE_INCLUDE_FILE 241 #define TRACE_INCLUDE_FILE trace 242 243 #include <trace/define_trace.h> 244