linux/drivers/usb/chipidea/trace.h

93 lines
2.4 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Trace support header file for device mode
*
* Copyright (C) 2020 NXP
*
* Author: Peter Chen <peter.chen@nxp.com>
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM chipidea
#if !defined(__LINUX_CHIPIDEA_TRACE) || defined(TRACE_HEADER_MULTI_READ)
#define __LINUX_CHIPIDEA_TRACE
#include <linux/types.h>
#include <linux/tracepoint.h>
#include <linux/usb/chipidea.h>
#include "ci.h"
#include "udc.h"
#define CHIPIDEA_MSG_MAX 500
void ci_log(struct ci_hdrc *ci, const char *fmt, ...);
TRACE_EVENT(ci_log,
TP_PROTO(struct ci_hdrc *ci, struct va_format *vaf),
TP_ARGS(ci, vaf),
TP_STRUCT__entry(
__string(name, dev_name(ci->dev))
__dynamic_array(char, msg, CHIPIDEA_MSG_MAX)
),
TP_fast_assign(
__assign_str(name, dev_name(ci->dev));
vsnprintf(__get_str(msg), CHIPIDEA_MSG_MAX, vaf->fmt, *vaf->va);
),
TP_printk("%s: %s", __get_str(name), __get_str(msg))
);
DECLARE_EVENT_CLASS(ci_log_trb,
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
TP_ARGS(hwep, hwreq, td),
TP_STRUCT__entry(
__string(name, hwep->name)
__field(struct td_node *, td)
__field(struct usb_request *, req)
__field(dma_addr_t, dma)
__field(s32, td_remaining_size)
__field(u32, next)
__field(u32, token)
__field(u32, type)
),
TP_fast_assign(
__assign_str(name, hwep->name);
__entry->req = &hwreq->req;
__entry->td = td;
__entry->dma = td->dma;
__entry->td_remaining_size = td->td_remaining_size;
usb: chipidea: trace: fix the endian issue "sparse warnings: (new ones prefixed by >>)" drivers/usb/chipidea/trace.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, drivers/usb/chipidea/trace.h): >> drivers/usb/chipidea/./trace.h:39:1: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] next @@ got restricted __le32 [usertype] next @@ >> drivers/usb/chipidea/./trace.h:39:1: sparse: expected unsigned int [usertype] next >> drivers/usb/chipidea/./trace.h:39:1: sparse: got restricted __le32 [usertype] next >> drivers/usb/chipidea/./trace.h:39:1: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] token @@ got restricted __le32 [usertype] token @@ >> drivers/usb/chipidea/./trace.h:39:1: sparse: expected unsigned int [usertype] token >> drivers/usb/chipidea/./trace.h:39:1: sparse: got restricted __le32 [usertype] token drivers/usb/chipidea/trace.c: note: in included file (through include/trace/perf.h, include/trace/define_trace.h, drivers/usb/chipidea/trace.h): >> drivers/usb/chipidea/./trace.h:39:1: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] next @@ got restricted __le32 [usertype] next @@ >> drivers/usb/chipidea/./trace.h:39:1: sparse: expected unsigned int [usertype] next >> drivers/usb/chipidea/./trace.h:39:1: sparse: got restricted __le32 [usertype] next >> drivers/usb/chipidea/./trace.h:39:1: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] token @@ got restricted __le32 [usertype] token @@ >> drivers/usb/chipidea/./trace.h:39:1: sparse: expected unsigned int [usertype] token >> drivers/usb/chipidea/./trace.h:39:1: sparse: got restricted __le32 [usertype] token Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-11-13 07:39:22 +00:00
__entry->next = le32_to_cpu(td->ptr->next);
__entry->token = le32_to_cpu(td->ptr->token);
__entry->type = usb_endpoint_type(hwep->ep.desc);
),
TP_printk("%s: req: %p, td: %p, td_dma_address: %pad, remaining_size: %d, "
"next: %x, total bytes: %d, status: %lx",
__get_str(name), __entry->req, __entry->td, &__entry->dma,
__entry->td_remaining_size, __entry->next,
(int)((__entry->token & TD_TOTAL_BYTES) >> __ffs(TD_TOTAL_BYTES)),
__entry->token & TD_STATUS
)
);
DEFINE_EVENT(ci_log_trb, ci_prepare_td,
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
TP_ARGS(hwep, hwreq, td)
);
DEFINE_EVENT(ci_log_trb, ci_complete_td,
TP_PROTO(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, struct td_node *td),
TP_ARGS(hwep, hwreq, td)
);
#endif /* __LINUX_CHIPIDEA_TRACE */
/* this part must be outside header guard */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>