cdnsp-trace.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  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 <pawell@cadence.com>
  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);
  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);
  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_ep_halt,
  155. TP_PROTO(char *msg),
  156. TP_ARGS(msg)
  157. );
  158. TRACE_EVENT(cdnsp_looking_trb_in_td,
  159. TP_PROTO(dma_addr_t suspect, dma_addr_t trb_start, dma_addr_t trb_end,
  160. dma_addr_t curr_seg, dma_addr_t end_seg),
  161. TP_ARGS(suspect, trb_start, trb_end, curr_seg, end_seg),
  162. TP_STRUCT__entry(
  163. __field(dma_addr_t, suspect)
  164. __field(dma_addr_t, trb_start)
  165. __field(dma_addr_t, trb_end)
  166. __field(dma_addr_t, curr_seg)
  167. __field(dma_addr_t, end_seg)
  168. ),
  169. TP_fast_assign(
  170. __entry->suspect = suspect;
  171. __entry->trb_start = trb_start;
  172. __entry->trb_end = trb_end;
  173. __entry->curr_seg = curr_seg;
  174. __entry->end_seg = end_seg;
  175. ),
  176. TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, "
  177. "seg-start %pad, seg-end %pad",
  178. &__entry->suspect, &__entry->trb_start, &__entry->trb_end,
  179. &__entry->curr_seg, &__entry->end_seg)
  180. );
  181. TRACE_EVENT(cdnsp_port_info,
  182. TP_PROTO(__le32 __iomem *addr, u32 offset, u32 count, u32 rev),
  183. TP_ARGS(addr, offset, count, rev),
  184. TP_STRUCT__entry(
  185. __field(__le32 __iomem *, addr)
  186. __field(u32, offset)
  187. __field(u32, count)
  188. __field(u32, rev)
  189. ),
  190. TP_fast_assign(
  191. __entry->addr = addr;
  192. __entry->offset = offset;
  193. __entry->count = count;
  194. __entry->rev = rev;
  195. ),
  196. TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x",
  197. __entry->addr, __entry->offset, __entry->count, __entry->rev)
  198. );
  199. DECLARE_EVENT_CLASS(cdnsp_log_deq_state,
  200. TP_PROTO(struct cdnsp_dequeue_state *state),
  201. TP_ARGS(state),
  202. TP_STRUCT__entry(
  203. __field(int, new_cycle_state)
  204. __field(struct cdnsp_segment *, new_deq_seg)
  205. __field(dma_addr_t, deq_seg_dma)
  206. __field(union cdnsp_trb *, new_deq_ptr)
  207. __field(dma_addr_t, deq_ptr_dma)
  208. ),
  209. TP_fast_assign(
  210. __entry->new_cycle_state = state->new_cycle_state;
  211. __entry->new_deq_seg = state->new_deq_seg;
  212. __entry->deq_seg_dma = state->new_deq_seg->dma;
  213. __entry->new_deq_ptr = state->new_deq_ptr,
  214. __entry->deq_ptr_dma = cdnsp_trb_virt_to_dma(state->new_deq_seg,
  215. state->new_deq_ptr);
  216. ),
  217. TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), "
  218. "New dequeue pointer = %p (0x%pad dma)",
  219. __entry->new_cycle_state, __entry->new_deq_seg,
  220. &__entry->deq_seg_dma, __entry->new_deq_ptr,
  221. &__entry->deq_ptr_dma
  222. )
  223. );
  224. DEFINE_EVENT(cdnsp_log_deq_state, cdnsp_new_deq_state,
  225. TP_PROTO(struct cdnsp_dequeue_state *state),
  226. TP_ARGS(state)
  227. );
  228. DECLARE_EVENT_CLASS(cdnsp_log_ctrl,
  229. TP_PROTO(struct usb_ctrlrequest *ctrl),
  230. TP_ARGS(ctrl),
  231. TP_STRUCT__entry(
  232. __field(u8, bRequestType)
  233. __field(u8, bRequest)
  234. __field(u16, wValue)
  235. __field(u16, wIndex)
  236. __field(u16, wLength)
  237. ),
  238. TP_fast_assign(
  239. __entry->bRequestType = ctrl->bRequestType;
  240. __entry->bRequest = ctrl->bRequest;
  241. __entry->wValue = le16_to_cpu(ctrl->wValue);
  242. __entry->wIndex = le16_to_cpu(ctrl->wIndex);
  243. __entry->wLength = le16_to_cpu(ctrl->wLength);
  244. ),
  245. TP_printk("%s", usb_decode_ctrl(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX,
  246. __entry->bRequestType,
  247. __entry->bRequest, __entry->wValue,
  248. __entry->wIndex, __entry->wLength)
  249. )
  250. );
  251. DEFINE_EVENT(cdnsp_log_ctrl, cdnsp_ctrl_req,
  252. TP_PROTO(struct usb_ctrlrequest *ctrl),
  253. TP_ARGS(ctrl)
  254. );
  255. DECLARE_EVENT_CLASS(cdnsp_log_bounce,
  256. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  257. dma_addr_t dma, unsigned int unalign),
  258. TP_ARGS(preq, new_buf_len, offset, dma, unalign),
  259. TP_STRUCT__entry(
  260. __string(name, preq->pep->name)
  261. __field(u32, new_buf_len)
  262. __field(u32, offset)
  263. __field(dma_addr_t, dma)
  264. __field(unsigned int, unalign)
  265. ),
  266. TP_fast_assign(
  267. __assign_str(name);
  268. __entry->new_buf_len = new_buf_len;
  269. __entry->offset = offset;
  270. __entry->dma = dma;
  271. __entry->unalign = unalign;
  272. ),
  273. TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d",
  274. __get_str(name), __entry->new_buf_len,
  275. __entry->offset, &__entry->dma, __entry->unalign
  276. )
  277. );
  278. DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_align_td_split,
  279. TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
  280. dma_addr_t dma, unsigned int unalign),
  281. TP_ARGS(preq, new_buf_len, offset, dma, unalign)
  282. );
  283. DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_map,
  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_unmap,
  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. DECLARE_EVENT_CLASS(cdnsp_log_trb,
  294. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  295. TP_ARGS(ring, trb),
  296. TP_STRUCT__entry(
  297. __field(u32, type)
  298. __field(u32, field0)
  299. __field(u32, field1)
  300. __field(u32, field2)
  301. __field(u32, field3)
  302. __field(union cdnsp_trb *, trb)
  303. __field(dma_addr_t, trb_dma)
  304. ),
  305. TP_fast_assign(
  306. __entry->type = ring->type;
  307. __entry->field0 = le32_to_cpu(trb->field[0]);
  308. __entry->field1 = le32_to_cpu(trb->field[1]);
  309. __entry->field2 = le32_to_cpu(trb->field[2]);
  310. __entry->field3 = le32_to_cpu(trb->field[3]);
  311. __entry->trb = (union cdnsp_trb *)trb;
  312. __entry->trb_dma = cdnsp_trb_virt_to_dma(ring->deq_seg,
  313. (union cdnsp_trb *)trb);
  314. ),
  315. TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry->type),
  316. cdnsp_decode_trb(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX,
  317. __entry->field0, __entry->field1,
  318. __entry->field2, __entry->field3),
  319. __entry->trb, &__entry->trb_dma
  320. )
  321. );
  322. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_event,
  323. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  324. TP_ARGS(ring, trb)
  325. );
  326. DEFINE_EVENT(cdnsp_log_trb, cdnsp_trb_without_td,
  327. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  328. TP_ARGS(ring, trb)
  329. );
  330. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_command,
  331. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  332. TP_ARGS(ring, trb)
  333. );
  334. DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_transfer,
  335. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  336. TP_ARGS(ring, trb)
  337. );
  338. DEFINE_EVENT(cdnsp_log_trb, cdnsp_queue_trb,
  339. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  340. TP_ARGS(ring, trb)
  341. );
  342. DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_wait_for_compl,
  343. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  344. TP_ARGS(ring, trb)
  345. );
  346. DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_timeout,
  347. TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
  348. TP_ARGS(ring, trb)
  349. );
  350. DECLARE_EVENT_CLASS(cdnsp_log_pdev,
  351. TP_PROTO(struct cdnsp_device *pdev),
  352. TP_ARGS(pdev),
  353. TP_STRUCT__entry(
  354. __field(struct cdnsp_device *, pdev)
  355. __field(struct usb_gadget *, gadget)
  356. __field(dma_addr_t, out_ctx)
  357. __field(dma_addr_t, in_ctx)
  358. __field(u8, port_num)
  359. ),
  360. TP_fast_assign(
  361. __entry->pdev = pdev;
  362. __entry->gadget = &pdev->gadget;
  363. __entry->in_ctx = pdev->in_ctx.dma;
  364. __entry->out_ctx = pdev->out_ctx.dma;
  365. __entry->port_num = pdev->active_port ?
  366. pdev->active_port->port_num : 0xFF;
  367. ),
  368. TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ",
  369. __entry->pdev, __entry->gadget, &__entry->in_ctx,
  370. &__entry->out_ctx, __entry->port_num
  371. )
  372. );
  373. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_alloc_priv_device,
  374. TP_PROTO(struct cdnsp_device *vdev),
  375. TP_ARGS(vdev)
  376. );
  377. DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_addressable_priv_device,
  378. TP_PROTO(struct cdnsp_device *vdev),
  379. TP_ARGS(vdev)
  380. );
  381. DECLARE_EVENT_CLASS(cdnsp_log_request,
  382. TP_PROTO(struct cdnsp_request *req),
  383. TP_ARGS(req),
  384. TP_STRUCT__entry(
  385. __string(name, req->pep->name)
  386. __field(struct usb_request *, request)
  387. __field(struct cdnsp_request *, preq)
  388. __field(void *, buf)
  389. __field(unsigned int, actual)
  390. __field(unsigned int, length)
  391. __field(int, status)
  392. __field(dma_addr_t, dma)
  393. __field(unsigned int, stream_id)
  394. __field(unsigned int, zero)
  395. __field(unsigned int, short_not_ok)
  396. __field(unsigned int, no_interrupt)
  397. __field(struct scatterlist*, sg)
  398. __field(unsigned int, num_sgs)
  399. __field(unsigned int, num_mapped_sgs)
  400. ),
  401. TP_fast_assign(
  402. __assign_str(name);
  403. __entry->request = &req->request;
  404. __entry->preq = req;
  405. __entry->buf = req->request.buf;
  406. __entry->actual = req->request.actual;
  407. __entry->length = req->request.length;
  408. __entry->status = req->request.status;
  409. __entry->dma = req->request.dma;
  410. __entry->stream_id = req->request.stream_id;
  411. __entry->zero = req->request.zero;
  412. __entry->short_not_ok = req->request.short_not_ok;
  413. __entry->no_interrupt = req->request.no_interrupt;
  414. __entry->sg = req->request.sg;
  415. __entry->num_sgs = req->request.num_sgs;
  416. __entry->num_mapped_sgs = req->request.num_mapped_sgs;
  417. ),
  418. TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, "
  419. "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d,"
  420. " num_m_sg %d",
  421. __get_str(name), __entry->request, __entry->preq,
  422. __entry->buf, __entry->actual, __entry->length,
  423. __entry->status, &__entry->dma,
  424. __entry->stream_id, __entry->zero ? "Z" : "z",
  425. __entry->short_not_ok ? "S" : "s",
  426. __entry->no_interrupt ? "I" : "i",
  427. __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs
  428. )
  429. );
  430. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue,
  431. TP_PROTO(struct cdnsp_request *req),
  432. TP_ARGS(req)
  433. );
  434. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_busy,
  435. TP_PROTO(struct cdnsp_request *req),
  436. TP_ARGS(req)
  437. );
  438. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_error,
  439. TP_PROTO(struct cdnsp_request *req),
  440. TP_ARGS(req)
  441. );
  442. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_dequeue,
  443. TP_PROTO(struct cdnsp_request *req),
  444. TP_ARGS(req)
  445. );
  446. DEFINE_EVENT(cdnsp_log_request, cdnsp_request_giveback,
  447. TP_PROTO(struct cdnsp_request *req),
  448. TP_ARGS(req)
  449. );
  450. DEFINE_EVENT(cdnsp_log_request, cdnsp_alloc_request,
  451. TP_PROTO(struct cdnsp_request *req),
  452. TP_ARGS(req)
  453. );
  454. DEFINE_EVENT(cdnsp_log_request, cdnsp_free_request,
  455. TP_PROTO(struct cdnsp_request *req),
  456. TP_ARGS(req)
  457. );
  458. DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx,
  459. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  460. TP_ARGS(ctx),
  461. TP_STRUCT__entry(
  462. __field(u32, info)
  463. __field(u32, info2)
  464. __field(u64, deq)
  465. __field(u32, tx_info)
  466. ),
  467. TP_fast_assign(
  468. __entry->info = le32_to_cpu(ctx->ep_info);
  469. __entry->info2 = le32_to_cpu(ctx->ep_info2);
  470. __entry->deq = le64_to_cpu(ctx->deq);
  471. __entry->tx_info = le32_to_cpu(ctx->tx_info);
  472. ),
  473. TP_printk("%s", cdnsp_decode_ep_context(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX,
  474. __entry->info, __entry->info2,
  475. __entry->deq, __entry->tx_info)
  476. )
  477. );
  478. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_disabled,
  479. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  480. TP_ARGS(ctx)
  481. );
  482. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_stopped_or_disabled,
  483. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  484. TP_ARGS(ctx)
  485. );
  486. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_remove_request,
  487. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  488. TP_ARGS(ctx)
  489. );
  490. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_stop_ep,
  491. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  492. TP_ARGS(ctx)
  493. );
  494. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_set_deq_ep,
  495. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  496. TP_ARGS(ctx)
  497. );
  498. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_reset_ep,
  499. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  500. TP_ARGS(ctx)
  501. );
  502. DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_config_ep,
  503. TP_PROTO(struct cdnsp_ep_ctx *ctx),
  504. TP_ARGS(ctx)
  505. );
  506. DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx,
  507. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  508. TP_ARGS(ctx),
  509. TP_STRUCT__entry(
  510. __field(u32, info)
  511. __field(u32, info2)
  512. __field(u32, int_target)
  513. __field(u32, state)
  514. ),
  515. TP_fast_assign(
  516. __entry->info = le32_to_cpu(ctx->dev_info);
  517. __entry->info2 = le32_to_cpu(ctx->dev_port);
  518. __entry->int_target = le32_to_cpu(ctx->int_target);
  519. __entry->state = le32_to_cpu(ctx->dev_state);
  520. ),
  521. TP_printk("%s", cdnsp_decode_slot_context(__entry->info,
  522. __entry->info2,
  523. __entry->int_target,
  524. __entry->state)
  525. )
  526. );
  527. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_slot_already_in_default,
  528. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  529. TP_ARGS(ctx)
  530. );
  531. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_enable_slot,
  532. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  533. TP_ARGS(ctx)
  534. );
  535. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_disable_slot,
  536. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  537. TP_ARGS(ctx)
  538. );
  539. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_reset_device,
  540. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  541. TP_ARGS(ctx)
  542. );
  543. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_setup_device_slot,
  544. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  545. TP_ARGS(ctx)
  546. );
  547. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_addr_dev,
  548. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  549. TP_ARGS(ctx)
  550. );
  551. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_reset_dev,
  552. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  553. TP_ARGS(ctx)
  554. );
  555. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_set_deq,
  556. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  557. TP_ARGS(ctx)
  558. );
  559. DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_configure_endpoint,
  560. TP_PROTO(struct cdnsp_slot_ctx *ctx),
  561. TP_ARGS(ctx)
  562. );
  563. DECLARE_EVENT_CLASS(cdnsp_log_td_info,
  564. TP_PROTO(struct cdnsp_request *preq),
  565. TP_ARGS(preq),
  566. TP_STRUCT__entry(
  567. __string(name, preq->pep->name)
  568. __field(struct usb_request *, request)
  569. __field(struct cdnsp_request *, preq)
  570. __field(union cdnsp_trb *, first_trb)
  571. __field(union cdnsp_trb *, last_trb)
  572. __field(dma_addr_t, trb_dma)
  573. ),
  574. TP_fast_assign(
  575. __assign_str(name);
  576. __entry->request = &preq->request;
  577. __entry->preq = preq;
  578. __entry->first_trb = preq->td.first_trb;
  579. __entry->last_trb = preq->td.last_trb;
  580. __entry->trb_dma = cdnsp_trb_virt_to_dma(preq->td.start_seg,
  581. preq->td.first_trb)
  582. ),
  583. TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p",
  584. __get_str(name), __entry->request, __entry->preq,
  585. __entry->first_trb, &__entry->trb_dma,
  586. __entry->last_trb
  587. )
  588. );
  589. DEFINE_EVENT(cdnsp_log_td_info, cdnsp_remove_request_td,
  590. TP_PROTO(struct cdnsp_request *preq),
  591. TP_ARGS(preq)
  592. );
  593. DECLARE_EVENT_CLASS(cdnsp_log_ring,
  594. TP_PROTO(struct cdnsp_ring *ring),
  595. TP_ARGS(ring),
  596. TP_STRUCT__entry(
  597. __field(u32, type)
  598. __field(void *, ring)
  599. __field(dma_addr_t, enq)
  600. __field(dma_addr_t, deq)
  601. __field(dma_addr_t, enq_seg)
  602. __field(dma_addr_t, deq_seg)
  603. __field(unsigned int, num_segs)
  604. __field(unsigned int, stream_id)
  605. __field(unsigned int, cycle_state)
  606. __field(unsigned int, num_trbs_free)
  607. __field(unsigned int, bounce_buf_len)
  608. ),
  609. TP_fast_assign(
  610. __entry->ring = ring;
  611. __entry->type = ring->type;
  612. __entry->num_segs = ring->num_segs;
  613. __entry->stream_id = ring->stream_id;
  614. __entry->enq_seg = ring->enq_seg->dma;
  615. __entry->deq_seg = ring->deq_seg->dma;
  616. __entry->cycle_state = ring->cycle_state;
  617. __entry->num_trbs_free = ring->num_trbs_free;
  618. __entry->bounce_buf_len = ring->bounce_buf_len;
  619. __entry->enq = cdnsp_trb_virt_to_dma(ring->enq_seg,
  620. ring->enqueue);
  621. __entry->deq = cdnsp_trb_virt_to_dma(ring->deq_seg,
  622. ring->dequeue);
  623. ),
  624. TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d"
  625. " free_trbs %d bounce %d cycle %d",
  626. cdnsp_ring_type_string(__entry->type), __entry->ring,
  627. &__entry->enq, &__entry->enq_seg,
  628. &__entry->deq, &__entry->deq_seg,
  629. __entry->num_segs,
  630. __entry->stream_id,
  631. __entry->num_trbs_free,
  632. __entry->bounce_buf_len,
  633. __entry->cycle_state
  634. )
  635. );
  636. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_alloc,
  637. TP_PROTO(struct cdnsp_ring *ring),
  638. TP_ARGS(ring)
  639. );
  640. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_free,
  641. TP_PROTO(struct cdnsp_ring *ring),
  642. TP_ARGS(ring)
  643. );
  644. DEFINE_EVENT(cdnsp_log_ring, cdnsp_set_stream_ring,
  645. TP_PROTO(struct cdnsp_ring *ring),
  646. TP_ARGS(ring)
  647. );
  648. DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_expansion,
  649. TP_PROTO(struct cdnsp_ring *ring),
  650. TP_ARGS(ring)
  651. );
  652. DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_enq,
  653. TP_PROTO(struct cdnsp_ring *ring),
  654. TP_ARGS(ring)
  655. );
  656. DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_deq,
  657. TP_PROTO(struct cdnsp_ring *ring),
  658. TP_ARGS(ring)
  659. );
  660. DECLARE_EVENT_CLASS(cdnsp_log_portsc,
  661. TP_PROTO(u32 portnum, u32 portsc),
  662. TP_ARGS(portnum, portsc),
  663. TP_STRUCT__entry(
  664. __field(u32, portnum)
  665. __field(u32, portsc)
  666. ),
  667. TP_fast_assign(
  668. __entry->portnum = portnum;
  669. __entry->portsc = portsc;
  670. ),
  671. TP_printk("port-%d: %s",
  672. __entry->portnum,
  673. cdnsp_decode_portsc(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX,
  674. __entry->portsc)
  675. )
  676. );
  677. DEFINE_EVENT(cdnsp_log_portsc, cdnsp_handle_port_status,
  678. TP_PROTO(u32 portnum, u32 portsc),
  679. TP_ARGS(portnum, portsc)
  680. );
  681. DEFINE_EVENT(cdnsp_log_portsc, cdnsp_link_state_changed,
  682. TP_PROTO(u32 portnum, u32 portsc),
  683. TP_ARGS(portnum, portsc)
  684. );
  685. TRACE_EVENT(cdnsp_stream_number,
  686. TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams),
  687. TP_ARGS(pep, num_stream_ctxs, num_streams),
  688. TP_STRUCT__entry(
  689. __string(name, pep->name)
  690. __field(int, num_stream_ctxs)
  691. __field(int, num_streams)
  692. ),
  693. TP_fast_assign(
  694. __entry->num_stream_ctxs = num_stream_ctxs;
  695. __entry->num_streams = num_streams;
  696. ),
  697. TP_printk("%s Need %u stream ctx entries for %u stream IDs.",
  698. __get_str(name), __entry->num_stream_ctxs,
  699. __entry->num_streams)
  700. );
  701. #endif /* __CDNSP_TRACE_H */
  702. /* this part must be outside header guard */
  703. #undef TRACE_INCLUDE_PATH
  704. #define TRACE_INCLUDE_PATH .
  705. #undef TRACE_INCLUDE_FILE
  706. #define TRACE_INCLUDE_FILE cdnsp-trace
  707. #include <trace/define_trace.h>