trace.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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\n", __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(struct usb_ctrlrequest *, ctrl)
  67. ),
  68. TP_fast_assign(
  69. __entry->ctrl = ctrl;
  70. ),
  71. TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
  72. __entry->ctrl->bRequestType, __entry->ctrl->bRequest,
  73. le16_to_cpu(__entry->ctrl->wValue), le16_to_cpu(__entry->ctrl->wIndex),
  74. le16_to_cpu(__entry->ctrl->wLength)
  75. )
  76. );
  77. DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
  78. TP_PROTO(struct usb_ctrlrequest *ctrl),
  79. TP_ARGS(ctrl)
  80. );
  81. DECLARE_EVENT_CLASS(dwc3_log_request,
  82. TP_PROTO(struct dwc3_request *req),
  83. TP_ARGS(req),
  84. TP_STRUCT__entry(
  85. __field(struct dwc3_request *, req)
  86. ),
  87. TP_fast_assign(
  88. __entry->req = req;
  89. ),
  90. TP_printk("%s: req %p length %u/%u ==> %d",
  91. __entry->req->dep->name, __entry->req,
  92. __entry->req->request.actual, __entry->req->request.length,
  93. __entry->req->request.status
  94. )
  95. );
  96. DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
  97. TP_PROTO(struct dwc3_request *req),
  98. TP_ARGS(req)
  99. );
  100. DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
  101. TP_PROTO(struct dwc3_request *req),
  102. TP_ARGS(req)
  103. );
  104. DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
  105. TP_PROTO(struct dwc3_request *req),
  106. TP_ARGS(req)
  107. );
  108. DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
  109. TP_PROTO(struct dwc3_request *req),
  110. TP_ARGS(req)
  111. );
  112. DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
  113. TP_PROTO(struct dwc3_request *req),
  114. TP_ARGS(req)
  115. );
  116. DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
  117. TP_PROTO(unsigned int cmd, u32 param),
  118. TP_ARGS(cmd, param),
  119. TP_STRUCT__entry(
  120. __field(unsigned int, cmd)
  121. __field(u32, param)
  122. ),
  123. TP_fast_assign(
  124. __entry->cmd = cmd;
  125. __entry->param = param;
  126. ),
  127. TP_printk("cmd '%s' [%d] param %08x\n",
  128. dwc3_gadget_generic_cmd_string(__entry->cmd),
  129. __entry->cmd, __entry->param
  130. )
  131. );
  132. DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
  133. TP_PROTO(unsigned int cmd, u32 param),
  134. TP_ARGS(cmd, param)
  135. );
  136. DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
  137. TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
  138. struct dwc3_gadget_ep_cmd_params *params),
  139. TP_ARGS(dep, cmd, params),
  140. TP_STRUCT__entry(
  141. __field(struct dwc3_ep *, dep)
  142. __field(unsigned int, cmd)
  143. __field(struct dwc3_gadget_ep_cmd_params *, params)
  144. ),
  145. TP_fast_assign(
  146. __entry->dep = dep;
  147. __entry->cmd = cmd;
  148. __entry->params = params;
  149. ),
  150. TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n",
  151. __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd),
  152. __entry->cmd, __entry->params->param0,
  153. __entry->params->param1, __entry->params->param2
  154. )
  155. );
  156. DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
  157. TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
  158. struct dwc3_gadget_ep_cmd_params *params),
  159. TP_ARGS(dep, cmd, params)
  160. );
  161. DECLARE_EVENT_CLASS(dwc3_log_trb,
  162. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  163. TP_ARGS(dep, trb),
  164. TP_STRUCT__entry(
  165. __field(struct dwc3_ep *, dep)
  166. __field(struct dwc3_trb *, trb)
  167. ),
  168. TP_fast_assign(
  169. __entry->dep = dep;
  170. __entry->trb = trb;
  171. ),
  172. TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n",
  173. __entry->dep->name, __entry->trb, __entry->trb->bph,
  174. __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl
  175. )
  176. );
  177. DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
  178. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  179. TP_ARGS(dep, trb)
  180. );
  181. DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
  182. TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
  183. TP_ARGS(dep, trb)
  184. );
  185. #endif /* __DWC3_TRACE_H */
  186. /* this part has to be here */
  187. #undef TRACE_INCLUDE_PATH
  188. #define TRACE_INCLUDE_PATH .
  189. #undef TRACE_INCLUDE_FILE
  190. #define TRACE_INCLUDE_FILE trace
  191. #include <trace/define_trace.h>