Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 1 | /* |
| 2 | * xHCI host controller driver |
| 3 | * |
| 4 | * Copyright (C) 2013 Xenia Ragiadakou |
| 5 | * |
| 6 | * Author: Xenia Ragiadakou |
| 7 | * Email : burzalodowa@gmail.com |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | */ |
| 13 | |
| 14 | #undef TRACE_SYSTEM |
| 15 | #define TRACE_SYSTEM xhci-hcd |
| 16 | |
Steven Rostedt (Red Hat) | 7267b23 | 2015-04-01 14:22:01 -0400 | [diff] [blame] | 17 | /* |
| 18 | * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a |
| 19 | * legitimate C variable. It is not exported to user space. |
| 20 | */ |
| 21 | #undef TRACE_SYSTEM_VAR |
| 22 | #define TRACE_SYSTEM_VAR xhci_hcd |
| 23 | |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 24 | #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 25 | #define __XHCI_TRACE_H |
| 26 | |
| 27 | #include <linux/tracepoint.h> |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 28 | #include "xhci.h" |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 29 | |
| 30 | #define XHCI_MSG_MAX 500 |
| 31 | |
| 32 | DECLARE_EVENT_CLASS(xhci_log_msg, |
| 33 | TP_PROTO(struct va_format *vaf), |
| 34 | TP_ARGS(vaf), |
| 35 | TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)), |
| 36 | TP_fast_assign( |
| 37 | vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va); |
| 38 | ), |
| 39 | TP_printk("%s", __get_str(msg)) |
| 40 | ); |
| 41 | |
| 42 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, |
| 43 | TP_PROTO(struct va_format *vaf), |
| 44 | TP_ARGS(vaf) |
| 45 | ); |
| 46 | |
Xenia Ragiadakou | 3a7fa5b | 2013-07-31 07:35:27 +0300 | [diff] [blame] | 47 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change, |
| 48 | TP_PROTO(struct va_format *vaf), |
| 49 | TP_ARGS(vaf) |
| 50 | ); |
| 51 | |
Xenia Ragiadakou | 4bdfe4c | 2013-08-06 07:52:45 +0300 | [diff] [blame] | 52 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks, |
| 53 | TP_PROTO(struct va_format *vaf), |
| 54 | TP_ARGS(vaf) |
| 55 | ); |
| 56 | |
Xenia Ragiadakou | a025432 | 2013-08-06 07:52:46 +0300 | [diff] [blame] | 57 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep, |
| 58 | TP_PROTO(struct va_format *vaf), |
| 59 | TP_ARGS(vaf) |
| 60 | ); |
| 61 | |
Xenia Ragiadakou | aa50b29 | 2013-08-14 06:33:54 +0300 | [diff] [blame] | 62 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, |
| 63 | TP_PROTO(struct va_format *vaf), |
| 64 | TP_ARGS(vaf) |
| 65 | ); |
| 66 | |
Xenia Ragiadakou | d195fcf | 2013-08-14 06:33:55 +0300 | [diff] [blame] | 67 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_init, |
| 68 | TP_PROTO(struct va_format *vaf), |
| 69 | TP_ARGS(vaf) |
| 70 | ); |
| 71 | |
Xenia Ragiadakou | 68ffb01 | 2013-08-14 06:33:56 +0300 | [diff] [blame] | 72 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, |
| 73 | TP_PROTO(struct va_format *vaf), |
| 74 | TP_ARGS(vaf) |
| 75 | ); |
| 76 | |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 77 | DECLARE_EVENT_CLASS(xhci_log_ctx, |
| 78 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
| 79 | unsigned int ep_num), |
| 80 | TP_ARGS(xhci, ctx, ep_num), |
| 81 | TP_STRUCT__entry( |
| 82 | __field(int, ctx_64) |
| 83 | __field(unsigned, ctx_type) |
| 84 | __field(dma_addr_t, ctx_dma) |
| 85 | __field(u8 *, ctx_va) |
| 86 | __field(unsigned, ctx_ep_num) |
| 87 | __field(int, slot_id) |
| 88 | __dynamic_array(u32, ctx_data, |
| 89 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * |
| 90 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) |
| 91 | ), |
| 92 | TP_fast_assign( |
| 93 | struct usb_device *udev; |
| 94 | |
| 95 | udev = to_usb_device(xhci_to_hcd(xhci)->self.controller); |
| 96 | __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
| 97 | __entry->ctx_type = ctx->type; |
| 98 | __entry->ctx_dma = ctx->dma; |
| 99 | __entry->ctx_va = ctx->bytes; |
| 100 | __entry->slot_id = udev->slot_id; |
| 101 | __entry->ctx_ep_num = ep_num; |
| 102 | memcpy(__get_dynamic_array(ctx_data), ctx->bytes, |
| 103 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * |
| 104 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)); |
| 105 | ), |
Vamsi Krishna Samavedam | f826f83 | 2016-11-03 17:06:34 -0700 | [diff] [blame] | 106 | TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%pK", |
Xenia Ragiadakou | 1d27fab | 2013-08-06 07:52:47 +0300 | [diff] [blame] | 107 | __entry->ctx_64, __entry->ctx_type, |
| 108 | (unsigned long long) __entry->ctx_dma, __entry->ctx_va |
| 109 | ) |
| 110 | ); |
| 111 | |
| 112 | DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx, |
| 113 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
| 114 | unsigned int ep_num), |
| 115 | TP_ARGS(xhci, ctx, ep_num) |
| 116 | ); |
| 117 | |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 118 | DECLARE_EVENT_CLASS(xhci_log_event, |
| 119 | TP_PROTO(void *trb_va, struct xhci_generic_trb *ev), |
| 120 | TP_ARGS(trb_va, ev), |
| 121 | TP_STRUCT__entry( |
| 122 | __field(void *, va) |
| 123 | __field(u64, dma) |
| 124 | __field(u32, status) |
| 125 | __field(u32, flags) |
Xenia Ragiadakou | d20c722 | 2013-09-09 21:03:12 +0300 | [diff] [blame] | 126 | __dynamic_array(u8, trb, sizeof(struct xhci_generic_trb)) |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 127 | ), |
| 128 | TP_fast_assign( |
| 129 | __entry->va = trb_va; |
Xenia Ragiadakou | f004669 | 2013-09-09 21:03:11 +0300 | [diff] [blame] | 130 | __entry->dma = ((u64)le32_to_cpu(ev->field[1])) << 32 | |
| 131 | le32_to_cpu(ev->field[0]); |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 132 | __entry->status = le32_to_cpu(ev->field[2]); |
| 133 | __entry->flags = le32_to_cpu(ev->field[3]); |
| 134 | memcpy(__get_dynamic_array(trb), trb_va, |
| 135 | sizeof(struct xhci_generic_trb)); |
| 136 | ), |
Vamsi Krishna Samavedam | f826f83 | 2016-11-03 17:06:34 -0700 | [diff] [blame] | 137 | TP_printk("\ntrb_dma=@%llx, trb_va=@%pK, status=%08x, flags=%08x", |
Xenia Ragiadakou | 63a23b9a | 2013-08-06 07:52:48 +0300 | [diff] [blame] | 138 | (unsigned long long) __entry->dma, __entry->va, |
| 139 | __entry->status, __entry->flags |
| 140 | ) |
| 141 | ); |
| 142 | |
| 143 | DEFINE_EVENT(xhci_log_event, xhci_cmd_completion, |
| 144 | TP_PROTO(void *trb_va, struct xhci_generic_trb *ev), |
| 145 | TP_ARGS(trb_va, ev) |
| 146 | ); |
| 147 | |
Xenia Ragiadakou | 84a99f6 | 2013-08-06 00:22:15 +0300 | [diff] [blame] | 148 | #endif /* __XHCI_TRACE_H */ |
| 149 | |
| 150 | /* this part must be outside header guard */ |
| 151 | |
| 152 | #undef TRACE_INCLUDE_PATH |
| 153 | #define TRACE_INCLUDE_PATH . |
| 154 | |
| 155 | #undef TRACE_INCLUDE_FILE |
| 156 | #define TRACE_INCLUDE_FILE xhci-trace |
| 157 | |
| 158 | #include <trace/define_trace.h> |