2013-08-06 05:22:15 +08:00
|
|
|
/*
|
|
|
|
* xHCI host controller driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Xenia Ragiadakou
|
|
|
|
*
|
|
|
|
* Author: Xenia Ragiadakou
|
|
|
|
* Email : burzalodowa@gmail.com
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef TRACE_SYSTEM
|
|
|
|
#define TRACE_SYSTEM xhci-hcd
|
|
|
|
|
2015-04-02 02:22:01 +08:00
|
|
|
/*
|
|
|
|
* The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
|
|
|
|
* legitimate C variable. It is not exported to user space.
|
|
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM_VAR
|
|
|
|
#define TRACE_SYSTEM_VAR xhci_hcd
|
|
|
|
|
2013-08-06 05:22:15 +08:00
|
|
|
#if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define __XHCI_TRACE_H
|
|
|
|
|
|
|
|
#include <linux/tracepoint.h>
|
xhci: add xhci_address_ctx trace event
This patch defines a new event class, called xhci_log_ctx,
that records in the ring buffer the context data, the
context type (input or output), the context dma and virtual
addresses, the context endpoint entries, the slot ID and
whether the xHC uses 64 byte context data structures.
This information can be used, later, to parse and display
the context data fields with the appropriate plugin using
the trace-cmd tool.
Also, this patch defines a trace event, called xhci_address_ctx,
to trace the contexts related to the Address Device command and
adds the associated tracepoints in xhci_address_device().
Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-08-06 12:52:47 +08:00
|
|
|
#include "xhci.h"
|
2013-08-06 05:22:15 +08:00
|
|
|
|
|
|
|
#define XHCI_MSG_MAX 500
|
|
|
|
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_msg,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf),
|
|
|
|
TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)),
|
|
|
|
TP_fast_assign(
|
|
|
|
vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va);
|
|
|
|
),
|
|
|
|
TP_printk("%s", __get_str(msg))
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_address,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-07-31 12:35:27 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-08-06 12:52:45 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-08-06 12:52:46 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-08-14 11:33:54 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-08-14 11:33:55 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_init,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
2013-08-14 11:33:56 +08:00
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion,
|
|
|
|
TP_PROTO(struct va_format *vaf),
|
|
|
|
TP_ARGS(vaf)
|
|
|
|
);
|
|
|
|
|
xhci: add xhci_address_ctx trace event
This patch defines a new event class, called xhci_log_ctx,
that records in the ring buffer the context data, the
context type (input or output), the context dma and virtual
addresses, the context endpoint entries, the slot ID and
whether the xHC uses 64 byte context data structures.
This information can be used, later, to parse and display
the context data fields with the appropriate plugin using
the trace-cmd tool.
Also, this patch defines a trace event, called xhci_address_ctx,
to trace the contexts related to the Address Device command and
adds the associated tracepoints in xhci_address_device().
Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-08-06 12:52:47 +08:00
|
|
|
DECLARE_EVENT_CLASS(xhci_log_ctx,
|
|
|
|
TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
|
|
|
unsigned int ep_num),
|
|
|
|
TP_ARGS(xhci, ctx, ep_num),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(int, ctx_64)
|
|
|
|
__field(unsigned, ctx_type)
|
|
|
|
__field(dma_addr_t, ctx_dma)
|
|
|
|
__field(u8 *, ctx_va)
|
|
|
|
__field(unsigned, ctx_ep_num)
|
|
|
|
__field(int, slot_id)
|
|
|
|
__dynamic_array(u32, ctx_data,
|
|
|
|
((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) *
|
|
|
|
((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1))
|
|
|
|
),
|
|
|
|
TP_fast_assign(
|
|
|
|
struct usb_device *udev;
|
|
|
|
|
|
|
|
udev = to_usb_device(xhci_to_hcd(xhci)->self.controller);
|
|
|
|
__entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params);
|
|
|
|
__entry->ctx_type = ctx->type;
|
|
|
|
__entry->ctx_dma = ctx->dma;
|
|
|
|
__entry->ctx_va = ctx->bytes;
|
|
|
|
__entry->slot_id = udev->slot_id;
|
|
|
|
__entry->ctx_ep_num = ep_num;
|
|
|
|
memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
|
|
|
|
((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) *
|
|
|
|
((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1));
|
|
|
|
),
|
|
|
|
TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
|
|
|
|
__entry->ctx_64, __entry->ctx_type,
|
|
|
|
(unsigned long long) __entry->ctx_dma, __entry->ctx_va
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx,
|
|
|
|
TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
|
|
|
unsigned int ep_num),
|
|
|
|
TP_ARGS(xhci, ctx, ep_num)
|
|
|
|
);
|
|
|
|
|
2013-08-06 12:52:48 +08:00
|
|
|
DECLARE_EVENT_CLASS(xhci_log_event,
|
|
|
|
TP_PROTO(void *trb_va, struct xhci_generic_trb *ev),
|
|
|
|
TP_ARGS(trb_va, ev),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(void *, va)
|
|
|
|
__field(u64, dma)
|
|
|
|
__field(u32, status)
|
|
|
|
__field(u32, flags)
|
2013-09-10 02:03:12 +08:00
|
|
|
__dynamic_array(u8, trb, sizeof(struct xhci_generic_trb))
|
2013-08-06 12:52:48 +08:00
|
|
|
),
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->va = trb_va;
|
2013-09-10 02:03:11 +08:00
|
|
|
__entry->dma = ((u64)le32_to_cpu(ev->field[1])) << 32 |
|
|
|
|
le32_to_cpu(ev->field[0]);
|
2013-08-06 12:52:48 +08:00
|
|
|
__entry->status = le32_to_cpu(ev->field[2]);
|
|
|
|
__entry->flags = le32_to_cpu(ev->field[3]);
|
|
|
|
memcpy(__get_dynamic_array(trb), trb_va,
|
|
|
|
sizeof(struct xhci_generic_trb));
|
|
|
|
),
|
|
|
|
TP_printk("\ntrb_dma=@%llx, trb_va=@%p, status=%08x, flags=%08x",
|
|
|
|
(unsigned long long) __entry->dma, __entry->va,
|
|
|
|
__entry->status, __entry->flags
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(xhci_log_event, xhci_cmd_completion,
|
|
|
|
TP_PROTO(void *trb_va, struct xhci_generic_trb *ev),
|
|
|
|
TP_ARGS(trb_va, ev)
|
|
|
|
);
|
|
|
|
|
2013-08-06 05:22:15 +08:00
|
|
|
#endif /* __XHCI_TRACE_H */
|
|
|
|
|
|
|
|
/* this part must be outside header guard */
|
|
|
|
|
|
|
|
#undef TRACE_INCLUDE_PATH
|
|
|
|
#define TRACE_INCLUDE_PATH .
|
|
|
|
|
|
|
|
#undef TRACE_INCLUDE_FILE
|
|
|
|
#define TRACE_INCLUDE_FILE xhci-trace
|
|
|
|
|
|
|
|
#include <trace/define_trace.h>
|