cdnsp-trace.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Cadence CDNSP DRD Driver.
  4. * Trace support header file
  5. *
  6. * Copyright (C) 2020 Cadence.
  7. *
  8. * Author: Pawel Laszczak <[email protected]>
  9. *
  10. */
  11. #undef TRACE_SYSTEM
  12. #define TRACE_SYSTEM cdnsp-dev
  13. /*
  14. * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
  15. * legitimate C variable. It is not exported to user space.
  16. */
  17. #undef TRACE_SYSTEM_VAR
  18. #define TRACE_SYSTEM_VAR cdnsp_dev
  19. #if !defined(__CDNSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  20. #define __CDNSP_DEV_TRACE_H
  21. #include <linux/tracepoint.h>
  22. #include "cdnsp-gadget.h"
  23. #include "cdnsp-debug.h"
  24. /*
  25. * There is limitation for single buffer size in TRACEPOINT subsystem.
  26. * By default TRACE_BUF_SIZE is 1024, so no all data will be logged.
  27. * To show more data this must be increased. In most cases the default
  28. * value is sufficient.
  29. */
  30. #define CDNSP_MSG_MAX 500
  31. DECLARE_EVENT_CLASS(cdnsp_log_ep,
  32. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  33. TP_ARGS(pep, stream_id),
  34. TP_STRUCT__entry(
  35. __string(name, pep->name)
  36. __field(unsigned int, state)
  37. __field(u32, stream_id)
  38. __field(u8, enabled)
  39. __field(unsigned int, num_streams)
  40. __field(int, td_count)
  41. __field(u8, first_prime_det)
  42. __field(u8, drbls_count)
  43. ),
  44. TP_fast_assign(
  45. __assign_str(name, pep->name);
  46. __entry->state = pep->ep_state;
  47. __entry->stream_id = stream_id;
  48. __entry->enabled = pep->ep_state & EP_HAS_STREAMS;
  49. __entry->num_streams = pep->stream_info.num_streams;
  50. __entry->td_count = pep->stream_info.td_count;
  51. __entry->first_prime_det = pep->stream_info.first_prime_det;
  52. __entry->drbls_count = pep->stream_info.drbls_count;
  53. ),
  54. TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d "
  55. "tds %d, first prime: %d drbls %d",
  56. __get_str(name), __entry->stream_id, __entry->state,
  57. __entry->enabled, __entry->num_streams, __entry->td_count,
  58. __entry->first_prime_det, __entry->drbls_count)
  59. );
  60. DEFINE_EVENT(cdnsp_log_ep, cdnsp_tr_drbl,
  61. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  62. TP_ARGS(pep, stream_id)
  63. );
  64. DEFINE_EVENT(cdnsp_log_ep, cdnsp_wait_for_prime,
  65. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  66. TP_ARGS(pep, stream_id)
  67. );
  68. DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_list_empty_with_skip,
  69. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  70. TP_ARGS(pep, stream_id)
  71. );
  72. DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_enable_end,
  73. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  74. TP_ARGS(pep, stream_id)
  75. );
  76. DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_disable_end,
  77. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  78. TP_ARGS(pep, stream_id)
  79. );
  80. DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_busy_try_halt_again,
  81. TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
  82. TP_ARGS(pep, stream_id)
  83. );
  84. DECLARE_EVENT_CLASS(cdnsp_log_enable_disable,
  85. TP_PROTO(int set),
  86. TP_ARGS(set),
  87. TP_STRUCT__entry(
  88. __field(int, set)
  89. ),
  90. TP_fast_assign(
  91. __entry->set = set;
  92. ),
  93. TP_printk("%s", __entry->set ? "enabled" : "disabled")
  94. );
  95. DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_pullup,
  96. TP_PROTO(int set),
  97. TP_ARGS(set)
  98. );
  99. DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u1,
  100. TP_PROTO(int set),
  101. TP_ARGS(set)
  102. );
  103. DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u2,
  104. TP_PROTO(int set),
  105. TP_ARGS(set)
  106. );
  107. DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_lpm,
  108. TP_PROTO(int set),
  109. TP_ARGS(set)
  110. );
  111. DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_may_wakeup,
  112. TP_PROTO(int set),
  113. TP_ARGS(set)
  114. );
  115. DECLARE_EVENT_CLASS(cdnsp_log_simple,
  116. TP_PROTO(char *msg),
  117. TP_ARGS(msg),
  118. TP_STRUCT__entry(
  119. __string(text, msg)
  120. ),
  121. TP_fast_assign(
  122. __assign_str(text, msg);
  123. ),
  124. TP_printk("%s", __get_str(text))
  125. );
  126. DEFINE_EVENT(cdnsp_log_simple, cdnsp_exit,
  127. TP_PROTO(char *msg),
  128. TP_ARGS(msg)
  129. );
  130. DEFINE_EVENT(cdnsp_log_simple, cdnsp_init,
  131. TP_PROTO(char *msg),
  132. TP_ARGS(msg)
  133. );
  134. DEFINE_EVENT(cdnsp_log_simple, cdnsp_slot_id,
  135. TP_PROTO(char *msg),
  136. TP_ARGS(msg)
  137. );
  138. DEFINE_EVENT(cdnsp_log_simple, cdnsp_no_room_on_ring,
  139. TP_PROTO(char *msg),
  140. TP_ARGS(msg)
  141. );
  142. DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_status_stage,
  143. TP_PROTO(char *msg),
  144. TP_ARGS(msg)
  145. );
  146. DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_request,
  147. TP_PROTO(char *msg),
  148. TP_ARGS(msg)
  149. );
  150. DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_set_config,
  151. TP_PROTO(char *msg),
  152. TP_ARGS(msg)
  153. );
  154. DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_halted,
  155. TP_PROTO(char *msg),
  156. TP_ARGS(msg)
  157. );
  158. DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep_halt,
  159. TP_PROTO(char *msg),
  160. TP_ARGS(msg)
  161. );
  162. TRACE_EVENT(cdnsp_looking_trb_in_td,
  163. TP_PROTO(dma_addr_t suspect, dma_addr_t trb_start, dma_addr_t trb_end,
  164. dma_addr_t curr_seg, dma_addr_t end_seg),
  165. TP_ARGS(suspect, trb_start, trb_end, curr_seg, end_seg),
  166. TP_STRUCT__entry(
  167. __field(dma_addr_t, suspect)
  168. __field(dma_addr_t, trb_start)
  169. __field(dma_addr_t, trb_end)
  170. __field(dma_addr_t, curr_seg)
  171. __field(dma_addr_t, end_seg)
  172. ),
  173. TP_fast_assign(
  174. __entry->suspect = suspect;
  175. __entry->trb_start = trb_start;
  176. __entry->trb_end = trb_end;
  177. __entry->curr_seg = curr_seg;
  178. __entry->end_seg = end_seg;
  179. ),
  180. TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, "
  181. "seg-start %pad, seg-end %pad",
  182. &__entry->suspect, &__entry->trb_start, &__entry->trb_end,
  183. &__entry->curr_seg, &__entry->end_seg)
  184. );
  185. TRACE_EVENT(cdnsp_port_info,
  186. TP_PROTO(__le32 __iomem *addr, u32 offset, u32 count, u32 rev),
  187. TP_ARGS(addr, offset, count, rev),
  188. TP_STRUCT__entry(
  189. __field(__le32 __iomem *, addr)
  190. __field(u32, offset)
  191. __field(u32, count)
  192. __field(u32, rev)
  193. ),
  194. TP_fast_assign(
  195. __entry->addr = addr;
  196. __entry->offset = offset;
  197. __entry->count = count;
  198. __entry->rev = rev;
  199. ),
  200. TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x",
  201. __entry->addr, __entry->offset, __entry->count, __entry->rev)
  202. );
  203. DECLARE_EVENT_CLASS(cdnsp_log_deq_state,
  204. TP_PROTO(struct cdnsp_dequeue_state *state),
  205. TP_ARGS(state),
  206. TP_STRUCT__entry(
  207. __field(int, new_cycle_state)
  208. __field(struct cdnsp_segment *, new_deq_seg)
  209. __field(dma_addr_t, deq_seg_dma)
  210. __field(union cdnsp_trb *, new_deq_ptr)
  211. __field(dma_addr_t, deq_ptr_dma)
  212. ),
  213. TP_fast_assign(
  214. __entry->new_cycle_state = state->new_cycle_state;
  215. __entry->new_deq_seg = state->new_deq_seg;
  216. __entry->deq_seg_dma = state->new_deq_seg->dma;
  217. __entry->new_deq_ptr = state->new_deq_ptr,
  218. __entry->deq_ptr_dma = cdnsp_trb_virt_to_dma(state->new_deq_seg,
  219. state->new_deq_ptr);
  220. ),
  221. TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), "
  222. "New dequeue pointer = %p (0x%pad dma)",
  223. __entry->new_cycle_state, __entry->new_deq_seg,
  224. &__entry->deq_seg_dma, __entry->new_deq_ptr,
  225. &__entry->deq_ptr_dma
  226. )
  227. );
  228. DEFINE_EVENT(cdnsp_log_deq_state, cdnsp_new_deq_state,
  229. TP_PROTO(struct cdnsp_dequeue_state *state),
  230. TP_ARGS(state)
  231. );
  232. DECLARE_EVENT_CLASS(cdnsp_log_ctrl,
  233. TP_PROTO(struct usb_ctrlrequest *ctrl),
  234. TP_ARGS(ctrl),
  235. TP_STRUCT__entry(
  236. __field(u8, bRequestType)
  237. __field(u8, bRequest)
  238. __field(u16, wValue)
  239. __field(u16, wIndex)
  240. __field(u16, wLength)
  241. __dynamic_array(char, str, CDNSP_MSG_MAX)
  242. ),
  243. TP_fast_assign(
  244. __entry->bRequestType = ctrl->bRequestType;
  245. __entry->bRequest = ctrl->bRequest;
  246. __entry->wValue = le16_to_cpu(ctrl->wValue);
  247. __entry->wIndex = le16_to_cpu(ctrl->wIndex);
  248. __entry->wLength = le16_to_cpu(ctrl->wLength);
  249. ),
  250. TP_printk("%s", usb_decode_ctrl(__get_str(str), CDNSP_MSG_MAX,
  251. __entry->bRequestType,
  252. __entry->bRequest, __entry->wValue,
  253. __entry->wIndex, __entry->wLength)
  254. )
  255. );
  256. DEFINE_EVENT(cdnsp_log_ctrl, cdnsp_ctrl_req,
  257. TP_PROTO(struct usb_ctrlrequest *ctrl),
  258. TP_ARGS(ctrl)
  259. );
  260. DECLARE_EVENT_CLASS(cdnsp_log_bounce,
  261. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  262. dma_addr_t dma, unsigned int unalign),
  263. TP_ARGS(preq, new_buf_len, offset, dma, unalign),
  264. TP_STRUCT__entry(
  265. __string(name, preq->pep->name)
  266. __field(u32, new_buf_len)
  267. __field(u32, offset)
  268. __field(dma_addr_t, dma)
  269. __field(unsigned int, unalign)
  270. ),
  271. TP_fast_assign(
  272. __assign_str(name, preq->pep->name);
  273. __entry->new_buf_len = new_buf_len;
  274. __entry->offset = offset;
  275. __entry->dma = dma;
  276. __entry->unalign = unalign;
  277. ),
  278. TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d",
  279. __get_str(name), __entry->new_buf_len,
  280. __entry->offset, &__entry->dma, __entry->unalign
  281. )
  282. );
  283. DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_align_td_split,
  284. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  285. dma_addr_t dma, unsigned int unalign),
  286. TP_ARGS(preq, new_buf_len, offset, dma, unalign)
  287. );
  288. DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_map,
  289. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  290. dma_addr_t dma, unsigned int unalign),
  291. TP_ARGS(preq, new_buf_len, offset, dma, unalign)
  292. );
  293. DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_unmap,
  294. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  295. dma_addr_t dma, unsigned int unalign),
  296. TP_ARGS(preq, new_buf_len, offset, dma, unalign)
  297. );
  298. DECLARE_EVENT_CLASS(cdnsp_log_trb,
  299. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  300. TP_ARGS(ring, trb),
  301. TP_STRUCT__entry(
  302. __field(u32, type)
  303. __field(u32, field0)
  304. __field(u32, field1)
  305. __field(u32, field2)
  306. __field(u32, field3)
  307. __field(union cdnsp_trb *, trb)
  308. __field(dma_addr_t, trb_dma)
  309. __dynamic_array(char, str, CDNSP_MSG_MAX)
  310. ),
  311. TP_fast_assign(
  312. __entry->type = ring->type;
  313. __entry->field0 = le32_to_cpu(trb->field[0]);
  314. __entry->field1 = le32_to_cpu(trb->field[1]);
  315. __entry->field2 = le32_to_cpu(trb->field[2]);
  316. __entry->field3 = le32_to_cpu(trb->field[3]);
  317. __entry->trb = (union cdnsp_trb *)trb;
  318. __entry->trb_dma = cdnsp_trb_virt_to_dma(ring->deq_seg,
  319. (union cdnsp_trb *)trb);
  320. ),
  321. TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry->type),
  322. cdnsp_decode_trb(__get_str(str), CDNSP_MSG_MAX,
  323. __entry->field0, __entry->field1,
  324. __entry->field2, __entry->field3),
  325. __entry->trb, &__entry->trb_dma
  326. )
  327. );
  328. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_event,
  329. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  330. TP_ARGS(ring, trb)
  331. );
  332. DEFINE_EVENT(cdnsp_log_trb, cdnsp_trb_without_td,
  333. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  334. TP_ARGS(ring, trb)
  335. );
  336. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_command,
  337. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  338. TP_ARGS(ring, trb)
  339. );
  340. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_transfer,
  341. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  342. TP_ARGS(ring, trb)
  343. );
  344. DEFINE_EVENT(cdnsp_log_trb, cdnsp_queue_trb,
  345. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  346. TP_ARGS(ring, trb)
  347. );
  348. DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_wait_for_compl,
  349. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  350. TP_ARGS(ring, trb)
  351. );
  352. DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_timeout,
  353. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  354. TP_ARGS(ring, trb)
  355. );
  356. DEFINE_EVENT(cdnsp_log_trb, cdnsp_defered_event,
  357. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  358. TP_ARGS(ring, trb)
  359. );
  360. DECLARE_EVENT_CLASS(cdnsp_log_pdev,
  361. TP_PROTO(struct cdnsp_device *pdev),
  362. TP_ARGS(pdev),
  363. TP_STRUCT__entry(
  364. __field(struct cdnsp_device *, pdev)
  365. __field(struct usb_gadget *, gadget)
  366. __field(dma_addr_t, out_ctx)
  367. __field(dma_addr_t, in_ctx)
  368. __field(u8, port_num)
  369. ),
  370. TP_fast_assign(
  371. __entry->pdev = pdev;
  372. __entry->gadget = &pdev->gadget;
  373. __entry->in_ctx = pdev->in_ctx.dma;
  374. __entry->out_ctx = pdev->out_ctx.dma;
  375. __entry->port_num = pdev->active_port ?
  376. pdev->active_port->port_num : 0xFF;
  377. ),
  378. TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ",
  379. __entry->pdev, __entry->gadget, &__entry->in_ctx,
  380. &__entry->out_ctx, __entry->port_num
  381. )
  382. );
  383. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_alloc_priv_device,
  384. TP_PROTO(struct cdnsp_device *vdev),
  385. TP_ARGS(vdev)
  386. );
  387. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_free_priv_device,
  388. TP_PROTO(struct cdnsp_device *vdev),
  389. TP_ARGS(vdev)
  390. );
  391. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_device,
  392. TP_PROTO(struct cdnsp_device *vdev),
  393. TP_ARGS(vdev)
  394. );
  395. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_addressable_priv_device,
  396. TP_PROTO(struct cdnsp_device *vdev),
  397. TP_ARGS(vdev)
  398. );
  399. DECLARE_EVENT_CLASS(cdnsp_log_request,
  400. TP_PROTO(struct cdnsp_request *req),
  401. TP_ARGS(req),
  402. TP_STRUCT__entry(
  403. __string(name, req->pep->name)
  404. __field(struct usb_request *, request)
  405. __field(struct cdnsp_request *, preq)
  406. __field(void *, buf)
  407. __field(unsigned int, actual)
  408. __field(unsigned int, length)
  409. __field(int, status)
  410. __field(dma_addr_t, dma)
  411. __field(unsigned int, stream_id)
  412. __field(unsigned int, zero)
  413. __field(unsigned int, short_not_ok)
  414. __field(unsigned int, no_interrupt)
  415. __field(struct scatterlist*, sg)
  416. __field(unsigned int, num_sgs)
  417. __field(unsigned int, num_mapped_sgs)
  418. ),
  419. TP_fast_assign(
  420. __assign_str(name, req->pep->name);
  421. __entry->request = &req->request;
  422. __entry->preq = req;
  423. __entry->buf = req->request.buf;
  424. __entry->actual = req->request.actual;
  425. __entry->length = req->request.length;
  426. __entry->status = req->request.status;
  427. __entry->dma = req->request.dma;
  428. __entry->stream_id = req->request.stream_id;
  429. __entry->zero = req->request.zero;
  430. __entry->short_not_ok = req->request.short_not_ok;
  431. __entry->no_interrupt = req->request.no_interrupt;
  432. __entry->sg = req->request.sg;
  433. __entry->num_sgs = req->request.num_sgs;
  434. __entry->num_mapped_sgs = req->request.num_mapped_sgs;
  435. ),
  436. TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, "
  437. "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d,"
  438. " num_m_sg %d",
  439. __get_str(name), __entry->request, __entry->preq,
  440. __entry->buf, __entry->actual, __entry->length,
  441. __entry->status, &__entry->dma,
  442. __entry->stream_id, __entry->zero ? "Z" : "z",
  443. __entry->short_not_ok ? "S" : "s",
  444. __entry->no_interrupt ? "I" : "i",
  445. __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs
  446. )
  447. );
  448. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue,
  449. TP_PROTO(struct cdnsp_request *req),
  450. TP_ARGS(req)
  451. );
  452. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_busy,
  453. TP_PROTO(struct cdnsp_request *req),
  454. TP_ARGS(req)
  455. );
  456. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_error,
  457. TP_PROTO(struct cdnsp_request *req),
  458. TP_ARGS(req)
  459. );
  460. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_dequeue,
  461. TP_PROTO(struct cdnsp_request *req),
  462. TP_ARGS(req)
  463. );
  464. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_giveback,
  465. TP_PROTO(struct cdnsp_request *req),
  466. TP_ARGS(req)
  467. );
  468. DEFINE_EVENT(cdnsp_log_request, cdnsp_alloc_request,
  469. TP_PROTO(struct cdnsp_request *req),
  470. TP_ARGS(req)
  471. );
  472. DEFINE_EVENT(cdnsp_log_request, cdnsp_free_request,
  473. TP_PROTO(struct cdnsp_request *req),
  474. TP_ARGS(req)
  475. );
  476. DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx,
  477. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  478. TP_ARGS(ctx),
  479. TP_STRUCT__entry(
  480. __field(u32, info)
  481. __field(u32, info2)
  482. __field(u64, deq)
  483. __field(u32, tx_info)
  484. __dynamic_array(char, str, CDNSP_MSG_MAX)
  485. ),
  486. TP_fast_assign(
  487. __entry->info = le32_to_cpu(ctx->ep_info);
  488. __entry->info2 = le32_to_cpu(ctx->ep_info2);
  489. __entry->deq = le64_to_cpu(ctx->deq);
  490. __entry->tx_info = le32_to_cpu(ctx->tx_info);
  491. ),
  492. TP_printk("%s", cdnsp_decode_ep_context(__get_str(str), CDNSP_MSG_MAX,
  493. __entry->info, __entry->info2,
  494. __entry->deq, __entry->tx_info)
  495. )
  496. );
  497. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_disabled,
  498. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  499. TP_ARGS(ctx)
  500. );
  501. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_stopped_or_disabled,
  502. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  503. TP_ARGS(ctx)
  504. );
  505. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_remove_request,
  506. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  507. TP_ARGS(ctx)
  508. );
  509. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_stop_ep,
  510. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  511. TP_ARGS(ctx)
  512. );
  513. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_flush_ep,
  514. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  515. TP_ARGS(ctx)
  516. );
  517. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_set_deq_ep,
  518. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  519. TP_ARGS(ctx)
  520. );
  521. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_reset_ep,
  522. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  523. TP_ARGS(ctx)
  524. );
  525. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_config_ep,
  526. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  527. TP_ARGS(ctx)
  528. );
  529. DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx,
  530. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  531. TP_ARGS(ctx),
  532. TP_STRUCT__entry(
  533. __field(u32, info)
  534. __field(u32, info2)
  535. __field(u32, int_target)
  536. __field(u32, state)
  537. ),
  538. TP_fast_assign(
  539. __entry->info = le32_to_cpu(ctx->dev_info);
  540. __entry->info2 = le32_to_cpu(ctx->dev_port);
  541. __entry->int_target = le32_to_cpu(ctx->int_target);
  542. __entry->state = le32_to_cpu(ctx->dev_state);
  543. ),
  544. TP_printk("%s", cdnsp_decode_slot_context(__entry->info,
  545. __entry->info2,
  546. __entry->int_target,
  547. __entry->state)
  548. )
  549. );
  550. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_slot_already_in_default,
  551. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  552. TP_ARGS(ctx)
  553. );
  554. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_enable_slot,
  555. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  556. TP_ARGS(ctx)
  557. );
  558. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_disable_slot,
  559. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  560. TP_ARGS(ctx)
  561. );
  562. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_reset_device,
  563. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  564. TP_ARGS(ctx)
  565. );
  566. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_setup_device_slot,
  567. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  568. TP_ARGS(ctx)
  569. );
  570. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_addr_dev,
  571. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  572. TP_ARGS(ctx)
  573. );
  574. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_reset_dev,
  575. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  576. TP_ARGS(ctx)
  577. );
  578. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_set_deq,
  579. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  580. TP_ARGS(ctx)
  581. );
  582. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_configure_endpoint,
  583. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  584. TP_ARGS(ctx)
  585. );
  586. DECLARE_EVENT_CLASS(cdnsp_log_td_info,
  587. TP_PROTO(struct cdnsp_request *preq),
  588. TP_ARGS(preq),
  589. TP_STRUCT__entry(
  590. __string(name, preq->pep->name)
  591. __field(struct usb_request *, request)
  592. __field(struct cdnsp_request *, preq)
  593. __field(union cdnsp_trb *, first_trb)
  594. __field(union cdnsp_trb *, last_trb)
  595. __field(dma_addr_t, trb_dma)
  596. ),
  597. TP_fast_assign(
  598. __assign_str(name, preq->pep->name);
  599. __entry->request = &preq->request;
  600. __entry->preq = preq;
  601. __entry->first_trb = preq->td.first_trb;
  602. __entry->last_trb = preq->td.last_trb;
  603. __entry->trb_dma = cdnsp_trb_virt_to_dma(preq->td.start_seg,
  604. preq->td.first_trb)
  605. ),
  606. TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p",
  607. __get_str(name), __entry->request, __entry->preq,
  608. __entry->first_trb, &__entry->trb_dma,
  609. __entry->last_trb
  610. )
  611. );
  612. DEFINE_EVENT(cdnsp_log_td_info, cdnsp_remove_request_td,
  613. TP_PROTO(struct cdnsp_request *preq),
  614. TP_ARGS(preq)
  615. );
  616. DECLARE_EVENT_CLASS(cdnsp_log_ring,
  617. TP_PROTO(struct cdnsp_ring *ring),
  618. TP_ARGS(ring),
  619. TP_STRUCT__entry(
  620. __field(u32, type)
  621. __field(void *, ring)
  622. __field(dma_addr_t, enq)
  623. __field(dma_addr_t, deq)
  624. __field(dma_addr_t, enq_seg)
  625. __field(dma_addr_t, deq_seg)
  626. __field(unsigned int, num_segs)
  627. __field(unsigned int, stream_id)
  628. __field(unsigned int, cycle_state)
  629. __field(unsigned int, num_trbs_free)
  630. __field(unsigned int, bounce_buf_len)
  631. ),
  632. TP_fast_assign(
  633. __entry->ring = ring;
  634. __entry->type = ring->type;
  635. __entry->num_segs = ring->num_segs;
  636. __entry->stream_id = ring->stream_id;
  637. __entry->enq_seg = ring->enq_seg->dma;
  638. __entry->deq_seg = ring->deq_seg->dma;
  639. __entry->cycle_state = ring->cycle_state;
  640. __entry->num_trbs_free = ring->num_trbs_free;
  641. __entry->bounce_buf_len = ring->bounce_buf_len;
  642. __entry->enq = cdnsp_trb_virt_to_dma(ring->enq_seg,
  643. ring->enqueue);
  644. __entry->deq = cdnsp_trb_virt_to_dma(ring->deq_seg,
  645. ring->dequeue);
  646. ),
  647. TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d"
  648. " free_trbs %d bounce %d cycle %d",
  649. cdnsp_ring_type_string(__entry->type), __entry->ring,
  650. &__entry->enq, &__entry->enq_seg,
  651. &__entry->deq, &__entry->deq_seg,
  652. __entry->num_segs,
  653. __entry->stream_id,
  654. __entry->num_trbs_free,
  655. __entry->bounce_buf_len,
  656. __entry->cycle_state
  657. )
  658. );
  659. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_alloc,
  660. TP_PROTO(struct cdnsp_ring *ring),
  661. TP_ARGS(ring)
  662. );
  663. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_free,
  664. TP_PROTO(struct cdnsp_ring *ring),
  665. TP_ARGS(ring)
  666. );
  667. DEFINE_EVENT(cdnsp_log_ring, cdnsp_set_stream_ring,
  668. TP_PROTO(struct cdnsp_ring *ring),
  669. TP_ARGS(ring)
  670. );
  671. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_expansion,
  672. TP_PROTO(struct cdnsp_ring *ring),
  673. TP_ARGS(ring)
  674. );
  675. DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_enq,
  676. TP_PROTO(struct cdnsp_ring *ring),
  677. TP_ARGS(ring)
  678. );
  679. DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_deq,
  680. TP_PROTO(struct cdnsp_ring *ring),
  681. TP_ARGS(ring)
  682. );
  683. DECLARE_EVENT_CLASS(cdnsp_log_portsc,
  684. TP_PROTO(u32 portnum, u32 portsc),
  685. TP_ARGS(portnum, portsc),
  686. TP_STRUCT__entry(
  687. __field(u32, portnum)
  688. __field(u32, portsc)
  689. __dynamic_array(char, str, CDNSP_MSG_MAX)
  690. ),
  691. TP_fast_assign(
  692. __entry->portnum = portnum;
  693. __entry->portsc = portsc;
  694. ),
  695. TP_printk("port-%d: %s",
  696. __entry->portnum,
  697. cdnsp_decode_portsc(__get_str(str), CDNSP_MSG_MAX,
  698. __entry->portsc)
  699. )
  700. );
  701. DEFINE_EVENT(cdnsp_log_portsc, cdnsp_handle_port_status,
  702. TP_PROTO(u32 portnum, u32 portsc),
  703. TP_ARGS(portnum, portsc)
  704. );
  705. DEFINE_EVENT(cdnsp_log_portsc, cdnsp_link_state_changed,
  706. TP_PROTO(u32 portnum, u32 portsc),
  707. TP_ARGS(portnum, portsc)
  708. );
  709. TRACE_EVENT(cdnsp_stream_number,
  710. TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams),
  711. TP_ARGS(pep, num_stream_ctxs, num_streams),
  712. TP_STRUCT__entry(
  713. __string(name, pep->name)
  714. __field(int, num_stream_ctxs)
  715. __field(int, num_streams)
  716. ),
  717. TP_fast_assign(
  718. __entry->num_stream_ctxs = num_stream_ctxs;
  719. __entry->num_streams = num_streams;
  720. ),
  721. TP_printk("%s Need %u stream ctx entries for %u stream IDs.",
  722. __get_str(name), __entry->num_stream_ctxs,
  723. __entry->num_streams)
  724. );
  725. #endif /* __CDNSP_TRACE_H */
  726. /* this part must be outside header guard */
  727. #undef TRACE_INCLUDE_PATH
  728. #define TRACE_INCLUDE_PATH .
  729. #undef TRACE_INCLUDE_FILE
  730. #define TRACE_INCLUDE_FILE cdnsp-trace
  731. #include <trace/define_trace.h>