xhci-trace.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * xHCI host controller driver
  4. *
  5. * Copyright (C) 2013 Xenia Ragiadakou
  6. *
  7. * Author: Xenia Ragiadakou
  8. * Email : burzalodowa@gmail.com
  9. */
  10. #undef TRACE_SYSTEM
  11. #define TRACE_SYSTEM xhci-hcd
  12. /*
  13. * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
  14. * legitimate C variable. It is not exported to user space.
  15. */
  16. #undef TRACE_SYSTEM_VAR
  17. #define TRACE_SYSTEM_VAR xhci_hcd
  18. #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  19. #define __XHCI_TRACE_H
  20. #include <linux/tracepoint.h>
  21. #include "xhci.h"
  22. #include "xhci-dbgcap.h"
  23. DECLARE_EVENT_CLASS(xhci_log_msg,
  24. TP_PROTO(struct va_format *vaf),
  25. TP_ARGS(vaf),
  26. TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)),
  27. TP_fast_assign(
  28. vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va);
  29. ),
  30. TP_printk("%s", __get_str(msg))
  31. );
  32. DEFINE_EVENT(xhci_log_msg, xhci_dbg_address,
  33. TP_PROTO(struct va_format *vaf),
  34. TP_ARGS(vaf)
  35. );
  36. DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change,
  37. TP_PROTO(struct va_format *vaf),
  38. TP_ARGS(vaf)
  39. );
  40. DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks,
  41. TP_PROTO(struct va_format *vaf),
  42. TP_ARGS(vaf)
  43. );
  44. DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep,
  45. TP_PROTO(struct va_format *vaf),
  46. TP_ARGS(vaf)
  47. );
  48. DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb,
  49. TP_PROTO(struct va_format *vaf),
  50. TP_ARGS(vaf)
  51. );
  52. DEFINE_EVENT(xhci_log_msg, xhci_dbg_init,
  53. TP_PROTO(struct va_format *vaf),
  54. TP_ARGS(vaf)
  55. );
  56. DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion,
  57. TP_PROTO(struct va_format *vaf),
  58. TP_ARGS(vaf)
  59. );
  60. DECLARE_EVENT_CLASS(xhci_log_ctx,
  61. TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
  62. unsigned int ep_num),
  63. TP_ARGS(xhci, ctx, ep_num),
  64. TP_STRUCT__entry(
  65. __field(int, ctx_64)
  66. __field(unsigned, ctx_type)
  67. __field(dma_addr_t, ctx_dma)
  68. __field(u8 *, ctx_va)
  69. __field(unsigned, ctx_ep_num)
  70. __field(int, slot_id)
  71. __dynamic_array(u32, ctx_data,
  72. ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) *
  73. ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1))
  74. ),
  75. TP_fast_assign(
  76. struct usb_device *udev;
  77. udev = to_usb_device(xhci_to_hcd(xhci)->self.controller);
  78. __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params);
  79. __entry->ctx_type = ctx->type;
  80. __entry->ctx_dma = ctx->dma;
  81. __entry->ctx_va = ctx->bytes;
  82. __entry->slot_id = udev->slot_id;
  83. __entry->ctx_ep_num = ep_num;
  84. memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
  85. ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) *
  86. ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1));
  87. ),
  88. TP_printk("ctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
  89. __entry->ctx_64, __entry->ctx_type,
  90. (unsigned long long) __entry->ctx_dma, __entry->ctx_va
  91. )
  92. );
  93. DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx,
  94. TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
  95. unsigned int ep_num),
  96. TP_ARGS(xhci, ctx, ep_num)
  97. );
  98. DECLARE_EVENT_CLASS(xhci_log_trb,
  99. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  100. TP_ARGS(ring, trb),
  101. TP_STRUCT__entry(
  102. __field(u32, type)
  103. __field(u32, field0)
  104. __field(u32, field1)
  105. __field(u32, field2)
  106. __field(u32, field3)
  107. __dynamic_array(char, str, XHCI_MSG_MAX)
  108. ),
  109. TP_fast_assign(
  110. __entry->type = ring->type;
  111. __entry->field0 = le32_to_cpu(trb->field[0]);
  112. __entry->field1 = le32_to_cpu(trb->field[1]);
  113. __entry->field2 = le32_to_cpu(trb->field[2]);
  114. __entry->field3 = le32_to_cpu(trb->field[3]);
  115. ),
  116. TP_printk("%s: %s", xhci_ring_type_string(__entry->type),
  117. xhci_decode_trb(__get_str(str), XHCI_MSG_MAX, __entry->field0, __entry->field1,
  118. __entry->field2, __entry->field3)
  119. )
  120. );
  121. DEFINE_EVENT(xhci_log_trb, xhci_handle_event,
  122. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  123. TP_ARGS(ring, trb)
  124. );
  125. DEFINE_EVENT(xhci_log_trb, xhci_handle_command,
  126. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  127. TP_ARGS(ring, trb)
  128. );
  129. DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer,
  130. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  131. TP_ARGS(ring, trb)
  132. );
  133. DEFINE_EVENT(xhci_log_trb, xhci_queue_trb,
  134. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  135. TP_ARGS(ring, trb)
  136. );
  137. DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_event,
  138. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  139. TP_ARGS(ring, trb)
  140. );
  141. DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_transfer,
  142. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  143. TP_ARGS(ring, trb)
  144. );
  145. DEFINE_EVENT(xhci_log_trb, xhci_dbc_gadget_ep_queue,
  146. TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
  147. TP_ARGS(ring, trb)
  148. );
  149. DECLARE_EVENT_CLASS(xhci_log_free_virt_dev,
  150. TP_PROTO(struct xhci_virt_device *vdev),
  151. TP_ARGS(vdev),
  152. TP_STRUCT__entry(
  153. __field(void *, vdev)
  154. __field(unsigned long long, out_ctx)
  155. __field(unsigned long long, in_ctx)
  156. __field(u8, fake_port)
  157. __field(u8, real_port)
  158. __field(u16, current_mel)
  159. ),
  160. TP_fast_assign(
  161. __entry->vdev = vdev;
  162. __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
  163. __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
  164. __entry->fake_port = (u8) vdev->fake_port;
  165. __entry->real_port = (u8) vdev->real_port;
  166. __entry->current_mel = (u16) vdev->current_mel;
  167. ),
  168. TP_printk("vdev %p ctx %llx | %llx fake_port %d real_port %d current_mel %d",
  169. __entry->vdev, __entry->in_ctx, __entry->out_ctx,
  170. __entry->fake_port, __entry->real_port, __entry->current_mel
  171. )
  172. );
  173. DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device,
  174. TP_PROTO(struct xhci_virt_device *vdev),
  175. TP_ARGS(vdev)
  176. );
  177. DECLARE_EVENT_CLASS(xhci_log_virt_dev,
  178. TP_PROTO(struct xhci_virt_device *vdev),
  179. TP_ARGS(vdev),
  180. TP_STRUCT__entry(
  181. __field(void *, vdev)
  182. __field(unsigned long long, out_ctx)
  183. __field(unsigned long long, in_ctx)
  184. __field(int, devnum)
  185. __field(int, state)
  186. __field(int, speed)
  187. __field(u8, portnum)
  188. __field(u8, level)
  189. __field(int, slot_id)
  190. ),
  191. TP_fast_assign(
  192. __entry->vdev = vdev;
  193. __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
  194. __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
  195. __entry->devnum = vdev->udev->devnum;
  196. __entry->state = vdev->udev->state;
  197. __entry->speed = vdev->udev->speed;
  198. __entry->portnum = vdev->udev->portnum;
  199. __entry->level = vdev->udev->level;
  200. __entry->slot_id = vdev->udev->slot_id;
  201. ),
  202. TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d",
  203. __entry->vdev, __entry->in_ctx, __entry->out_ctx,
  204. __entry->devnum, __entry->state, __entry->speed,
  205. __entry->portnum, __entry->level, __entry->slot_id
  206. )
  207. );
  208. DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device,
  209. TP_PROTO(struct xhci_virt_device *vdev),
  210. TP_ARGS(vdev)
  211. );
  212. DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device,
  213. TP_PROTO(struct xhci_virt_device *vdev),
  214. TP_ARGS(vdev)
  215. );
  216. DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device,
  217. TP_PROTO(struct xhci_virt_device *vdev),
  218. TP_ARGS(vdev)
  219. );
  220. DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device,
  221. TP_PROTO(struct xhci_virt_device *vdev),
  222. TP_ARGS(vdev)
  223. );
  224. DECLARE_EVENT_CLASS(xhci_log_urb,
  225. TP_PROTO(struct urb *urb),
  226. TP_ARGS(urb),
  227. TP_STRUCT__entry(
  228. __field(void *, urb)
  229. __field(unsigned int, pipe)
  230. __field(unsigned int, stream)
  231. __field(int, status)
  232. __field(unsigned int, flags)
  233. __field(int, num_mapped_sgs)
  234. __field(int, num_sgs)
  235. __field(int, length)
  236. __field(int, actual)
  237. __field(int, epnum)
  238. __field(int, dir_in)
  239. __field(int, type)
  240. __field(int, slot_id)
  241. ),
  242. TP_fast_assign(
  243. __entry->urb = urb;
  244. __entry->pipe = urb->pipe;
  245. __entry->stream = urb->stream_id;
  246. __entry->status = urb->status;
  247. __entry->flags = urb->transfer_flags;
  248. __entry->num_mapped_sgs = urb->num_mapped_sgs;
  249. __entry->num_sgs = urb->num_sgs;
  250. __entry->length = urb->transfer_buffer_length;
  251. __entry->actual = urb->actual_length;
  252. __entry->epnum = usb_endpoint_num(&urb->ep->desc);
  253. __entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc);
  254. __entry->type = usb_endpoint_type(&urb->ep->desc);
  255. __entry->slot_id = urb->dev->slot_id;
  256. ),
  257. TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
  258. __entry->epnum, __entry->dir_in ? "in" : "out",
  259. __print_symbolic(__entry->type,
  260. { USB_ENDPOINT_XFER_INT, "intr" },
  261. { USB_ENDPOINT_XFER_CONTROL, "control" },
  262. { USB_ENDPOINT_XFER_BULK, "bulk" },
  263. { USB_ENDPOINT_XFER_ISOC, "isoc" }),
  264. __entry->urb, __entry->pipe, __entry->slot_id,
  265. __entry->actual, __entry->length, __entry->num_mapped_sgs,
  266. __entry->num_sgs, __entry->stream, __entry->flags
  267. )
  268. );
  269. DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue,
  270. TP_PROTO(struct urb *urb),
  271. TP_ARGS(urb)
  272. );
  273. DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback,
  274. TP_PROTO(struct urb *urb),
  275. TP_ARGS(urb)
  276. );
  277. DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue,
  278. TP_PROTO(struct urb *urb),
  279. TP_ARGS(urb)
  280. );
  281. DECLARE_EVENT_CLASS(xhci_log_ep_ctx,
  282. TP_PROTO(struct xhci_ep_ctx *ctx),
  283. TP_ARGS(ctx),
  284. TP_STRUCT__entry(
  285. __field(u32, info)
  286. __field(u32, info2)
  287. __field(u64, deq)
  288. __field(u32, tx_info)
  289. ),
  290. TP_fast_assign(
  291. __entry->info = le32_to_cpu(ctx->ep_info);
  292. __entry->info2 = le32_to_cpu(ctx->ep_info2);
  293. __entry->deq = le64_to_cpu(ctx->deq);
  294. __entry->tx_info = le32_to_cpu(ctx->tx_info);
  295. ),
  296. TP_printk("%s", xhci_decode_ep_context(__entry->info,
  297. __entry->info2, __entry->deq, __entry->tx_info)
  298. )
  299. );
  300. DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep,
  301. TP_PROTO(struct xhci_ep_ctx *ctx),
  302. TP_ARGS(ctx)
  303. );
  304. DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep,
  305. TP_PROTO(struct xhci_ep_ctx *ctx),
  306. TP_ARGS(ctx)
  307. );
  308. DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep,
  309. TP_PROTO(struct xhci_ep_ctx *ctx),
  310. TP_ARGS(ctx)
  311. );
  312. DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep,
  313. TP_PROTO(struct xhci_ep_ctx *ctx),
  314. TP_ARGS(ctx)
  315. );
  316. DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint,
  317. TP_PROTO(struct xhci_ep_ctx *ctx),
  318. TP_ARGS(ctx)
  319. );
  320. DECLARE_EVENT_CLASS(xhci_log_slot_ctx,
  321. TP_PROTO(struct xhci_slot_ctx *ctx),
  322. TP_ARGS(ctx),
  323. TP_STRUCT__entry(
  324. __field(u32, info)
  325. __field(u32, info2)
  326. __field(u32, tt_info)
  327. __field(u32, state)
  328. ),
  329. TP_fast_assign(
  330. __entry->info = le32_to_cpu(ctx->dev_info);
  331. __entry->info2 = le32_to_cpu(ctx->dev_info2);
  332. __entry->tt_info = le64_to_cpu(ctx->tt_info);
  333. __entry->state = le32_to_cpu(ctx->dev_state);
  334. ),
  335. TP_printk("%s", xhci_decode_slot_context(__entry->info,
  336. __entry->info2, __entry->tt_info,
  337. __entry->state)
  338. )
  339. );
  340. DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev,
  341. TP_PROTO(struct xhci_slot_ctx *ctx),
  342. TP_ARGS(ctx)
  343. );
  344. DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev,
  345. TP_PROTO(struct xhci_slot_ctx *ctx),
  346. TP_ARGS(ctx)
  347. );
  348. DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot,
  349. TP_PROTO(struct xhci_slot_ctx *ctx),
  350. TP_ARGS(ctx)
  351. );
  352. DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device,
  353. TP_PROTO(struct xhci_slot_ctx *ctx),
  354. TP_ARGS(ctx)
  355. );
  356. DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot,
  357. TP_PROTO(struct xhci_slot_ctx *ctx),
  358. TP_ARGS(ctx)
  359. );
  360. DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev,
  361. TP_PROTO(struct xhci_slot_ctx *ctx),
  362. TP_ARGS(ctx)
  363. );
  364. DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev,
  365. TP_PROTO(struct xhci_slot_ctx *ctx),
  366. TP_ARGS(ctx)
  367. );
  368. DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq,
  369. TP_PROTO(struct xhci_slot_ctx *ctx),
  370. TP_ARGS(ctx)
  371. );
  372. DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
  373. TP_PROTO(struct xhci_slot_ctx *ctx),
  374. TP_ARGS(ctx)
  375. );
  376. DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx,
  377. TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
  378. TP_ARGS(ctrl_ctx),
  379. TP_STRUCT__entry(
  380. __field(u32, drop)
  381. __field(u32, add)
  382. ),
  383. TP_fast_assign(
  384. __entry->drop = le32_to_cpu(ctrl_ctx->drop_flags);
  385. __entry->add = le32_to_cpu(ctrl_ctx->add_flags);
  386. ),
  387. TP_printk("%s", xhci_decode_ctrl_ctx(__entry->drop, __entry->add)
  388. )
  389. );
  390. DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx,
  391. TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
  392. TP_ARGS(ctrl_ctx)
  393. );
  394. DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx,
  395. TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
  396. TP_ARGS(ctrl_ctx)
  397. );
  398. DECLARE_EVENT_CLASS(xhci_log_ring,
  399. TP_PROTO(struct xhci_ring *ring),
  400. TP_ARGS(ring),
  401. TP_STRUCT__entry(
  402. __field(u32, type)
  403. __field(void *, ring)
  404. __field(dma_addr_t, enq)
  405. __field(dma_addr_t, deq)
  406. __field(dma_addr_t, enq_seg)
  407. __field(dma_addr_t, deq_seg)
  408. __field(unsigned int, num_segs)
  409. __field(unsigned int, stream_id)
  410. __field(unsigned int, cycle_state)
  411. __field(unsigned int, num_trbs_free)
  412. __field(unsigned int, bounce_buf_len)
  413. ),
  414. TP_fast_assign(
  415. __entry->ring = ring;
  416. __entry->type = ring->type;
  417. __entry->num_segs = ring->num_segs;
  418. __entry->stream_id = ring->stream_id;
  419. __entry->enq_seg = ring->enq_seg->dma;
  420. __entry->deq_seg = ring->deq_seg->dma;
  421. __entry->cycle_state = ring->cycle_state;
  422. __entry->num_trbs_free = ring->num_trbs_free;
  423. __entry->bounce_buf_len = ring->bounce_buf_len;
  424. __entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
  425. __entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
  426. ),
  427. TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d free_trbs %d bounce %d cycle %d",
  428. xhci_ring_type_string(__entry->type), __entry->ring,
  429. &__entry->enq, &__entry->enq_seg,
  430. &__entry->deq, &__entry->deq_seg,
  431. __entry->num_segs,
  432. __entry->stream_id,
  433. __entry->num_trbs_free,
  434. __entry->bounce_buf_len,
  435. __entry->cycle_state
  436. )
  437. );
  438. DEFINE_EVENT(xhci_log_ring, xhci_ring_alloc,
  439. TP_PROTO(struct xhci_ring *ring),
  440. TP_ARGS(ring)
  441. );
  442. DEFINE_EVENT(xhci_log_ring, xhci_ring_free,
  443. TP_PROTO(struct xhci_ring *ring),
  444. TP_ARGS(ring)
  445. );
  446. DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion,
  447. TP_PROTO(struct xhci_ring *ring),
  448. TP_ARGS(ring)
  449. );
  450. DEFINE_EVENT(xhci_log_ring, xhci_inc_enq,
  451. TP_PROTO(struct xhci_ring *ring),
  452. TP_ARGS(ring)
  453. );
  454. DEFINE_EVENT(xhci_log_ring, xhci_inc_deq,
  455. TP_PROTO(struct xhci_ring *ring),
  456. TP_ARGS(ring)
  457. );
  458. DECLARE_EVENT_CLASS(xhci_log_portsc,
  459. TP_PROTO(u32 portnum, u32 portsc),
  460. TP_ARGS(portnum, portsc),
  461. TP_STRUCT__entry(
  462. __field(u32, portnum)
  463. __field(u32, portsc)
  464. __dynamic_array(char, str, XHCI_MSG_MAX)
  465. ),
  466. TP_fast_assign(
  467. __entry->portnum = portnum;
  468. __entry->portsc = portsc;
  469. ),
  470. TP_printk("port-%d: %s",
  471. __entry->portnum,
  472. xhci_decode_portsc(__get_str(str), __entry->portsc)
  473. )
  474. );
  475. DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status,
  476. TP_PROTO(u32 portnum, u32 portsc),
  477. TP_ARGS(portnum, portsc)
  478. );
  479. DEFINE_EVENT(xhci_log_portsc, xhci_get_port_status,
  480. TP_PROTO(u32 portnum, u32 portsc),
  481. TP_ARGS(portnum, portsc)
  482. );
  483. DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data,
  484. TP_PROTO(u32 portnum, u32 portsc),
  485. TP_ARGS(portnum, portsc)
  486. );
  487. DECLARE_EVENT_CLASS(xhci_dbc_log_request,
  488. TP_PROTO(struct dbc_request *req),
  489. TP_ARGS(req),
  490. TP_STRUCT__entry(
  491. __field(struct dbc_request *, req)
  492. __field(bool, dir)
  493. __field(unsigned int, actual)
  494. __field(unsigned int, length)
  495. __field(int, status)
  496. ),
  497. TP_fast_assign(
  498. __entry->req = req;
  499. __entry->dir = req->direction;
  500. __entry->actual = req->actual;
  501. __entry->length = req->length;
  502. __entry->status = req->status;
  503. ),
  504. TP_printk("%s: req %p length %u/%u ==> %d",
  505. __entry->dir ? "bulk-in" : "bulk-out",
  506. __entry->req, __entry->actual,
  507. __entry->length, __entry->status
  508. )
  509. );
  510. DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_alloc_request,
  511. TP_PROTO(struct dbc_request *req),
  512. TP_ARGS(req)
  513. );
  514. DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_free_request,
  515. TP_PROTO(struct dbc_request *req),
  516. TP_ARGS(req)
  517. );
  518. DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_queue_request,
  519. TP_PROTO(struct dbc_request *req),
  520. TP_ARGS(req)
  521. );
  522. DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_giveback_request,
  523. TP_PROTO(struct dbc_request *req),
  524. TP_ARGS(req)
  525. );
  526. #endif /* __XHCI_TRACE_H */
  527. /* this part must be outside header guard */
  528. #undef TRACE_INCLUDE_PATH
  529. #define TRACE_INCLUDE_PATH .
  530. #undef TRACE_INCLUDE_FILE
  531. #define TRACE_INCLUDE_FILE xhci-trace
  532. #include <trace/define_trace.h>