^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * trace.h - DesignWare USB3 DRD Controller Trace Support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Author: Felipe Balbi <balbi@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define TRACE_SYSTEM dwc3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define __DWC3_TRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) DECLARE_EVENT_CLASS(dwc3_log_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) TP_PROTO(void *base, u32 offset, u32 value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) TP_ARGS(base, offset, value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __field(void *, base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) __field(u32, offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) __field(u32, value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __entry->base = base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __entry->offset = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) __entry->value = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) TP_printk("addr %p value %08x", __entry->base + __entry->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) __entry->value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) DEFINE_EVENT(dwc3_log_io, dwc3_readl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) TP_PROTO(void __iomem *base, u32 offset, u32 value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) TP_ARGS(base, offset, value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) DEFINE_EVENT(dwc3_log_io, dwc3_writel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) TP_PROTO(void __iomem *base, u32 offset, u32 value),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) TP_ARGS(base, offset, value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DECLARE_EVENT_CLASS(dwc3_log_event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) TP_PROTO(u32 event, struct dwc3 *dwc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) TP_ARGS(event, dwc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) __field(u32, event)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __field(u32, ep0state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __dynamic_array(char, str, DWC3_MSG_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) __entry->event = event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) __entry->ep0state = dwc->ep0state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) TP_printk("event (%08x): %s", __entry->event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) dwc3_decode_event(__get_str(str), DWC3_MSG_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) __entry->event, __entry->ep0state))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) DEFINE_EVENT(dwc3_log_event, dwc3_event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) TP_PROTO(u32 event, struct dwc3 *dwc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TP_ARGS(event, dwc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) DECLARE_EVENT_CLASS(dwc3_log_ctrl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) TP_PROTO(struct usb_ctrlrequest *ctrl),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) TP_ARGS(ctrl),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __field(__u8, bRequestType)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) __field(__u8, bRequest)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) __field(__u16, wValue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __field(__u16, wIndex)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) __field(__u16, wLength)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __dynamic_array(char, str, DWC3_MSG_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __entry->bRequestType = ctrl->bRequestType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) __entry->bRequest = ctrl->bRequest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) __entry->wValue = le16_to_cpu(ctrl->wValue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) __entry->wIndex = le16_to_cpu(ctrl->wIndex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __entry->wLength = le16_to_cpu(ctrl->wLength);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) TP_printk("%s", usb_decode_ctrl(__get_str(str), DWC3_MSG_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) __entry->bRequestType,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) __entry->bRequest, __entry->wValue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) __entry->wIndex, __entry->wLength)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) TP_PROTO(struct usb_ctrlrequest *ctrl),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) TP_ARGS(ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) DECLARE_EVENT_CLASS(dwc3_log_request,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) TP_ARGS(req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) __string(name, req->dep->name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) __field(struct dwc3_request *, req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) __field(unsigned int, actual)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __field(unsigned int, length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __field(int, status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __field(int, zero)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __field(int, short_not_ok)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __field(int, no_interrupt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) __assign_str(name, req->dep->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __entry->req = req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __entry->actual = req->request.actual;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) __entry->length = req->request.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) __entry->status = req->request.status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) __entry->zero = req->request.zero;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __entry->short_not_ok = req->request.short_not_ok;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) __entry->no_interrupt = req->request.no_interrupt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) TP_printk("%s: req %p length %u/%u %s%s%s ==> %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) __get_str(name), __entry->req, __entry->actual, __entry->length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) __entry->zero ? "Z" : "z",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) __entry->short_not_ok ? "S" : "s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) __entry->no_interrupt ? "i" : "I",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __entry->status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) TP_ARGS(req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) TP_ARGS(req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) TP_ARGS(req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) TP_ARGS(req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) TP_PROTO(struct dwc3_request *req),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) TP_ARGS(req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) TP_PROTO(unsigned int cmd, u32 param, int status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) TP_ARGS(cmd, param, status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) __field(unsigned int, cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) __field(u32, param)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) __field(int, status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) __entry->cmd = cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) __entry->param = param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) __entry->status = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) TP_printk("cmd '%s' [%x] param %08x --> status: %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) dwc3_gadget_generic_cmd_string(__entry->cmd),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) __entry->cmd, __entry->param,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) dwc3_gadget_generic_cmd_status_string(__entry->status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) TP_PROTO(unsigned int cmd, u32 param, int status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) TP_ARGS(cmd, param, status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) TP_ARGS(dep, cmd, params, cmd_status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) __string(name, dep->name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) __field(unsigned int, cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __field(u32, param0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) __field(u32, param1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __field(u32, param2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) __field(int, cmd_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) __assign_str(name, dep->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) __entry->cmd = cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) __entry->param0 = params->param0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) __entry->param1 = params->param1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) __entry->param2 = params->param2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) __entry->cmd_status = cmd_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) __entry->cmd, __entry->param0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) __entry->param1, __entry->param2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) dwc3_ep_cmd_status_string(__entry->cmd_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) TP_ARGS(dep, cmd, params, cmd_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) DECLARE_EVENT_CLASS(dwc3_log_trb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) TP_ARGS(dep, trb),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) __string(name, dep->name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) __field(struct dwc3_trb *, trb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) __field(u32, allocated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) __field(u32, queued)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) __field(u32, bpl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) __field(u32, bph)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) __field(u32, size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) __field(u32, ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) __field(u32, type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) __field(u32, enqueue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) __field(u32, dequeue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) __assign_str(name, dep->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) __entry->trb = trb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) __entry->bpl = trb->bpl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) __entry->bph = trb->bph;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) __entry->size = trb->size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) __entry->ctrl = trb->ctrl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) __entry->type = usb_endpoint_type(dep->endpoint.desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) __entry->enqueue = dep->trb_enqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) __entry->dequeue = dep->trb_dequeue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) TP_printk("%s: trb %p (E%d:D%d) buf %08x%08x size %s%d ctrl %08x (%c%c%c%c:%c%c:%s)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) __get_str(name), __entry->trb, __entry->enqueue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) __entry->dequeue, __entry->bph, __entry->bpl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ({char *s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) int pcm = ((__entry->size >> 24) & 3) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) switch (__entry->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) case USB_ENDPOINT_XFER_INT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) case USB_ENDPOINT_XFER_ISOC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) switch (pcm) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) s = "1x ";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) s = "2x ";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) case 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) s = "3x ";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) s = "";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) } s; }),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) DWC3_TRB_SIZE_LENGTH(__entry->size), __entry->ctrl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __entry->ctrl & DWC3_TRB_CTRL_HWO ? 'H' : 'h',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __entry->ctrl & DWC3_TRB_CTRL_LST ? 'L' : 'l',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __entry->ctrl & DWC3_TRB_CTRL_CHN ? 'C' : 'c',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) __entry->ctrl & DWC3_TRB_CTRL_CSP ? 'S' : 's',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) __entry->ctrl & DWC3_TRB_CTRL_ISP_IMI ? 'S' : 's',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) __entry->ctrl & DWC3_TRB_CTRL_IOC ? 'C' : 'c',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) dwc3_trb_type_string(DWC3_TRBCTL_TYPE(__entry->ctrl))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) TP_ARGS(dep, trb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) TP_ARGS(dep, trb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) DECLARE_EVENT_CLASS(dwc3_log_ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) TP_PROTO(struct dwc3_ep *dep),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) TP_ARGS(dep),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) __string(name, dep->name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) __field(unsigned int, maxpacket)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) __field(unsigned int, maxpacket_limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) __field(unsigned int, max_streams)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) __field(unsigned int, maxburst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) __field(unsigned int, flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) __field(unsigned int, direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) __field(u8, trb_enqueue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) __field(u8, trb_dequeue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) __assign_str(name, dep->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) __entry->maxpacket = dep->endpoint.maxpacket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) __entry->maxpacket_limit = dep->endpoint.maxpacket_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) __entry->max_streams = dep->endpoint.max_streams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) __entry->maxburst = dep->endpoint.maxburst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) __entry->flags = dep->flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) __entry->direction = dep->direction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) __entry->trb_enqueue = dep->trb_enqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) __entry->trb_dequeue = dep->trb_dequeue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) __get_str(name), __entry->maxpacket,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) __entry->maxpacket_limit, __entry->max_streams,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) __entry->maxburst, __entry->trb_enqueue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) __entry->trb_dequeue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) __entry->flags & DWC3_EP_ENABLED ? 'E' : 'e',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) __entry->flags & DWC3_EP_STALL ? 'S' : 's',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) __entry->flags & DWC3_EP_WEDGE ? 'W' : 'w',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) __entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) __entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) __entry->direction ? '<' : '>'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) TP_PROTO(struct dwc3_ep *dep),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) TP_ARGS(dep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) TP_PROTO(struct dwc3_ep *dep),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) TP_ARGS(dep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) #endif /* __DWC3_TRACE_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* this part has to be here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) #undef TRACE_INCLUDE_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) #define TRACE_INCLUDE_PATH .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) #undef TRACE_INCLUDE_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) #define TRACE_INCLUDE_FILE trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) #include <trace/define_trace.h>