| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* Cadence CDNSP DRD Driver. |
| 4 |
* Trace support header file |
| 5 |
* |
| 6 |
* Copyright (C) 2020 Cadence. |
| 7 |
* |
| 8 |
* Author: Pawel Laszczak <[email protected]> |
| 9 |
* |
| 10 |
*/ |
| 11 |
|
| 12 |
#undef TRACE_SYSTEM |
| 13 |
#define TRACE_SYSTEM cdnsp-dev |
| 14 |
|
| 15 |
/* |
| 16 |
* The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a |
| 17 |
* legitimate C variable. It is not exported to user space. |
| 18 |
*/ |
| 19 |
#undef TRACE_SYSTEM_VAR |
| 20 |
#define TRACE_SYSTEM_VAR cdnsp_dev |
| 21 |
|
| 22 |
#if !defined(__CDNSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 23 |
#define __CDNSP_DEV_TRACE_H |
| 24 |
|
| 25 |
#include <linux/tracepoint.h> |
| 26 |
#include "cdnsp-gadget.h" |
| 27 |
#include "cdnsp-debug.h" |
| 28 |
|
| 29 |
/* |
| 30 |
* There is limitation for single buffer size in TRACEPOINT subsystem. |
| 31 |
* By default TRACE_BUF_SIZE is 1024, so no all data will be logged. |
| 32 |
* To show more data this must be increased. In most cases the default |
| 33 |
* value is sufficient. |
| 34 |
*/ |
| 35 |
#define CDNSP_MSG_MAX 500 |
| 36 |
|
| 37 |
DECLARE_EVENT_CLASS(cdnsp_log_ep, |
| 38 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 39 |
TP_ARGS(pep, stream_id), |
| 40 |
TP_STRUCT__entry( |
| 41 |
__string(name, pep->name) |
| 42 |
__field(unsigned int, state) |
| 43 |
__field(u32, stream_id) |
| 44 |
__field(u8, enabled) |
| 45 |
__field(unsigned int, num_streams) |
| 46 |
__field(int, td_count) |
| 47 |
__field(u8, first_prime_det) |
| 48 |
__field(u8, drbls_count) |
| 49 |
), |
| 50 |
TP_fast_assign( |
| 51 |
__assign_str(name); |
| 52 |
__entry->state = pep->ep_state; |
| 53 |
__entry->stream_id = stream_id; |
| 54 |
__entry->enabled = pep->ep_state & EP_HAS_STREAMS; |
| 55 |
__entry->num_streams = pep->stream_info.num_streams; |
| 56 |
__entry->td_count = pep->stream_info.td_count; |
| 57 |
__entry->first_prime_det = pep->stream_info.first_prime_det; |
| 58 |
__entry->drbls_count = pep->stream_info.drbls_count; |
| 59 |
), |
| 60 |
TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d " |
| 61 |
"tds %d, first prime: %d drbls %d", |
| 62 |
__get_str(name), __entry->stream_id, __entry->state, |
| 63 |
__entry->enabled, __entry->num_streams, __entry->td_count, |
| 64 |
__entry->first_prime_det, __entry->drbls_count) |
| 65 |
); |
| 66 |
|
| 67 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_tr_drbl, |
| 68 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 69 |
TP_ARGS(pep, stream_id) |
| 70 |
); |
| 71 |
|
| 72 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_wait_for_prime, |
| 73 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 74 |
TP_ARGS(pep, stream_id) |
| 75 |
); |
| 76 |
|
| 77 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_list_empty_with_skip, |
| 78 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 79 |
TP_ARGS(pep, stream_id) |
| 80 |
); |
| 81 |
|
| 82 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_enable_end, |
| 83 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 84 |
TP_ARGS(pep, stream_id) |
| 85 |
); |
| 86 |
|
| 87 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_disable_end, |
| 88 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 89 |
TP_ARGS(pep, stream_id) |
| 90 |
); |
| 91 |
|
| 92 |
DEFINE_EVENT(cdnsp_log_ep, cdnsp_ep_busy_try_halt_again, |
| 93 |
TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), |
| 94 |
TP_ARGS(pep, stream_id) |
| 95 |
); |
| 96 |
|
| 97 |
DECLARE_EVENT_CLASS(cdnsp_log_enable_disable, |
| 98 |
TP_PROTO(int set), |
| 99 |
TP_ARGS(set), |
| 100 |
TP_STRUCT__entry( |
| 101 |
__field(int, set) |
| 102 |
), |
| 103 |
TP_fast_assign( |
| 104 |
__entry->set = set; |
| 105 |
), |
| 106 |
TP_printk("%s", __entry->set ? "enabled" : "disabled") |
| 107 |
); |
| 108 |
|
| 109 |
DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_pullup, |
| 110 |
TP_PROTO(int set), |
| 111 |
TP_ARGS(set) |
| 112 |
); |
| 113 |
|
| 114 |
DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u1, |
| 115 |
TP_PROTO(int set), |
| 116 |
TP_ARGS(set) |
| 117 |
); |
| 118 |
|
| 119 |
DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_u2, |
| 120 |
TP_PROTO(int set), |
| 121 |
TP_ARGS(set) |
| 122 |
); |
| 123 |
|
| 124 |
DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_lpm, |
| 125 |
TP_PROTO(int set), |
| 126 |
TP_ARGS(set) |
| 127 |
); |
| 128 |
|
| 129 |
DEFINE_EVENT(cdnsp_log_enable_disable, cdnsp_may_wakeup, |
| 130 |
TP_PROTO(int set), |
| 131 |
TP_ARGS(set) |
| 132 |
); |
| 133 |
|
| 134 |
DECLARE_EVENT_CLASS(cdnsp_log_simple, |
| 135 |
TP_PROTO(char *msg), |
| 136 |
TP_ARGS(msg), |
| 137 |
TP_STRUCT__entry( |
| 138 |
__string(text, msg) |
| 139 |
), |
| 140 |
TP_fast_assign( |
| 141 |
__assign_str(text); |
| 142 |
), |
| 143 |
TP_printk("%s", __get_str(text)) |
| 144 |
); |
| 145 |
|
| 146 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_exit, |
| 147 |
TP_PROTO(char *msg), |
| 148 |
TP_ARGS(msg) |
| 149 |
); |
| 150 |
|
| 151 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_init, |
| 152 |
TP_PROTO(char *msg), |
| 153 |
TP_ARGS(msg) |
| 154 |
); |
| 155 |
|
| 156 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_slot_id, |
| 157 |
TP_PROTO(char *msg), |
| 158 |
TP_ARGS(msg) |
| 159 |
); |
| 160 |
|
| 161 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_no_room_on_ring, |
| 162 |
TP_PROTO(char *msg), |
| 163 |
TP_ARGS(msg) |
| 164 |
); |
| 165 |
|
| 166 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_status_stage, |
| 167 |
TP_PROTO(char *msg), |
| 168 |
TP_ARGS(msg) |
| 169 |
); |
| 170 |
|
| 171 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_request, |
| 172 |
TP_PROTO(char *msg), |
| 173 |
TP_ARGS(msg) |
| 174 |
); |
| 175 |
|
| 176 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep0_set_config, |
| 177 |
TP_PROTO(char *msg), |
| 178 |
TP_ARGS(msg) |
| 179 |
); |
| 180 |
|
| 181 |
DEFINE_EVENT(cdnsp_log_simple, cdnsp_ep_halt, |
| 182 |
TP_PROTO(char *msg), |
| 183 |
TP_ARGS(msg) |
| 184 |
); |
| 185 |
|
| 186 |
TRACE_EVENT(cdnsp_looking_trb_in_td, |
| 187 |
TP_PROTO(dma_addr_t suspect, dma_addr_t trb_start, dma_addr_t trb_end, |
| 188 |
dma_addr_t curr_seg, dma_addr_t end_seg), |
| 189 |
TP_ARGS(suspect, trb_start, trb_end, curr_seg, end_seg), |
| 190 |
TP_STRUCT__entry( |
| 191 |
__field(dma_addr_t, suspect) |
| 192 |
__field(dma_addr_t, trb_start) |
| 193 |
__field(dma_addr_t, trb_end) |
| 194 |
__field(dma_addr_t, curr_seg) |
| 195 |
__field(dma_addr_t, end_seg) |
| 196 |
), |
| 197 |
TP_fast_assign( |
| 198 |
__entry->suspect = suspect; |
| 199 |
__entry->trb_start = trb_start; |
| 200 |
__entry->trb_end = trb_end; |
| 201 |
__entry->curr_seg = curr_seg; |
| 202 |
__entry->end_seg = end_seg; |
| 203 |
), |
| 204 |
TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, " |
| 205 |
"seg-start %pad, seg-end %pad", |
| 206 |
&__entry->suspect, &__entry->trb_start, &__entry->trb_end, |
| 207 |
&__entry->curr_seg, &__entry->end_seg) |
| 208 |
); |
| 209 |
|
| 210 |
TRACE_EVENT(cdnsp_port_info, |
| 211 |
TP_PROTO(__le32 __iomem *addr, u32 offset, u32 count, u32 rev), |
| 212 |
TP_ARGS(addr, offset, count, rev), |
| 213 |
TP_STRUCT__entry( |
| 214 |
__field(__le32 __iomem *, addr) |
| 215 |
__field(u32, offset) |
| 216 |
__field(u32, count) |
| 217 |
__field(u32, rev) |
| 218 |
), |
| 219 |
TP_fast_assign( |
| 220 |
__entry->addr = addr; |
| 221 |
__entry->offset = offset; |
| 222 |
__entry->count = count; |
| 223 |
__entry->rev = rev; |
| 224 |
), |
| 225 |
TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x", |
| 226 |
__entry->addr, __entry->offset, __entry->count, __entry->rev) |
| 227 |
); |
| 228 |
|
| 229 |
DECLARE_EVENT_CLASS(cdnsp_log_deq_state, |
| 230 |
TP_PROTO(struct cdnsp_dequeue_state *state), |
| 231 |
TP_ARGS(state), |
| 232 |
TP_STRUCT__entry( |
| 233 |
__field(int, new_cycle_state) |
| 234 |
__field(struct cdnsp_segment *, new_deq_seg) |
| 235 |
__field(dma_addr_t, deq_seg_dma) |
| 236 |
__field(union cdnsp_trb *, new_deq_ptr) |
| 237 |
__field(dma_addr_t, deq_ptr_dma) |
| 238 |
), |
| 239 |
TP_fast_assign( |
| 240 |
__entry->new_cycle_state = state->new_cycle_state; |
| 241 |
__entry->new_deq_seg = state->new_deq_seg; |
| 242 |
__entry->deq_seg_dma = state->new_deq_seg->dma; |
| 243 |
__entry->new_deq_ptr = state->new_deq_ptr, |
| 244 |
__entry->deq_ptr_dma = cdnsp_trb_virt_to_dma(state->new_deq_seg, |
| 245 |
state->new_deq_ptr); |
| 246 |
), |
| 247 |
TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), " |
| 248 |
"New dequeue pointer = %p (0x%pad dma)", |
| 249 |
__entry->new_cycle_state, __entry->new_deq_seg, |
| 250 |
&__entry->deq_seg_dma, __entry->new_deq_ptr, |
| 251 |
&__entry->deq_ptr_dma |
| 252 |
) |
| 253 |
); |
| 254 |
|
| 255 |
DEFINE_EVENT(cdnsp_log_deq_state, cdnsp_new_deq_state, |
| 256 |
TP_PROTO(struct cdnsp_dequeue_state *state), |
| 257 |
TP_ARGS(state) |
| 258 |
); |
| 259 |
|
| 260 |
DECLARE_EVENT_CLASS(cdnsp_log_ctrl, |
| 261 |
TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 262 |
TP_ARGS(ctrl), |
| 263 |
TP_STRUCT__entry( |
| 264 |
__field(u8, bRequestType) |
| 265 |
__field(u8, bRequest) |
| 266 |
__field(u16, wValue) |
| 267 |
__field(u16, wIndex) |
| 268 |
__field(u16, wLength) |
| 269 |
), |
| 270 |
TP_fast_assign( |
| 271 |
__entry->bRequestType = ctrl->bRequestType; |
| 272 |
__entry->bRequest = ctrl->bRequest; |
| 273 |
__entry->wValue = le16_to_cpu(ctrl->wValue); |
| 274 |
__entry->wIndex = le16_to_cpu(ctrl->wIndex); |
| 275 |
__entry->wLength = le16_to_cpu(ctrl->wLength); |
| 276 |
), |
| 277 |
TP_printk("%s", usb_decode_ctrl(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX, |
| 278 |
__entry->bRequestType, |
| 279 |
__entry->bRequest, __entry->wValue, |
| 280 |
__entry->wIndex, __entry->wLength) |
| 281 |
) |
| 282 |
); |
| 283 |
|
| 284 |
DEFINE_EVENT(cdnsp_log_ctrl, cdnsp_ctrl_req, |
| 285 |
TP_PROTO(struct usb_ctrlrequest *ctrl), |
| 286 |
TP_ARGS(ctrl) |
| 287 |
); |
| 288 |
|
| 289 |
DECLARE_EVENT_CLASS(cdnsp_log_bounce, |
| 290 |
TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 291 |
dma_addr_t dma, unsigned int unalign), |
| 292 |
TP_ARGS(preq, new_buf_len, offset, dma, unalign), |
| 293 |
TP_STRUCT__entry( |
| 294 |
__string(name, preq->pep->name) |
| 295 |
__field(u32, new_buf_len) |
| 296 |
__field(u32, offset) |
| 297 |
__field(dma_addr_t, dma) |
| 298 |
__field(unsigned int, unalign) |
| 299 |
), |
| 300 |
TP_fast_assign( |
| 301 |
__assign_str(name); |
| 302 |
__entry->new_buf_len = new_buf_len; |
| 303 |
__entry->offset = offset; |
| 304 |
__entry->dma = dma; |
| 305 |
__entry->unalign = unalign; |
| 306 |
), |
| 307 |
TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d", |
| 308 |
__get_str(name), __entry->new_buf_len, |
| 309 |
__entry->offset, &__entry->dma, __entry->unalign |
| 310 |
) |
| 311 |
); |
| 312 |
|
| 313 |
DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_align_td_split, |
| 314 |
TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 315 |
dma_addr_t dma, unsigned int unalign), |
| 316 |
TP_ARGS(preq, new_buf_len, offset, dma, unalign) |
| 317 |
); |
| 318 |
|
| 319 |
DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_map, |
| 320 |
TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 321 |
dma_addr_t dma, unsigned int unalign), |
| 322 |
TP_ARGS(preq, new_buf_len, offset, dma, unalign) |
| 323 |
); |
| 324 |
|
| 325 |
DEFINE_EVENT(cdnsp_log_bounce, cdnsp_bounce_unmap, |
| 326 |
TP_PROTO(struct cdnsp_request *preq, u32 new_buf_len, u32 offset, |
| 327 |
dma_addr_t dma, unsigned int unalign), |
| 328 |
TP_ARGS(preq, new_buf_len, offset, dma, unalign) |
| 329 |
); |
| 330 |
|
| 331 |
DECLARE_EVENT_CLASS(cdnsp_log_trb, |
| 332 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 333 |
TP_ARGS(ring, trb), |
| 334 |
TP_STRUCT__entry( |
| 335 |
__field(u32, type) |
| 336 |
__field(u32, field0) |
| 337 |
__field(u32, field1) |
| 338 |
__field(u32, field2) |
| 339 |
__field(u32, field3) |
| 340 |
__field(union cdnsp_trb *, trb) |
| 341 |
__field(dma_addr_t, trb_dma) |
| 342 |
), |
| 343 |
TP_fast_assign( |
| 344 |
__entry->type = ring->type; |
| 345 |
__entry->field0 = le32_to_cpu(trb->field[0]); |
| 346 |
__entry->field1 = le32_to_cpu(trb->field[1]); |
| 347 |
__entry->field2 = le32_to_cpu(trb->field[2]); |
| 348 |
__entry->field3 = le32_to_cpu(trb->field[3]); |
| 349 |
__entry->trb = (union cdnsp_trb *)trb; |
| 350 |
__entry->trb_dma = cdnsp_trb_virt_to_dma(ring->deq_seg, |
| 351 |
(union cdnsp_trb *)trb); |
| 352 |
|
| 353 |
), |
| 354 |
TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry->type), |
| 355 |
cdnsp_decode_trb(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX, |
| 356 |
__entry->field0, __entry->field1, |
| 357 |
__entry->field2, __entry->field3), |
| 358 |
__entry->trb, &__entry->trb_dma |
| 359 |
) |
| 360 |
); |
| 361 |
|
| 362 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_event, |
| 363 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 364 |
TP_ARGS(ring, trb) |
| 365 |
); |
| 366 |
|
| 367 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_trb_without_td, |
| 368 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 369 |
TP_ARGS(ring, trb) |
| 370 |
); |
| 371 |
|
| 372 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_command, |
| 373 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 374 |
TP_ARGS(ring, trb) |
| 375 |
); |
| 376 |
|
| 377 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_handle_transfer, |
| 378 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 379 |
TP_ARGS(ring, trb) |
| 380 |
); |
| 381 |
|
| 382 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_queue_trb, |
| 383 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 384 |
TP_ARGS(ring, trb) |
| 385 |
); |
| 386 |
|
| 387 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_wait_for_compl, |
| 388 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 389 |
TP_ARGS(ring, trb) |
| 390 |
); |
| 391 |
|
| 392 |
DEFINE_EVENT(cdnsp_log_trb, cdnsp_cmd_timeout, |
| 393 |
TP_PROTO(struct cdnsp_ring *ring, struct cdnsp_generic_trb *trb), |
| 394 |
TP_ARGS(ring, trb) |
| 395 |
); |
| 396 |
|
| 397 |
DECLARE_EVENT_CLASS(cdnsp_log_pdev, |
| 398 |
TP_PROTO(struct cdnsp_device *pdev), |
| 399 |
TP_ARGS(pdev), |
| 400 |
TP_STRUCT__entry( |
| 401 |
__field(struct cdnsp_device *, pdev) |
| 402 |
__field(struct usb_gadget *, gadget) |
| 403 |
__field(dma_addr_t, out_ctx) |
| 404 |
__field(dma_addr_t, in_ctx) |
| 405 |
__field(u8, port_num) |
| 406 |
), |
| 407 |
TP_fast_assign( |
| 408 |
__entry->pdev = pdev; |
| 409 |
__entry->gadget = &pdev->gadget; |
| 410 |
__entry->in_ctx = pdev->in_ctx.dma; |
| 411 |
__entry->out_ctx = pdev->out_ctx.dma; |
| 412 |
__entry->port_num = pdev->active_port ? |
| 413 |
pdev->active_port->port_num : 0xFF; |
| 414 |
), |
| 415 |
TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ", |
| 416 |
__entry->pdev, __entry->gadget, &__entry->in_ctx, |
| 417 |
&__entry->out_ctx, __entry->port_num |
| 418 |
) |
| 419 |
); |
| 420 |
|
| 421 |
DEFINE_EVENT(cdnsp_log_pdev, cdnsp_alloc_priv_device, |
| 422 |
TP_PROTO(struct cdnsp_device *vdev), |
| 423 |
TP_ARGS(vdev) |
| 424 |
); |
| 425 |
|
| 426 |
DEFINE_EVENT(cdnsp_log_pdev, cdnsp_setup_addressable_priv_device, |
| 427 |
TP_PROTO(struct cdnsp_device *vdev), |
| 428 |
TP_ARGS(vdev) |
| 429 |
); |
| 430 |
|
| 431 |
DECLARE_EVENT_CLASS(cdnsp_log_request, |
| 432 |
TP_PROTO(struct cdnsp_request *req), |
| 433 |
TP_ARGS(req), |
| 434 |
TP_STRUCT__entry( |
| 435 |
__string(name, req->pep->name) |
| 436 |
__field(struct usb_request *, request) |
| 437 |
__field(struct cdnsp_request *, preq) |
| 438 |
__field(void *, buf) |
| 439 |
__field(unsigned int, actual) |
| 440 |
__field(unsigned int, length) |
| 441 |
__field(int, status) |
| 442 |
__field(dma_addr_t, dma) |
| 443 |
__field(unsigned int, stream_id) |
| 444 |
__field(unsigned int, zero) |
| 445 |
__field(unsigned int, short_not_ok) |
| 446 |
__field(unsigned int, no_interrupt) |
| 447 |
__field(struct scatterlist*, sg) |
| 448 |
__field(unsigned int, num_sgs) |
| 449 |
__field(unsigned int, num_mapped_sgs) |
| 450 |
|
| 451 |
), |
| 452 |
TP_fast_assign( |
| 453 |
__assign_str(name); |
| 454 |
__entry->request = &req->request; |
| 455 |
__entry->preq = req; |
| 456 |
__entry->buf = req->request.buf; |
| 457 |
__entry->actual = req->request.actual; |
| 458 |
__entry->length = req->request.length; |
| 459 |
__entry->status = req->request.status; |
| 460 |
__entry->dma = req->request.dma; |
| 461 |
__entry->stream_id = req->request.stream_id; |
| 462 |
__entry->zero = req->request.zero; |
| 463 |
__entry->short_not_ok = req->request.short_not_ok; |
| 464 |
__entry->no_interrupt = req->request.no_interrupt; |
| 465 |
__entry->sg = req->request.sg; |
| 466 |
__entry->num_sgs = req->request.num_sgs; |
| 467 |
__entry->num_mapped_sgs = req->request.num_mapped_sgs; |
| 468 |
), |
| 469 |
TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, " |
| 470 |
"buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d," |
| 471 |
" num_m_sg %d", |
| 472 |
__get_str(name), __entry->request, __entry->preq, |
| 473 |
__entry->buf, __entry->actual, __entry->length, |
| 474 |
__entry->status, &__entry->dma, |
| 475 |
__entry->stream_id, __entry->zero ? "Z" : "z", |
| 476 |
__entry->short_not_ok ? "S" : "s", |
| 477 |
__entry->no_interrupt ? "I" : "i", |
| 478 |
__entry->sg, __entry->num_sgs, __entry->num_mapped_sgs |
| 479 |
) |
| 480 |
); |
| 481 |
|
| 482 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue, |
| 483 |
TP_PROTO(struct cdnsp_request *req), |
| 484 |
TP_ARGS(req) |
| 485 |
); |
| 486 |
|
| 487 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_busy, |
| 488 |
TP_PROTO(struct cdnsp_request *req), |
| 489 |
TP_ARGS(req) |
| 490 |
); |
| 491 |
|
| 492 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_request_enqueue_error, |
| 493 |
TP_PROTO(struct cdnsp_request *req), |
| 494 |
TP_ARGS(req) |
| 495 |
); |
| 496 |
|
| 497 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_request_dequeue, |
| 498 |
TP_PROTO(struct cdnsp_request *req), |
| 499 |
TP_ARGS(req) |
| 500 |
); |
| 501 |
|
| 502 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_request_giveback, |
| 503 |
TP_PROTO(struct cdnsp_request *req), |
| 504 |
TP_ARGS(req) |
| 505 |
); |
| 506 |
|
| 507 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_alloc_request, |
| 508 |
TP_PROTO(struct cdnsp_request *req), |
| 509 |
TP_ARGS(req) |
| 510 |
); |
| 511 |
|
| 512 |
DEFINE_EVENT(cdnsp_log_request, cdnsp_free_request, |
| 513 |
TP_PROTO(struct cdnsp_request *req), |
| 514 |
TP_ARGS(req) |
| 515 |
); |
| 516 |
|
| 517 |
DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx, |
| 518 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 519 |
TP_ARGS(ctx), |
| 520 |
TP_STRUCT__entry( |
| 521 |
__field(u32, info) |
| 522 |
__field(u32, info2) |
| 523 |
__field(u64, deq) |
| 524 |
__field(u32, tx_info) |
| 525 |
), |
| 526 |
TP_fast_assign( |
| 527 |
__entry->info = le32_to_cpu(ctx->ep_info); |
| 528 |
__entry->info2 = le32_to_cpu(ctx->ep_info2); |
| 529 |
__entry->deq = le64_to_cpu(ctx->deq); |
| 530 |
__entry->tx_info = le32_to_cpu(ctx->tx_info); |
| 531 |
), |
| 532 |
TP_printk("%s", cdnsp_decode_ep_context(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX, |
| 533 |
__entry->info, __entry->info2, |
| 534 |
__entry->deq, __entry->tx_info) |
| 535 |
) |
| 536 |
); |
| 537 |
|
| 538 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_disabled, |
| 539 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 540 |
TP_ARGS(ctx) |
| 541 |
); |
| 542 |
|
| 543 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_ep_stopped_or_disabled, |
| 544 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 545 |
TP_ARGS(ctx) |
| 546 |
); |
| 547 |
|
| 548 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_remove_request, |
| 549 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 550 |
TP_ARGS(ctx) |
| 551 |
); |
| 552 |
|
| 553 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_stop_ep, |
| 554 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 555 |
TP_ARGS(ctx) |
| 556 |
); |
| 557 |
|
| 558 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_set_deq_ep, |
| 559 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 560 |
TP_ARGS(ctx) |
| 561 |
); |
| 562 |
|
| 563 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_reset_ep, |
| 564 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 565 |
TP_ARGS(ctx) |
| 566 |
); |
| 567 |
|
| 568 |
DEFINE_EVENT(cdnsp_log_ep_ctx, cdnsp_handle_cmd_config_ep, |
| 569 |
TP_PROTO(struct cdnsp_ep_ctx *ctx), |
| 570 |
TP_ARGS(ctx) |
| 571 |
); |
| 572 |
|
| 573 |
DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx, |
| 574 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 575 |
TP_ARGS(ctx), |
| 576 |
TP_STRUCT__entry( |
| 577 |
__field(u32, info) |
| 578 |
__field(u32, info2) |
| 579 |
__field(u32, int_target) |
| 580 |
__field(u32, state) |
| 581 |
), |
| 582 |
TP_fast_assign( |
| 583 |
__entry->info = le32_to_cpu(ctx->dev_info); |
| 584 |
__entry->info2 = le32_to_cpu(ctx->dev_port); |
| 585 |
__entry->int_target = le32_to_cpu(ctx->int_target); |
| 586 |
__entry->state = le32_to_cpu(ctx->dev_state); |
| 587 |
), |
| 588 |
TP_printk("%s", cdnsp_decode_slot_context(__entry->info, |
| 589 |
__entry->info2, |
| 590 |
__entry->int_target, |
| 591 |
__entry->state) |
| 592 |
) |
| 593 |
); |
| 594 |
|
| 595 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_slot_already_in_default, |
| 596 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 597 |
TP_ARGS(ctx) |
| 598 |
); |
| 599 |
|
| 600 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_enable_slot, |
| 601 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 602 |
TP_ARGS(ctx) |
| 603 |
); |
| 604 |
|
| 605 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_disable_slot, |
| 606 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 607 |
TP_ARGS(ctx) |
| 608 |
); |
| 609 |
|
| 610 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_reset_device, |
| 611 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 612 |
TP_ARGS(ctx) |
| 613 |
); |
| 614 |
|
| 615 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_setup_device_slot, |
| 616 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 617 |
TP_ARGS(ctx) |
| 618 |
); |
| 619 |
|
| 620 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_addr_dev, |
| 621 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 622 |
TP_ARGS(ctx) |
| 623 |
); |
| 624 |
|
| 625 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_reset_dev, |
| 626 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 627 |
TP_ARGS(ctx) |
| 628 |
); |
| 629 |
|
| 630 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_handle_cmd_set_deq, |
| 631 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 632 |
TP_ARGS(ctx) |
| 633 |
); |
| 634 |
|
| 635 |
DEFINE_EVENT(cdnsp_log_slot_ctx, cdnsp_configure_endpoint, |
| 636 |
TP_PROTO(struct cdnsp_slot_ctx *ctx), |
| 637 |
TP_ARGS(ctx) |
| 638 |
); |
| 639 |
|
| 640 |
DECLARE_EVENT_CLASS(cdnsp_log_td_info, |
| 641 |
TP_PROTO(struct cdnsp_request *preq), |
| 642 |
TP_ARGS(preq), |
| 643 |
TP_STRUCT__entry( |
| 644 |
__string(name, preq->pep->name) |
| 645 |
__field(struct usb_request *, request) |
| 646 |
__field(struct cdnsp_request *, preq) |
| 647 |
__field(union cdnsp_trb *, first_trb) |
| 648 |
__field(union cdnsp_trb *, last_trb) |
| 649 |
__field(dma_addr_t, trb_dma) |
| 650 |
), |
| 651 |
TP_fast_assign( |
| 652 |
__assign_str(name); |
| 653 |
__entry->request = &preq->request; |
| 654 |
__entry->preq = preq; |
| 655 |
__entry->first_trb = preq->td.first_trb; |
| 656 |
__entry->last_trb = preq->td.last_trb; |
| 657 |
__entry->trb_dma = cdnsp_trb_virt_to_dma(preq->td.start_seg, |
| 658 |
preq->td.first_trb) |
| 659 |
), |
| 660 |
TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p", |
| 661 |
__get_str(name), __entry->request, __entry->preq, |
| 662 |
__entry->first_trb, &__entry->trb_dma, |
| 663 |
__entry->last_trb |
| 664 |
) |
| 665 |
); |
| 666 |
|
| 667 |
DEFINE_EVENT(cdnsp_log_td_info, cdnsp_remove_request_td, |
| 668 |
TP_PROTO(struct cdnsp_request *preq), |
| 669 |
TP_ARGS(preq) |
| 670 |
); |
| 671 |
|
| 672 |
DECLARE_EVENT_CLASS(cdnsp_log_ring, |
| 673 |
TP_PROTO(struct cdnsp_ring *ring), |
| 674 |
TP_ARGS(ring), |
| 675 |
TP_STRUCT__entry( |
| 676 |
__field(u32, type) |
| 677 |
__field(void *, ring) |
| 678 |
__field(dma_addr_t, enq) |
| 679 |
__field(dma_addr_t, deq) |
| 680 |
__field(dma_addr_t, enq_seg) |
| 681 |
__field(dma_addr_t, deq_seg) |
| 682 |
__field(unsigned int, num_segs) |
| 683 |
__field(unsigned int, stream_id) |
| 684 |
__field(unsigned int, cycle_state) |
| 685 |
__field(unsigned int, num_trbs_free) |
| 686 |
__field(unsigned int, bounce_buf_len) |
| 687 |
), |
| 688 |
TP_fast_assign( |
| 689 |
__entry->ring = ring; |
| 690 |
__entry->type = ring->type; |
| 691 |
__entry->num_segs = ring->num_segs; |
| 692 |
__entry->stream_id = ring->stream_id; |
| 693 |
__entry->enq_seg = ring->enq_seg->dma; |
| 694 |
__entry->deq_seg = ring->deq_seg->dma; |
| 695 |
__entry->cycle_state = ring->cycle_state; |
| 696 |
__entry->num_trbs_free = ring->num_trbs_free; |
| 697 |
__entry->bounce_buf_len = ring->bounce_buf_len; |
| 698 |
__entry->enq = cdnsp_trb_virt_to_dma(ring->enq_seg, |
| 699 |
ring->enqueue); |
| 700 |
__entry->deq = cdnsp_trb_virt_to_dma(ring->deq_seg, |
| 701 |
ring->dequeue); |
| 702 |
), |
| 703 |
TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d" |
| 704 |
" free_trbs %d bounce %d cycle %d", |
| 705 |
cdnsp_ring_type_string(__entry->type), __entry->ring, |
| 706 |
&__entry->enq, &__entry->enq_seg, |
| 707 |
&__entry->deq, &__entry->deq_seg, |
| 708 |
__entry->num_segs, |
| 709 |
__entry->stream_id, |
| 710 |
__entry->num_trbs_free, |
| 711 |
__entry->bounce_buf_len, |
| 712 |
__entry->cycle_state |
| 713 |
) |
| 714 |
); |
| 715 |
|
| 716 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_alloc, |
| 717 |
TP_PROTO(struct cdnsp_ring *ring), |
| 718 |
TP_ARGS(ring) |
| 719 |
); |
| 720 |
|
| 721 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_free, |
| 722 |
TP_PROTO(struct cdnsp_ring *ring), |
| 723 |
TP_ARGS(ring) |
| 724 |
); |
| 725 |
|
| 726 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_set_stream_ring, |
| 727 |
TP_PROTO(struct cdnsp_ring *ring), |
| 728 |
TP_ARGS(ring) |
| 729 |
); |
| 730 |
|
| 731 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_ring_expansion, |
| 732 |
TP_PROTO(struct cdnsp_ring *ring), |
| 733 |
TP_ARGS(ring) |
| 734 |
); |
| 735 |
|
| 736 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_enq, |
| 737 |
TP_PROTO(struct cdnsp_ring *ring), |
| 738 |
TP_ARGS(ring) |
| 739 |
); |
| 740 |
|
| 741 |
DEFINE_EVENT(cdnsp_log_ring, cdnsp_inc_deq, |
| 742 |
TP_PROTO(struct cdnsp_ring *ring), |
| 743 |
TP_ARGS(ring) |
| 744 |
); |
| 745 |
|
| 746 |
DECLARE_EVENT_CLASS(cdnsp_log_portsc, |
| 747 |
TP_PROTO(u32 portnum, u32 portsc), |
| 748 |
TP_ARGS(portnum, portsc), |
| 749 |
TP_STRUCT__entry( |
| 750 |
__field(u32, portnum) |
| 751 |
__field(u32, portsc) |
| 752 |
), |
| 753 |
TP_fast_assign( |
| 754 |
__entry->portnum = portnum; |
| 755 |
__entry->portsc = portsc; |
| 756 |
), |
| 757 |
TP_printk("port-%d: %s", |
| 758 |
__entry->portnum, |
| 759 |
cdnsp_decode_portsc(__get_buf(CDNSP_MSG_MAX), CDNSP_MSG_MAX, |
| 760 |
__entry->portsc) |
| 761 |
) |
| 762 |
); |
| 763 |
|
| 764 |
DEFINE_EVENT(cdnsp_log_portsc, cdnsp_handle_port_status, |
| 765 |
TP_PROTO(u32 portnum, u32 portsc), |
| 766 |
TP_ARGS(portnum, portsc) |
| 767 |
); |
| 768 |
|
| 769 |
DEFINE_EVENT(cdnsp_log_portsc, cdnsp_link_state_changed, |
| 770 |
TP_PROTO(u32 portnum, u32 portsc), |
| 771 |
TP_ARGS(portnum, portsc) |
| 772 |
); |
| 773 |
|
| 774 |
TRACE_EVENT(cdnsp_stream_number, |
| 775 |
TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams), |
| 776 |
TP_ARGS(pep, num_stream_ctxs, num_streams), |
| 777 |
TP_STRUCT__entry( |
| 778 |
__string(name, pep->name) |
| 779 |
__field(int, num_stream_ctxs) |
| 780 |
__field(int, num_streams) |
| 781 |
), |
| 782 |
TP_fast_assign( |
| 783 |
__entry->num_stream_ctxs = num_stream_ctxs; |
| 784 |
__entry->num_streams = num_streams; |
| 785 |
), |
| 786 |
TP_printk("%s Need %u stream ctx entries for %u stream IDs.", |
| 787 |
__get_str(name), __entry->num_stream_ctxs, |
| 788 |
__entry->num_streams) |
| 789 |
); |
| 790 |
|
| 791 |
#endif /* __CDNSP_TRACE_H */ |
| 792 |
|
| 793 |
/* this part must be outside header guard */ |
| 794 |
|
| 795 |
#undef TRACE_INCLUDE_PATH |
| 796 |
#define TRACE_INCLUDE_PATH . |
| 797 |
|
| 798 |
#undef TRACE_INCLUDE_FILE |
| 799 |
#define TRACE_INCLUDE_FILE cdnsp-trace |
| 800 |
|
| 801 |
#include <trace/define_trace.h> |