Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Cadence CDNSP DRD Driver.
0004  * Trace support header file
0005  *
0006  * Copyright (C) 2020 Cadence.
0007  *
0008  * Author: Pawel Laszczak <pawell@cadence.com>
0009  *
0010  */
0011 
0012 #undef TRACE_SYSTEM
0013 #define TRACE_SYSTEM cdnsp-dev
0014 
0015 /*
0016  * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
0017  * legitimate C variable. It is not exported to user space.
0018  */
0019 #undef TRACE_SYSTEM_VAR
0020 #define TRACE_SYSTEM_VAR cdnsp_dev
0021 
0022 #if !defined(__CDNSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
0023 #define __CDNSP_DEV_TRACE_H
0024 
0025 #include <linux/tracepoint.h>
0026 #include "cdnsp-gadget.h"
0027 #include "cdnsp-debug.h"
0028 
0029 /*
0030  * There is limitation for single buffer size in TRACEPOINT subsystem.
0031  * By default TRACE_BUF_SIZE is 1024, so no all data will be logged.
0032  * To show more data this must be increased. In most cases the default
0033  * value is sufficient.
0034  */
0035 #define CDNSP_MSG_MAX 500
0036 
0037 DECLARE_EVENT_CLASS(cdnsp_log_ep,
0038     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0039     TP_ARGS(pep, stream_id),
0040     TP_STRUCT__entry(
0041         __string(name, pep->name)
0042         __field(unsigned int, state)
0043         __field(u32, stream_id)
0044         __field(u8, enabled)
0045         __field(unsigned int, num_streams)
0046         __field(int, td_count)
0047         __field(u8, first_prime_det)
0048         __field(u8, drbls_count)
0049     ),
0050     TP_fast_assign(
0051         __assign_str(name, pep->name);
0052         __entry->state = pep->ep_state;
0053         __entry->stream_id = stream_id;
0054         __entry->enabled = pep->ep_state & EP_HAS_STREAMS;
0055         __entry->num_streams = pep->stream_info.num_streams;
0056         __entry->td_count = pep->stream_info.td_count;
0057         __entry->first_prime_det = pep->stream_info.first_prime_det;
0058         __entry->drbls_count = pep->stream_info.drbls_count;
0059     ),
0060     TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d "
0061           "tds %d, first prime: %d drbls %d",
0062           __get_str(name), __entry->stream_id, __entry->state,
0063           __entry->enabled, __entry->num_streams, __entry->td_count,
0064           __entry->first_prime_det, __entry->drbls_count)
0065 );
0066 
0067 DEFINE_EVENT(cdnsp_log_ep, cdnsp_tr_drbl,
0068     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0069     TP_ARGS(pep, stream_id)
0070 );
0071 
0072 DEFINE_EVENT(cdnsp_log_ep, cdnsp_wait_for_prime,
0073     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0074     TP_ARGS(pep, stream_id)
0075 );
0076 
0077 DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_list_empty_with_skip,
0078     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0079     TP_ARGS(pep, stream_id)
0080 );
0081 
0082 DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_enable_end,
0083     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0084     TP_ARGS(pep, stream_id)
0085 );
0086 
0087 DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_disable_end,
0088     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0089     TP_ARGS(pep, stream_id)
0090 );
0091 
0092 DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_busy_try_halt_again,
0093     TP_PROTO(struct cdnsp_ep *pep, u32 stream_id),
0094     TP_ARGS(pep, stream_id)
0095 );
0096 
0097 DECLARE_EVENT_CLASS(cdnsp_log_enable_disable,
0098     TP_PROTO(int set),
0099     TP_ARGS(set),
0100     TP_STRUCT__entry(
0101         __field(int, set)
0102     ),
0103     TP_fast_assign(
0104         __entry->set = set;
0105     ),
0106     TP_printk("%s", __entry->set ? "enabled" : "disabled")
0107 );
0108 
0109 DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_pullup,
0110     TP_PROTO(int set),
0111     TP_ARGS(set)
0112 );
0113 
0114 DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u1,
0115     TP_PROTO(int set),
0116     TP_ARGS(set)
0117 );
0118 
0119 DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u2,
0120     TP_PROTO(int set),
0121     TP_ARGS(set)
0122 );
0123 
0124 DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_lpm,
0125     TP_PROTO(int set),
0126     TP_ARGS(set)
0127 );
0128 
0129 DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_may_wakeup,
0130     TP_PROTO(int set),
0131     TP_ARGS(set)
0132 );
0133 
0134 DECLARE_EVENT_CLASS(cdnsp_log_simple,
0135     TP_PROTO(char *msg),
0136     TP_ARGS(msg),
0137     TP_STRUCT__entry(
0138         __string(text, msg)
0139     ),
0140     TP_fast_assign(
0141         __assign_str(text, msg);
0142     ),
0143     TP_printk("%s", __get_str(text))
0144 );
0145 
0146 DEFINE_EVENT(cdnsp_log_simple, cdnsp_exit,
0147     TP_PROTO(char *msg),
0148     TP_ARGS(msg)
0149 );
0150 
0151 DEFINE_EVENT(cdnsp_log_simple, cdnsp_init,
0152     TP_PROTO(char *msg),
0153     TP_ARGS(msg)
0154 );
0155 
0156 DEFINE_EVENT(cdnsp_log_simple, cdnsp_slot_id,
0157     TP_PROTO(char *msg),
0158     TP_ARGS(msg)
0159 );
0160 
0161 DEFINE_EVENT(cdnsp_log_simple, cdnsp_no_room_on_ring,
0162     TP_PROTO(char *msg),
0163     TP_ARGS(msg)
0164 );
0165 
0166 DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_status_stage,
0167     TP_PROTO(char *msg),
0168     TP_ARGS(msg)
0169 );
0170 
0171 DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_request,
0172     TP_PROTO(char *msg),
0173     TP_ARGS(msg)
0174 );
0175 
0176 DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_set_config,
0177     TP_PROTO(char *msg),
0178     TP_ARGS(msg)
0179 );
0180 
0181 DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_halted,
0182     TP_PROTO(char *msg),
0183     TP_ARGS(msg)
0184 );
0185 
0186 DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep_halt,
0187     TP_PROTO(char *msg),
0188     TP_ARGS(msg)
0189 );
0190 
0191 TRACE_EVENT(cdnsp_looking_trb_in_td,
0192     TP_PROTO(dma_addr_t suspect, dma_addr_t trb_start, dma_addr_t trb_end,
0193          dma_addr_t curr_seg, dma_addr_t end_seg),
0194     TP_ARGS(suspect, trb_start, trb_end, curr_seg, end_seg),
0195     TP_STRUCT__entry(
0196         __field(dma_addr_t, suspect)
0197         __field(dma_addr_t, trb_start)
0198         __field(dma_addr_t, trb_end)
0199         __field(dma_addr_t, curr_seg)
0200         __field(dma_addr_t, end_seg)
0201     ),
0202     TP_fast_assign(
0203         __entry->suspect = suspect;
0204         __entry->trb_start = trb_start;
0205         __entry->trb_end = trb_end;
0206         __entry->curr_seg = curr_seg;
0207         __entry->end_seg = end_seg;
0208     ),
0209     TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, "
0210           "seg-start %pad, seg-end %pad",
0211           &__entry->suspect, &__entry->trb_start, &__entry->trb_end,
0212           &__entry->curr_seg, &__entry->end_seg)
0213 );
0214 
0215 TRACE_EVENT(cdnsp_port_info,
0216     TP_PROTO(__le32 __iomem *addr, u32 offset, u32 count, u32 rev),
0217     TP_ARGS(addr, offset, count, rev),
0218     TP_STRUCT__entry(
0219         __field(__le32 __iomem *, addr)
0220         __field(u32, offset)
0221         __field(u32, count)
0222         __field(u32, rev)
0223     ),
0224     TP_fast_assign(
0225         __entry->addr = addr;
0226         __entry->offset = offset;
0227         __entry->count = count;
0228         __entry->rev = rev;
0229     ),
0230     TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x",
0231           __entry->addr, __entry->offset, __entry->count, __entry->rev)
0232 );
0233 
0234 DECLARE_EVENT_CLASS(cdnsp_log_deq_state,
0235     TP_PROTO(struct cdnsp_dequeue_state *state),
0236     TP_ARGS(state),
0237     TP_STRUCT__entry(
0238         __field(int, new_cycle_state)
0239         __field(struct cdnsp_segment *, new_deq_seg)
0240         __field(dma_addr_t, deq_seg_dma)
0241         __field(union cdnsp_trb *, new_deq_ptr)
0242         __field(dma_addr_t, deq_ptr_dma)
0243     ),
0244     TP_fast_assign(
0245         __entry->new_cycle_state = state->new_cycle_state;
0246         __entry->new_deq_seg = state->new_deq_seg;
0247         __entry->deq_seg_dma = state->new_deq_seg->dma;
0248         __entry->new_deq_ptr = state->new_deq_ptr,
0249         __entry->deq_ptr_dma = cdnsp_trb_virt_to_dma(state->new_deq_seg,
0250                                  state->new_deq_ptr);
0251     ),
0252     TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), "
0253           "New dequeue pointer = %p (0x%pad dma)",
0254           __entry->new_cycle_state, __entry->new_deq_seg,
0255           &__entry->deq_seg_dma, __entry->new_deq_ptr,
0256           &__entry->deq_ptr_dma
0257     )
0258 );
0259 
0260 DEFINE_EVENT(cdnsp_log_deq_state, cdnsp_new_deq_state,
0261     TP_PROTO(struct cdnsp_dequeue_state *state),
0262     TP_ARGS(state)
0263 );
0264 
0265 DECLARE_EVENT_CLASS(cdnsp_log_ctrl,
0266     TP_PROTO(struct usb_ctrlrequest *ctrl),
0267     TP_ARGS(ctrl),
0268     TP_STRUCT__entry(
0269         __field(u8, bRequestType)
0270         __field(u8, bRequest)
0271         __field(u16, wValue)
0272         __field(u16, wIndex)
0273         __field(u16, wLength)
0274         __dynamic_array(char, str, CDNSP_MSG_MAX)
0275     ),
0276     TP_fast_assign(
0277         __entry->bRequestType = ctrl->bRequestType;
0278         __entry->bRequest = ctrl->bRequest;
0279         __entry->wValue = le16_to_cpu(ctrl->wValue);
0280         __entry->wIndex = le16_to_cpu(ctrl->wIndex);
0281         __entry->wLength = le16_to_cpu(ctrl->wLength);
0282     ),
0283     TP_printk("%s", usb_decode_ctrl(__get_str(str), CDNSP_MSG_MAX,
0284                     __entry->bRequestType,
0285                     __entry->bRequest, __entry->wValue,
0286                     __entry->wIndex, __entry->wLength)
0287     )
0288 );
0289 
0290 DEFINE_EVENT(cdnsp_log_ctrl, cdnsp_ctrl_req,
0291     TP_PROTO(struct usb_ctrlrequest *ctrl),
0292     TP_ARGS(ctrl)
0293 );
0294 
0295 DECLARE_EVENT_CLASS(cdnsp_log_bounce,
0296     TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
0297          dma_addr_t dma, unsigned int unalign),
0298     TP_ARGS(preq, new_buf_len, offset, dma, unalign),
0299     TP_STRUCT__entry(
0300         __string(name, preq->pep->name)
0301         __field(u32, new_buf_len)
0302         __field(u32, offset)
0303         __field(dma_addr_t, dma)
0304         __field(unsigned int, unalign)
0305     ),
0306     TP_fast_assign(
0307         __assign_str(name, preq->pep->name);
0308         __entry->new_buf_len = new_buf_len;
0309         __entry->offset = offset;
0310         __entry->dma = dma;
0311         __entry->unalign = unalign;
0312     ),
0313     TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d",
0314           __get_str(name), __entry->new_buf_len,
0315           __entry->offset, &__entry->dma, __entry->unalign
0316     )
0317 );
0318 
0319 DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_align_td_split,
0320     TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
0321          dma_addr_t dma, unsigned int unalign),
0322     TP_ARGS(preq, new_buf_len, offset, dma, unalign)
0323 );
0324 
0325 DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_map,
0326     TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
0327          dma_addr_t dma, unsigned int unalign),
0328     TP_ARGS(preq, new_buf_len, offset, dma, unalign)
0329 );
0330 
0331 DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_unmap,
0332     TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset,
0333          dma_addr_t dma, unsigned int unalign),
0334     TP_ARGS(preq, new_buf_len, offset, dma, unalign)
0335 );
0336 
0337 DECLARE_EVENT_CLASS(cdnsp_log_trb,
0338     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0339     TP_ARGS(ring, trb),
0340     TP_STRUCT__entry(
0341         __field(u32, type)
0342         __field(u32, field0)
0343         __field(u32, field1)
0344         __field(u32, field2)
0345         __field(u32, field3)
0346         __field(union cdnsp_trb *, trb)
0347         __field(dma_addr_t, trb_dma)
0348         __dynamic_array(char, str, CDNSP_MSG_MAX)
0349     ),
0350     TP_fast_assign(
0351         __entry->type = ring->type;
0352         __entry->field0 = le32_to_cpu(trb->field[0]);
0353         __entry->field1 = le32_to_cpu(trb->field[1]);
0354         __entry->field2 = le32_to_cpu(trb->field[2]);
0355         __entry->field3 = le32_to_cpu(trb->field[3]);
0356         __entry->trb = (union cdnsp_trb *)trb;
0357         __entry->trb_dma = cdnsp_trb_virt_to_dma(ring->deq_seg,
0358                              (union cdnsp_trb *)trb);
0359 
0360     ),
0361     TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry->type),
0362           cdnsp_decode_trb(__get_str(str), CDNSP_MSG_MAX,
0363                    __entry->field0, __entry->field1,
0364                    __entry->field2, __entry->field3),
0365                    __entry->trb, &__entry->trb_dma
0366     )
0367 );
0368 
0369 DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_event,
0370     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0371     TP_ARGS(ring, trb)
0372 );
0373 
0374 DEFINE_EVENT(cdnsp_log_trb, cdnsp_trb_without_td,
0375     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0376     TP_ARGS(ring, trb)
0377 );
0378 
0379 DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_command,
0380     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0381     TP_ARGS(ring, trb)
0382 );
0383 
0384 DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_transfer,
0385     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0386     TP_ARGS(ring, trb)
0387 );
0388 
0389 DEFINE_EVENT(cdnsp_log_trb, cdnsp_queue_trb,
0390     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0391     TP_ARGS(ring, trb)
0392 );
0393 
0394 DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_wait_for_compl,
0395     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0396     TP_ARGS(ring, trb)
0397 );
0398 
0399 DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_timeout,
0400     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0401     TP_ARGS(ring, trb)
0402 );
0403 
0404 DEFINE_EVENT(cdnsp_log_trb, cdnsp_defered_event,
0405     TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb),
0406     TP_ARGS(ring, trb)
0407 );
0408 
0409 DECLARE_EVENT_CLASS(cdnsp_log_pdev,
0410     TP_PROTO(struct cdnsp_device *pdev),
0411     TP_ARGS(pdev),
0412     TP_STRUCT__entry(
0413         __field(struct cdnsp_device *, pdev)
0414         __field(struct usb_gadget *, gadget)
0415         __field(dma_addr_t, out_ctx)
0416         __field(dma_addr_t, in_ctx)
0417         __field(u8, port_num)
0418     ),
0419     TP_fast_assign(
0420         __entry->pdev = pdev;
0421         __entry->gadget = &pdev->gadget;
0422         __entry->in_ctx = pdev->in_ctx.dma;
0423         __entry->out_ctx = pdev->out_ctx.dma;
0424         __entry->port_num = pdev->active_port ?
0425                 pdev->active_port->port_num : 0xFF;
0426     ),
0427     TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ",
0428           __entry->pdev, __entry->gadget, &__entry->in_ctx,
0429           &__entry->out_ctx, __entry->port_num
0430     )
0431 );
0432 
0433 DEFINE_EVENT(cdnsp_log_pdev, cdnsp_alloc_priv_device,
0434     TP_PROTO(struct cdnsp_device *vdev),
0435     TP_ARGS(vdev)
0436 );
0437 
0438 DEFINE_EVENT(cdnsp_log_pdev, cdnsp_free_priv_device,
0439     TP_PROTO(struct cdnsp_device *vdev),
0440     TP_ARGS(vdev)
0441 );
0442 
0443 DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_device,
0444     TP_PROTO(struct cdnsp_device *vdev),
0445     TP_ARGS(vdev)
0446 );
0447 
0448 DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_addressable_priv_device,
0449     TP_PROTO(struct cdnsp_device *vdev),
0450     TP_ARGS(vdev)
0451 );
0452 
0453 DECLARE_EVENT_CLASS(cdnsp_log_request,
0454     TP_PROTO(struct cdnsp_request *req),
0455     TP_ARGS(req),
0456     TP_STRUCT__entry(
0457         __string(name, req->pep->name)
0458         __field(struct usb_request *, request)
0459         __field(struct cdnsp_request *, preq)
0460         __field(void *, buf)
0461         __field(unsigned int, actual)
0462         __field(unsigned int, length)
0463         __field(int, status)
0464         __field(dma_addr_t, dma)
0465         __field(unsigned int, stream_id)
0466         __field(unsigned int, zero)
0467         __field(unsigned int, short_not_ok)
0468         __field(unsigned int, no_interrupt)
0469         __field(struct scatterlist*, sg)
0470         __field(unsigned int, num_sgs)
0471         __field(unsigned int, num_mapped_sgs)
0472 
0473     ),
0474     TP_fast_assign(
0475         __assign_str(name, req->pep->name);
0476         __entry->request = &req->request;
0477         __entry->preq = req;
0478         __entry->buf = req->request.buf;
0479         __entry->actual = req->request.actual;
0480         __entry->length = req->request.length;
0481         __entry->status = req->request.status;
0482         __entry->dma = req->request.dma;
0483         __entry->stream_id = req->request.stream_id;
0484         __entry->zero = req->request.zero;
0485         __entry->short_not_ok = req->request.short_not_ok;
0486         __entry->no_interrupt = req->request.no_interrupt;
0487         __entry->sg = req->request.sg;
0488         __entry->num_sgs = req->request.num_sgs;
0489         __entry->num_mapped_sgs = req->request.num_mapped_sgs;
0490     ),
0491     TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, "
0492           "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d,"
0493           " num_m_sg %d",
0494           __get_str(name), __entry->request, __entry->preq,
0495           __entry->buf, __entry->actual, __entry->length,
0496           __entry->status, &__entry->dma,
0497           __entry->stream_id, __entry->zero ? "Z" : "z",
0498           __entry->short_not_ok ? "S" : "s",
0499           __entry->no_interrupt ? "I" : "i",
0500           __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs
0501         )
0502 );
0503 
0504 DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue,
0505     TP_PROTO(struct cdnsp_request *req),
0506     TP_ARGS(req)
0507 );
0508 
0509 DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_busy,
0510     TP_PROTO(struct cdnsp_request *req),
0511     TP_ARGS(req)
0512 );
0513 
0514 DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_error,
0515     TP_PROTO(struct cdnsp_request *req),
0516     TP_ARGS(req)
0517 );
0518 
0519 DEFINE_EVENT(cdnsp_log_request, cdnsp_request_dequeue,
0520     TP_PROTO(struct cdnsp_request *req),
0521     TP_ARGS(req)
0522 );
0523 
0524 DEFINE_EVENT(cdnsp_log_request, cdnsp_request_giveback,
0525     TP_PROTO(struct cdnsp_request *req),
0526     TP_ARGS(req)
0527 );
0528 
0529 DEFINE_EVENT(cdnsp_log_request, cdnsp_alloc_request,
0530     TP_PROTO(struct cdnsp_request *req),
0531     TP_ARGS(req)
0532 );
0533 
0534 DEFINE_EVENT(cdnsp_log_request, cdnsp_free_request,
0535     TP_PROTO(struct cdnsp_request *req),
0536     TP_ARGS(req)
0537 );
0538 
0539 DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx,
0540     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0541     TP_ARGS(ctx),
0542     TP_STRUCT__entry(
0543         __field(u32, info)
0544         __field(u32, info2)
0545         __field(u64, deq)
0546         __field(u32, tx_info)
0547         __dynamic_array(char, str, CDNSP_MSG_MAX)
0548     ),
0549     TP_fast_assign(
0550         __entry->info = le32_to_cpu(ctx->ep_info);
0551         __entry->info2 = le32_to_cpu(ctx->ep_info2);
0552         __entry->deq = le64_to_cpu(ctx->deq);
0553         __entry->tx_info = le32_to_cpu(ctx->tx_info);
0554     ),
0555     TP_printk("%s", cdnsp_decode_ep_context(__get_str(str), CDNSP_MSG_MAX,
0556                         __entry->info, __entry->info2,
0557                         __entry->deq, __entry->tx_info)
0558     )
0559 );
0560 
0561 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_disabled,
0562     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0563     TP_ARGS(ctx)
0564 );
0565 
0566 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_stopped_or_disabled,
0567     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0568     TP_ARGS(ctx)
0569 );
0570 
0571 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_remove_request,
0572     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0573     TP_ARGS(ctx)
0574 );
0575 
0576 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_stop_ep,
0577     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0578     TP_ARGS(ctx)
0579 );
0580 
0581 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_flush_ep,
0582     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0583     TP_ARGS(ctx)
0584 );
0585 
0586 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_set_deq_ep,
0587     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0588     TP_ARGS(ctx)
0589 );
0590 
0591 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_reset_ep,
0592     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0593     TP_ARGS(ctx)
0594 );
0595 
0596 DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_config_ep,
0597     TP_PROTO(struct cdnsp_ep_ctx *ctx),
0598     TP_ARGS(ctx)
0599 );
0600 
0601 DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx,
0602     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0603     TP_ARGS(ctx),
0604     TP_STRUCT__entry(
0605         __field(u32, info)
0606         __field(u32, info2)
0607         __field(u32, int_target)
0608         __field(u32, state)
0609     ),
0610     TP_fast_assign(
0611         __entry->info = le32_to_cpu(ctx->dev_info);
0612         __entry->info2 = le32_to_cpu(ctx->dev_port);
0613         __entry->int_target = le32_to_cpu(ctx->int_target);
0614         __entry->state = le32_to_cpu(ctx->dev_state);
0615     ),
0616     TP_printk("%s", cdnsp_decode_slot_context(__entry->info,
0617                           __entry->info2,
0618                           __entry->int_target,
0619                           __entry->state)
0620     )
0621 );
0622 
0623 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_slot_already_in_default,
0624     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0625     TP_ARGS(ctx)
0626 );
0627 
0628 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_enable_slot,
0629     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0630     TP_ARGS(ctx)
0631 );
0632 
0633 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_disable_slot,
0634     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0635     TP_ARGS(ctx)
0636 );
0637 
0638 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_reset_device,
0639     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0640     TP_ARGS(ctx)
0641 );
0642 
0643 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_setup_device_slot,
0644     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0645     TP_ARGS(ctx)
0646 );
0647 
0648 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_addr_dev,
0649     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0650     TP_ARGS(ctx)
0651 );
0652 
0653 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_reset_dev,
0654     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0655     TP_ARGS(ctx)
0656 );
0657 
0658 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_set_deq,
0659     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0660     TP_ARGS(ctx)
0661 );
0662 
0663 DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_configure_endpoint,
0664     TP_PROTO(struct cdnsp_slot_ctx *ctx),
0665     TP_ARGS(ctx)
0666 );
0667 
0668 DECLARE_EVENT_CLASS(cdnsp_log_td_info,
0669     TP_PROTO(struct cdnsp_request *preq),
0670     TP_ARGS(preq),
0671     TP_STRUCT__entry(
0672         __string(name, preq->pep->name)
0673         __field(struct usb_request *, request)
0674         __field(struct cdnsp_request *, preq)
0675         __field(union cdnsp_trb *, first_trb)
0676         __field(union cdnsp_trb *, last_trb)
0677         __field(dma_addr_t, trb_dma)
0678     ),
0679     TP_fast_assign(
0680         __assign_str(name, preq->pep->name);
0681         __entry->request = &preq->request;
0682         __entry->preq = preq;
0683         __entry->first_trb = preq->td.first_trb;
0684         __entry->last_trb = preq->td.last_trb;
0685         __entry->trb_dma = cdnsp_trb_virt_to_dma(preq->td.start_seg,
0686                              preq->td.first_trb)
0687     ),
0688     TP_printk("%s req/preq:  %p/%p, first trb %p[vir]/%pad(dma), last trb %p",
0689           __get_str(name), __entry->request, __entry->preq,
0690           __entry->first_trb, &__entry->trb_dma,
0691           __entry->last_trb
0692         )
0693 );
0694 
0695 DEFINE_EVENT(cdnsp_log_td_info, cdnsp_remove_request_td,
0696     TP_PROTO(struct cdnsp_request *preq),
0697     TP_ARGS(preq)
0698 );
0699 
0700 DECLARE_EVENT_CLASS(cdnsp_log_ring,
0701     TP_PROTO(struct cdnsp_ring *ring),
0702     TP_ARGS(ring),
0703     TP_STRUCT__entry(
0704         __field(u32, type)
0705         __field(void *, ring)
0706         __field(dma_addr_t, enq)
0707         __field(dma_addr_t, deq)
0708         __field(dma_addr_t, enq_seg)
0709         __field(dma_addr_t, deq_seg)
0710         __field(unsigned int, num_segs)
0711         __field(unsigned int, stream_id)
0712         __field(unsigned int, cycle_state)
0713         __field(unsigned int, num_trbs_free)
0714         __field(unsigned int, bounce_buf_len)
0715     ),
0716     TP_fast_assign(
0717         __entry->ring = ring;
0718         __entry->type = ring->type;
0719         __entry->num_segs = ring->num_segs;
0720         __entry->stream_id = ring->stream_id;
0721         __entry->enq_seg = ring->enq_seg->dma;
0722         __entry->deq_seg = ring->deq_seg->dma;
0723         __entry->cycle_state = ring->cycle_state;
0724         __entry->num_trbs_free = ring->num_trbs_free;
0725         __entry->bounce_buf_len = ring->bounce_buf_len;
0726         __entry->enq = cdnsp_trb_virt_to_dma(ring->enq_seg,
0727                              ring->enqueue);
0728         __entry->deq = cdnsp_trb_virt_to_dma(ring->deq_seg,
0729                              ring->dequeue);
0730     ),
0731     TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d"
0732           " free_trbs %d bounce %d cycle %d",
0733           cdnsp_ring_type_string(__entry->type), __entry->ring,
0734           &__entry->enq, &__entry->enq_seg,
0735           &__entry->deq, &__entry->deq_seg,
0736           __entry->num_segs,
0737           __entry->stream_id,
0738           __entry->num_trbs_free,
0739           __entry->bounce_buf_len,
0740           __entry->cycle_state
0741         )
0742 );
0743 
0744 DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_alloc,
0745     TP_PROTO(struct cdnsp_ring *ring),
0746     TP_ARGS(ring)
0747 );
0748 
0749 DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_free,
0750     TP_PROTO(struct cdnsp_ring *ring),
0751     TP_ARGS(ring)
0752 );
0753 
0754 DEFINE_EVENT(cdnsp_log_ring, cdnsp_set_stream_ring,
0755     TP_PROTO(struct cdnsp_ring *ring),
0756     TP_ARGS(ring)
0757 );
0758 
0759 DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_expansion,
0760     TP_PROTO(struct cdnsp_ring *ring),
0761     TP_ARGS(ring)
0762 );
0763 
0764 DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_enq,
0765     TP_PROTO(struct cdnsp_ring *ring),
0766     TP_ARGS(ring)
0767 );
0768 
0769 DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_deq,
0770     TP_PROTO(struct cdnsp_ring *ring),
0771     TP_ARGS(ring)
0772 );
0773 
0774 DECLARE_EVENT_CLASS(cdnsp_log_portsc,
0775         TP_PROTO(u32 portnum, u32 portsc),
0776         TP_ARGS(portnum, portsc),
0777         TP_STRUCT__entry(
0778                 __field(u32, portnum)
0779                 __field(u32, portsc)
0780                 __dynamic_array(char, str, CDNSP_MSG_MAX)
0781                 ),
0782         TP_fast_assign(
0783                 __entry->portnum = portnum;
0784                 __entry->portsc = portsc;
0785                 ),
0786         TP_printk("port-%d: %s",
0787               __entry->portnum,
0788               cdnsp_decode_portsc(__get_str(str), CDNSP_MSG_MAX,
0789                           __entry->portsc)
0790             )
0791 );
0792 
0793 DEFINE_EVENT(cdnsp_log_portsc, cdnsp_handle_port_status,
0794         TP_PROTO(u32 portnum, u32 portsc),
0795         TP_ARGS(portnum, portsc)
0796 );
0797 
0798 DEFINE_EVENT(cdnsp_log_portsc, cdnsp_link_state_changed,
0799         TP_PROTO(u32 portnum, u32 portsc),
0800         TP_ARGS(portnum, portsc)
0801 );
0802 
0803 TRACE_EVENT(cdnsp_stream_number,
0804     TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams),
0805     TP_ARGS(pep, num_stream_ctxs, num_streams),
0806     TP_STRUCT__entry(
0807         __string(name, pep->name)
0808         __field(int, num_stream_ctxs)
0809         __field(int, num_streams)
0810     ),
0811     TP_fast_assign(
0812         __entry->num_stream_ctxs = num_stream_ctxs;
0813         __entry->num_streams = num_streams;
0814     ),
0815     TP_printk("%s Need %u stream ctx entries for %u stream IDs.",
0816           __get_str(name), __entry->num_stream_ctxs,
0817           __entry->num_streams)
0818 );
0819 
0820 #endif /* __CDNSP_TRACE_H */
0821 
0822 /* this part must be outside header guard */
0823 
0824 #undef TRACE_INCLUDE_PATH
0825 #define TRACE_INCLUDE_PATH .
0826 
0827 #undef TRACE_INCLUDE_FILE
0828 #define TRACE_INCLUDE_FILE cdnsp-trace
0829 
0830 #include <trace/define_trace.h>