trace.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. #undef TRACE_SYSTEM
  18. #define TRACE_SYSTEM dwc3
  19. #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  20. #define __DWC3_TRACE_H
  21. #include <linux/types.h>
  22. #include <linux/tracepoint.h>
  23. #include <asm/byteorder.h>
  24. #include "core.h"
  25. #include "debug.h"
  26. DECLARE_EVENT_CLASS(dwc3_log_msg,
  27. TP_PROTO(struct va_format *vaf),
  28. TP_ARGS(vaf),
  29. TP_STRUCT__entry(__dynamic_array(char, msg, DWC3_MSG_MAX)),
  30. TP_fast_assign(
  31. vsnprintf(__get_str(msg), DWC3_MSG_MAX, vaf->fmt, *vaf->va);
  32. ),
  33. TP_printk("%s", __get_str(msg))
  34. );
  35. DEFINE_EVENT(dwc3_log_msg, dwc3_readl,
  36. TP_PROTO(struct va_format *vaf),
  37. TP_ARGS(vaf)
  38. );
  39. DEFINE_EVENT(dwc3_log_msg, dwc3_writel,
  40. TP_PROTO(struct va_format *vaf),
  41. TP_ARGS(vaf)
  42. );
  43. DEFINE_EVENT(dwc3_log_msg, dwc3_ep0,
  44. TP_PROTO(struct va_format *vaf),
  45. TP_ARGS(vaf)
  46. );
  47. DECLARE_EVENT_CLASS(dwc3_log_event,
  48. TP_PROTO(u32 event),
  49. TP_ARGS(event),
  50. TP_STRUCT__entry(
  51. __field(u32, event)
  52. ),
  53. TP_fast_assign(
  54. __entry->event = event;
  55. ),
  56. TP_printk("event %08x", __entry->event)
  57. );
  58. DEFINE_EVENT(dwc3_log_event, dwc3_event,
  59. TP_PROTO(u32 event),
  60. TP_ARGS(event)
  61. );
  62. DECLARE_EVENT_CLASS(dwc3_log_ctrl,
  63. TP_PROTO(struct usb_ctrlrequest *ctrl),
  64. TP_ARGS(ctrl),
  65. TP_STRUCT__entry(
  66. __field(__u8, bRequestType)
  67. __field(__u8, bRequest)
  68. __field(__le16, wValue)
  69. __field(__le16, wIndex)
  70. __field(__le16, wLength)
  71. ),
  72. TP_fast_assign(
  73. __entry->bRequestType = ctrl->bRequestType;
  74. __entry->bRequest = ctrl->bRequest;
  75. __entry->wValue = ctrl->wValue;
  76. __entry->wIndex = ctrl->wIndex;
  77. __entry->wLength = ctrl->wLength;
  78. ),
  79. TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
  80. __entry->bRequestType, __entry->bRequest,
  81. le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex),
  82. le16_to_cpu(__entry->wLength)
  83. )
  84. );
  85. DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
  86. TP_PROTO(struct usb_ctrlrequest *ctrl),
  87. TP_ARGS(ctrl)
  88. );
  89. DECLARE_EVENT_CLASS(dwc3_log_request,
  90. TP_PROTO(struct dwc3_request *req),
  91. TP_ARGS(req),
  92. TP_STRUCT__entry(
  93. __dynamic_array(char, name, DWC3_MSG_MAX)
  94. __field(struct dwc3_request *, req)
  95. __field(unsigned, actual)
  96. __field(unsigned, length)
  97. __field(int, status)
  98. ),
  99. TP_fast_assign(
  100. snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name);
  101. __entry->req = req;
  102. __entry->actual = req->request.actual;
  103. __entry->length = req->request.length;
  104. __entry->status = req->request.status;
  105. ),
  106. TP_printk("%s: req %p length %u/%u ==> %d",
  107. __get_str(name), __entry->req, __entry->actual, __entry->length,
  108. __entry->status
  109. )
  110. );
  111. DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
  112. TP_PROTO(struct dwc3_request *req),
  113. TP_ARGS(req)
  114. );
  115. DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
  116. TP_PROTO(struct dwc3_request *req),
  117. TP_ARGS(req)
  118. );
  119. DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
  120. TP_PROTO(struct dwc3_request *req),
  121. TP_ARGS(req)
  122. );
  123. DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
  124. TP_PROTO(struct dwc3_request *req),
  125. TP_ARGS(req)
  126. );
  127. DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
  128. TP_PROTO(struct dwc3_request *req),
  129. TP_ARGS(req)
  130. );
  131. DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
  132. TP_PROTO(unsigned int cmd, u32 param),
  133. TP_ARGS(cmd, param),
  134. TP_STRUCT__entry(
  135. __field(unsigned int, cmd)
  136. __field(u32, param)
  137. ),
  138. TP_fast_assign(
  139. __entry->cmd = cmd;
  140. __entry->param = param;
  141. ),
  142. TP_printk("cmd '%s' [%d] param %08x",
  143. dwc3_gadget_generic_cmd_string(__entry->cmd),
  144. __entry->cmd, __entry->param
  145. )
  146. );
  147. DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
  148. TP_PROTO(unsigned int cmd, u32 param),
  149. TP_ARGS(cmd, param)
  150. );
  151. DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
  152. TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
  153. struct dwc3_gadget_ep_cmd_params *params),
  154. TP_ARGS(dep, cmd, params),
  155. TP_STRUCT__entry(
  156. __dynamic_array(char, name, DWC3_MSG_MAX)
  157. __field(unsigned int, cmd)
  158. __field(u32, param0)
  159. __field(u32, param1)
  160. __field(u32, param2)
  161. ),
  162. TP_fast_assign(
  163. snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
  164. __entry->cmd = cmd;
  165. __entry->param0 = params->param0;
  166. __entry->param1 = params->param1;
  167. __entry->param2 = params->param2;
  168. ),
  169. TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x",
  170. __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
  171. __entry->cmd, __entry->param0,
  172. __entry->param1, __entry->param2
  173. )
  174. );
  175. DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
  176. TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
  177. struct dwc3_gadget_ep_cmd_params *params),
  178. TP_ARGS(dep, cmd, params)
  179. );
  180. DECLARE_EVENT_CLASS(dwc3_log_trb,
  181. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  182. TP_ARGS(dep, trb),
  183. TP_STRUCT__entry(
  184. __dynamic_array(char, name, DWC3_MSG_MAX)
  185. __field(struct dwc3_trb *, trb)
  186. __field(u32, bpl)
  187. __field(u32, bph)
  188. __field(u32, size)
  189. __field(u32, ctrl)
  190. ),
  191. TP_fast_assign(
  192. snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
  193. __entry->trb = trb;
  194. __entry->bpl = trb->bpl;
  195. __entry->bph = trb->bph;
  196. __entry->size = trb->size;
  197. __entry->ctrl = trb->ctrl;
  198. ),
  199. TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x",
  200. __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
  201. __entry->size, __entry->ctrl
  202. )
  203. );
  204. DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
  205. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  206. TP_ARGS(dep, trb)
  207. );
  208. DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
  209. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  210. TP_ARGS(dep, trb)
  211. );
  212. #endif /* __DWC3_TRACE_H */
  213. /* this part has to be here */
  214. #undef TRACE_INCLUDE_PATH
  215. #define TRACE_INCLUDE_PATH .
  216. #undef TRACE_INCLUDE_FILE
  217. #define TRACE_INCLUDE_FILE trace
  218. #include <trace/define_trace.h>