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 17 #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 18 #define __XHCI_TRACE_H 19 20 #include <linux/tracepoint.h> 21 #include "xhci.h" 22 23 #define XHCI_MSG_MAX 500 24 25 DECLARE_EVENT_CLASS(xhci_log_msg, 26 TP_PROTO(struct va_format *vaf), 27 TP_ARGS(vaf), 28 TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)), 29 TP_fast_assign( 30 vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va); 31 ), 32 TP_printk("%s", __get_str(msg)) 33 ); 34 35 DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, 36 TP_PROTO(struct va_format *vaf), 37 TP_ARGS(vaf) 38 ); 39 40 DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change, 41 TP_PROTO(struct va_format *vaf), 42 TP_ARGS(vaf) 43 ); 44 45 DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks, 46 TP_PROTO(struct va_format *vaf), 47 TP_ARGS(vaf) 48 ); 49 50 DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep, 51 TP_PROTO(struct va_format *vaf), 52 TP_ARGS(vaf) 53 ); 54 55 DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, 56 TP_PROTO(struct va_format *vaf), 57 TP_ARGS(vaf) 58 ); 59 60 DEFINE_EVENT(xhci_log_msg, xhci_dbg_init, 61 TP_PROTO(struct va_format *vaf), 62 TP_ARGS(vaf) 63 ); 64 65 DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, 66 TP_PROTO(struct va_format *vaf), 67 TP_ARGS(vaf) 68 ); 69 70 DECLARE_EVENT_CLASS(xhci_log_ctx, 71 TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, 72 unsigned int ep_num), 73 TP_ARGS(xhci, ctx, ep_num), 74 TP_STRUCT__entry( 75 __field(int, ctx_64) 76 __field(unsigned, ctx_type) 77 __field(dma_addr_t, ctx_dma) 78 __field(u8 *, ctx_va) 79 __field(unsigned, ctx_ep_num) 80 __field(int, slot_id) 81 __dynamic_array(u32, ctx_data, 82 ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * 83 ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) 84 ), 85 TP_fast_assign( 86 struct usb_device *udev; 87 88 udev = to_usb_device(xhci_to_hcd(xhci)->self.controller); 89 __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); 90 __entry->ctx_type = ctx->type; 91 __entry->ctx_dma = ctx->dma; 92 __entry->ctx_va = ctx->bytes; 93 __entry->slot_id = udev->slot_id; 94 __entry->ctx_ep_num = ep_num; 95 memcpy(__get_dynamic_array(ctx_data), ctx->bytes, 96 ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * 97 ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)); 98 ), 99 TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p", 100 __entry->ctx_64, __entry->ctx_type, 101 (unsigned long long) __entry->ctx_dma, __entry->ctx_va 102 ) 103 ); 104 105 DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx, 106 TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, 107 unsigned int ep_num), 108 TP_ARGS(xhci, ctx, ep_num) 109 ); 110 111 DECLARE_EVENT_CLASS(xhci_log_event, 112 TP_PROTO(void *trb_va, struct xhci_generic_trb *ev), 113 TP_ARGS(trb_va, ev), 114 TP_STRUCT__entry( 115 __field(void *, va) 116 __field(u64, dma) 117 __field(u32, status) 118 __field(u32, flags) 119 __dynamic_array(u8, trb, sizeof(struct xhci_generic_trb)) 120 ), 121 TP_fast_assign( 122 __entry->va = trb_va; 123 __entry->dma = ((u64)le32_to_cpu(ev->field[1])) << 32 | 124 le32_to_cpu(ev->field[0]); 125 __entry->status = le32_to_cpu(ev->field[2]); 126 __entry->flags = le32_to_cpu(ev->field[3]); 127 memcpy(__get_dynamic_array(trb), trb_va, 128 sizeof(struct xhci_generic_trb)); 129 ), 130 TP_printk("\ntrb_dma=@%llx, trb_va=@%p, status=%08x, flags=%08x", 131 (unsigned long long) __entry->dma, __entry->va, 132 __entry->status, __entry->flags 133 ) 134 ); 135 136 DEFINE_EVENT(xhci_log_event, xhci_cmd_completion, 137 TP_PROTO(void *trb_va, struct xhci_generic_trb *ev), 138 TP_ARGS(trb_va, ev) 139 ); 140 141 #endif /* __XHCI_TRACE_H */ 142 143 /* this part must be outside header guard */ 144 145 #undef TRACE_INCLUDE_PATH 146 #define TRACE_INCLUDE_PATH . 147 148 #undef TRACE_INCLUDE_FILE 149 #define TRACE_INCLUDE_FILE xhci-trace 150 151 #include <trace/define_trace.h> 152